Added IMGUI
This commit is contained in:
parent
9c92cc05b7
commit
af4a114fad
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,3 +13,6 @@
|
||||
[submodule "GorrillaAudio"]
|
||||
path = libs/GorillaAudio
|
||||
url = https://github.com/mewspring/gorilla-audio.git
|
||||
[submodule "ImGui"]
|
||||
path = libs/ImGui
|
||||
url = https://github.com/ocornut/imgui.git
|
||||
|
@ -18,9 +18,12 @@ class BarinkWindow{
|
||||
BarinkWindow(const int width, const int height);
|
||||
~BarinkWindow();
|
||||
|
||||
GLFWwindow* windowptr();
|
||||
|
||||
bool WindowShouldClose();
|
||||
|
||||
void Poll();
|
||||
void SwapBuffers();
|
||||
|
||||
|
||||
};
|
@ -52,12 +52,22 @@ BarinkWindow::~BarinkWindow(){
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
GLFWwindow* BarinkWindow::windowptr()
|
||||
{
|
||||
return window;
|
||||
}
|
||||
|
||||
bool BarinkWindow::WindowShouldClose(){
|
||||
return glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
void BarinkWindow::Poll()
|
||||
{
|
||||
glfwSwapBuffers(window);
|
||||
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
void BarinkWindow::SwapBuffers()
|
||||
{
|
||||
glfwSwapBuffers(window);
|
||||
}
|
@ -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,11 +124,17 @@ int main(int argc, char* argv[]) {
|
||||
gc_initialize(0);
|
||||
mgr = gau_manager_create();
|
||||
mixer = gau_manager_mixer(mgr);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
while (!GameWindow.WindowShouldClose()) {
|
||||
|
||||
|
||||
GameWindow.Poll();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
shader.Use();
|
||||
@ -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);
|
||||
|
15
imgui.ini
Normal file
15
imgui.ini
Normal file
@ -0,0 +1,15 @@
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Test]
|
||||
Pos=268,47
|
||||
Size=201,94
|
||||
Collapsed=0
|
||||
|
||||
[Window][Dear ImGui Demo]
|
||||
Pos=650,20
|
||||
Size=550,680
|
||||
Collapsed=0
|
||||
|
1
libs/ImGui
Submodule
1
libs/ImGui
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 6d27fecce1ea2cb10ca956cd67b8179cb76b35c3
|
@ -20,12 +20,14 @@ workspace "BarinkEngine"
|
||||
"./libs/GorillaAudio/include",
|
||||
"./libs/lua/include",
|
||||
"./libs/glfw/include",
|
||||
"./libs/ImGui"
|
||||
}
|
||||
|
||||
libdirs{
|
||||
"./libs/spdlog/build/Release",
|
||||
"./libs/glfw/build/src/Debug",
|
||||
"./libs/lua"
|
||||
"./libs/lua",
|
||||
"./libs/ImGui"
|
||||
}
|
||||
|
||||
links{
|
||||
@ -36,6 +38,9 @@ workspace "BarinkEngine"
|
||||
}
|
||||
|
||||
files {
|
||||
"./libs/ImGui/*.cpp",
|
||||
"./libs/ImGui/backends/imgui_impl_glfw.cpp",
|
||||
"./libs/ImGui/backends/imgui_impl_Opengl3.cpp",
|
||||
"SandboxApplication/*.cpp"
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user