Skip to content

Commit

Permalink
Fix input for debugger window
Browse files Browse the repository at this point in the history
  • Loading branch information
emoon committed Feb 14, 2024
1 parent e71d0d1 commit 406ee83
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion external/dear_imgui/backends/imgui_impl_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event)
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
int mouse_button = -1;
if (event->button.button == SDL_BUTTON_LEFT) { mouse_button = 0; }
if (event->button.button == SDL_BUTTON_RIGHT) { mouse_button = 1; }
if (event->button.button == SDL_BUTTON_MIDDLE) { mouse_button = 2; }
Expand Down
8 changes: 7 additions & 1 deletion src/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ static void draw_debugger_window() {

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Debugger_update(Debugger* debugger, SDL_Event* event) {
void Debugger_update_event(SDL_Event* event) {
ImGui_ImplSDL2_ProcessEvent(event);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void Debugger_update(Debugger* debugger) {
bool show_demo_window = true;
bool show_another_window = false;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
Expand Down
3 changes: 2 additions & 1 deletion src/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ struct Debugger {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Debugger* Debugger_create();
void Debugger_update(Debugger* debugger, SDL_Event* event);
void Debugger_update(Debugger* debugger);
void Debugger_update_event(SDL_Event* event);
void Debugger_destroy(Debugger* debugger);
4 changes: 3 additions & 1 deletion src/dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,11 @@ void unlockscr(struct vidbuffer* vb_in, int y_start, int y_end) {
default:
break;
}

Debugger_update_event(&e);
}

Debugger_update(s_debugger, &e);
Debugger_update(s_debugger);

uint32_t* pixels = nullptr;
int pitch = 0;
Expand Down

0 comments on commit 406ee83

Please sign in to comment.