Page 1 of 1

c++ documentation

Posted: October 27th, 2017, 3:01 pm
by kai
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?

Re: c++ documentation

Posted: October 27th, 2017, 3:34 pm
by SlevinKelevra
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 :)

Re: c++ documentation

Posted: October 27th, 2017, 3:48 pm
by albinopapa
Functions are pretty straight forward:

Code: Select all

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.

Re: c++ documentation

Posted: October 27th, 2017, 3:53 pm
by albinopapa
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 ).

Re: c++ documentation

Posted: October 27th, 2017, 7:48 pm
by kai
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

Re: c++ documentation

Posted: October 27th, 2017, 8:46 pm
by cameron
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.

Re: c++ documentation

Posted: October 28th, 2017, 3:07 am
by chili
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.

Re: c++ documentation

Posted: November 2nd, 2017, 2:53 pm
by kai
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