frodo-wii/Src/gui/game_info.hh

65 lines
1.2 KiB
C++
Raw Normal View History

#ifndef __GAME_INFO_HH__
#define __GAME_INFO_HH__
#include <SDL.h>
/* This is just a link to some other file (filename is the link) */
#define F_IS_LINK (1 << 0)
struct game_info
{
/* These two MUST stay the same */
uint32_t sz;
uint16_t version_magic;
uint16_t flags;
uint16_t author_off;
uint16_t name_off;
uint16_t screenshot_off; /* In PNG format */
uint16_t filename_off;
2010-01-30 20:21:01 +01:00
uint16_t score;
2010-01-31 08:58:48 +01:00
uint16_t year;
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 = " ",
const char *author = " ",
SDL_Surface *image = NULL);
GameInfo(GameInfo *gi);
~GameInfo();
void setAuthor(const char *author);
void setName(const char *name);
2010-01-31 08:58:48 +01:00
void setYear(uint16_t year);
2010-01-30 20:03:10 +01:00
void setScreenshot(SDL_Surface *scr);
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-31 08:58:48 +01:00
uint16_t year;
uint16_t score;
};
#endif /*__GAME_INFO_HH__ */