Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: c++ documentation
 Post Posted: October 27th, 2017, 3:01 pm 
 

Joined: October 27th, 2017, 2:56 pm
Posts: 8
guys i just started the chillie sex guide to game development
but im really confused about the functions and stuff.
is there any place where i could find the docuemntation for the functions and things?
r the functions similar to standard c++ or they like a version of c++ my microsoft?


Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: October 27th, 2017, 3:34 pm 
User avatar

Joined: September 9th, 2013, 12:58 am
Posts: 80
Location: Germany
Welcome Kai!

http://www.cplusplus.com/reference/
and
http://en.cppreference.com/w/

For any questions regarding coding (besides this forum :) ):
https://stackoverflow.com/

Edit:
Ups! I slightly misunderstood your question. But Albinopapa gave the correct answer. For everything else you can use my links from above :)

_________________
Carpe noctem


Last edited by SlevinKelevra on October 27th, 2017, 4:04 pm, edited 1 time in total.

Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: October 27th, 2017, 3:48 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2962
Location: Oklahoma, United States
Functions are pretty straight forward:
Code:
return_type Scope::Name( parameter_list ) const_qualifier;
Examples:
// Global function
void DoSomething();

// Scoped function in namespace
namespace MySpace
{
     int AddStuff( int A, int B );
}

// Member function in a class or struct
class MyClass
{
public:
     bool IsAlive()const;

private:
     bool alive = false;
};

Those are the signatures, now for the definitions
// Global
void DoSomething()
{
     // Do work here
}

// Scoped
int MySpace::AddStuff( int A, int B )
{
     return A + B;
}

// Member function
bool MyClass::IsAlive()const
{
     return alive;
}

// To call each function
// Global
DoSomething();

// Scoped
const int c = MySpace::AddStuff( 3, 39 );

// Member function
MyClass unit;
if(unit.IsAlive())
{
     // Handle alive unit
}
else
{
     // Handle dead unit
}

You have a return type which can be any type including void, which means no return.
You have the scope which a free function or global function doesn't need the ::
You have the name of the function followed by the parameter list
For member functions you have a choice to make the function constant, meaning during that function call, you are promising you won't change any of the data members of that object the function belongs to.

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: October 27th, 2017, 3:53 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2962
Location: Oklahoma, United States
Later you will find that there are static functions, virtual functions and templated functions, all pretty much have the same signature requirements and calling syntax with a few exceptions. The only things I know of that are Microsoft specific is the _vectorcall calling convention and being able to write "abstract" instead of "= 0" for virtual functions.

The _vectorcall calling convention uses CPU registers to pass parameters instead of the stack which makes function calls faster. The abstract thing is just syntactic, it means the same as = 0 ( making the function pure virtual meaning the definition to the function is defined by an inherited class ).

_________________
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com


Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: October 27th, 2017, 7:48 pm 
 

Joined: October 27th, 2017, 2:56 pm
Posts: 8
SlevinKelevra wrote:
Welcome Kai!

http://www.cplusplus.com/reference/
and
http://en.cppreference.com/w/

For any questions regarding coding (besides this forum :) ):
https://stackoverflow.com/

Edit:
Ups! I slightly misunderstood your question. But Albinopapa gave the correct answer. For everything else you can use my links from above :)


_____________________________________
thanks for the answer much appreciated but the functions that chillie is using like gfx.putpixel(); and wnd.kbd.KeyIsPressed(VK_UP)
i cant find them on these sites.
i know that keyIsPressed is a object within object type function but i search these on the net and its like they dont even exist like those functions r custom


Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: October 27th, 2017, 8:46 pm 
 

Joined: June 26th, 2012, 5:38 pm
Posts: 767
Location: USA
Those functions are user-defined (chilli wrote them). If you want to understand the code you can look over it and (I believe) chili goes over the framework in a couple of the videos.

_________________
Computer too slow? Consider running a VM on your toaster.


Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: October 28th, 2017, 3:07 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3537
Location: Japan
kai wrote:
SlevinKelevra wrote:
Welcome Kai!

http://www.cplusplus.com/reference/
and
http://en.cppreference.com/w/

For any questions regarding coding (besides this forum :) ):
https://stackoverflow.com/

Edit:
Ups! I slightly misunderstood your question. But Albinopapa gave the correct answer. For everything else you can use my links from above :)


_____________________________________
thanks for the answer much appreciated but the functions that chillie is using like gfx.putpixel(); and wnd.kbd.KeyIsPressed(VK_UP)
i cant find them on these sites.
i know that keyIsPressed is a object within object type function but i search these on the net and its like they dont even exist like those functions r custom


Those are a small part of the experience (as small as possible) so don't worry about them too much. Still if you are interested/when you need them:

http://wiki.planetchili.net <- search for "framework" or "keyboard" etc.

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post subject: Re: c++ documentation
 Post Posted: November 2nd, 2017, 2:53 pm 
 

Joined: October 27th, 2017, 2:56 pm
Posts: 8
chili wrote:
kai wrote:
SlevinKelevra wrote:
Welcome Kai!

http://www.cplusplus.com/reference/
and
http://en.cppreference.com/w/

For any questions regarding coding (besides this forum :) ):
https://stackoverflow.com/

Edit:
Ups! I slightly misunderstood your question. But Albinopapa gave the correct answer. For everything else you can use my links from above :)


_____________________________________
thanks for the answer much appreciated but the functions that chillie is using like gfx.putpixel(); and wnd.kbd.KeyIsPressed(VK_UP)
i cant find them on these sites.
i know that keyIsPressed is a object within object type function but i search these on the net and its like they dont even exist like those functions r custom


Those are a small part of the experience (as small as possible) so don't worry about them too much. Still if you are interested/when you need them:

http://wiki.planetchili.net <- search for "framework" or "keyboard" etc.

_______________________
aawwww thanks fam for such an awesome series


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 8 posts ] 

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron