blob: 8fb339d06ef52b40d968e032df09f7bcdbf9af6a (
plain) (
blame)
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 "gameCommon.h"
#include "animation.h"
#define MAX_CLICKIES 256
#define CLICKER_DEFAULT_DELAY 0.5
#ifndef CLICKY_H
#define CLICKY_H
typedef struct Clicky Clicky;
typedef void (*ClickyUpdateCB)(Game* game, Clicky* clicky);
typedef void (*ClickyFreeCB)(Clicky clicky);
typedef enum ClickyType {
PENGUIN_LOL_TYPE,
CLICKER_TYPE
} ClickyType;
// A fixable clicky clicky. There shall be many clicky clickies.
typedef struct Clicky {
ClickyType type;
Animation animation;
Texture* texture;
Rectangle rect;
void* data;
ClickyUpdateCB updateCB;
ClickyFreeCB freeCB;
// Used for reacting to clicks.
bool wasClicked;
} Clicky;
// ittle thingy used by the clicker
typedef struct Clicker {
double timeLastClicked;
double delay;
} Clicker;
typedef struct Clickies {
Clicky clickies[MAX_CLICKIES];
size_t clickiesCount;
} Clickies;
void initClickies(Clickies* clickies);
void closeClickies(Clickies* clickies);
void addClickyToClickies(Clickies* clickies, Clicky clicky);
void updateClickies(Game* game, Clickies* clickies);
// A silly silly penguin lol.
Clicky createPenguinLolClicky(Game* game);
// Create a clicker.
Clicky createClickerClicky(Game* game);
#endif
|