| 445 | } |
| 446 | |
| 447 | void ASDebugger::DebugLoop() { |
| 448 | Graphics* graphics = Graphics::Instance(); |
| 449 | Input* input = Input::Instance(); |
| 450 | |
| 451 | input->cursor->SetVisible(true); |
| 452 | input->SetGrabMouse(false); |
| 453 | while (paused) { |
| 454 | ctx->ClearLineCallback(); |
| 455 | PollEvents(); |
| 456 | |
| 457 | bool imgui_begun = true; // ImGui::FrameBegun(); |
| 458 | if (imgui_begun) { |
| 459 | ImGui::EndFrame(); |
| 460 | } |
| 461 | |
| 462 | ImGui_ImplSdlGL3_NewFrame(graphics->sdl_window_, input->GetGrabMouse()); |
| 463 | bool update_variables = true; |
| 464 | switch (UpdateGUI()) { |
| 465 | case CONTINUE: |
| 466 | continue_break = false; |
| 467 | ctx->SetLineCallback(asMETHOD(ASDebugger, Continue), this, asCALL_THISCALL); |
| 468 | paused = false; |
| 469 | do { |
| 470 | int ret = ctx->Execute(); |
| 471 | if (ret == asEXECUTION_FINISHED) { |
| 472 | ctx->SetLineCallback(asMETHOD(ASDebugger, LineCallback), this, asCALL_THISCALL); |
| 473 | ImGui::Render(); |
| 474 | if (imgui_begun) { |
| 475 | ImGui_ImplSdlGL3_NewFrame(graphics->sdl_window_, input->GetGrabMouse()); |
| 476 | } |
| 477 | return; |
| 478 | } |
| 479 | } while (!paused); |
| 480 | break; |
| 481 | case OVER: |
| 482 | current_stack_level = ctx->GetCallstackSize(); |
| 483 | ctx->SetLineCallback(asMETHOD(ASDebugger, StepOver), this, asCALL_THISCALL); |
| 484 | paused = false; |
| 485 | do { |
| 486 | int ret = ctx->Execute(); |
| 487 | if (ret == asEXECUTION_FINISHED) { |
| 488 | ctx->SetLineCallback(asMETHOD(ASDebugger, LineCallback), this, asCALL_THISCALL); |
| 489 | ImGui::Render(); |
| 490 | if (imgui_begun) { |
| 491 | ImGui_ImplSdlGL3_NewFrame(graphics->sdl_window_, input->GetGrabMouse()); |
| 492 | } |
| 493 | return; |
| 494 | } |
| 495 | } while (!paused); |
| 496 | break; |
| 497 | case INTO: |
| 498 | ctx->SetLineCallback(asMETHOD(ASDebugger, StepInto), this, asCALL_THISCALL); |
| 499 | paused = false; |
| 500 | do { |
| 501 | int ret = ctx->Execute(); |
| 502 | if (ret == asEXECUTION_FINISHED) { |
| 503 | ctx->SetLineCallback(asMETHOD(ASDebugger, LineCallback), this, asCALL_THISCALL); |
| 504 | ImGui::Render(); |
nothing calls this directly
no test coverage detected