Final Commit

This commit is contained in:
Bram Verhulst
2024-06-09 23:32:29 +02:00
parent caabb12838
commit 81746db9ae
36 changed files with 112 additions and 59426 deletions

View File

@@ -1,13 +1,3 @@
#include "imgui/imgui.h"
#include "imgui/imgui_impl_sdl2.h"
#include "imgui/imgui_impl_opengl2.h"
#if defined(IMGUI_IMPL_OPENGL_ES2)
#include <SDL_opengles2.h>
#else
#include <SDL_opengl.h>
#endif
#include "base.h"
#include <iostream>
#include <algorithm>
@@ -98,20 +88,6 @@ void BaseGame::InitializeGameEngine()
// The viewport is the rectangular region of the window where the image is drawn.
glViewport(0, 0, int(m_Window.width), int(m_Window.height));
IMGUI_CHECKVERSION();
ImGui::CreateContext();
//ImGuiIO& io = ImGui::GetIO(); (void)io;
//io.Fonts->AddFontFromFileTTF("ComicSans.ttf", 18.0f, NULL, NULL);
// Setup Dear ImGui style
ImGui::StyleColorsDark();
// ImGui::StyleColorsLight();
// Setup Platform/Renderer backends
ImGui_ImplSDL2_InitForOpenGL(m_pWindow, m_pContext);
ImGui_ImplOpenGL2_Init();
// Set the Modelview matrix to the identity matrix
glMatrixMode(GL_MODELVIEW);
@@ -197,7 +173,6 @@ void BaseGame::Run()
// Poll next event from queue
while (SDL_PollEvent(&e) != 0)
{
ImGui_ImplSDL2_ProcessEvent(&e);
// Handle the polled event
switch (e.type)
{
@@ -251,18 +226,10 @@ void BaseGame::Run()
// Call the BaseGame object 's Update function, using time in seconds (!)
this->Update(elapsedSeconds);
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplSDL2_NewFrame();
ImGui::NewFrame();
this->ProcessImGui(); // Process the ImGui code in the game
ImGui::Render();
// Draw in the back buffer
this->Draw();
ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
// Update screen: swap back and front buffer
SDL_GL_SwapWindow(m_pWindow);
@@ -272,10 +239,6 @@ void BaseGame::Run()
void BaseGame::CleanupGameEngine()
{
ImGui_ImplOpenGL2_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
SDL_FreeSurface(m_pIcon);
SDL_GL_DeleteContext(m_pContext);