I still don't understand this book on game programming in C++!

MrElusive

Banned
Dec 10, 2001
87
0
0
I just bought Introduction to Computer Game Programming with DirectX 8.0 by Ian Parberr, Ph.D. and I am an amateur in C++ I now know because my teacher is total dumbass and didn't teach us diddly. This book says I need to know:

1.) Classes, with private and public member variables and functions (I know these)
2.) Derived classes, protected members (I know these)
3.) Function overloading (Don't know this)
4.) The Operators New and Delete (Don't know these)
5.) Call-by-reference parameters (Don't know this or not familar with the name)
6.) Default parameters in functions (Nope, not this either)
7.) Conditional assignment using ? operator (Not this either)

It give me the code for all of the demos and when I look through it I still don't get it. As you can imagine I'm down on myself as usual. I'll be returning these Clive Barker books so I'll have about $30 to spend again. Should I buy a Visual C++ 6.0 book? I'm taking courses over the summer for C++ for about 8 weeks for 2 days a week 3 hours a night. I honestly can't wait that long to under C++ so I'd like to get a book to teach myself. My High School C++ is a freakin' joke so I know I won't learn $hit there since the teacher is a flaming jock. Get back to me.
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0


<< 3.) Function overloading (Don't know this) >>


Allows you to call a function with different types of parameters but using the same name for the function.



<< 4.) The Operators New and Delete (Don't know these) >>


Same as malloc/dealloc



<< 5.) Call-by-reference parameters (Don't know this or not familar with the name) >>





<< 6.) Default parameters in functions (Nope, not this either) >>


If most of the time a parameter is the same when passed in, you can avoid putting it in the calling code. Position dependent within the calling sequence.



<< 7.) Conditional assignment using ? operator (Not this either) >>


Short cut for a if/the/else statement


These answers are not in detail, but it will give you a starting point where to start digging.

Game programing is more about manipulating images after you have programmed the basic functionality.
 

Gaunt

Senior member
Aug 29, 2001
450
0
0
The only thing missing from Eagle Keeper's explanation is call by reference parameters. Call by reference is used to pass the address of a parameter into the function so that the object pointed to by the address can be modified. This differs from regular pass by value since pass by value makes a copy of the object to be used in the function call, and any modifications are lost.

An example of a pass by reference call.
prototype:
void DoSomething(int* Ref);
call:
DoSomething(&MyInt);

Inside DoSomething, MyInt can be accessed (by using the name Ref), and any changes will be reflected when the function returns.

As you can see, the prototype and the function call are slightly different from a regular pass-by value form, which would have
void DoSomething(int Ref);
DoSomething(MyInt);
But modifications made to MyInt inside of DoSomething would be lost when DoSomething returned.

Hopefully that wasn't too confusing. I've been watching for your posts to see if I can help out with any of the game related stuff. :)
 

Becks2k

Senior member
Oct 2, 2000
391
0
0
reply to yer sig w00p

Theres a time to discriminate, hate every motherfuker that's in your way

beautiful people!
 

MrElusive

Banned
Dec 10, 2001
87
0
0
Very good Becks. As for the other guys I think I finally give up on this stuff. It's impossible for me especially with my self-confidence and self-esteem so low. I don't know what to do now, maybe I'll try to become an author or a philosopher.:(
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0


<< I don't know what to do now, maybe I'll try to become an author or a philosopher >>



An author will get critized by reviews who are out to draw blood.
A philosopher will get slammed by other egotistical peers who do not share his views.

A programmer only gets slammed by others who understand their thinking, have been in the hot seat before and are trying to help with constructive ideas.

If you can think logically and discect the problem into small managable bites, programming is feasible.