aboutsummaryrefslogtreecommitdiffstats
path: root/src/sldj.h
blob: afbdfc5f55ffdb0920860a3be9874cd6d7fc89d9 (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 <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>

#include <raylib.h>
#include <raygui.h>

#include "sldjConfig.h"
#include "scripting.h"
#include "ffmpeg.h"
#include "libsldj/util.h"

#ifndef SLDJ_H
#define SLDJ_H

typedef struct Sldj {
    RenderTexture viewport;
    Rectangle viewPortRect;

    bool isPaused;
    uint8_t targetFps;
    uint32_t frameCounter;

    // Used for always using a 0 to 2**16 range when scanning.
    uint16_t xCount;
    uint16_t yCount;

    SldjScripting scripting;
    char scriptFilepath[SLDJ_NAMEMAX];

    struct {
        Rectangle fpsSlider;
        float fpsSliderValue;

        // Viewport shit.
        Rectangle widthSlider;
        Rectangle heightSlider;
        float widthSliderValue;
        float heightSliderValue;
        Rectangle viewportButton;
    } gui;

    FFMPEG* ffmpeg;
} Sldj;

void initSldj(Sldj* sldj);
void updateSldj(Sldj* sldj);
void closeSldj(Sldj* sldj);

void resizeGui(Sldj* sldj);

void resetViewportRect(Sldj* sldj, float scale);
void resetViewport(Sldj* sldj, int width, int height);

void reloadScriptContext(Sldj* sldj);
void reloadScript(Sldj* sldj);

#endif