imgui docking
This commit is contained in:
parent
1e08c45f0c
commit
2c6c38a964
@ -30,7 +30,7 @@ if(WIN32)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
imgui
|
imgui
|
||||||
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
||||||
GIT_TAG v1.91.1 # Latest stable version
|
GIT_TAG v1.91.2-docking # Latest stable version
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(imgui)
|
FetchContent_MakeAvailable(imgui)
|
||||||
|
|||||||
15
src/main.cpp
15
src/main.cpp
@ -23,11 +23,22 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||||||
int main() {
|
int main() {
|
||||||
// Setup window
|
// Setup window
|
||||||
glfwSetErrorCallback(glfw_error_callback);
|
glfwSetErrorCallback(glfw_error_callback);
|
||||||
|
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
std::cerr << "Failed to initialize GLFW" << std::endl;
|
std::cerr << "Failed to initialize GLFW" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||||
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
|
glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
|
||||||
|
glfwWindowHint(GLFW_VISIBLE, GL_TRUE);
|
||||||
|
glfwWindowHint(GLFW_MAXIMIZED, GL_TRUE);
|
||||||
|
glfwWindowHint(GLFW_DEPTH_BITS, 0);
|
||||||
|
glfwWindowHint(GLFW_STENCIL_BITS, 0);
|
||||||
|
|
||||||
// Create a windowed mode window and its OpenGL context
|
// Create a windowed mode window and its OpenGL context
|
||||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui + GLFW + GLAD Example", nullptr, nullptr);
|
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui + GLFW + GLAD Example", nullptr, nullptr);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
@ -50,6 +61,8 @@ int main() {
|
|||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); //(void)io;
|
ImGuiIO& io = ImGui::GetIO(); //(void)io;
|
||||||
// io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18);
|
// io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\segoeui.ttf", 18);
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
// Setup Dear ImGui style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
@ -69,6 +82,8 @@ int main() {
|
|||||||
ImGui_ImplGlfw_NewFrame();
|
ImGui_ImplGlfw_NewFrame();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
ImGui::DockSpaceOverViewport();
|
||||||
|
|
||||||
// Create a simple ImGui window
|
// Create a simple ImGui window
|
||||||
{
|
{
|
||||||
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!"
|
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user