aboutsummaryrefslogtreecommitdiff
path: root/teensy/teensy_ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'teensy/teensy_ui.c')
-rw-r--r--teensy/teensy_ui.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/teensy/teensy_ui.c b/teensy/teensy_ui.c
index 7ff2418..45bdda3 100644
--- a/teensy/teensy_ui.c
+++ b/teensy/teensy_ui.c
@@ -80,33 +80,13 @@ typedef struct {
const tyui_Text_Input *focused_text_box;
} Ctx;
-static
-tyui_Style default_style = {
- .fg_normal = ty_color(200, 200, 200),
- .bg_normal = ty_color(20, 20, 20),
- .fg_hover = ty_color(255, 255, 255),
- .bg_hover = ty_color(100, 100, 100),
- .fg_pressed = ty_color(150, 150, 150),
- .bg_pressed = ty_color(10, 10, 10),
- .win_bg = ty_color(48, 48, 48),
- .win_border = ty_color(24, 24, 24),
- .win_title = ty_color(64, 128, 128),
- .frame = ty_color(10, 10, 10),
- .title_bar_height = 12,
- .padding = 1,
- .control_padding = 2,
- .frame_size = 1,
- .grabber_size = 4,
- .slider_fmt = "%2d"
-};
-
-static
-Ctx tyui;
+static tyui_Style default_style;
+static Ctx tyui;
static
void rect_cmd(ty_Recti rect, ty_Color color)
{
- Cmd cmd = {};
+ Cmd cmd = {0};
cmd.kind = CMD_RECT;
cmd.rect = rect;
cmd.color = color;
@@ -117,7 +97,7 @@ void rect_cmd(ty_Recti rect, ty_Color color)
static
void text_cmd(const char *text, ty_Recti rect, tyui_Align align)
{
- Cmd cmd = {};
+ Cmd cmd = {0};
cmd.kind = CMD_TEXT;
cmd.text = text;
cmd.rect = rect;
@@ -129,7 +109,7 @@ void text_cmd(const char *text, ty_Recti rect, tyui_Align align)
static
void image_cmd(ty_Image img, ty_Recti rect)
{
- Cmd cmd = {};
+ Cmd cmd = {0};
cmd.kind = CMD_IMAGE;
cmd.img = img;
cmd.rect = rect;
@@ -139,7 +119,7 @@ void image_cmd(ty_Image img, ty_Recti rect)
static
void clip_cmd(ty_Recti rect)
{
- Cmd cmd = {};
+ Cmd cmd = {0};
cmd.kind = CMD_CLIP;
if (rect.w < 0 || rect.h < 0)
@@ -247,6 +227,25 @@ void tyui_init(const ty_Font *font)
{
assert(font);
+ default_style = (tyui_Style){
+ .fg_normal = ty_color(200, 200, 200),
+ .bg_normal = ty_color(20, 20, 20),
+ .fg_hover = ty_color(255, 255, 255),
+ .bg_hover = ty_color(100, 100, 100),
+ .fg_pressed = ty_color(150, 150, 150),
+ .bg_pressed = ty_color(10, 10, 10),
+ .win_bg = ty_color(48, 48, 48),
+ .win_border = ty_color(24, 24, 24),
+ .win_title = ty_color(64, 128, 128),
+ .frame = ty_color(10, 10, 10),
+ .title_bar_height = 12,
+ .padding = 1,
+ .control_padding = 2,
+ .frame_size = 1,
+ .grabber_size = 4,
+ .slider_fmt = "%2d"
+ };
+
uint32_t root_flags = 0;
root_flags |= TYUI_WIN_NORESIZE;
root_flags |= TYUI_WIN_NOCLOSE;