frodo-wii/game_info.hh

51 lines
1001 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 */
2010-01-16 08:11:17 +01:00
uint16_t filename_off;
uint16_t flags;
2009-12-19 10:00:29 +01:00
uint8_t data[]; /* 4-byte aligned */
};
class GameInfo
{
public:
2010-01-16 08:11:17 +01:00
GameInfo(const char *filename = NULL, const char *name = NULL,
const char *author = NULL,
SDL_Surface *image = NULL);
2009-12-19 10:00:29 +01:00
2010-01-16 13:42:28 +01:00
GameInfo(GameInfo *gi);
2009-12-19 10:00:29 +01:00
~GameInfo();
void setAuthor(const char *author);
void setName(const char *name);
2009-12-19 10:00:29 +01:00
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;
2010-01-16 08:11:17 +01:00
const char *filename;
2009-12-19 10:00:29 +01:00
SDL_Surface *screenshot;
};
#endif /*__GAME_INFO_HH__ */