#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace testbed { void application::update(entt::registry ®istry) { ImGui_ImplSDLRenderer3_NewFrame(); ImGui_ImplSDL3_NewFrame(); ImGui::NewFrame(); // update... static_cast(registry); } void application::draw(entt::registry ®istry, const context &context) const { SDL_SetRenderDrawColor(context, 0u, 0u, 0u, SDL_ALPHA_OPAQUE); SDL_RenderClear(context); rendering_system(registry, context); hud_system(registry, context); imgui_system(registry); ImGui::Render(); ImGuiIO &io = ImGui::GetIO(); SDL_SetRenderScale(context, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y); ImGui_ImplSDLRenderer3_RenderDrawData(ImGui::GetDrawData(), context); SDL_RenderPresent(context); } void application::input(entt::registry ®istry) { ImGuiIO &io = ImGui::GetIO(); SDL_Event event{}; while(SDL_PollEvent(&event)) { ImGui_ImplSDL3_ProcessEvent(&event); input_system(registry, event, quit); } } application::application() : quit{} { SDL_Init(SDL_INIT_EVENTS | SDL_INIT_VIDEO); } application::~application() { SDL_Quit(); } static void static_setup_for_dev_purposes(entt::registry ®istry) { const auto entt = registry.create(); registry.emplace(entt); registry.emplace(entt, SDL_FPoint{400.f, 400.f}); registry.emplace(entt, SDL_FRect{0.f, 0.f, 20.f, 20.f}); registry.emplace(entt); } int application::run() { entt::registry registry{}; context context{}; meta_setup(); static_setup_for_dev_purposes(registry); quit = false; while(!quit) { update(registry); draw(registry, context); input(registry); } return 0; } } // namespace testbed