|
@@ -7,10 +7,14 @@
|
|
* Created by Manoël Trapier on 09/02/2021.
|
|
* Created by Manoël Trapier on 09/02/2021.
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+
|
|
#include <SDL.h>
|
|
#include <SDL.h>
|
|
#include <SDL_image.h>
|
|
#include <SDL_image.h>
|
|
#include <glm/glm.hpp>
|
|
#include <glm/glm.hpp>
|
|
-#include <stdlib.h>
|
|
|
|
|
|
+#include <imgui.h>
|
|
|
|
+#include <imgui_sdl.h>
|
|
|
|
+#include <backends/imgui_impl_sdl.h>
|
|
|
|
|
|
#include <memory>
|
|
#include <memory>
|
|
#include <fstream>
|
|
#include <fstream>
|
|
@@ -101,6 +105,9 @@ void Game::Initialize()
|
|
|
|
|
|
//SDL_SetWindowFullscreen(this->window, SDL_WINDOW_FULLSCREEN);
|
|
//SDL_SetWindowFullscreen(this->window, SDL_WINDOW_FULLSCREEN);
|
|
|
|
|
|
|
|
+ ImGui::CreateContext();
|
|
|
|
+ ImGuiSDL::Initialize(this->renderer, Game::windowsWidth, Game::windowsHeight);
|
|
|
|
+
|
|
this->camera.x = 0;
|
|
this->camera.x = 0;
|
|
this->camera.y = 0;
|
|
this->camera.y = 0;
|
|
this->camera.w = Game::windowsWidth;
|
|
this->camera.w = Game::windowsWidth;
|
|
@@ -111,6 +118,9 @@ void Game::Initialize()
|
|
|
|
|
|
void Game::Destroy()
|
|
void Game::Destroy()
|
|
{
|
|
{
|
|
|
|
+ ImGuiSDL::Deinitialize();
|
|
|
|
+ ImGui::DestroyContext();
|
|
|
|
+
|
|
if (this->renderer)
|
|
if (this->renderer)
|
|
{
|
|
{
|
|
SDL_DestroyRenderer(this->renderer);
|
|
SDL_DestroyRenderer(this->renderer);
|
|
@@ -325,6 +335,11 @@ void Game::Render()
|
|
if (this->isDebug)
|
|
if (this->isDebug)
|
|
{
|
|
{
|
|
registry->getSystem<CollisionSystem>().debugRender(this->renderer, this->camera);
|
|
registry->getSystem<CollisionSystem>().debugRender(this->renderer, this->camera);
|
|
|
|
+
|
|
|
|
+ ImGui::NewFrame();
|
|
|
|
+ ImGui::ShowDemoWindow();
|
|
|
|
+ ImGui::Render();
|
|
|
|
+ ImGuiSDL::Render(ImGui::GetDrawData());
|
|
}
|
|
}
|
|
|
|
|
|
SDL_RenderPresent(this->renderer);
|
|
SDL_RenderPresent(this->renderer);
|