Made multiple managers for individual pieces

Added UIManager that renders the UI inside the window
This commit is contained in:
2022-05-28 18:49:08 +02:00
parent dae8830e2b
commit 76c051e407
18 changed files with 358 additions and 197 deletions

View File

@ -1,31 +1,64 @@
#include "BarinkEngine.h"
#include <imgui.h>
extern void Start(int argc, char* argv[]);
extern void UpdateApplication();
extern void Update();
extern void Stop();
using namespace BarinkEngine;
void DrawMyGUI();
bool ShouldQuit = false;
BarinkWindow* MainWindow;
int main(int argc, char* argv[]) {
// Start Engine
Engine::Startup();
// Startup services
MainWindow = new BarinkWindow(800, 600);
Renderer renderer = Renderer();
InputManager InputSystem = InputManager();
InputSystem.attach(MainWindow);
GUIManager GUISystem = GUIManager(MainWindow);
// First call to setup game
Start(argc, argv);
while (!ShouldQuit) {
//InputManager::PollEvents();
// Runtime loop
while (!MainWindow->WindowShouldClose()) {
InputSystem.PollEvents();
Update();
UpdateApplication();
renderer.Render();
DrawMyGUI();
GUISystem.Render();
MainWindow->SwapBuffers();
}
// Shutdown game
Stop();
// Kill Engine
Engine::Shutdown();
// Shutdown Services
delete MainWindow;
return 0;
}
@ -33,5 +66,41 @@ int main(int argc, char* argv[]) {
void WARN(std::string message) {
spdlog::warn(message);
}
void DrawMyGUI() {
ImGui::NewFrame();
ImGui::Begin("Transform");
ImGui::Text("Cube");
/*
ImGui::InputFloat3("Position:", (float*)nullptr);
ImGui::InputFloat3("Rotation:", (float*)nullptr);
ImGui::InputFloat3("Scale:", (float*)nullptr);
*/
ImGui::End();
ImGui::Begin("Camera");
//ImGui::SliderFloat("Zoom:", &NULL, 10, 190);
ImGui::End();
ImGui::Begin("Scripting!!");
//ImGui::InputTextMultiline("Lua Script", nullptr, 255);
//runCode = ImGui::Button("Run");
ImGui::End();
ImGui::ShowDemoWindow();
}