refactor: window (#34)

* build: add SDL3 dependency

* refactor(window): migrate from GLFW to SDL3 for window and input

* refactor: remove unused GLFW includes and commented-out code

* refactor(input): use relative mouse motion and simplify camera mouse update

* refactor(event-handling): guard input events with imgui state

Move mouse enable/disable logic into set_imgui_enabled and check imgui_enable before forwarding non-ImGui events to handlers. This prevents duplicate processing and ensures proper mouse state when toggling ImGui.

* fix(camera): reset camera on resize events and fix input handling on imgui toggle

- Add Camera::player() accessor.
- Handle WindowResizeEvent and FrameBufferResizeEvent to reset camera.
- Fix escape key handling to disable mouse before toggling imgui.
- Fix left alt handling to toggle mouse state correctly.
- Reset player key status when toggling imgui.

* fix(client_world): add direct exit flag to break connection error loop

* refactor(debug): add d_rep template and remove widget ID

* feat(debug_collector): add video driver display to debug UI

* fix: invert debug flag logic and rename to no_debug

The previous 'debug_on' field was never set to true by default, causing
debug mode to never be enabled. Now renamed to 'no_debug' and the
renderer initializes with debug enabled unless the --no-debug flag is
given.

* feat(window): add video driver selection via config and --video-driver argument

* ci: add vcpkg cache

* fix: mscv cpp version show

* fix: context delete too early

* fix: ci build fail

* fix: opengl resource delete error

* fix: add // NOLINT for NvOptimusEnablement and AmdPowerXpressRequestHighPerformance

* fix: windows ime fail on fullscreen

* feat(ui): update text input area on field changes and window resize

* fix(ui): initialize m_app pointer to nullptr

* feat(window): add exclusive fullscreen support with WM detection

* refactor: simplify WM detection and exclusive fullscreen default

Removed WindowManager enum; detect_wm() now returns string directly.
Default exclusive fullscreen based on platform (true on Linux).
Added WM info to debug overlay.

* feat: add Alt key to close ImGui; clarify debug log

* refactor(dev-panel): remove direct settings UI from settings tab
This commit is contained in:
zhenyan121
2026-07-17 18:08:51 +08:00
committed by GitHub
parent d6e1e4a50e
commit 2b75c510af
43 changed files with 1883 additions and 1934 deletions

View File

@@ -92,10 +92,20 @@ void TextField::update_show_text() {
m_foreground->set_color(Color::WHITE);
}
update_text_scale();
update_input_area();
m_cursor->set_offset({13.0f + m_foreground->width(), 0.0f});
}
void TextField::update_input_area() {
if (!m_app) {
return;
}
auto p = pos();
glm::vec4 textbox{p.x, p.y, width(), height()};
float cursor_position_x = p.x + 13.0f + m_foreground->width();
m_app->update_text_input_area(textbox, cursor_position_x);
}
TextField& TextField::set_scale(float scale) {
m_scale = scale;
return *this;
@@ -156,14 +166,21 @@ bool TextField::handle_mouse_button_event(const MouseButtonEvent& e) {
if (e.key == MouseKey::LEFT_BUTTON && e.action == KeyAction::PRESS) {
if (m_inside) {
m_typing = true;
if (m_app) {
m_app->start_text_input();
}
update_show_text();
return false;
} else {
if (m_typing) {
m_typing = false;
if (m_app) {
m_app->stop_text_input();
}
if (m_on_finished) {
m_on_finished();
}
return false;
}
}
@@ -182,9 +199,13 @@ bool TextField::handle_key_event(const KeyEvent& e) {
if (e.key == Key::ENTER && e.action == KeyAction::PRESS) {
if (m_typing) {
m_typing = false;
if (m_app) {
m_app->stop_text_input();
}
if (m_on_finished) {
m_on_finished();
}
return true;
}
}
@@ -216,4 +237,11 @@ bool TextField::handle_key_event(const KeyEvent& e) {
return false;
}
bool TextField::handle_window_resize_event(const WindowResizeEvent& e) {
Widget::handle_window_resize_event(e);
update_input_area();
return false;
}
} // namespace Cubed