c++ documentation

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
kai
Posts: 8
Joined: October 27th, 2017, 2:56 pm

c++ documentation

Post by kai » October 27th, 2017, 3:01 pm

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?

User avatar
SlevinKelevra
Posts: 80
Joined: September 9th, 2013, 12:58 am
Location: Germany

Re: c++ documentation

Post by SlevinKelevra » October 27th, 2017, 3:34 pm

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 :)
Last edited by SlevinKelevra on October 27th, 2017, 4:04 pm, edited 1 time in total.
Carpe noctem

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: c++ documentation

Post by albinopapa » October 27th, 2017, 3:48 pm

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.
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

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: c++ documentation

Post by albinopapa » October 27th, 2017, 3:53 pm

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

kai
Posts: 8
Joined: October 27th, 2017, 2:56 pm

Re: c++ documentation

Post by kai » October 27th, 2017, 7:48 pm

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

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: c++ documentation

Post by cameron » October 27th, 2017, 8:46 pm

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.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: c++ documentation

Post by chili » October 28th, 2017, 3:07 am

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

kai
Posts: 8
Joined: October 27th, 2017, 2:56 pm

Re: c++ documentation

Post by kai » November 2nd, 2017, 2:53 pm

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

Post Reply