Skip to content

Commit ff200d7

Browse files
committed
[FIX] properly size split_x and split_y
1 parent b0856ba commit ff200d7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

lmtyn_editor.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ typedef struct lmtyn_editor
129129
f32 circles_last_z;
130130
f32 circles_last_radius;
131131

132-
f32 font_glyph_width;
133-
f32 font_glyph_height;
132+
u32 font_glyph_width;
133+
u32 font_glyph_height;
134134

135135
} lmtyn_editor;
136136

@@ -630,7 +630,7 @@ LMTYN_API void lmtyn_editor_draw_text(
630630
lmtyn_editor *editor,
631631
u32 x,
632632
u32 y,
633-
const char *text,
633+
char *text,
634634
u32 color_fg)
635635
{
636636
u32 cursor_x = x;
@@ -1206,7 +1206,7 @@ LMTYN_API void lmtyn_editor_draw_circles(lmtyn_editor *editor)
12061206
u32 i;
12071207
u32 c;
12081208

1209-
for (i = 0; i < LMTYN_EDITOR_REGION_COUNT - 2; ++i)
1209+
for (i = 0; i < LMTYN_EDITOR_REGION_COUNT - 3; ++i)
12101210
{
12111211
lmtyn_editor_region *r = &editor->regions[i];
12121212

@@ -1541,7 +1541,6 @@ LMTYN_API void lmtyn_editor_draw_3d_model(
15411541
v3 world_up = vm_v3(0.0f, 1.0f, 0.0f);
15421542
v3 cam_look_at_pos = vm_v3(0.0f, 0.0f, 0.0f);
15431543
f32 cam_fov = 90.0f;
1544-
v3 model_rotation_y = vm_v3(0.0f, 1.0f, 0.0);
15451544
v3 model_position = vm_v3_zero;
15461545

15471546
m4x4 projection = vm_m4x4_perspective(vm_radf(cam_fov), (f32)ctx->width / (f32)ctx->height, 0.1f, 1000.0f);
@@ -1678,8 +1677,8 @@ LMTYN_API u8 lmtyn_editor_initialize(
16781677
editor->regions[LMTYN_EDITOR_REGION_TOOLBAR].color_background = 0x00202020;
16791678

16801679
editor->regions_selected_region_index = -1;
1681-
editor->regions_split_x = editor->framebuffer_width / 2;
1682-
editor->regions_split_y = editor->framebuffer_height / 2;
1680+
editor->regions_split_x = (editor->framebuffer_width - editor->regions_menu_size_x) / 2;
1681+
editor->regions_split_y = (editor->framebuffer_height - editor->regions_toolbar_size_y) / 2;
16831682
editor->regions_split_size_min = 50;
16841683
editor->regions_split_size_factor = 20;
16851684
editor->regions_color_border = 0x404040;
@@ -1903,8 +1902,6 @@ LMTYN_API void lmtyn_editor_input_update(
19031902

19041903
if (editor->selection_mode == LMTYN_EDITOR_MODE_CIRCLE_PLACEMENT && lmtyn_editor_is_drawing_region(editor))
19051904
{
1906-
lmtyn_editor_region *r = &editor->regions[editor->regions_selected_region_index];
1907-
19081905
u32 current_circle_index = editor->circles_count > 0 ? editor->circles_count - 1 : editor->circles_count;
19091906
lmtyn_shape_circle *circle = &editor->circles[current_circle_index];
19101907

win32_lmtyn_editor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ LMTYN_API void win32_lmtyn_editor_resize_framebuffer(lmtyn_editor *editor, i32 n
4343
bmi->bmiHeader.biWidth = new_w;
4444
bmi->bmiHeader.biHeight = -new_h; /* top-down */
4545

46-
editor->regions_split_x = editor->framebuffer_width / 2;
47-
editor->regions_split_y = editor->framebuffer_height / 2;
46+
editor->regions_split_x = (editor->framebuffer_width - editor->regions_menu_size_x) / 2;
47+
editor->regions_split_y = (editor->framebuffer_height - editor->regions_toolbar_size_y) / 2;
4848

4949
/* TODO: unsafe to change the regions asynchronously here */
5050
/* update sizes and regions in the lmtyn_editor loop */

0 commit comments

Comments
 (0)