-
Notifications
You must be signed in to change notification settings - Fork 1
/
imgui.h
57 lines (43 loc) · 930 Bytes
/
imgui.h
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
#ifndef IMGUI_GUARD
#define IMGUI_GUARD
#define SDL_MAIN_HANDLED
#include <SDL2/SDL.h>
#include "font.h"
namespace imgui {
using Rect = SDL_Rect;
class TextBuffer {
public:
char* buffer;
int size;
int cursor;
TextBuffer(int size);
~TextBuffer();
void Push(char c);
void Back();
};
class Context {
public:
SDL_Renderer* renderer;
Font* font;
TextBuffer* focus;
int mouseX, mouseY;
bool mouseClick;
};
class Container {
protected:
Rect size;
int nextX;
int nextY;
Container() {}
public:
void Text(const char* text);
bool Button(const char* text);
bool TextField(TextBuffer* textBuffer);
};
class Window : public Container {
public:
Window(int width, int height);
};
extern Context context;
}
#endif