Added IMGUI
This commit is contained in:
parent
9c92cc05b7
commit
af4a114fad
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,3 +13,6 @@
|
|||||||
[submodule "GorrillaAudio"]
|
[submodule "GorrillaAudio"]
|
||||||
path = libs/GorillaAudio
|
path = libs/GorillaAudio
|
||||||
url = https://github.com/mewspring/gorilla-audio.git
|
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(const int width, const int height);
|
||||||
~BarinkWindow();
|
~BarinkWindow();
|
||||||
|
|
||||||
|
GLFWwindow* windowptr();
|
||||||
|
|
||||||
bool WindowShouldClose();
|
bool WindowShouldClose();
|
||||||
|
|
||||||
void Poll();
|
void Poll();
|
||||||
|
void SwapBuffers();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
@ -50,6 +50,11 @@ Width(width), Height(height), FullScreen(false){
|
|||||||
BarinkWindow::~BarinkWindow(){
|
BarinkWindow::~BarinkWindow(){
|
||||||
|
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLFWwindow* BarinkWindow::windowptr()
|
||||||
|
{
|
||||||
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BarinkWindow::WindowShouldClose(){
|
bool BarinkWindow::WindowShouldClose(){
|
||||||
@ -58,6 +63,11 @@ bool BarinkWindow::WindowShouldClose(){
|
|||||||
|
|
||||||
void BarinkWindow::Poll()
|
void BarinkWindow::Poll()
|
||||||
{
|
{
|
||||||
glfwSwapBuffers(window);
|
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BarinkWindow::SwapBuffers()
|
||||||
|
{
|
||||||
|
glfwSwapBuffers(window);
|
||||||
}
|
}
|
@ -4,6 +4,10 @@
|
|||||||
#include <MyGraphicsEngine/Mesh.h>
|
#include <MyGraphicsEngine/Mesh.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "backends/imgui_impl_glfw.h"
|
||||||
|
#include "backends/imgui_impl_opengl3.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extern "C"
|
* extern "C"
|
||||||
{
|
{
|
||||||
@ -11,11 +15,12 @@
|
|||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
#include "lualib.h"
|
#include "lualib.h"
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
//#include <include/AssetManager/ModelImporter.h>
|
#include <include/AssetManager/ModelImporter.h>
|
||||||
|
|
||||||
#include <gorilla/gau.h>
|
#include <gorilla/gau.h>
|
||||||
#include <gorilla/ga.h>
|
#include <gorilla/ga.h>
|
||||||
|
*/
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|
||||||
@ -44,6 +49,16 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
BarinkWindow GameWindow(800, 600);
|
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 vertexShaderSource = "build/SandboxApplication/Debug/test.vs";
|
||||||
std::string fragmentShaderSource = "build/SandboxApplication/Debug/test.fs";
|
std::string fragmentShaderSource = "build/SandboxApplication/Debug/test.fs";
|
||||||
Shader shader (vertexShaderSource, fragmentShaderSource);
|
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);
|
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_Mixer* mixer;
|
||||||
ga_Sound sound;
|
ga_Sound sound;
|
||||||
ga_Handle handle;
|
ga_Handle handle;
|
||||||
@ -108,13 +124,19 @@ int main(int argc, char* argv[]) {
|
|||||||
gc_initialize(0);
|
gc_initialize(0);
|
||||||
mgr = gau_manager_create();
|
mgr = gau_manager_create();
|
||||||
mixer = gau_manager_mixer(mgr);
|
mixer = gau_manager_mixer(mgr);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (!GameWindow.WindowShouldClose()) {
|
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.Use();
|
||||||
shader.setUniformMat4("P", projection);
|
shader.setUniformMat4("P", projection);
|
||||||
shader.setUniformMat4("M", model);
|
shader.setUniformMat4("M", model);
|
||||||
@ -124,11 +146,34 @@ int main(int argc, char* argv[]) {
|
|||||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
|
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
|
||||||
glBindVertexArray(0);
|
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);
|
glDeleteVertexArrays(1, &VAO);
|
||||||
glDeleteBuffers(1, &EBO);
|
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/GorillaAudio/include",
|
||||||
"./libs/lua/include",
|
"./libs/lua/include",
|
||||||
"./libs/glfw/include",
|
"./libs/glfw/include",
|
||||||
|
"./libs/ImGui"
|
||||||
}
|
}
|
||||||
|
|
||||||
libdirs{
|
libdirs{
|
||||||
"./libs/spdlog/build/Release",
|
"./libs/spdlog/build/Release",
|
||||||
"./libs/glfw/build/src/Debug",
|
"./libs/glfw/build/src/Debug",
|
||||||
"./libs/lua"
|
"./libs/lua",
|
||||||
|
"./libs/ImGui"
|
||||||
}
|
}
|
||||||
|
|
||||||
links{
|
links{
|
||||||
@ -36,6 +38,9 @@ workspace "BarinkEngine"
|
|||||||
}
|
}
|
||||||
|
|
||||||
files {
|
files {
|
||||||
|
"./libs/ImGui/*.cpp",
|
||||||
|
"./libs/ImGui/backends/imgui_impl_glfw.cpp",
|
||||||
|
"./libs/ImGui/backends/imgui_impl_Opengl3.cpp",
|
||||||
"SandboxApplication/*.cpp"
|
"SandboxApplication/*.cpp"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user