17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-21 02:37:28 +02:00

feat(editor): scripted mouse and keys of a self-test are delivered between frames like real input events, so a press seen by ImGui starts a drag as it does by hand; while a script drives the input the real mouse and keyboard are ignored

This commit is contained in:
maj00r
2026-10-15 17:29:04 +02:00
parent 92aa39ce6e
commit 2a3d7f2e29
5 changed files with 73 additions and 22 deletions

View File

@@ -80,6 +80,8 @@ void focus_callback(GLFWwindow *window, int focus)
void cursor_enter_callback(GLFWwindow *window, int entered)
{
if (scripted_input::driving())
return;
ui_layer::cursor_enter_callback(entered);
}
@@ -96,6 +98,8 @@ void window_resize_callback(GLFWwindow *, int w, int h)
void cursor_pos_callback(GLFWwindow *window, double x, double y)
{
if (scripted_input::driving())
return;
ui_layer::cursor_pos_callback(x, y);
Global.cursor_pos = glm::ivec2(x, y);
Application.on_cursor_pos(x, y);
@@ -103,22 +107,30 @@ void cursor_pos_callback(GLFWwindow *window, double x, double y)
void mouse_button_callback(GLFWwindow *window, int button, int action, int mods)
{
if (scripted_input::driving())
return;
Application.on_mouse_button(button, action, mods);
}
void scroll_callback(GLFWwindow *window, double xoffset, double yoffset)
{
if (scripted_input::driving())
return;
Application.on_scroll(xoffset, yoffset);
}
void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods)
{
if (scripted_input::driving())
return;
Application.on_key(key, scancode, action, mods);
}
void char_callback(GLFWwindow *window, unsigned int c)
{
if (scripted_input::driving())
return;
Application.on_char(c);
}