I've been reading articles and tutorials on the web on the subject and it looks like there's really no "perfect design" it's a personal choice how to structure classes etc... I was thinking about it and I came up with this:
- System class: inits/closes the library, handles input and rendering and checks for collision
- Image class: loads/frees images and returns an SDL_Surface * (because i'm using SDL) when needed
- Audio class: same as Image class just with audio
- Font class: save as above with fonts
- Sprite class: has a SDL_Rect wich is used to render the sprite and also for collision and all the flags like is_solid is_transparent is_animated
- Tile class: same as above (infact i think i should link Sprite and Tile together in some way)
Also i have a question about collision... I don't know when to check for collision, I guess i'd have to check inside the main loop if all the sprites in the game are solid and if they are solid if they are colliding with each other OR with the tiles wich are solid... because if i just check for collision on a key down for example, i'm only checking for the player and I want to check for the enemies also...
But that looks like it's gonna eat too much cpu and I'm sure there are better ways to do that.
Thanks in advance, I hope my english is comprehensible.
(This is my first attempt at making a game engine by the way, go easy on me






