GeoCitesSites.com

***THIS PAGE CREATED FROM MY NOTES AND OFF THE TOP OF MY HEAD. ALL EXAMPLES WERE COMPILED AND TESTED ON MANDRAKE LINUX 10***

What a programmer should have & game logic


People think game programming should be just hacking up code straight from you head. Well in reality to build a game engine you should always be thinking of the pros and cons. It is good to be prepared with a notepad and binder for programming notes and design notes for the engine. You should plan out everything on paper before doing anything. I write down the goals and plans for game design then try to start coding it. Its like building a building structure. You must start from the bottom then build up from there. There are better pages that explain game programming than this page.

Class programming in C++


#include /*the include directive*/
using namespace std;/*this is a namespace which acts like a partition. Namespaces
localize header files and are a better way to organize the headers.
It stores the header files locally to avoid namespace collisions from my understanding*/

class kodi
{
int a;//cant initialize here.
public:
void num(int j){a = j;}/*Here we are using automatic inline functions. The advantage of usint this method over a common function is so you could have better proccessing speed.
The disadvantage is it takes up more code space for large tasks in turn creating a lot of copying and pasting*/
int show(){cout< };


int main()
{
kodi ob;/*Here we create our object*/
ob.num(12);/*Here our function num() takes a integer parameter of 12*/
ob.show();
return 0;
}

c++ class programming (Constructors with one parameter(special case))


/*this program is taking only one parameter which is consideridably a special case. This method is rarly used*/ #include
using namespace std;


class myclass
{
char s;
public:
myclass(char j){s = j;}
char gets(){return s;}
};
int main()
{
//create object of myclass in constructor
myclass ob = 'h';
cout< return 0;
}

c++ class programming(Static class members)


***no code example here just description***


When you make a variable static you tell the compiler that there is one copy of that variable only and the whole class shares attributes of it.
In order to allocate storage for that static variable one must use the scope resolution operator.

c++ Class programming(parameterized constructors)


***No code example here just description***


Parameterized constructors are useful because it reduces the amount of function calls. For example it could reduce you from using a function to perform a simple operation.