Added IMGUI
This commit is contained in:
@ -4,6 +4,10 @@
|
||||
#include <MyGraphicsEngine/Mesh.h>
|
||||
#include <string>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "backends/imgui_impl_glfw.h"
|
||||
#include "backends/imgui_impl_opengl3.h"
|
||||
|
||||
/*
|
||||
* extern "C"
|
||||
{
|
||||
@ -11,11 +15,12 @@
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
}
|
||||
*/
|
||||
//#include <include/AssetManager/ModelImporter.h>
|
||||
|
||||
#include <include/AssetManager/ModelImporter.h>
|
||||
|
||||
#include <gorilla/gau.h>
|
||||
#include <gorilla/ga.h>
|
||||
*/
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
@ -44,6 +49,16 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
BarinkWindow GameWindow(800, 600);
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
(void)io;
|
||||
|
||||
ImGui::StyleColorsDark();
|
||||
ImGui_ImplGlfw_InitForOpenGL(GameWindow.windowptr(), true);
|
||||
ImGui_ImplOpenGL3_Init("#version 440");
|
||||
|
||||
|
||||
std::string vertexShaderSource = "build/SandboxApplication/Debug/test.vs";
|
||||
std::string fragmentShaderSource = "build/SandboxApplication/Debug/test.fs";
|
||||
Shader shader (vertexShaderSource, fragmentShaderSource);
|
||||
@ -95,7 +110,8 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
glm::mat4 projection = glm::perspective(cam.Zoom, (800.0f / 600.0f), 0.001f, 100.0f);
|
||||
|
||||
gau_Manager* mgr;
|
||||
/*
|
||||
* gau_Manager* mgr;
|
||||
ga_Mixer* mixer;
|
||||
ga_Sound sound;
|
||||
ga_Handle handle;
|
||||
@ -108,13 +124,19 @@ int main(int argc, char* argv[]) {
|
||||
gc_initialize(0);
|
||||
mgr = gau_manager_create();
|
||||
mixer = gau_manager_mixer(mgr);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
while (!GameWindow.WindowShouldClose()) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT) ;
|
||||
|
||||
|
||||
|
||||
GameWindow.Poll();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
shader.Use();
|
||||
shader.setUniformMat4("P", projection);
|
||||
shader.setUniformMat4("M", model);
|
||||
@ -124,11 +146,34 @@ int main(int argc, char* argv[]) {
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
|
||||
glBindVertexArray(0);
|
||||
|
||||
GameWindow.Poll();
|
||||
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
ImGui::Begin("Test");
|
||||
|
||||
ImGui::Text("Hello world!");
|
||||
bool isChecked = false;
|
||||
ImGui::Checkbox("Yellow!", &isChecked);
|
||||
float v = 5;
|
||||
ImGui::SliderFloat("Something to slide on..", &v, 1, 10 );
|
||||
|
||||
ImGui::End();
|
||||
|
||||
|
||||
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
|
||||
GameWindow.SwapBuffers();
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
glDeleteVertexArrays(1, &VAO);
|
||||
glDeleteBuffers(1, &EBO);
|
||||
|
Reference in New Issue
Block a user