aboutsummaryrefslogtreecommitdiffstats
path: root/src/clicky.h
blob: cb96397bfb98616cee98fac6297d8e006dc31f16 (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
#include "gameCommon.h"
#include "animation.h"

#define MAX_CLICKIES 256

#ifndef CLICKY_H
#define CLICKY_H

typedef struct Clicky Clicky;
typedef void (*ClickyUpdateCB)(Game* game, Clicky* clicky);
typedef void (*ClickyFreeCB)(Clicky clicky);

// A fixable clicky clicky. There shall be many clicky clickies.
typedef struct Clicky {
    Animation animation;
    Texture* texture;
    Rectangle rect;

    void* data;
    ClickyUpdateCB updateCB;
    ClickyFreeCB freeCB;

    // Used for reacting to clicks.
    bool wasClicked;
} Clicky;

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);

#endif