frodo-wii/game_info.hh

40 lines
804 B
C++
Raw Normal View History

2009-12-19 10:00:29 +01:00
#ifndef __GAME_INFO_HH__
#define __GAME_INFO_HH__
#include <SDL.h>
struct game_info
{
uint32_t sz;
2009-12-19 10:12:30 +01:00
uint16_t version_magic;
2009-12-19 10:00:29 +01:00
uint16_t author_off;
uint16_t name_off;
uint16_t screenshot_off; /* In PNG format */
uint8_t data[]; /* 4-byte aligned */
};
class GameInfo
{
public:
GameInfo(const char *name = NULL, const char *author = NULL, SDL_Surface *image = NULL);
2009-12-19 10:00:29 +01:00
~GameInfo();
void resetDefaults();
/** Returns an allocated dump structure */
struct game_info *dump();
2009-12-19 10:00:29 +01:00
/** Fill in this game info object from a structure */
2009-12-19 14:20:15 +01:00
bool fromDump(struct game_info *data);
2009-12-19 10:00:29 +01:00
2009-12-19 14:20:15 +01:00
static GameInfo *loadFromFile(const char *fileName);
/* Should perhaps be protected but I trust you - just be careful! */
const char *name;
const char *author;
2009-12-19 10:00:29 +01:00
SDL_Surface *screenshot;
};
#endif /*__GAME_INFO_HH__ */