Blob Blame History Raw
#ifndef GAME_H
#define GAME_H


#include "path.h"
#include "puzzle.h"


typedef struct {
  char *path;
  char *imgname;
  int seed;
  Puzzle pz;
  
  double winTransition;
} Game;


typedef struct {
  char *imgname;
  int rows, cols, turn, groups, seed;
  time_t t;
} GameInfo;


void gameFree(Game *gm);
int gameCreate(Game *gm, const char *path, const char *imgname, int rows, int cols, int turn, int seed);
int gameSave(Game *gm);
int gameLoad(Game *gm, const char *path);
GameInfo* loadGameInfo(const char *path);
void gameDraw(Game *gm);

static inline int gameStarted(Game *gm) { return !!gm->path; }
static inline int gameWon(Game *gm) { return gameStarted(gm) && gm->pz.ph.first && !gm->pz.ph.first->next; }


#endif