2010-01-25 14:01:22 +01:00
|
|
|
#ifndef __GAME_INFO_HH__
|
|
|
|
#define __GAME_INFO_HH__
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
struct game_info
|
|
|
|
{
|
|
|
|
/* These two MUST stay the same */
|
|
|
|
uint32_t sz;
|
|
|
|
uint16_t version_magic;
|
|
|
|
|
|
|
|
uint16_t author_off;
|
|
|
|
uint16_t name_off;
|
|
|
|
uint16_t screenshot_off; /* In PNG format */
|
|
|
|
uint16_t filename_off;
|
|
|
|
uint16_t flags;
|
|
|
|
uint8_t data[]; /* 4-byte aligned */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class GameInfo
|
|
|
|
{
|
|
|
|
public:
|
2010-01-30 14:03:53 +01:00
|
|
|
GameInfo(const char *filename = "unknown", const char *name = " ",
|
2010-01-30 13:48:47 +01:00
|
|
|
const char *author = " ",
|
2010-01-25 14:01:22 +01:00
|
|
|
SDL_Surface *image = NULL);
|
|
|
|
|
|
|
|
GameInfo(GameInfo *gi);
|
|
|
|
|
|
|
|
~GameInfo();
|
|
|
|
|
|
|
|
void setAuthor(const char *author);
|
|
|
|
|
|
|
|
void setName(const char *name);
|
|
|
|
|
2010-01-30 20:03:10 +01:00
|
|
|
void setScreenshot(SDL_Surface *scr);
|
|
|
|
|
2010-01-25 14:01:22 +01:00
|
|
|
void resetDefaults();
|
|
|
|
|
|
|
|
/** Returns an allocated dump structure */
|
|
|
|
struct game_info *dump();
|
|
|
|
|
|
|
|
/** Fill in this game info object from a structure */
|
|
|
|
bool fromDump(struct game_info *data);
|
|
|
|
|
|
|
|
static GameInfo *loadFromFile(const char *fileName);
|
|
|
|
|
|
|
|
/* Should perhaps be protected but I trust you - just be careful! */
|
|
|
|
const char *name;
|
|
|
|
const char *author;
|
|
|
|
const char *filename;
|
|
|
|
SDL_Surface *screenshot;
|
2010-01-30 20:06:18 +01:00
|
|
|
|
|
|
|
Uint16 score;
|
2010-01-25 14:01:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*__GAME_INFO_HH__ */
|