Add Imgui Navbar

This commit is contained in:
Bram Verhulst
2024-03-18 23:47:13 +01:00
parent 964a1a42f6
commit 6f2a6ead37
8 changed files with 95 additions and 152 deletions

View File

@@ -2,12 +2,15 @@
#include "pch.h"
#include "Game.h"
#include <iostream>
#include <ostream>
#include "colors.h"
#include "utils.h"
#include "WorldLevel.h"
Game::Game(const Window& window)
: BaseGame { window }, m_Camera(Camera()), m_WorldLevel(WorldLevel(&m_Camera))
: BaseGame { window }, m_Camera(Camera()), m_WorldLevel(WorldLevel(&m_Camera, GetViewPort()))
{
Initialize();
}
@@ -60,7 +63,6 @@ void Game::ProcessKeyDownEvent(const SDL_KeyboardEvent& e) {
}
void Game::ProcessKeyUpEvent(const SDL_KeyboardEvent& e) {
}
void Game::ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
@@ -71,26 +73,10 @@ void Game::ProcessMouseMotionEvent(const SDL_MouseMotionEvent& e) {
void Game::ProcessMouseDownEvent(const SDL_MouseButtonEvent& e) {
m_IsRightMouseDown = e.button == SDL_BUTTON_RIGHT;
m_MouseOffset = Point2f{m_Camera.GetPosition().x - m_MousePos.x, m_Camera.GetPosition().y - m_MousePos.y};
//std::cout << "MOUSEBUTTONDOWN event: ";
//switch ( e.button )
//{
//case SDL_BUTTON_LEFT:
// std::cout << " left button " << std::endl;
// break;
//case SDL_BUTTON_RIGHT:
// std::cout << " right button " << std::endl;
// break;
//case SDL_BUTTON_MIDDLE:
// std::cout << " middle button " << std::endl;
// break;
//}
}
void Game::ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
m_IsRightMouseDown = e.button == SDL_BUTTON_RIGHT;
m_IsRightMouseDown = e.button == SDL_BUTTON_RIGHT ? false : m_IsRightMouseDown;
//std::cout << "MOUSEBUTTONUP event: ";
//switch ( e.button )
//{
@@ -106,11 +92,8 @@ void Game::ProcessMouseUpEvent(const SDL_MouseButtonEvent& e) {
//}
}
void Game::ProcessImGui() {
ImGui::Begin("Hello world", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
ImGui::Text("Texture loading Count:");
ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 0.0f, 1.0f, 1.0f), std::to_string(Texture::m_TextureCounter).c_str());
ImGui::End();
m_WorldLevel.ProcessImGui();
}