Changeset 5b3462b in opengl-game
- Timestamp:
- May 8, 2018, 2:54:09 AM (7 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- f0cc877
- Parents:
- 1c81bf0
- Files:
-
- 2 edited
-
IMGUI/imgui.h (modified) (1 diff)
-
new-game.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
IMGUI/imgui.h
r1c81bf0 r5b3462b 564 564 ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it 565 565 ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame 566 //ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items (OBSOLETE! Use e.g. style.FrameBorderSize=1.0f to enable borders).567 ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file568 ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs, hovering test with pass through.569 ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar570 ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.571 ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state572 ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus)573 ImGuiWindowFlags_AlwaysVerticalScrollbar = 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y)574 ImGuiWindowFlags_AlwaysHorizontalScrollbar = 1 << 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x)575 ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)576 ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // [BETA] Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui.577 ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window578 ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB)579 ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,580 581 // [Internal]582 ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)583 ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()584 ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()585 ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()586 ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal()587 ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For internal use by BeginMenu()566 //ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items (OBSOLETE! Use e.g. style.FrameBorderSize=1.0f to enable borders). 567 ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file 568 ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs, hovering test with pass through. 569 ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar 570 ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section. 571 ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state 572 ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13, // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus) 573 ImGuiWindowFlags_AlwaysVerticalScrollbar = 1 << 14, // Always show vertical scrollbar (even if ContentSize.y < Size.y) 574 ImGuiWindowFlags_AlwaysHorizontalScrollbar = 1 << 15, // Always show horizontal scrollbar (even if ContentSize.x < Size.x) 575 ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16, // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient) 576 ImGuiWindowFlags_ResizeFromAnySide = 1 << 17, // [BETA] Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui. 577 ImGuiWindowFlags_NoNavInputs = 1 << 18, // No gamepad/keyboard navigation within the window 578 ImGuiWindowFlags_NoNavFocus = 1 << 19, // No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB) 579 ImGuiWindowFlags_NoNav = ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus, 580 581 // [Internal] 582 ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!) 583 ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild() 584 ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip() 585 ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup() 586 ImGuiWindowFlags_Modal = 1 << 27, // Don't use! For internal use by BeginPopupModal() 587 ImGuiWindowFlags_ChildMenu = 1 << 28 // Don't use! For internal use by BeginMenu() 588 588 }; 589 589 -
new-game.cpp
r1c81bf0 r5b3462b 69 69 float NEAR_CLIP = 0.1f; 70 70 float FAR_CLIP = 100.0f; 71 72 // Should really have some array or struct of UI-related variables 73 bool isRunning = true; 71 74 72 75 ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); … … 518 521 //glfwSwapInterval(0); 519 522 520 while (!glfwWindowShouldClose(window) ) {523 while (!glfwWindowShouldClose(window) && isRunning) { 521 524 double current_seconds = glfwGetTime(); 522 525 double elapsed_seconds = current_seconds - previous_seconds; … … 813 816 814 817 void renderGui() { 815 bool show_demo_window = true;816 bool show_another_window = true;817 818 818 ImGui_ImplGlfwGL3_NewFrame(); 819 819 820 820 // 1. Show a simple window. 821 821 // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 822 /* 822 823 { 823 824 static float f = 0.0f; … … 837 838 ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 838 839 } 839 840 // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 841 if (show_another_window) { 842 ImGui::Begin("Another Window", &show_another_window); 843 ImGui::Text("Hello from another window!"); 844 if (ImGui::Button("Close Me")) 845 show_another_window = false; 840 */ 841 842 { 843 ImGui::SetNextWindowSize(ImVec2(85, 22), ImGuiCond_Once); 844 ImGui::SetNextWindowPos(ImVec2(10, 50), ImGuiCond_Once); 845 ImGui::Begin("WndStats", NULL, ImGuiWindowFlags_NoTitleBar | 846 ImGuiWindowFlags_NoResize | 847 ImGuiWindowFlags_NoMove); 848 ImGui::Text("Score: ???"); 846 849 ImGui::End(); 847 850 } 848 851 849 // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 850 if (show_demo_window) { 851 ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 852 ImGui::ShowDemoWindow(&show_demo_window); 852 { 853 ImGui::SetNextWindowPos(ImVec2(380, 10), ImGuiCond_Once); 854 ImGui::SetNextWindowSize(ImVec2(250, 35), ImGuiCond_Once); 855 ImGui::Begin("WndMenubar", NULL, ImGuiWindowFlags_NoTitleBar | 856 ImGuiWindowFlags_NoResize | 857 ImGuiWindowFlags_NoMove); 858 ImGui::InvisibleButton("", ImVec2(190, 18)); 859 ImGui::SameLine(); 860 if (ImGui::Button("Quit")) { 861 isRunning = false; 862 } 863 ImGui::End(); 853 864 } 854 865
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/medieval/chrome/site/your_project_logo.png)