blob: 3c420d3d18c54e297dcc9826761b7af8da519cb1 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include <stdbool.h>
#include "../puzzles/puzzle.h"
#ifndef SCENES_H
#define SCENES_H
#define SCENE_STACK_SIZE 16
typedef enum {
/// The full screen blackout
POPUP_REVEALING,
/// The popup of a transparent scene
POPUP_REVEALING_OVERLAY,
/// The scene is actively rendered
POPUP_ACTIVE,
/// The full screen blackout
POPUP_HIDING,
/// The popup of a transparent scene
POPUP_HIDING_OVERLAY,
} PopUpState;
static const int SCROLL_SPEED = 8;
static const int BLACKOUT_SPEED = 3;
/// 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);
/// Is called when the scene becomes active after the next scene was popped
void (*Reopen)(void *self, PopUpState PreviousSceneState);
PopUpState (*GetCurrentState)(void *self);
/// A generic pointer to whatever data the scene needs. You will have to
/// cast it yourself
void *data;
// Set this to true if the previous scene should be rendered
bool IsTransparent;
} Scene;
bool InitSceneStack();
bool AddScene(Scene *newScene);
void DeleteSceneFromStack();
bool DrawScene();
bool UpdateScene();
Scene *CreateMainMenu();
Scene *CreatePuzzleScene(Puzzle *puzzle);
/// Expects a callback to add time (second argument = amount of seconds) to the scene.
Scene *CreateDistractionScene(DistractionPuzzle *puzzle, void (*addTime)(Scene *, size_t));
Scene *CreateResultView(SubmitionResult *result);
Scene *CreatePuzzleCollectionScene(CollectionElement *el, bool smooothEntry);
Scene *CreatePuzzlePreview(Puzzle *puzzle);
#endif // SCENES_H
|