diff --git a/.build/.added_strings_w3.jai b/.build/.added_strings_w3.jai index 166fb84..0dc2e43 100644 --- a/.build/.added_strings_w3.jai +++ b/.build/.added_strings_w3.jai @@ -6,7 +6,7 @@ NAME :: "mexplore"; VERSION :: "0.1"; JAI_VERSION :: "beta 0.2.016, built on 19 July 2025"; - RELEASE_DATE :: "26 July 2025, 17:47:40"; + RELEASE_DATE :: "3 August 2025, 09:51:04"; GIT_BRANCH :: "main"; - GIT_REVISION :: "89727b9bc176c098f703cbc731593120989767ed"; + GIT_REVISION :: "e4df2e155175ce56f09148738c333da44455ce7a"; DEBUG :: true; diff --git a/.build/mexplore-debug.lib b/.build/mexplore-debug.lib index f547c8c..954e25b 100644 Binary files a/.build/mexplore-debug.lib and b/.build/mexplore-debug.lib differ diff --git a/.build/mexplore-debug_0_w3.obj b/.build/mexplore-debug_0_w3.obj index f6fc585..8eb9c51 100644 Binary files a/.build/mexplore-debug_0_w3.obj and b/.build/mexplore-debug_0_w3.obj differ diff --git a/.build/mexplore-debug_1_w3.obj b/.build/mexplore-debug_1_w3.obj index 8b03293..ab11050 100644 Binary files a/.build/mexplore-debug_1_w3.obj and b/.build/mexplore-debug_1_w3.obj differ diff --git a/.build/mexplore-debug_2_w3.obj b/.build/mexplore-debug_2_w3.obj index bc3d8bf..87f6fc9 100644 Binary files a/.build/mexplore-debug_2_w3.obj and b/.build/mexplore-debug_2_w3.obj differ diff --git a/.build/mexplore-debug_3_w3.obj b/.build/mexplore-debug_3_w3.obj index 46b9a64..05585fb 100644 Binary files a/.build/mexplore-debug_3_w3.obj and b/.build/mexplore-debug_3_w3.obj differ diff --git a/bin/mexplore-debug.exe b/bin/mexplore-debug.exe index 0dddf11..22960cc 100644 Binary files a/bin/mexplore-debug.exe and b/bin/mexplore-debug.exe differ diff --git a/bin/mexplore-debug.pdb b/bin/mexplore-debug.pdb index ff4f1c3..8a7d42a 100644 Binary files a/bin/mexplore-debug.pdb and b/bin/mexplore-debug.pdb differ diff --git a/bin/mexplore-debug.rdi b/bin/mexplore-debug.rdi index 606f9b5..8649241 100644 Binary files a/bin/mexplore-debug.rdi and b/bin/mexplore-debug.rdi differ diff --git a/src/main.jai b/src/main.jai index 6d66573..e4b0dc4 100644 --- a/src/main.jai +++ b/src/main.jai @@ -75,9 +75,6 @@ main :: () { new_counter : u64 = SDL_GetPerformanceCounter(); dt = cast(float, new_counter - last_counter) / cast(float, counter_frequency); last_counter = new_counter; - log("%", dt); - - input_state.last_char = 0; event : SDL_Event; @@ -89,13 +86,13 @@ main :: () { running = false; case SDL_EVENT_KEY_DOWN; + log("%", event.key); if event.key.key == { case SDLK_ESCAPE; running = false; case SDLK_RETURN; - log("pressing enter"); - input_state.last_char = STB_TEXTEDIT_NEWLINE; + transition.char = STB_TEXTEDIT_NEWLINE; } case SDL_EVENT_MOUSE_MOTION; @@ -136,7 +133,7 @@ main :: () { Decode : kbts_decode = kbts_DecodeUtf8(text.data + StringAt, xx text.count - StringAt); StringAt += Decode.SourceCharactersConsumed; if Decode.Valid { - input_state.last_char = xx Decode.Codepoint; + transition.char = xx Decode.Codepoint; } } } diff --git a/src/platform/input.jai b/src/platform/input.jai index ed48acc..572ac57 100644 --- a/src/platform/input.jai +++ b/src/platform/input.jai @@ -7,13 +7,19 @@ InputTransition :: struct { mouse_wheel : s64; motion_delta : Vector2; + + control_down : bool; + control_up : bool; + + shift_down : bool; + shift_up : bool; + + char : s32; } InputState :: struct { left_mouse : bool; right_mouse : bool; - - last_char : s32; } input_state : InputState; diff --git a/src/text.jai b/src/text.jai index 80e87e0..5e3c6b8 100644 --- a/src/text.jai +++ b/src/text.jai @@ -308,8 +308,6 @@ render_text :: (font: *Font, text: []u32, pos: Vector2, size: Vector2, window_sp // t1 := t0 + .{cast(float, glyph.width / ATLAS_SIZE), cast(float, glyph.height / ATLAS_SIZE)}; // } - log("adding vertex %, %, with size %", v0, v1, v1 - v0); - array_add(*vertices, .{v0, t0, colour}); array_add(*vertices, .{.{v0.x, v1.y}, .{t0.x, t1.y}, colour}); array_add(*vertices, .{.{v1.x, v0.y}, .{t1.x, t0.y}, colour}); diff --git a/src/ui.jai b/src/ui.jai index 3edf4c8..c850e0d 100644 --- a/src/ui.jai +++ b/src/ui.jai @@ -905,15 +905,6 @@ ui_text_input :: (s: string, font_colour := Vector4.{1, 1, 1, 1}) { ui_append_to_parent(text_input); - log("%", text_input.textedit_state.cursor); - - if text_input.active && input_state.last_char > 0 { - stb_textedit_key(text_input, *text_input.textedit_state, input_state.last_char); - log("adding char %", input_state.last_char); - // log("Adding % to builder.", to_string(*input_state.last_char, 1)); - // append(*text_input.input_buffer, input_state.last_char); - } - text_size : Vector2; //text_size.y = xx text_input.font.face.size.metrics.height >> 6; //str := builder_to_string(*text_input.input_buffer, 0, false); @@ -964,7 +955,6 @@ ui_text_input :: (s: string, font_colour := Vector4.{1, 1, 1, 1}) { if action.left_pressed { text_input.active = true; - log("Text input active"); } text_input.interacted = true; @@ -1041,7 +1031,6 @@ ui_draw_text_input :: (using text_input: *TextInput) { } if cursor_time < 0.5 { - log("rendering cursor at %", cursor_pos); render_filled_rectangle(cursor_pos + v2(margin) + v2(border_size) + v2(padding), .{5.0, xx font.face.size.metrics.height >> 6}); } else if cursor_time > 1.0 { cursor_time = 0.0; @@ -1260,7 +1249,7 @@ ui_decompose_and_generate_id :: (parent: *Rect, s: string) -> string, UIKey { return text, key; } -ui_action :: (rect: *Rect) -> UIAction { +ui_action :: (rect : *Rect) -> UIAction { action : UIAction; should_consume : bool; @@ -1268,11 +1257,6 @@ ui_action :: (rect: *Rect) -> UIAction { x, y : float; SDL_GetMouseState(*x, *y); - if rect.key == "Strain-Today-Strain-HR&Strain-Scroll-Dashboard" { - if input_transitions.count > 0 - print("%\n", input_transitions); - } - mouse := Vector2.{xx x, xx (window_height - y)}; isinrect := is_in_rect(rect, mouse); @@ -1335,17 +1319,25 @@ ui_action :: (rect: *Rect) -> UIAction { } } } else { - for transition: input_transitions { - if rect.type == .SCROLLBAR { - if abs(transition.motion_delta.y) > 0 { - action.scroll -= transition.motion_delta.y; - - should_consume = true; - } + for transition : input_transitions { + if rect.type == { + case .SCROLLBAR; + if abs(transition.motion_delta.y) > 0 { + action.scroll -= transition.motion_delta.y; + } } } } + for transition : input_transitions { + if rect.type == { + case .TEXTINPUT; + text_input := cast(*TextInput, rect); + if text_input.active && transition.char > 0 { + stb_textedit_key(text_input, *text_input.textedit_state, transition.char); + } + } + } if should_consume array_reset(*input_transitions); diff --git a/ui.rad b/ui.rad index c387193..edc21e1 100644 --- a/ui.rad +++ b/ui.rad @@ -1,14 +1,14 @@ // raddbg 0.9.20 project file -recent_file: path: "src/text.jai" +recent_file: path: "src/main.jai" recent_file: path: "src/ui.jai" +recent_file: path: "../../../../jai/modules/math/module.jai" +recent_file: path: "../../../../jai/modules/basic/array.jai" +recent_file: path: "src/text.jai" recent_file: path: "src/stb_textedit.jai" recent_file: path: "modules/kb_text_shape/kb_text_shape.h" recent_file: path: "modules/SDL3/src/SDL-release-3.2.16/src/events/sdl_keyboard.c" recent_file: path: "modules/SDL3/src/SDL-release-3.2.16/src/video/windows/SDL_windowsevents.c" -recent_file: path: "src/main.jai" -recent_file: path: "../../../../jai/modules/basic/array.jai" -recent_file: path: "../../../../jai/modules/math/module.jai" recent_file: path: "src/math/math.jai" recent_file: path: "../../../../jai/modules/runtime_support.jai" recent_file: path: "../../../../jai/modules/basic/module.jai" @@ -19,15 +19,3 @@ target: working_directory: bin enabled: 1 } -breakpoint: -{ - source_location: "src/ui.jai:1014:1" - hit_count: 0 - enabled: 0 -} -breakpoint: -{ - source_location: "src/text.jai:281:1" - hit_count: 0 - enabled: 0 -}