Original Post
After using Andre LaMoth''s examples from Windows Game Programming for Dummies, I am at a loss. In the book, LaMoth uses structs for things like sprites and bitmaps, and defines them like this:
typedef struct sprite_typ
{
---
---
}, SPRITE, *spritePtr
and then he can write functions like this:
int drawSprite(spritePtr sprite, bitmapPtr bitmap, etc etc)
.........
Okay, now here''s where the problem arises. I am now writing my own game and would like to use classes for most of the functions, (ie sprite.draw, object.update, as directed by someone here at game dev). Now when I am making a class method, I am unable to convert some old functions (such as grab bitmap)
I thought that i could just do:
int grabBitmap(*sprite currentSprite, etc etc)
where sprite is the name of a class, but for some reason it is not the same, because if I use the STRUCT version of sprites and grabbing bitmaps, the program works, but if I use CLASSES the program hangs when trying to perform the GrabBitmap function.
Is there a difference between *spritePtr as a typedef and just using *sprite in the function prototype?
Has anyone else had this problem?
Thanks in advance,
wiseGuy