aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy_ui.h
blob: ce35ec1ae02d8fa9254c07c500e526777d537b86 (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
#ifndef TEENSY_UI_H_
#define TEENSY_UI_H_

#include "teensy_common.h"
#include "teensy.h"

#define TYUI_WIN_NORESIZE  (1 << 0)
#define TYUI_WIN_NOCLOSE   (1 << 1)
#define TYUI_WIN_NOMOVE    (1 << 2)
#define TYUI_WIN_INVISIBLE (1 << 3)

#define tyui_begin_window(title, rect, id) \
    tyui_begin_window_ex(title, rect, id, 0, NULL)

typedef struct {
    ty_Color fg_normal;
    ty_Color bg_normal;
    ty_Color fg_hover;
    ty_Color bg_hover;
    ty_Color win_bg;
    ty_Color win_title;
} tyui_Style;

typedef uint8_t tyui_Id;

void tyui_init(const ty_Font *font);
void tyui_deinit(void);

void tyui_layout(const float *layout);

void tyui_draw(void);

bool tyui_begin_window_ex(
    const char *title,
    ty_Recti rect,
    tyui_Id *id,
    uint32_t flags,
    bool *closed
);
void tyui_end_window(void);
bool tyui_button(const char *text);
void tyui_slider(float min, float max, float step, float *value);

void tyui_text(const char *fmt, ...);

#endif // TEENSY_UI_H_