summaryrefslogtreecommitdiff
path: root/src/scenes/scenes.h
blob: d243a6de99425a0321564a899ef21401cb00f733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdbool.h>
#include "../puzzles/puzzle.h"

#ifndef SCENES_H
#define SCENES_H

#define SCENE_STACK_SIZE 16

/// This structure represents a scene that is stored in a stack.
/// The main appeal of this data type is dynamic creation of different
/// scenes that don't depend on global state
typedef struct {
    bool (*Update)(void *self);
    bool (*Draw)(void *self);
    void (*Deint)(void *self);
    /// A generic pointer to whatever data the scene needs. You will have to
    /// cast it yourself
    void *data;
} Scene;

bool InitSceneStack();

bool AddScene(Scene *newScene);
void DeleteSceneFromStack();

bool DrawScene();
bool UpdateScene();

Scene *CreateMainMenu();
Scene *CreatePuzzleScene(Puzzle *puzzle);
Scene *CreateResultView(char *result);

#endif // SCENES_H