slight render call rearrangement

This commit is contained in:
oxmox 2023-02-18 22:41:05 +01:00
parent 86dcd6f92d
commit e590bed17a
2 changed files with 8 additions and 5 deletions

View file

@ -261,6 +261,7 @@ ControllerActions run_ui(ControllerContext &ctx)
int doom_controller_loop(ControllerContext &ctx) int doom_controller_loop(ControllerContext &ctx)
{ {
static constexpr ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); static constexpr ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
ControllerActions actions = {}; ControllerActions actions = {};
while (!ctx.quit) while (!ctx.quit)
@ -301,13 +302,15 @@ int doom_controller_loop(ControllerContext &ctx)
ImGui::NewFrame(); ImGui::NewFrame();
actions = run_ui(ctx); actions = run_ui(ctx);
// TODO render dooms
// Rendering // Rendering
ImGui::Render(); const auto [r, g, b, a] = imvec4_to_rgba(clear_color);
auto [r, g, b, a] = imvec4_to_rgba(clear_color);
SDL_SetRenderDrawColor(ctx.renderer, r, g, b, a); SDL_SetRenderDrawColor(ctx.renderer, r, g, b, a);
SDL_RenderClear(ctx.renderer); SDL_RenderClear(ctx.renderer);
// TODO render dooms
ImGui::Render();
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData()); ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
SDL_RenderPresent(ctx.renderer); SDL_RenderPresent(ctx.renderer);
} }

View file

@ -10,7 +10,7 @@
#include "dp_types.h" #include "dp_types.h"
inline std::tuple<u8, u8, u8, u8> imvec4_to_rgba(const ImVec4 &color) inline constexpr std::tuple<u8, u8, u8, u8> imvec4_to_rgba(const ImVec4 &color)
{ {
return return
{ {
@ -172,4 +172,4 @@ struct ExampleAppLog
} }
}; };
#endif // SRC_DP_UTIL_HPP #endif // SRC_DP_UTIL_HPP