Hello, It's me again
Okay, I've started the production phase of my game,
there are 3 main parts. A map editor, the client and a dedicated server (3 binaries).
I have the source structured as so:
./source/shared contains things like SDL font wrappers, SDL image wrappers, config parsers etc. The client and map editor use things from the shared directory, so my question is...Code:./source/me ./source/cl ./source/sv ./source/shared
Should I build everything in the shared directory into an object file and link with the map editor and client, as some things in the shared directory are dependant on-one another. I also set ./source as an include directory, so the map editor only has to #include "shared/font.h" for font support etc.
Sorry this is hard to explain
font.c relies on image.c to be built into the project else it won't work. So should I build everything in the shared directory into an object? Then link with the map editor and the client?Code:auxiliary.c config.c console.c font.c image.c niris.h auxiliary.h config.h console.h font.h image.h
Also, I wrap SDL_TTF, so when you use it you see nothing of SDL_TTF, so I typedef SDL_Font to font so SDL_TTF.h doesn't need to be included. Is it good practice to do that? ie:
font.cCode:#ifndef INCLUDED_FONT_H #define INCLUDED_FONT_H #include <SDL/SDL_ttf.h> typedef TTF_Font font; int fontInit(void); font * fontLoad(const char * name, int pt); void fontUnload(font * f); void fontPrint(SDL_Surface * dest, font * f, const char * s, SDL_Color clr, int x, int y); void fontDeinit(void); #endif /* INCLUDED_FONT_H */
If you'd rather read the entire source, It's at http://files-upload.com/files/550997/source.zip. I'd really appreciate comments on my source / coding styleCode:#include <stdio.h> #include <string.h> #include <SDL/SDL.h> #include <SDL/SDL_ttf.h> #include "niris.h" #include "image.h" /* SEE ABOVE, font.c relies on image.c being built with it! */ #include "font.h"
Should I be including 'SDL/SDL_ttf.h' into font.h? Or just assume SDL_Font is already defined? ie, SDL_ttf.h was included before font.h was.
Thanks in advance
Sorry it's so long