├── .gitignore ├── README.md ├── build_test.cmd ├── drawhistory_screen.png ├── drawlist_screen.png ├── imgui ├── .github │ ├── CONTRIBUTING.md │ ├── issue_template.md │ └── pull_request_template.md ├── .travis.yml ├── LICENSE.txt ├── docs │ ├── CHANGELOG.txt │ ├── README.md │ └── TODO.txt ├── examples │ ├── .gitignore │ ├── README.txt │ ├── example_allegro5 │ │ ├── README.md │ │ ├── example_allegro5.vcxproj │ │ ├── example_allegro5.vcxproj.filters │ │ ├── imconfig_allegro5.h │ │ └── main.cpp │ ├── example_apple_metal │ │ ├── README.md │ │ ├── Shared │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Renderer.h │ │ │ ├── Renderer.mm │ │ │ ├── ViewController.h │ │ │ ├── ViewController.mm │ │ │ └── main.m │ │ ├── example_apple_metal.xcodeproj │ │ │ └── project.pbxproj │ │ ├── iOS │ │ │ ├── Base.lproj │ │ │ │ └── Main.storyboard │ │ │ ├── Default-568h@2x.png │ │ │ ├── Info-iOS.plist │ │ │ └── Launch Screen.storyboard │ │ └── macOS │ │ │ ├── Base.lproj │ │ │ └── Main.storyboard │ │ │ └── Info-macOS.plist │ ├── example_apple_opengl2 │ │ ├── example_apple_opengl2.xcodeproj │ │ │ └── project.pbxproj │ │ └── main.mm │ ├── example_freeglut_opengl2 │ │ ├── example_freeglut_opengl2.vcxproj │ │ ├── example_freeglut_opengl2.vcxproj.filters │ │ └── main.cpp │ ├── example_glfw_opengl2 │ │ ├── Makefile │ │ ├── build_win32.bat │ │ ├── example_glfw_opengl2.vcxproj │ │ ├── example_glfw_opengl2.vcxproj.filters │ │ └── main.cpp │ ├── example_glfw_opengl3 │ │ ├── Makefile │ │ ├── build_win32.bat │ │ ├── example_glfw_opengl3.vcxproj │ │ ├── example_glfw_opengl3.vcxproj.filters │ │ └── main.cpp │ ├── example_glfw_vulkan │ │ ├── CMakeLists.txt │ │ ├── build_win32.bat │ │ ├── build_win64.bat │ │ ├── example_glfw_vulkan.vcxproj │ │ ├── example_glfw_vulkan.vcxproj.filters │ │ ├── gen_spv.sh │ │ ├── glsl_shader.frag │ │ ├── glsl_shader.vert │ │ └── main.cpp │ ├── example_marmalade │ │ ├── data │ │ │ └── app.icf │ │ ├── main.cpp │ │ └── marmalade_example.mkb │ ├── example_null │ │ ├── build_win32.bat │ │ └── main.cpp │ ├── example_sdl_opengl2 │ │ ├── Makefile │ │ ├── README.md │ │ ├── build_win32.bat │ │ ├── example_sdl_opengl2.vcxproj │ │ ├── example_sdl_opengl2.vcxproj.filters │ │ └── main.cpp │ ├── example_sdl_opengl3 │ │ ├── Makefile │ │ ├── README.md │ │ ├── build_win32.bat │ │ ├── example_sdl_opengl3.vcxproj │ │ ├── example_sdl_opengl3.vcxproj.filters │ │ └── main.cpp │ ├── example_sdl_vulkan │ │ ├── example_sdl_vulkan.vcxproj │ │ ├── example_sdl_vulkan.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx10 │ │ ├── build_win32.bat │ │ ├── example_win32_directx10.vcxproj │ │ ├── example_win32_directx10.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx11 │ │ ├── build_win32.bat │ │ ├── example_win32_directx11.vcxproj │ │ ├── example_win32_directx11.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx12 │ │ ├── build_win32.bat │ │ ├── example_win32_directx12.vcxproj │ │ ├── example_win32_directx12.vcxproj.filters │ │ └── main.cpp │ ├── example_win32_directx9 │ │ ├── build_win32.bat │ │ ├── example_win32_directx9.vcxproj │ │ ├── example_win32_directx9.vcxproj.filters │ │ └── main.cpp │ ├── imgui_examples.sln │ ├── imgui_impl_allegro5.cpp │ ├── imgui_impl_allegro5.h │ ├── imgui_impl_dx10.cpp │ ├── imgui_impl_dx10.h │ ├── imgui_impl_dx11.cpp │ ├── imgui_impl_dx11.h │ ├── imgui_impl_dx12.cpp │ ├── imgui_impl_dx12.h │ ├── imgui_impl_dx9.cpp │ ├── imgui_impl_dx9.h │ ├── imgui_impl_freeglut.cpp │ ├── imgui_impl_freeglut.h │ ├── imgui_impl_glfw.cpp │ ├── imgui_impl_glfw.h │ ├── imgui_impl_marmalade.cpp │ ├── imgui_impl_marmalade.h │ ├── imgui_impl_metal.h │ ├── imgui_impl_metal.mm │ ├── imgui_impl_opengl2.cpp │ ├── imgui_impl_opengl2.h │ ├── imgui_impl_opengl3.cpp │ ├── imgui_impl_opengl3.h │ ├── imgui_impl_osx.h │ ├── imgui_impl_osx.mm │ ├── imgui_impl_sdl.cpp │ ├── imgui_impl_sdl.h │ ├── imgui_impl_vulkan.cpp │ ├── imgui_impl_vulkan.h │ ├── imgui_impl_win32.cpp │ ├── imgui_impl_win32.h │ └── libs │ │ ├── gl3w │ │ └── GL │ │ │ ├── gl3w.c │ │ │ ├── gl3w.h │ │ │ └── glcorearb.h │ │ ├── glfw │ │ ├── COPYING.txt │ │ ├── include │ │ │ └── GLFW │ │ │ │ ├── glfw3.h │ │ │ │ └── glfw3native.h │ │ ├── lib-vc2010-32 │ │ │ └── glfw3.lib │ │ └── lib-vc2010-64 │ │ │ └── glfw3.lib │ │ └── usynergy │ │ ├── README.txt │ │ ├── uSynergy.c │ │ └── uSynergy.h ├── imconfig.h ├── imgui.cpp ├── imgui.h ├── imgui_demo.cpp ├── imgui_draw.cpp ├── imgui_internal.h ├── imgui_widgets.cpp ├── imstb_rectpack.h ├── imstb_textedit.h ├── imstb_truetype.h └── misc │ ├── fonts │ ├── Cousine-Regular.ttf │ ├── DroidSans.ttf │ ├── Karla-Regular.ttf │ ├── ProggyClean.ttf │ ├── ProggyTiny.ttf │ ├── README.txt │ ├── Roboto-Medium.ttf │ └── binary_to_compressed_c.cpp │ ├── freetype │ ├── README.md │ ├── imgui_freetype.cpp │ └── imgui_freetype.h │ ├── natvis │ ├── README.txt │ └── imgui.natvis │ └── stl │ ├── imgui_stl.cpp │ └── imgui_stl.h ├── license.txt ├── metrics_gui ├── include │ └── metrics_gui │ │ └── metrics_gui.h └── source │ ├── ProggyTiny.cpp │ └── metrics_gui.cpp ├── portable ├── README.md ├── countof.h ├── perf_timer.h └── snprintf.h ├── sample ├── impl.h ├── impl_d3d11.cpp ├── impl_d3d11.h ├── impl_d3d12.cpp ├── impl_d3d12.h ├── main.cpp ├── ps.hlsl ├── sample.sln ├── sample.vcxproj ├── sample.vcxproj.filters └── vs.hlsl └── sample_screen.png /.gitignore: -------------------------------------------------------------------------------- 1 | /sample/build/ 2 | /sample/.vs/ 3 | imgui.ini 4 | *.opensdf 5 | *.v12.suo 6 | *.sdf 7 | *.vcxproj.user 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DISCONTINUATION OF PROJECT # 2 | This project will no longer be maintained by Intel. 3 | Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. 4 | Intel no longer accepts patches to this project. 5 | # MetricsGui 6 | 7 | This library provides ImGui controls for displaying performance metrics such as the following: 8 | 9 | ![MetricsGui sample screen shot](sample_screen.png "MetricsGui sample screen shot") 10 | 11 | ## License 12 | 13 | Copyright 2017 Intel Corporation 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy of 16 | this software and associated documentation files (the "Software"), to deal in 17 | the Software without restriction, including without limitation the rights to 18 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 19 | of the Software, and to permit persons to whom the Software is furnished to do 20 | so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in all 23 | copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | SOFTWARE. 32 | 33 | ## Usage 34 | 35 | A simple example of MetricsGui usage can be found in the sample app in the 36 | 'sample/' directory. 37 | 38 | Essential steps include: 39 | 40 | 1. Allocate and initialize `MetricsGuiMetric` instances. 41 | 42 | ```C++ 43 | // Note: MetricsGuiPlot does not assume ownership over added metrics, so it 44 | // is the users responsibility to manage the lifetime of MetricsGuiMetric 45 | // instances. 46 | MetricsGuiMetric frameTimeMetric("Frame time", "s", MetricsGuiMetric::USE_SI_UNIT_PREFIX); 47 | frameTimeMetric.mSelected = true; 48 | ``` 49 | 50 | 2. Allocate and initialize `MetricsGuiPlot` instances. The below shows all of the `MetricsGuiPlot` options with their default values (i.e., the same values set by the `MetricsGuiPlot` constructor) so you only need to set ones you want changed. 51 | 52 | ```C++ 53 | MetricsGuiPlot frameTimePlot; 54 | frameTimePlot.mBarRounding = 0.f; // amount of rounding on bars 55 | frameTimePlot.mRangeDampening = 0.95f; // weight of historic range on axis range [0,1] 56 | frameTimePlot.mInlinePlotRowCount = 2; // height of DrawList() inline plots, in text rows 57 | frameTimePlot.mPlotRowCount = 5; // height of DrawHistory() plots, in text rows 58 | frameTimePlot.mVBarMinWidth = 6; // min width of bar graph bar in pixels 59 | frameTimePlot.mVBarGapWidth = 1; // width of bar graph inter-bar gap in pixels 60 | frameTimePlot.mShowAverage = false; // draw horizontal line at series average 61 | frameTimePlot.mShowInlineGraphs = false; // show history plot in DrawList() 62 | frameTimePlot.mShowOnlyIfSelected = false; // draw show selected metrics 63 | frameTimePlot.mShowLegendDesc = true; // show series description in legend 64 | frameTimePlot.mShowLegendColor = true; // use series color in legend 65 | frameTimePlot.mShowLegendUnits = true; // show units in legend values 66 | frameTimePlot.mShowLegendAverage = false; // show series average in legend 67 | frameTimePlot.mShowLegendMin = true; // show plot y-axis minimum in legend 68 | frameTimePlot.mShowLegendMax = true; // show plot y-axis maximum in legend 69 | frameTimePlot.mBarGraph = false; // use bars to draw history 70 | frameTimePlot.mStacked = false; // stack series when drawing history 71 | frameTimePlot.mSharedAxis = false; // use first series' axis range 72 | frameTimePlot.mFilterHistory = true; // allow single plot point to represent more than on history value 73 | ``` 74 | 75 | 3. Add metrics to the plot. 76 | 77 | ```C++ 78 | frameTimePlot.AddMetric(&frameTimeMetric); 79 | ``` 80 | 81 | 4. Then, within your render loop you can add values to the metric history and update the plot axes. 82 | 83 | ```C++ 84 | frameTimeMetric.AddNewValue(1.f / ImGui::GetIO().Framerate); 85 | frameTimePlot.UpdateAxes(); 86 | ``` 87 | 88 | 5. Render the GUI from within an ImGui window using either `MetricsGuiPlot::DrawList()` or `MetricsGuiPlot::DrawHistory()`. 89 | 90 | ```C++ 91 | frameTimePlot.DrawList(); 92 | ``` 93 | 94 | ![DrawList](drawlist_screen.png "DrawList example") 95 | 96 | ```C++ 97 | frameTimePlot.DrawHistory(); 98 | ``` 99 | 100 | ![DrawHistory](drawhistory_screen.png "DrawHistory example") 101 | -------------------------------------------------------------------------------- /build_test.cmd: -------------------------------------------------------------------------------- 1 | rmdir /s /q "%~dp0sample\build" 2 | msbuild /p:configuration=debug-nodx12 "%~dp0sample\sample.sln" 3 | @if not "%errorlevel%"=="0" exit /b 1 4 | msbuild /p:configuration=release-nodx12 "%~dp0sample\sample.sln" 5 | @if not "%errorlevel%"=="0" exit /b 1 6 | msbuild /p:configuration=debug "%~dp0sample\sample.sln" 7 | @if not "%errorlevel%"=="0" exit /b 1 8 | msbuild /p:configuration=release "%~dp0sample\sample.sln" 9 | @if not "%errorlevel%"=="0" exit /b 1 10 | @echo. 11 | @echo. 12 | @echo PASS 13 | -------------------------------------------------------------------------------- /drawhistory_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/drawhistory_screen.png -------------------------------------------------------------------------------- /drawlist_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/drawlist_screen.png -------------------------------------------------------------------------------- /imgui/.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to create an Issue 2 | 3 | Hello! 4 | 5 | You may use the Issue Tracker to submit bug reports, feature requests or suggestions. You may ask for help or advice as well. However please read this wall of text before doing so. The amount of incomplete or ambiguous requests due to people not following those guidelines is often overwhelming. Please do your best to clarify your request. Thank you! 6 | 7 | **IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS** 8 | - Please post on the "Getting Started" Discourse forum: https://discourse.dearimgui.org/c/getting-started 9 | 10 | **Prerequisites for new users of dear imgui:** 11 | - Please read the FAQ in imgui.cpp. 12 | - Please read misc/fonts/README.txt if your question relates to fonts or text. 13 | - Please run ImGui::ShowDemoWindow() to explore the demo and its sources. 14 | - Please use the Search function of GitHub to look for similar issues. You may also browse issues by tags. 15 | - Please use the Search function of your IDE to search in the code for comments related to your situation. 16 | - If you get a assert, use a debugger to locate the line triggering it and read the comments around the assert. 17 | 18 | **Guidelines to report an issue or ask a question:** 19 | - Please provide your imgui version number. 20 | - Please state if you have made substantial modifications to your copy of imgui. 21 | - Try to be explicit with your expectations and what you have tried. What you have in mind or in your code is not obvious to other people. 22 | - If you are discussing an assert or a crash, please provide a debugger callstack. Never state "it crashes" without additional information. If you don't know how to use a debugger and retrieve a callstack, learning about it will be useful. 23 | - Please make sure that your compilation settings have asserts enabled. Calls to IM_ASSERT() are scattered in the code to help catch common issues. By default IM_ASSERT() calls the standard assert() function. To verify that your asserts are enabled, add the line `IM_ASSERT(false);` in your main() function. Your application should display an error message and abort. If your application report an error, it means that your asserts are disabled. Please make sure they are enabled. 24 | - When discussing issues related to rendering or inputs, please state the OS/back-end/renderer you are using. Please state if you are using a vanilla copy of the example back-ends (imgui_impl_XXX files), or a modified one, or if you built your own. 25 | - Please provide a Minimal, Complete and Verifiable Example ([MCVE](https://stackoverflow.com/help/mcve)) to demonstrate your problem. An ideal submission includes a small piece of code that anyone can paste in one of the examples/ application (e.g. in main.cpp or imgui_demo.cpp) to understand and reproduce it. Narrowing your problem to its shortest and purest form is the easiest way to understand it. Please test your shortened code to ensure it actually exhibit the problem. Often while creating the MCVE you will end up solving the problem! Many questions that are missing a standalone verifiable example are missing the actual cause of their issue in the description, which ends up wasting everyone's time. 26 | - Try to attach screenshots to clarify the context. They often convey useful information that are omitted by the description. You can drag pictures/files here (prefer github attachments over 3rd party hosting). 27 | - When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.). 28 | 29 | **Some unfortunate words of warning** 30 | - If you are or were involved in cheating schemes (e.g. DLL injection) for competitive online multi-player games, please don't post here. We won't answer and you will be blocked. We've had too many of you. Please stop. 31 | - Due to frequent abuse of this service from aforementioned users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and incomplete questions may be dismissed. 32 | 33 | If you have been using dear imgui for a while or have been using C/C++ for several years or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users or members of the community will know what information are useful in a given context. 34 | 35 | ## How to create an Pull Request 36 | - When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.). 37 | - When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using. 38 | - Try to attach screenshots to clarify the context and demonstrate the feature at a glance. You can drag pictures/files here (prefer github attachments over 3rd party hosting). 39 | - Make sure your code follows the coding style already used in imgui (spaces instead of tabs, "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11. 40 | - Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR (we can still cherry-pick individual commits). 41 | 42 | Thank you for reading! 43 | -------------------------------------------------------------------------------- /imgui/.github/issue_template.md: -------------------------------------------------------------------------------- 1 | IF YOU ARE HAVING AN ISSUE COMPILING/LINKING/RUNNING/DISPLAYING/ADDING FONTS/WIRING INPUTS, please post on the "Getting Started" Discourse forum: 2 | https://discourse.dearimgui.org/c/getting-started 3 | 4 | Otherwise, you may use this Issue Tracker to ask for help and submit bug reports, feature requests or suggestions. PLEASE CAREFULLY READ THIS DOCUMENT before submitting any issue: 5 | https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md 6 | (Click "Preview" to turn the URL above into a clickable link) 7 | 8 | PLEASE MAKE SURE that you have: read the FAQ in imgui.cpp; explored the contents of ShowDemoWindow() including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the CONTRIBUTING.md file linked above. 9 | 10 | (Delete everything above this section before submitting your issue.) 11 | 12 | ---- 13 | 14 | **Version/Branch of Dear ImGui:** 15 | 16 | XXX 17 | 18 | **Back-end file/Renderer/OS:** _(or specify if you are using a custom engine back-end)_ 19 | 20 | Back-ends: imgui_impl_XXX.cpp + imgui_impl_XXX.cpp 21 | OS: XXX 22 | Compiler: XXX _(if the question is related to building)_ 23 | 24 | **My Issue/Question:** _(please provide context)_ 25 | 26 | **Standalone, minimal, complete and verifiable example:** _(see CONTRIBUTING.md)_ 27 | ``` 28 | ImGui::Begin("Example Bug"); 29 | MoreCodeToExplainMyIssue(); 30 | ImGui::End(); 31 | ``` 32 | 33 | **Screenshots/Video** _(you can drag files here)_ 34 | -------------------------------------------------------------------------------- /imgui/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | - Please read https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md 2 | - When adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.). 3 | - When fixing a warning or compilation problem, please post the compiler log and specify the version and OS you are using. 4 | - Try to attach screenshots to clarify the context and demonstrate the feature at a glance. 5 | - Make sure your code follows the coding style already used in imgui (4 spaces instead of tabs, "type* name", "local_variable", "FunctionName", "MemberName", etc.). We don't use modern C++ idioms and can compile without C++11. 6 | - Make sure you create a branch for the pull request. In Git, 1 PR is associated to 1 branch. If you keep pushing to the same branch after you submitted the PR, your new commits will appear in the PR. 7 | 8 | (Clear this form before submitting your PR) 9 | -------------------------------------------------------------------------------- /imgui/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | sudo: required 3 | dist: trusty 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | compiler: 10 | - gcc 11 | - clang 12 | 13 | before_install: 14 | - if [ $TRAVIS_OS_NAME == linux ]; then 15 | sudo apt-get update -qq; 16 | sudo apt-get install -y --no-install-recommends libxrandr-dev libxi-dev libxxf86vm-dev libsdl2-dev; 17 | wget https://github.com/glfw/glfw/releases/download/3.2.1/glfw-3.2.1.zip; 18 | unzip glfw-3.2.1.zip && cd glfw-3.2.1; 19 | cmake -DBUILD_SHARED_LIBS=true -DGLFW_BUILD_EXAMPLES=false -DGLFW_BUILD_TESTS=false -DGLFW_BUILD_DOCS=false .; 20 | sudo make -j $CPU_NUM install && cd ..; 21 | fi 22 | - if [ $TRAVIS_OS_NAME == osx ]; then 23 | brew update; 24 | brew install glfw3; 25 | brew install sdl2; 26 | fi 27 | 28 | script: 29 | - make -C examples/example_glfw_opengl2 30 | - make -C examples/example_glfw_opengl3 31 | - make -C examples/example_sdl_opengl3 32 | - if [ $TRAVIS_OS_NAME == osx ]; then 33 | xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos; 34 | fi 35 | -------------------------------------------------------------------------------- /imgui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2018 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /imgui/examples/.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | */Debug/* 3 | */Release/* 4 | */x64/* 5 | *.o 6 | *.obj 7 | *.exe 8 | 9 | ## Visual Studio cruft 10 | .vs/* 11 | */ipch/* 12 | *.opensdf 13 | *.log 14 | *.pdb 15 | *.ilk 16 | *.user 17 | *.sdf 18 | *.suo 19 | *.VC.db 20 | *.VC.VC.opendb 21 | 22 | ## Xcode cruft 23 | .DS_Store 24 | project.xcworkspace 25 | xcuserdata 26 | 27 | ## Emscripten output 28 | *.out.js 29 | *.out.wasm 30 | 31 | ## Unix executables 32 | example_glfw_opengl2/example_glfw_opengl2 33 | example_glfw_opengl3/example_glfw_opengl3 34 | example_sdl_opengl2/example_sdl_opengl2 35 | example_sdl_opengl3/example_sdl_opengl3 36 | 37 | ## Dear ImGui Ini files 38 | imgui.ini 39 | -------------------------------------------------------------------------------- /imgui/examples/example_allegro5/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Configuration 3 | 4 | Dear ImGui outputs 16-bit vertex indices by default. 5 | Allegro doesn't support them natively, so we have two solutions: convert the indices manually in imgui_impl_allegro5.cpp, or compile imgui with 32-bit indices. 6 | You can either modify imconfig.h that comes with Dear ImGui (easier), or set a C++ preprocessor option IMGUI_USER_CONFIG to find to a filename. 7 | We are providing `imconfig_allegro5.h` that enables 32-bit indices. 8 | Note that the back-end supports _BOTH_ 16-bit and 32-bit indices, but 32-bit indices will be slightly faster as they won't require a manual conversion. 9 | 10 | # How to Build 11 | 12 | - On Ubuntu 14.04+ 13 | 14 | ```bash 15 | g++ -DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" -I .. -I ../.. main.cpp ..\imgui_impl_allegro5.cpp ../../imgui*.cpp -lallegro -lallegro_primitives -o allegro5_example 16 | ``` 17 | 18 | - On Windows with Visual Studio's CLI 19 | 20 | ``` 21 | set ALLEGRODIR=path_to_your_allegro5_folder 22 | cl /Zi /MD /I %ALLEGRODIR%\include /DIMGUI_USER_CONFIG=\"examples/example_allegro5/imconfig_allegro5.h\" /I .. /I ..\.. main.cpp ..\imgui_impl_allegro5.cpp ..\..\imgui*.cpp /link /LIBPATH:%ALLEGRODIR%\lib allegro-5.0.10-monolith-md.lib user32.lib 23 | ``` 24 | -------------------------------------------------------------------------------- /imgui/examples/example_allegro5/example_allegro5.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | 50 | 51 | 52 | sources 53 | 54 | 55 | -------------------------------------------------------------------------------- /imgui/examples/example_allegro5/imconfig_allegro5.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI ALLEGRO 5 EXAMPLE 3 | // See imconfig.h for the full template 4 | // Because Allegro doesn't support 16-bit vertex indices, we enable the compile-time option of imgui to use 32-bit indices 5 | //----------------------------------------------------------------------------- 6 | 7 | #pragma once 8 | 9 | // Use 32-bit vertex indices because Allegro doesn't support 16-bit ones 10 | // This allows us to avoid converting vertices format at runtime 11 | #define ImDrawIdx int 12 | -------------------------------------------------------------------------------- /imgui/examples/example_allegro5/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - standalone example application for Allegro 5 2 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | #include 5 | #include 6 | #include 7 | #include "imgui.h" 8 | #include "imgui_impl_allegro5.h" 9 | 10 | int main(int, char**) 11 | { 12 | // Setup Allegro 13 | al_init(); 14 | al_install_keyboard(); 15 | al_install_mouse(); 16 | al_init_primitives_addon(); 17 | al_set_new_display_flags(ALLEGRO_RESIZABLE); 18 | ALLEGRO_DISPLAY* display = al_create_display(1280, 720); 19 | al_set_window_title(display, "Dear ImGui Allegro 5 example"); 20 | ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); 21 | al_register_event_source(queue, al_get_display_event_source(display)); 22 | al_register_event_source(queue, al_get_keyboard_event_source()); 23 | al_register_event_source(queue, al_get_mouse_event_source()); 24 | 25 | // Setup Dear ImGui binding 26 | IMGUI_CHECKVERSION(); 27 | ImGui::CreateContext(); 28 | ImGuiIO& io = ImGui::GetIO(); (void)io; 29 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 30 | ImGui_ImplAllegro5_Init(display); 31 | 32 | // Setup style 33 | ImGui::StyleColorsDark(); 34 | //ImGui::StyleColorsClassic(); 35 | 36 | // Load Fonts 37 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 38 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 39 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 40 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 41 | // - Read 'misc/fonts/README.txt' for more instructions and details. 42 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 43 | //io.Fonts->AddFontDefault(); 44 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 45 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 46 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 47 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 48 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 49 | //IM_ASSERT(font != NULL); 50 | 51 | bool show_demo_window = true; 52 | bool show_another_window = false; 53 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 54 | 55 | // Main loop 56 | bool running = true; 57 | while (running) 58 | { 59 | // Poll and handle events (inputs, window resize, etc.) 60 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 61 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 62 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 63 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 64 | ALLEGRO_EVENT ev; 65 | while (al_get_next_event(queue, &ev)) 66 | { 67 | ImGui_ImplAllegro5_ProcessEvent(&ev); 68 | if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) 69 | running = false; 70 | if (ev.type == ALLEGRO_EVENT_DISPLAY_RESIZE) 71 | { 72 | ImGui_ImplAllegro5_InvalidateDeviceObjects(); 73 | al_acknowledge_resize(display); 74 | ImGui_ImplAllegro5_CreateDeviceObjects(); 75 | } 76 | } 77 | 78 | // Start the Dear ImGui frame 79 | ImGui_ImplAllegro5_NewFrame(); 80 | ImGui::NewFrame(); 81 | 82 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 83 | if (show_demo_window) 84 | ImGui::ShowDemoWindow(&show_demo_window); 85 | 86 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 87 | { 88 | static float f = 0.0f; 89 | static int counter = 0; 90 | 91 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 92 | 93 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 94 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 95 | ImGui::Checkbox("Another Window", &show_another_window); 96 | 97 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 98 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 99 | 100 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 101 | counter++; 102 | ImGui::SameLine(); 103 | ImGui::Text("counter = %d", counter); 104 | 105 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 106 | ImGui::End(); 107 | } 108 | 109 | // 3. Show another simple window. 110 | if (show_another_window) 111 | { 112 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 113 | ImGui::Text("Hello from another window!"); 114 | if (ImGui::Button("Close Me")) 115 | show_another_window = false; 116 | ImGui::End(); 117 | } 118 | 119 | // Rendering 120 | ImGui::Render(); 121 | al_clear_to_color(al_map_rgba_f(clear_color.x, clear_color.y, clear_color.z, clear_color.w)); 122 | ImGui_ImplAllegro5_RenderDrawData(ImGui::GetDrawData()); 123 | al_flip_display(); 124 | } 125 | 126 | // Cleanup 127 | ImGui_ImplAllegro5_Shutdown(); 128 | ImGui::DestroyContext(); 129 | al_destroy_event_queue(queue); 130 | al_destroy_display(display); 131 | 132 | return 0; 133 | } 134 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/README.md: -------------------------------------------------------------------------------- 1 | # iOS / OSX Metal example 2 | 3 | ## Introduction 4 | 5 | This example shows how to integrate Dear ImGui with Metal. It is based on the "cross-platform" game template provided with Xcode as of Xcode 9. 6 | 7 | (NB: you may still want to use GLFW or SDL which will also support Windows, Linux along with OSX.) 8 | 9 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/AppDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | #if TARGET_OS_IPHONE 5 | 6 | #import 7 | 8 | @interface AppDelegate : UIResponder 9 | @property (strong, nonatomic) UIWindow *window; 10 | @end 11 | 12 | #else 13 | 14 | #import 15 | 16 | @interface AppDelegate : NSObject 17 | @end 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/AppDelegate.m: -------------------------------------------------------------------------------- 1 | 2 | #import "AppDelegate.h" 3 | 4 | @implementation AppDelegate 5 | 6 | #if TARGET_OS_OSX 7 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { 8 | return YES; 9 | } 10 | #endif 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/Renderer.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface Renderer : NSObject 5 | 6 | -(nonnull instancetype)initWithView:(nonnull MTKView *)view; 7 | 8 | @end 9 | 10 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/Renderer.mm: -------------------------------------------------------------------------------- 1 | 2 | #import "Renderer.h" 3 | #import 4 | 5 | #include "imgui.h" 6 | #include "imgui_impl_metal.h" 7 | 8 | #if TARGET_OS_OSX 9 | #include "imgui_impl_osx.h" 10 | #endif 11 | 12 | @interface Renderer () 13 | @property (nonatomic, strong) id device; 14 | @property (nonatomic, strong) id commandQueue; 15 | @end 16 | 17 | @implementation Renderer 18 | 19 | -(nonnull instancetype)initWithView:(nonnull MTKView *)view; 20 | { 21 | self = [super init]; 22 | if(self) 23 | { 24 | _device = view.device; 25 | _commandQueue = [_device newCommandQueue]; 26 | 27 | IMGUI_CHECKVERSION(); 28 | ImGui::CreateContext(); 29 | (void)ImGui::GetIO(); 30 | 31 | ImGui_ImplMetal_Init(_device); 32 | 33 | ImGui::StyleColorsDark(); 34 | } 35 | 36 | return self; 37 | } 38 | 39 | - (void)drawInMTKView:(MTKView *)view 40 | { 41 | ImGuiIO &io = ImGui::GetIO(); 42 | io.DisplaySize.x = view.bounds.size.width; 43 | io.DisplaySize.y = view.bounds.size.height; 44 | 45 | #if TARGET_OS_OSX 46 | CGFloat framebufferScale = view.window.screen.backingScaleFactor ?: NSScreen.mainScreen.backingScaleFactor; 47 | #else 48 | CGFloat framebufferScale = view.window.screen.scale ?: UIScreen.mainScreen.scale; 49 | #endif 50 | io.DisplayFramebufferScale = ImVec2(framebufferScale, framebufferScale); 51 | 52 | io.DeltaTime = 1 / float(view.preferredFramesPerSecond ?: 60); 53 | 54 | id commandBuffer = [self.commandQueue commandBuffer]; 55 | 56 | static bool show_demo_window = true; 57 | static bool show_another_window = false; 58 | static float clear_color[4] = { 0.28f, 0.36f, 0.5f, 1.0f }; 59 | 60 | MTLRenderPassDescriptor *renderPassDescriptor = view.currentRenderPassDescriptor; 61 | if (renderPassDescriptor != nil) 62 | { 63 | renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColorMake(clear_color[0], clear_color[1], clear_color[2], clear_color[3]); 64 | 65 | // Here, you could do additional rendering work, including other passes as necessary. 66 | 67 | id renderEncoder = [commandBuffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; 68 | [renderEncoder pushDebugGroup:@"ImGui demo"]; 69 | 70 | // Start the Dear ImGui frame 71 | ImGui_ImplMetal_NewFrame(renderPassDescriptor); 72 | #if TARGET_OS_OSX 73 | ImGui_ImplOSX_NewFrame(view); 74 | #endif 75 | ImGui::NewFrame(); 76 | 77 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 78 | if (show_demo_window) 79 | ImGui::ShowDemoWindow(&show_demo_window); 80 | 81 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 82 | { 83 | static float f = 0.0f; 84 | static int counter = 0; 85 | 86 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 87 | 88 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 89 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 90 | ImGui::Checkbox("Another Window", &show_another_window); 91 | 92 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 93 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 94 | 95 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 96 | counter++; 97 | ImGui::SameLine(); 98 | ImGui::Text("counter = %d", counter); 99 | 100 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 101 | ImGui::End(); 102 | } 103 | 104 | // 3. Show another simple window. 105 | if (show_another_window) 106 | { 107 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 108 | ImGui::Text("Hello from another window!"); 109 | if (ImGui::Button("Close Me")) 110 | show_another_window = false; 111 | ImGui::End(); 112 | } 113 | 114 | // Rendering 115 | ImGui::Render(); 116 | ImDrawData *drawData = ImGui::GetDrawData(); 117 | ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder); 118 | 119 | [renderEncoder popDebugGroup]; 120 | [renderEncoder endEncoding]; 121 | 122 | [commandBuffer presentDrawable:view.currentDrawable]; 123 | } 124 | 125 | [commandBuffer commit]; 126 | } 127 | 128 | - (void)mtkView:(MTKView *)view drawableSizeWillChange:(CGSize)size 129 | { 130 | } 131 | 132 | @end 133 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/ViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import "Renderer.h" 5 | 6 | #if TARGET_OS_IPHONE 7 | 8 | #import 9 | 10 | @interface ViewController : UIViewController 11 | @end 12 | 13 | #else 14 | 15 | #import 16 | 17 | @interface ViewController : NSViewController 18 | @end 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/ViewController.mm: -------------------------------------------------------------------------------- 1 | 2 | #import "ViewController.h" 3 | #import "Renderer.h" 4 | #include "imgui.h" 5 | 6 | #if TARGET_OS_OSX 7 | #include "imgui_impl_osx.h" 8 | #endif 9 | 10 | @interface ViewController () 11 | @property (nonatomic, readonly) MTKView *mtkView; 12 | @property (nonatomic, strong) Renderer *renderer; 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (MTKView *)mtkView { 18 | return (MTKView *)self.view; 19 | } 20 | 21 | - (void)viewDidLoad 22 | { 23 | [super viewDidLoad]; 24 | 25 | self.mtkView.device = MTLCreateSystemDefaultDevice(); 26 | 27 | if (!self.mtkView.device) { 28 | NSLog(@"Metal is not supported"); 29 | abort(); 30 | } 31 | 32 | self.renderer = [[Renderer alloc] initWithView:self.mtkView]; 33 | 34 | [self.renderer mtkView:self.mtkView drawableSizeWillChange:self.mtkView.bounds.size]; 35 | 36 | self.mtkView.delegate = self.renderer; 37 | 38 | #if TARGET_OS_OSX 39 | // Add a tracking area in order to receive mouse events whenever the mouse is within the bounds of our view 40 | NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect 41 | options:NSTrackingMouseMoved | NSTrackingInVisibleRect | NSTrackingActiveAlways 42 | owner:self 43 | userInfo:nil]; 44 | [self.view addTrackingArea:trackingArea]; 45 | 46 | // If we want to receive key events, we either need to be in the responder chain of the key view, 47 | // or else we can install a local monitor. The consequence of this heavy-handed approach is that 48 | // we receive events for all controls, not just ImGui widgets. If we had native controls in our 49 | // window, we'd want to be much more careful than just ingesting the complete event stream, though 50 | // we do make an effort to be good citizens by passing along events when ImGui doesn't want to capture. 51 | NSEventMask eventMask = NSEventMaskKeyDown | NSEventMaskKeyUp | NSEventMaskFlagsChanged | NSEventTypeScrollWheel; 52 | [NSEvent addLocalMonitorForEventsMatchingMask:eventMask handler:^NSEvent * _Nullable(NSEvent *event) { 53 | BOOL wantsCapture = ImGui_ImplOSX_HandleEvent(event, self.view); 54 | if (event.type == NSEventTypeKeyDown && wantsCapture) { 55 | return nil; 56 | } else { 57 | return event; 58 | } 59 | 60 | }]; 61 | 62 | ImGui_ImplOSX_Init(); 63 | #endif 64 | } 65 | 66 | #if TARGET_OS_OSX 67 | 68 | - (void)mouseMoved:(NSEvent *)event { 69 | ImGui_ImplOSX_HandleEvent(event, self.view); 70 | } 71 | 72 | - (void)mouseDown:(NSEvent *)event { 73 | ImGui_ImplOSX_HandleEvent(event, self.view); 74 | } 75 | 76 | - (void)mouseUp:(NSEvent *)event { 77 | ImGui_ImplOSX_HandleEvent(event, self.view); 78 | } 79 | 80 | - (void)mouseDragged:(NSEvent *)event { 81 | ImGui_ImplOSX_HandleEvent(event, self.view); 82 | } 83 | 84 | - (void)scrollWheel:(NSEvent *)event { 85 | ImGui_ImplOSX_HandleEvent(event, self.view); 86 | } 87 | 88 | #elif TARGET_OS_IOS 89 | 90 | // This touch mapping is super cheesy/hacky. We treat any touch on the screen 91 | // as if it were a depressed left mouse button, and we don't bother handling 92 | // multitouch correctly at all. This causes the "cursor" to behave very erratically 93 | // when there are multiple active touches. But for demo purposes, single-touch 94 | // interaction actually works surprisingly well. 95 | - (void)updateIOWithTouchEvent:(UIEvent *)event { 96 | UITouch *anyTouch = event.allTouches.anyObject; 97 | CGPoint touchLocation = [anyTouch locationInView:self.view]; 98 | ImGuiIO &io = ImGui::GetIO(); 99 | io.MousePos = ImVec2(touchLocation.x, touchLocation.y); 100 | 101 | BOOL hasActiveTouch = NO; 102 | for (UITouch *touch in event.allTouches) { 103 | if (touch.phase != UITouchPhaseEnded && touch.phase != UITouchPhaseCancelled) { 104 | hasActiveTouch = YES; 105 | break; 106 | } 107 | } 108 | io.MouseDown[0] = hasActiveTouch; 109 | } 110 | 111 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 112 | [self updateIOWithTouchEvent:event]; 113 | } 114 | 115 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 116 | [self updateIOWithTouchEvent:event]; 117 | } 118 | 119 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { 120 | [self updateIOWithTouchEvent:event]; 121 | } 122 | 123 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { 124 | [self updateIOWithTouchEvent:event]; 125 | } 126 | 127 | #endif 128 | 129 | @end 130 | 131 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/Shared/main.m: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | #if TARGET_OS_IPHONE 5 | 6 | #import 7 | #import "AppDelegate.h" 8 | 9 | int main(int argc, char * argv[]) { 10 | @autoreleasepool { 11 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 12 | } 13 | } 14 | 15 | #else 16 | 17 | #import 18 | 19 | int main(int argc, const char * argv[]) { 20 | return NSApplicationMain(argc, argv); 21 | } 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/iOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/examples/example_apple_metal/iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/iOS/Info-iOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | imgui 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | Launch Screen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | metal 31 | 32 | UIRequiresFullScreen 33 | 34 | UIStatusBarHidden 35 | 36 | UISupportedInterfaceOrientations 37 | 38 | UIInterfaceOrientationPortrait 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | UIInterfaceOrientationPortraitUpsideDown 42 | 43 | UISupportedInterfaceOrientations~ipad 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationPortraitUpsideDown 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/iOS/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /imgui/examples/example_apple_metal/macOS/Info-macOS.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | imgui 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2018 Warren Moore. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /imgui/examples/example_freeglut_opengl2/example_freeglut_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui/examples/example_freeglut_opengl2/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - standalone example application for FreeGLUT + OpenGL2, using legacy fixed pipeline 2 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | // (Using GLUT or FreeGLUT is not recommended unless you really miss the 90's) 4 | 5 | #include "imgui.h" 6 | #include "../imgui_impl_freeglut.h" 7 | #include "../imgui_impl_opengl2.h" 8 | #include 9 | 10 | #ifdef _MSC_VER 11 | #pragma warning (disable: 4505) // unreferenced local function has been removed 12 | #endif 13 | 14 | static bool show_demo_window = true; 15 | static bool show_another_window = false; 16 | static ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 17 | 18 | void my_display_code() 19 | { 20 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 21 | if (show_demo_window) 22 | ImGui::ShowDemoWindow(&show_demo_window); 23 | 24 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 25 | { 26 | static float f = 0.0f; 27 | static int counter = 0; 28 | 29 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 30 | 31 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 32 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 33 | ImGui::Checkbox("Another Window", &show_another_window); 34 | 35 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 36 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 37 | 38 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 39 | counter++; 40 | ImGui::SameLine(); 41 | ImGui::Text("counter = %d", counter); 42 | 43 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 44 | ImGui::End(); 45 | } 46 | 47 | // 3. Show another simple window. 48 | if (show_another_window) 49 | { 50 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 51 | ImGui::Text("Hello from another window!"); 52 | if (ImGui::Button("Close Me")) 53 | show_another_window = false; 54 | ImGui::End(); 55 | } 56 | } 57 | 58 | void glut_display_func() 59 | { 60 | // Start the ImGui frame 61 | ImGui_ImplOpenGL2_NewFrame(); 62 | ImGui_ImplFreeGLUT_NewFrame(); 63 | 64 | my_display_code(); 65 | 66 | // Rendering 67 | ImGui::Render(); 68 | ImGuiIO& io = ImGui::GetIO(); 69 | glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y); 70 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 71 | glClear(GL_COLOR_BUFFER_BIT); 72 | //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound, but prefer using the GL3+ code. 73 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 74 | 75 | glutSwapBuffers(); 76 | glutPostRedisplay(); 77 | } 78 | 79 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 80 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 81 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 82 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 83 | 84 | int main(int argc, char** argv) 85 | { 86 | // Create GLUT window 87 | glutInit(&argc, argv); 88 | glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); 89 | glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE); 90 | glutInitWindowSize(1280, 720); 91 | glutCreateWindow("Dear ImGui FreeGLUT+OpenGL2 Example"); 92 | 93 | // Setup GLUT display function 94 | // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us, 95 | // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves. 96 | glutDisplayFunc(glut_display_func); 97 | 98 | // Setup ImGui binding 99 | ImGui::CreateContext(); 100 | ImGuiIO& io = ImGui::GetIO(); (void)io; 101 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 102 | 103 | ImGui_ImplFreeGLUT_Init(); 104 | ImGui_ImplFreeGLUT_InstallFuncs(); 105 | ImGui_ImplOpenGL2_Init(); 106 | 107 | // Setup style 108 | ImGui::StyleColorsDark(); 109 | //ImGui::StyleColorsClassic(); 110 | 111 | // Load Fonts 112 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 113 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 114 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 115 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 116 | // - Read 'misc/fonts/README.txt' for more instructions and details. 117 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 118 | //io.Fonts->AddFontDefault(); 119 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 120 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 121 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 122 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 123 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 124 | //IM_ASSERT(font != NULL); 125 | 126 | glutMainLoop(); 127 | 128 | // Cleanup 129 | ImGui_ImplOpenGL2_Shutdown(); 130 | ImGui_ImplFreeGLUT_Shutdown(); 131 | ImGui::DestroyContext(); 132 | 133 | return 0; 134 | } 135 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need GLFW (http://www.glfw.org): 6 | # Linux: 7 | # apt-get install libglfw-dev 8 | # Mac OS X: 9 | # brew install glfw 10 | # MSYS2: 11 | # pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_glfw_opengl2 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl2.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | 23 | UNAME_S := $(shell uname -s) 24 | 25 | 26 | ifeq ($(UNAME_S), Linux) #LINUX 27 | ECHO_MESSAGE = "Linux" 28 | LIBS = -lGL `pkg-config --static --libs glfw3` 29 | 30 | CXXFLAGS = -I../ -I../../ `pkg-config --cflags glfw3` 31 | CXXFLAGS += -Wall -Wformat 32 | CFLAGS = $(CXXFLAGS) 33 | endif 34 | 35 | ifeq ($(UNAME_S), Darwin) #APPLE 36 | ECHO_MESSAGE = "Mac OS X" 37 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 38 | #LIBS += -L/usr/local/lib -lglfw3 39 | LIBS += -L/usr/local/lib -lglfw 40 | 41 | CXXFLAGS = -I../ -I../../ -I/usr/local/include 42 | CXXFLAGS += -Wall -Wformat 43 | CFLAGS = $(CXXFLAGS) 44 | endif 45 | 46 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 47 | ECHO_MESSAGE = "Windows" 48 | LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32 49 | 50 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3` 51 | CXXFLAGS += -Wall -Wformat 52 | CFLAGS = $(CXXFLAGS) 53 | endif 54 | 55 | 56 | %.o:%.cpp 57 | $(CXX) $(CXXFLAGS) -c -o $@ $< 58 | 59 | %.o:../%.cpp 60 | $(CXX) $(CXXFLAGS) -c -o $@ $< 61 | 62 | %.o:../../%.cpp 63 | $(CXX) $(CXXFLAGS) -c -o $@ $< 64 | 65 | all: $(EXE) 66 | @echo Build complete for $(ECHO_MESSAGE) 67 | 68 | $(EXE): $(OBJS) 69 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 70 | 71 | clean: 72 | rm -f $(EXE) $(OBJS) 73 | 74 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_opengl2.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c336cfe3-f0c4-464c-9ef0-a9e17a7ff222} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl2/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - standalone example application for GLFW + OpenGL2, using legacy fixed pipeline 2 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | // (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 6 | // **Prefer using the code in the example_glfw_opengl2/ folder** 7 | // See imgui_impl_glfw.cpp for details. 8 | 9 | #include "imgui.h" 10 | #include "imgui_impl_glfw.h" 11 | #include "imgui_impl_opengl2.h" 12 | #include 13 | #include 14 | 15 | static void glfw_error_callback(int error, const char* description) 16 | { 17 | fprintf(stderr, "Glfw Error %d: %s\n", error, description); 18 | } 19 | 20 | int main(int, char**) 21 | { 22 | // Setup window 23 | glfwSetErrorCallback(glfw_error_callback); 24 | if (!glfwInit()) 25 | return 1; 26 | GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL2 example", NULL, NULL); 27 | if (window == NULL) 28 | return 1; 29 | glfwMakeContextCurrent(window); 30 | glfwSwapInterval(1); // Enable vsync 31 | 32 | // Setup Dear ImGui binding 33 | IMGUI_CHECKVERSION(); 34 | ImGui::CreateContext(); 35 | ImGuiIO& io = ImGui::GetIO(); (void)io; 36 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 37 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls 38 | 39 | ImGui_ImplGlfw_InitForOpenGL(window, true); 40 | ImGui_ImplOpenGL2_Init(); 41 | 42 | // Setup style 43 | ImGui::StyleColorsDark(); 44 | //ImGui::StyleColorsClassic(); 45 | 46 | // Load Fonts 47 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 48 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 49 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 50 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 51 | // - Read 'misc/fonts/README.txt' for more instructions and details. 52 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 53 | //io.Fonts->AddFontDefault(); 54 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 55 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 56 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 57 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 58 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 59 | //IM_ASSERT(font != NULL); 60 | 61 | bool show_demo_window = true; 62 | bool show_another_window = false; 63 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 64 | 65 | // Main loop 66 | while (!glfwWindowShouldClose(window)) 67 | { 68 | // Poll and handle events (inputs, window resize, etc.) 69 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 70 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 71 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 72 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 73 | glfwPollEvents(); 74 | 75 | // Start the Dear ImGui frame 76 | ImGui_ImplOpenGL2_NewFrame(); 77 | ImGui_ImplGlfw_NewFrame(); 78 | ImGui::NewFrame(); 79 | 80 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 81 | if (show_demo_window) 82 | ImGui::ShowDemoWindow(&show_demo_window); 83 | 84 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 85 | { 86 | static float f = 0.0f; 87 | static int counter = 0; 88 | 89 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 90 | 91 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 92 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 93 | ImGui::Checkbox("Another Window", &show_another_window); 94 | 95 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 96 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 97 | 98 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 99 | counter++; 100 | ImGui::SameLine(); 101 | ImGui::Text("counter = %d", counter); 102 | 103 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 104 | ImGui::End(); 105 | } 106 | 107 | // 3. Show another simple window. 108 | if (show_another_window) 109 | { 110 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 111 | ImGui::Text("Hello from another window!"); 112 | if (ImGui::Button("Close Me")) 113 | show_another_window = false; 114 | ImGui::End(); 115 | } 116 | 117 | // Rendering 118 | ImGui::Render(); 119 | int display_w, display_h; 120 | glfwGetFramebufferSize(window, &display_w, &display_h); 121 | glViewport(0, 0, display_w, display_h); 122 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 123 | glClear(GL_COLOR_BUFFER_BIT); 124 | //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound, but prefer using the GL3+ code. 125 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 126 | 127 | glfwMakeContextCurrent(window); 128 | glfwSwapBuffers(window); 129 | } 130 | 131 | // Cleanup 132 | ImGui_ImplOpenGL2_Shutdown(); 133 | ImGui_ImplGlfw_Shutdown(); 134 | ImGui::DestroyContext(); 135 | 136 | glfwDestroyWindow(window); 137 | glfwTerminate(); 138 | 139 | return 0; 140 | } 141 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need GLFW (http://www.glfw.org): 6 | # Linux: 7 | # apt-get install libglfw-dev 8 | # Mac OS X: 9 | # brew install glfw 10 | # MSYS2: 11 | # pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_glfw_opengl3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | ##--------------------------------------------------------------------- 25 | ## OPENGL LOADER 26 | ##--------------------------------------------------------------------- 27 | 28 | ## Using OpenGL loader: gl3w [default] 29 | SOURCES += ../libs/gl3w/GL/gl3w.c 30 | CXXFLAGS = -I../libs/gl3w 31 | 32 | ## Using OpenGL loader: glew 33 | ## (This assumes a system-wide installation) 34 | # CXXFLAGS = -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW 35 | 36 | ## Using OpenGL loader: glad 37 | ## (You'll also need to change the rule at line ~77 of this Makefile to compile/link glad.c/.o) 38 | # SOURCES += ../libs/glad/src/glad.c 39 | # CXXFLAGS = -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD 40 | 41 | ##--------------------------------------------------------------------- 42 | ## BUILD FLAGS PER PLATFORM 43 | ##--------------------------------------------------------------------- 44 | 45 | ifeq ($(UNAME_S), Linux) #LINUX 46 | ECHO_MESSAGE = "Linux" 47 | LIBS = -lGL `pkg-config --static --libs glfw3` 48 | 49 | CXXFLAGS += -I../ -I../../ `pkg-config --cflags glfw3` 50 | CXXFLAGS += -Wall -Wformat 51 | CFLAGS = $(CXXFLAGS) 52 | endif 53 | 54 | ifeq ($(UNAME_S), Darwin) #APPLE 55 | ECHO_MESSAGE = "Mac OS X" 56 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 57 | #LIBS += -L/usr/local/lib -lglfw3 58 | LIBS += -L/usr/local/lib -lglfw 59 | 60 | CXXFLAGS += -I../ -I../../ -I/usr/local/include 61 | CXXFLAGS += -Wall -Wformat 62 | CFLAGS = $(CXXFLAGS) 63 | endif 64 | 65 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 66 | ECHO_MESSAGE = "Windows" 67 | LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32 68 | 69 | CXXFLAGS += -I../ -I../../ `pkg-config --cflags glfw3` 70 | CXXFLAGS += -Wall -Wformat 71 | CFLAGS = $(CXXFLAGS) 72 | endif 73 | 74 | ##--------------------------------------------------------------------- 75 | ## BUILD RULES 76 | ##--------------------------------------------------------------------- 77 | 78 | %.o:%.cpp 79 | $(CXX) $(CXXFLAGS) -c -o $@ $< 80 | 81 | %.o:../%.cpp 82 | $(CXX) $(CXXFLAGS) -c -o $@ $< 83 | 84 | %.o:../../%.cpp 85 | $(CXX) $(CXXFLAGS) -c -o $@ $< 86 | 87 | %.o:../libs/gl3w/GL/%.c 88 | # %.o:../libs/glad/src/%.c 89 | $(CC) $(CFLAGS) -c -o $@ $< 90 | 91 | all: $(EXE) 92 | @echo Build complete for $(ECHO_MESSAGE) 93 | 94 | $(EXE): $(OBJS) 95 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 96 | 97 | clean: 98 | rm -f $(EXE) $(OBJS) 99 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I ..\libs\gl3w *.cpp ..\imgui_impl_glfw.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_glfw_opengl3.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {42f99867-3108-43b8-99d0-fabefaf1f2e3} 13 | 14 | 15 | 16 | 17 | sources 18 | 19 | 20 | imgui 21 | 22 | 23 | gl3w 24 | 25 | 26 | imgui 27 | 28 | 29 | imgui 30 | 31 | 32 | sources 33 | 34 | 35 | sources 36 | 37 | 38 | imgui 39 | 40 | 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | gl3w 50 | 51 | 52 | gl3w 53 | 54 | 55 | imgui 56 | 57 | 58 | sources 59 | 60 | 61 | sources 62 | 63 | 64 | 65 | 66 | 67 | sources 68 | 69 | 70 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_opengl3/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - standalone example application for GLFW + OpenGL 3, using programmable pipeline 2 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | // (GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | #include "imgui.h" 6 | #include "imgui_impl_glfw.h" 7 | #include "imgui_impl_opengl3.h" 8 | #include 9 | 10 | // About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual function pointers to be loaded manually. 11 | // Helper libraries are often used for this purpose! Here we are supporting a few common ones: gl3w, glew, glad. 12 | // You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own. 13 | #if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) 14 | #include // Initialize with gl3wInit() 15 | #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) 16 | #include // Initialize with glewInit() 17 | #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) 18 | #include // Initialize with gladLoadGL() 19 | #else 20 | #include IMGUI_IMPL_OPENGL_LOADER_CUSTOM 21 | #endif 22 | 23 | #include // Include glfw3.h after our OpenGL definitions 24 | 25 | static void glfw_error_callback(int error, const char* description) 26 | { 27 | fprintf(stderr, "Glfw Error %d: %s\n", error, description); 28 | } 29 | 30 | int main(int, char**) 31 | { 32 | // Setup window 33 | glfwSetErrorCallback(glfw_error_callback); 34 | if (!glfwInit()) 35 | return 1; 36 | 37 | // Decide GL+GLSL versions 38 | #if __APPLE__ 39 | // GL 3.2 + GLSL 150 40 | const char* glsl_version = "#version 150"; 41 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 42 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); 43 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only 44 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac 45 | #else 46 | // GL 3.0 + GLSL 130 47 | const char* glsl_version = "#version 130"; 48 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 49 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); 50 | //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only 51 | //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only 52 | #endif 53 | 54 | // Create window with graphics context 55 | GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui GLFW+OpenGL3 example", NULL, NULL); 56 | if (window == NULL) 57 | return 1; 58 | glfwMakeContextCurrent(window); 59 | glfwSwapInterval(1); // Enable vsync 60 | 61 | // Initialize OpenGL loader 62 | #if defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) 63 | bool err = gl3wInit() != 0; 64 | #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) 65 | bool err = glewInit() != GLEW_OK; 66 | #elif defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) 67 | bool err = gladLoadGL() != 0; 68 | #endif 69 | if (err) 70 | { 71 | fprintf(stderr, "Failed to initialize OpenGL loader!\n"); 72 | return 1; 73 | } 74 | 75 | // Setup Dear ImGui binding 76 | IMGUI_CHECKVERSION(); 77 | ImGui::CreateContext(); 78 | ImGuiIO& io = ImGui::GetIO(); (void)io; 79 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 80 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls 81 | 82 | ImGui_ImplGlfw_InitForOpenGL(window, true); 83 | ImGui_ImplOpenGL3_Init(glsl_version); 84 | 85 | // Setup style 86 | ImGui::StyleColorsDark(); 87 | //ImGui::StyleColorsClassic(); 88 | 89 | // Load Fonts 90 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 91 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 92 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 93 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 94 | // - Read 'misc/fonts/README.txt' for more instructions and details. 95 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 96 | //io.Fonts->AddFontDefault(); 97 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 98 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 99 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 100 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 101 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 102 | //IM_ASSERT(font != NULL); 103 | 104 | bool show_demo_window = true; 105 | bool show_another_window = false; 106 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 107 | 108 | // Main loop 109 | while (!glfwWindowShouldClose(window)) 110 | { 111 | // Poll and handle events (inputs, window resize, etc.) 112 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 113 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 114 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 115 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 116 | glfwPollEvents(); 117 | 118 | // Start the Dear ImGui frame 119 | ImGui_ImplOpenGL3_NewFrame(); 120 | ImGui_ImplGlfw_NewFrame(); 121 | ImGui::NewFrame(); 122 | 123 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 124 | if (show_demo_window) 125 | ImGui::ShowDemoWindow(&show_demo_window); 126 | 127 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 128 | { 129 | static float f = 0.0f; 130 | static int counter = 0; 131 | 132 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 133 | 134 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 135 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 136 | ImGui::Checkbox("Another Window", &show_another_window); 137 | 138 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 139 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 140 | 141 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 142 | counter++; 143 | ImGui::SameLine(); 144 | ImGui::Text("counter = %d", counter); 145 | 146 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 147 | ImGui::End(); 148 | } 149 | 150 | // 3. Show another simple window. 151 | if (show_another_window) 152 | { 153 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 154 | ImGui::Text("Hello from another window!"); 155 | if (ImGui::Button("Close Me")) 156 | show_another_window = false; 157 | ImGui::End(); 158 | } 159 | 160 | // Rendering 161 | ImGui::Render(); 162 | int display_w, display_h; 163 | glfwMakeContextCurrent(window); 164 | glfwGetFramebufferSize(window, &display_w, &display_h); 165 | glViewport(0, 0, display_w, display_h); 166 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 167 | glClear(GL_COLOR_BUFFER_BIT); 168 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); 169 | 170 | glfwMakeContextCurrent(window); 171 | glfwSwapBuffers(window); 172 | } 173 | 174 | // Cleanup 175 | ImGui_ImplOpenGL3_Shutdown(); 176 | ImGui_ImplGlfw_Shutdown(); 177 | ImGui::DestroyContext(); 178 | 179 | glfwDestroyWindow(window); 180 | glfwTerminate(); 181 | 182 | return 0; 183 | } 184 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(imgui_example_glfw_vulkan C CXX) 3 | 4 | if(NOT CMAKE_BUILD_TYPE) 5 | set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE) 6 | endif() 7 | 8 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") 9 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") 10 | 11 | # GLFW 12 | set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo 13 | option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) 14 | option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) 15 | option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) 16 | option(GLFW_INSTALL "Generate installation target" OFF) 17 | option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) 18 | add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL) 19 | include_directories(${GLFW_DIR}/include) 20 | 21 | # ImGui 22 | set(IMGUI_DIR ../../) 23 | include_directories(${IMGUI_DIR} ..) 24 | 25 | # Libraries 26 | find_library(VULKAN_LIBRARY 27 | NAMES vulkan vulkan-1) 28 | set(LIBRARIES "glfw;${VULKAN_LIBRARY}") 29 | 30 | # Use vulkan headers from glfw: 31 | include_directories(${GLFW_DIR}/deps) 32 | 33 | file(GLOB sources *.cpp) 34 | 35 | add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/examples/imgui_impl_glfw.cpp ${IMGUI_DIR}/examples/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp) 36 | target_link_libraries(example_glfw_vulkan ${LIBRARIES}) 37 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | 3 | mkdir Debug 4 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 5 | 6 | mkdir Release 7 | cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 /libpath:%VULKAN_SDK%\lib32 glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 8 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/build_win64.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of amd64/vcvars32.bat to setup 64-bit command-line compiler. 2 | 3 | mkdir Debug 4 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeDebug/example_glfw_vulkan.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 5 | 6 | mkdir Release 7 | cl /nologo /Zi /MD /Ox /Oi /I .. /I ..\.. /I ..\libs\glfw\include /I %VULKAN_SDK%\include *.cpp ..\imgui_impl_vulkan.cpp ..\imgui_impl_glfw.cpp ..\..\imgui*.cpp /FeRelease/example_glfw_vulkan.exe /FoRelease/ /link /LIBPATH:..\libs\glfw\lib-vc2010-64 /libpath:%VULKAN_SDK%\lib glfw3.lib opengl32.lib gdi32.lib shell32.lib vulkan-1.lib 8 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | 33 | 34 | imgui 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | sources 44 | 45 | 46 | sources 47 | 48 | 49 | 50 | 51 | 52 | sources 53 | 54 | 55 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/gen_spv.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | glslangValidator -V -x -o glsl_shader.frag.u32 glsl_shader.frag 3 | glslangValidator -V -x -o glsl_shader.vert.u32 glsl_shader.vert 4 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/glsl_shader.frag: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) out vec4 fColor; 3 | 4 | layout(set=0, binding=0) uniform sampler2D sTexture; 5 | 6 | layout(location = 0) in struct{ 7 | vec4 Color; 8 | vec2 UV; 9 | } In; 10 | 11 | void main() 12 | { 13 | fColor = In.Color * texture(sTexture, In.UV.st); 14 | } 15 | -------------------------------------------------------------------------------- /imgui/examples/example_glfw_vulkan/glsl_shader.vert: -------------------------------------------------------------------------------- 1 | #version 450 core 2 | layout(location = 0) in vec2 aPos; 3 | layout(location = 1) in vec2 aUV; 4 | layout(location = 2) in vec4 aColor; 5 | 6 | layout(push_constant) uniform uPushConstant{ 7 | vec2 uScale; 8 | vec2 uTranslate; 9 | } pc; 10 | 11 | out gl_PerVertex{ 12 | vec4 gl_Position; 13 | }; 14 | 15 | layout(location = 0) out struct{ 16 | vec4 Color; 17 | vec2 UV; 18 | } Out; 19 | 20 | void main() 21 | { 22 | Out.Color = aColor; 23 | Out.UV = aUV; 24 | gl_Position = vec4(aPos*pc.uScale+pc.uTranslate, 0, 1); 25 | } 26 | -------------------------------------------------------------------------------- /imgui/examples/example_marmalade/data/app.icf: -------------------------------------------------------------------------------- 1 | # This file is for configuration settings for your 2 | # application. 3 | # 4 | # The syntax is similar to windows .ini files ie 5 | # 6 | # [GroupName] 7 | # Setting = Value 8 | # 9 | # Which can be read by your application using 10 | # e.g s3eConfigGetString("GroupName", "Setting", string) 11 | # 12 | # All settings must be documented in .config.txt files. 13 | # New settings specific to this application should be 14 | # documented in app.config.txt 15 | # 16 | # Some conditional operations are also permitted, see the 17 | # S3E documentation for details. 18 | 19 | [S3E] 20 | MemSize=6000000 21 | MemSizeDebug=6000000 22 | DispFixRot=FixedLandscape 23 | 24 | # emulate iphone 5 resolution, change these settings to emulate other display resolution 25 | WinWidth=1136 26 | WinHeight=640 27 | 28 | [GX] 29 | DataCacheSize=131070 30 | 31 | [Util] 32 | #MemoryBreakpoint=1282 33 | -------------------------------------------------------------------------------- /imgui/examples/example_marmalade/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - standalone example application for Marmalade 2 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | 4 | // Copyright (C) 2015 by Giovanni Zito 5 | // This file is part of ImGui 6 | 7 | #include "imgui.h" 8 | #include "imgui_impl_marmalade.h" 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int, char**) 16 | { 17 | IwGxInit(); 18 | 19 | // Setup Dear ImGui binding 20 | IMGUI_CHECKVERSION(); 21 | ImGui::CreateContext(); 22 | ImGuiIO& io = ImGui::GetIO(); (void)io; 23 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 24 | ImGui_Marmalade_Init(true); 25 | 26 | // Setup style 27 | ImGui::StyleColorsDark(); 28 | //ImGui::StyleColorsClassic(); 29 | 30 | // Load Fonts 31 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 32 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 33 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 34 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 35 | // - Read 'misc/fonts/README.txt' for more instructions and details. 36 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 37 | //io.Fonts->AddFontDefault(); 38 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 39 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 40 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 41 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 42 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 43 | //IM_ASSERT(font != NULL); 44 | 45 | bool show_demo_window = true; 46 | bool show_another_window = false; 47 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 48 | 49 | // Main loop 50 | while (true) 51 | { 52 | if (s3eDeviceCheckQuitRequest()) 53 | break; 54 | 55 | // Poll and handle inputs 56 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 57 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 58 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 59 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 60 | s3eKeyboardUpdate(); 61 | s3ePointerUpdate(); 62 | 63 | // Start the Dear ImGui frame 64 | ImGui_Marmalade_NewFrame(); 65 | ImGui::NewFrame(); 66 | 67 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 68 | if (show_demo_window) 69 | ImGui::ShowDemoWindow(&show_demo_window); 70 | 71 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 72 | { 73 | static float f = 0.0f; 74 | static int counter = 0; 75 | 76 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 77 | 78 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 79 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 80 | ImGui::Checkbox("Another Window", &show_another_window); 81 | 82 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 83 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 84 | 85 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 86 | counter++; 87 | ImGui::SameLine(); 88 | ImGui::Text("counter = %d", counter); 89 | 90 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 91 | ImGui::End(); 92 | } 93 | 94 | // 3. Show another simple window. 95 | if (show_another_window) 96 | { 97 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 98 | ImGui::Text("Hello from another window!"); 99 | if (ImGui::Button("Close Me")) 100 | show_another_window = false; 101 | ImGui::End(); 102 | } 103 | 104 | // Rendering 105 | ImGui::Render(); 106 | IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255); 107 | IwGxClear(); 108 | ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData()); 109 | IwGxSwapBuffers(); 110 | 111 | s3eDeviceYield(0); 112 | } 113 | 114 | // Cleanup 115 | ImGui_Marmalade_Shutdown(); 116 | ImGui::DestroyContext(); 117 | IwGxTerminate(); 118 | 119 | return 0; 120 | } 121 | -------------------------------------------------------------------------------- /imgui/examples/example_marmalade/marmalade_example.mkb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env mkb 2 | 3 | # ImGui - standalone example application for Marmalade 4 | # Copyright (C) 2015 by Giovanni Zito 5 | # This file is part of ImGui 6 | # https://github.com/ocornut/imgui 7 | 8 | define IMGUI_DISABLE_INCLUDE_IMCONFIG_H 9 | define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS 10 | define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS 11 | define _snprintf=snprintf 12 | 13 | options 14 | { 15 | optimise-speed=1 16 | } 17 | 18 | includepaths 19 | { 20 | .. 21 | ../.. 22 | } 23 | 24 | subprojects 25 | { 26 | iwgx 27 | } 28 | 29 | files 30 | { 31 | (.) 32 | ["imgui"] 33 | ../../imgui.cpp 34 | ../../imgui_demo.cpp 35 | ../../imgui_draw.cpp 36 | ../../imgui_widgets.cpp 37 | ../../imconfig.h 38 | ../../imgui.h 39 | ../../imgui_internal.h 40 | 41 | ["imgui","Marmalade binding"] 42 | ../imgui_impl_marmalade.h 43 | ../imgui_impl_marmalade.cpp 44 | main.cpp 45 | 46 | } 47 | -------------------------------------------------------------------------------- /imgui/examples/example_null/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I ..\.. *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib 4 | -------------------------------------------------------------------------------- /imgui/examples/example_null/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - null/dummy example application (compile and link imgui with no inputs, no outputs) 2 | #include "imgui.h" 3 | #include 4 | 5 | int main(int, char**) 6 | { 7 | IMGUI_CHECKVERSION(); 8 | ImGui::CreateContext(); 9 | ImGuiIO& io = ImGui::GetIO(); 10 | 11 | // Build atlas 12 | unsigned char* tex_pixels = NULL; 13 | int tex_w, tex_h; 14 | io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_w, &tex_h); 15 | 16 | for (int n = 0; n < 50; n++) 17 | { 18 | printf("NewFrame() %d\n", n); 19 | io.DisplaySize = ImVec2(1920, 1080); 20 | io.DeltaTime = 1.0f / 60.0f; 21 | ImGui::NewFrame(); 22 | 23 | static float f = 0.0f; 24 | ImGui::Text("Hello, world!"); 25 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); 26 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); 27 | ImGui::ShowDemoWindow(NULL); 28 | 29 | ImGui::Render(); 30 | } 31 | 32 | printf("DestroyContext()\n"); 33 | ImGui::DestroyContext(); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need SDL2 (http://www.libsdl.org): 6 | # Linux: 7 | # apt-get install libsdl2-dev 8 | # Mac OS X: 9 | # brew install sdl2 10 | # MSYS2: 11 | # pacman -S mingw-w64-i686-SDL 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_sdl_opengl2 18 | SOURCES = main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp 19 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 20 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 21 | 22 | UNAME_S := $(shell uname -s) 23 | 24 | 25 | ifeq ($(UNAME_S), Linux) #LINUX 26 | ECHO_MESSAGE = "Linux" 27 | LIBS = -lGL -ldl `sdl2-config --libs` 28 | 29 | CXXFLAGS = -I ../ -I../../ `sdl2-config --cflags` 30 | CXXFLAGS += -Wall -Wformat 31 | CFLAGS = $(CXXFLAGS) 32 | endif 33 | 34 | ifeq ($(UNAME_S), Darwin) #APPLE 35 | ECHO_MESSAGE = "Mac OS X" 36 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 37 | 38 | CXXFLAGS = -I ../ -I../../ -I/usr/local/include `sdl2-config --cflags` 39 | CXXFLAGS += -Wall -Wformat 40 | CFLAGS = $(CXXFLAGS) 41 | endif 42 | 43 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 44 | ECHO_MESSAGE = "Windows" 45 | LIBS = -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 46 | 47 | CXXFLAGS = -I ../ -I../../ `pkg-config --cflags sdl2` 48 | CXXFLAGS += -Wall -Wformat 49 | CFLAGS = $(CXXFLAGS) 50 | endif 51 | 52 | 53 | %.o:%.cpp 54 | $(CXX) $(CXXFLAGS) -c -o $@ $< 55 | 56 | %.o:../%.cpp 57 | $(CXX) $(CXXFLAGS) -c -o $@ $< 58 | 59 | %.o:../../%.cpp 60 | $(CXX) $(CXXFLAGS) -c -o $@ $< 61 | 62 | all: $(EXE) 63 | @echo Build complete for $(ECHO_MESSAGE) 64 | 65 | $(EXE): $(OBJS) 66 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 67 | 68 | clean: 69 | rm -f $(EXE) $(OBJS) 70 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl2/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's CLI 5 | 6 | ``` 7 | set SDL2DIR=path_to_your_sdl2_folder 8 | cl /Zi /MD /I %SDL2DIR%\include /I .. /I ..\.. main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl2.cpp ..\..\imgui*.cpp /link /LIBPATH:%SDL2DIR%\lib SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 9 | ``` 10 | 11 | - On Linux and similar Unixes 12 | 13 | ``` 14 | c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL 15 | ``` 16 | 17 | - On Mac OS X 18 | 19 | ``` 20 | brew install sdl2 21 | c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl 22 | ``` 23 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl2/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl2.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl2.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 4 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl2/example_sdl_opengl2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl2/main.cpp: -------------------------------------------------------------------------------- 1 | // ImGui - standalone example application for SDL2 + OpenGL 2 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 3 | // (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 6 | // **Prefer using the code in the example_sdl_opengl3/ folder** 7 | // See imgui_impl_sdl.cpp for details. 8 | 9 | #include "imgui.h" 10 | #include "imgui_impl_sdl.h" 11 | #include "imgui_impl_opengl2.h" 12 | #include 13 | #include 14 | #include 15 | 16 | int main(int, char**) 17 | { 18 | // Setup SDL 19 | if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0) 20 | { 21 | printf("Error: %s\n", SDL_GetError()); 22 | return -1; 23 | } 24 | 25 | // Setup window 26 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 27 | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); 28 | SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); 29 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); 30 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); 31 | SDL_DisplayMode current; 32 | SDL_GetCurrentDisplayMode(0, ¤t); 33 | SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); 34 | SDL_GLContext gl_context = SDL_GL_CreateContext(window); 35 | SDL_GL_SetSwapInterval(1); // Enable vsync 36 | 37 | // Setup Dear ImGui binding 38 | IMGUI_CHECKVERSION(); 39 | ImGui::CreateContext(); 40 | ImGuiIO& io = ImGui::GetIO(); (void)io; 41 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 42 | 43 | ImGui_ImplSDL2_InitForOpenGL(window, gl_context); 44 | ImGui_ImplOpenGL2_Init(); 45 | 46 | // Setup style 47 | ImGui::StyleColorsDark(); 48 | //ImGui::StyleColorsClassic(); 49 | 50 | // Load Fonts 51 | // - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them. 52 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 53 | // - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit). 54 | // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call. 55 | // - Read 'misc/fonts/README.txt' for more instructions and details. 56 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 57 | //io.Fonts->AddFontDefault(); 58 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 59 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 60 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 61 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 62 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 63 | //IM_ASSERT(font != NULL); 64 | 65 | bool show_demo_window = true; 66 | bool show_another_window = false; 67 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 68 | 69 | // Main loop 70 | bool done = false; 71 | while (!done) 72 | { 73 | // Poll and handle events (inputs, window resize, etc.) 74 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 75 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 76 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 77 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 78 | SDL_Event event; 79 | while (SDL_PollEvent(&event)) 80 | { 81 | ImGui_ImplSDL2_ProcessEvent(&event); 82 | if (event.type == SDL_QUIT) 83 | done = true; 84 | } 85 | 86 | // Start the Dear ImGui frame 87 | ImGui_ImplOpenGL2_NewFrame(); 88 | ImGui_ImplSDL2_NewFrame(window); 89 | ImGui::NewFrame(); 90 | 91 | // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!). 92 | if (show_demo_window) 93 | ImGui::ShowDemoWindow(&show_demo_window); 94 | 95 | // 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window. 96 | { 97 | static float f = 0.0f; 98 | static int counter = 0; 99 | 100 | ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it. 101 | 102 | ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too) 103 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state 104 | ImGui::Checkbox("Another Window", &show_another_window); 105 | 106 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 107 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 108 | 109 | if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated) 110 | counter++; 111 | ImGui::SameLine(); 112 | ImGui::Text("counter = %d", counter); 113 | 114 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 115 | ImGui::End(); 116 | } 117 | 118 | // 3. Show another simple window. 119 | if (show_another_window) 120 | { 121 | ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked) 122 | ImGui::Text("Hello from another window!"); 123 | if (ImGui::Button("Close Me")) 124 | show_another_window = false; 125 | ImGui::End(); 126 | } 127 | 128 | // Rendering 129 | ImGui::Render(); 130 | glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); 131 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 132 | glClear(GL_COLOR_BUFFER_BIT); 133 | //glUseProgram(0); // You may want this if using this code in an OpenGL 3+ context where shaders may be bound 134 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 135 | SDL_GL_SwapWindow(window); 136 | } 137 | 138 | // Cleanup 139 | ImGui_ImplOpenGL2_Shutdown(); 140 | ImGui_ImplSDL2_Shutdown(); 141 | ImGui::DestroyContext(); 142 | 143 | SDL_GL_DeleteContext(gl_context); 144 | SDL_DestroyWindow(window); 145 | SDL_Quit(); 146 | 147 | return 0; 148 | } 149 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Cross Platform Makefile 3 | # Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X 4 | # 5 | # You will need SDL2 (http://www.libsdl.org): 6 | # Linux: 7 | # apt-get install libsdl2-dev 8 | # Mac OS X: 9 | # brew install sdl2 10 | # MSYS2: 11 | # pacman -S mingw-w64-i686-SDL 12 | # 13 | 14 | #CXX = g++ 15 | #CXX = clang++ 16 | 17 | EXE = example_sdl_opengl3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp ../../imgui_widgets.cpp 21 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 22 | UNAME_S := $(shell uname -s) 23 | 24 | ##--------------------------------------------------------------------- 25 | ## OPENGL LOADER 26 | ##--------------------------------------------------------------------- 27 | 28 | ## Using OpenGL loader: gl3w [default] 29 | SOURCES += ../libs/gl3w/GL/gl3w.c 30 | CXXFLAGS = -I../libs/gl3w 31 | 32 | ## Using OpenGL loader: glew 33 | ## (This assumes a system-wide installation) 34 | # CXXFLAGS = -lGLEW -DIMGUI_IMPL_OPENGL_LOADER_GLEW 35 | 36 | ## Using OpenGL loader: glad 37 | ## (You'll also need to change the rule at line ~77 of this Makefile to compile/link glad.c/.o) 38 | # SOURCES += ../libs/glad/src/glad.c 39 | # CXXFLAGS = -I../libs/glad/include -DIMGUI_IMPL_OPENGL_LOADER_GLAD 40 | 41 | ##--------------------------------------------------------------------- 42 | ## BUILD FLAGS PER PLATFORM 43 | ##--------------------------------------------------------------------- 44 | 45 | ifeq ($(UNAME_S), Linux) #LINUX 46 | ECHO_MESSAGE = "Linux" 47 | LIBS = -lGL -ldl `sdl2-config --libs` 48 | 49 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` 50 | CXXFLAGS += -Wall -Wformat 51 | CFLAGS = $(CXXFLAGS) 52 | endif 53 | 54 | ifeq ($(UNAME_S), Darwin) #APPLE 55 | ECHO_MESSAGE = "Mac OS X" 56 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 57 | 58 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w -I/usr/local/include `sdl2-config --cflags` 59 | CXXFLAGS += -Wall -Wformat 60 | CFLAGS = $(CXXFLAGS) 61 | endif 62 | 63 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 64 | ECHO_MESSAGE = "Windows" 65 | LIBS = -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 66 | 67 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags sdl2` 68 | CXXFLAGS += -Wall -Wformat 69 | CFLAGS = $(CXXFLAGS) 70 | endif 71 | 72 | ##--------------------------------------------------------------------- 73 | ## BUILD RULES 74 | ##--------------------------------------------------------------------- 75 | 76 | %.o:%.cpp 77 | $(CXX) $(CXXFLAGS) -c -o $@ $< 78 | 79 | %.o:../%.cpp 80 | $(CXX) $(CXXFLAGS) -c -o $@ $< 81 | 82 | %.o:../../%.cpp 83 | $(CXX) $(CXXFLAGS) -c -o $@ $< 84 | 85 | %.o:../libs/gl3w/GL/%.c 86 | $(CC) $(CFLAGS) -c -o $@ $< 87 | 88 | all: $(EXE) 89 | @echo Build complete for $(ECHO_MESSAGE) 90 | 91 | $(EXE): $(OBJS) 92 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 93 | 94 | clean: 95 | rm -f $(EXE) $(OBJS) 96 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl3/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Build 3 | 4 | - On Windows with Visual Studio's CLI 5 | 6 | ``` 7 | set SDL2DIR=path_to_your_sdl2_folder 8 | cl /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2DIR%\include main.cpp ..\imgui_impl_sdl.cpp ..\imgui_impl_opengl3.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /link /libpath:%SDL2DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 9 | ``` 10 | 11 | - On Linux and similar Unixes 12 | 13 | ``` 14 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -lGL -ldl 15 | ``` 16 | 17 | - On Mac OS X 18 | 19 | ``` 20 | brew install sdl2 21 | c++ `sdl2-config --cflags` -I .. -I ../.. -I ../libs/gl3w main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl3.cpp ../../imgui*.cpp ../libs/gl3w/GL/gl3w.c `sdl2-config --libs` -framework OpenGl -framework CoreFoundation 22 | ``` 23 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl3/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I ..\libs\gl3w /I %SDL2_DIR%\include *.cpp ..\imgui_impl_opengl3.cpp ..\imgui_impl_sdl.cpp ..\..\imgui*.cpp ..\libs\gl3w\GL\gl3w.c /FeDebug/example_sdl_opengl3.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib opengl32.lib /subsystem:console 4 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_opengl3/example_sdl_opengl3.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {f9997b32-5479-4756-9ffc-77793ad3764f} 13 | 14 | 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | gl3w 30 | 31 | 32 | sources 33 | 34 | 35 | sources 36 | 37 | 38 | imgui 39 | 40 | 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | imgui 50 | 51 | 52 | gl3w 53 | 54 | 55 | gl3w 56 | 57 | 58 | sources 59 | 60 | 61 | sources 62 | 63 | 64 | 65 | 66 | 67 | sources 68 | 69 | 70 | -------------------------------------------------------------------------------- /imgui/examples/example_sdl_vulkan/example_sdl_vulkan.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {20b90ce4-7fcb-4731-b9a0-075f875de82d} 6 | 7 | 8 | {f18ab499-84e1-499f-8eff-9754361e0e52} 9 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | 13 | 14 | imgui 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | sources 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx10/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_win32.cpp ..\imgui_impl_dx10.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx10.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d10.lib d3dcompiler.lib 4 | 5 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx10/example_win32_directx10.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx11/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /I "%DXSDK_DIR%Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx11.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx11.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d11.lib d3dcompiler.lib 4 | 5 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx11/example_win32_directx11.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0587d7a3-f2ce-4d56-b84f-a0005d3bfce6} 6 | 7 | 8 | {08e36723-ce4f-4cff-9662-c40801cf1acf} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | sources 55 | 56 | 57 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx12/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%WindowsSdkDir%Include\um" /I "%WindowsSdkDir%Include\shared" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx12.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx12.exe /FoDebug/ /link d3d12.lib d3dcompiler.lib dxgi.lib 4 | 5 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx12/example_win32_directx12.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {fb3d294f-51ec-478e-a627-25831c80fefd} 6 | 7 | 8 | {4f33ddea-9910-456d-b868-4267eb3c2b19} 9 | 10 | 11 | 12 | 13 | imgui 14 | 15 | 16 | imgui 17 | 18 | 19 | imgui 20 | 21 | 22 | sources 23 | 24 | 25 | sources 26 | 27 | 28 | 29 | 30 | imgui 31 | 32 | 33 | sources 34 | 35 | 36 | imgui 37 | 38 | 39 | imgui 40 | 41 | 42 | sources 43 | 44 | 45 | sources 46 | 47 | 48 | imgui 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx9/build_win32.bat: -------------------------------------------------------------------------------- 1 | @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. 2 | mkdir Debug 3 | cl /nologo /Zi /MD /I .. /I ..\.. /I "%DXSDK_DIR%/Include" /D UNICODE /D _UNICODE *.cpp ..\imgui_impl_dx9.cpp ..\imgui_impl_win32.cpp ..\..\imgui*.cpp /FeDebug/example_win32_directx9.exe /FoDebug/ /link /LIBPATH:"%DXSDK_DIR%/Lib/x86" d3d9.lib 4 | -------------------------------------------------------------------------------- /imgui/examples/example_win32_directx9/example_win32_directx9.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {a82cba23-9de0-45c2-b1e3-2eb1666702de} 10 | 11 | 12 | 13 | 14 | sources 15 | 16 | 17 | imgui 18 | 19 | 20 | imgui 21 | 22 | 23 | imgui 24 | 25 | 26 | sources 27 | 28 | 29 | sources 30 | 31 | 32 | imgui 33 | 34 | 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | sources 47 | 48 | 49 | sources 50 | 51 | 52 | 53 | 54 | 55 | sources 56 | 57 | 58 | -------------------------------------------------------------------------------- /imgui/examples/imgui_examples.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx9", "example_win32_directx9\example_win32_directx9.vcxproj", "{4165A294-21F2-44CA-9B38-E3F935ABADF5}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx10", "example_win32_directx10\example_win32_directx10.vcxproj", "{345A953E-A004-4648-B442-DC5F9F11068C}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx11", "example_win32_directx11\example_win32_directx11.vcxproj", "{9F316E83-5AE5-4939-A723-305A94F48005}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl2", "example_glfw_opengl2\example_glfw_opengl2.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl3", "example_glfw_opengl3\example_glfw_opengl3.vcxproj", "{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Win32 = Debug|Win32 19 | Debug|x64 = Debug|x64 20 | Release|Win32 = Release|Win32 21 | Release|x64 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 24 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.Build.0 = Debug|Win32 26 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.ActiveCfg = Debug|x64 27 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.Build.0 = Debug|x64 28 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|Win32.ActiveCfg = Release|Win32 29 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|Win32.Build.0 = Release|Win32 30 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|x64.ActiveCfg = Release|x64 31 | {9CDA7840-B7A5-496D-A527-E95571496D18}.Release|x64.Build.0 = Release|x64 32 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|Win32.ActiveCfg = Debug|Win32 33 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|Win32.Build.0 = Debug|Win32 34 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|x64.ActiveCfg = Debug|x64 35 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Debug|x64.Build.0 = Debug|x64 36 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|Win32.ActiveCfg = Release|Win32 37 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|Win32.Build.0 = Release|Win32 38 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|x64.ActiveCfg = Release|x64 39 | {4165A294-21F2-44CA-9B38-E3F935ABADF5}.Release|x64.Build.0 = Release|x64 40 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|Win32.ActiveCfg = Debug|Win32 41 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|Win32.Build.0 = Debug|Win32 42 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|x64.ActiveCfg = Debug|x64 43 | {9F316E83-5AE5-4939-A723-305A94F48005}.Debug|x64.Build.0 = Debug|x64 44 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.ActiveCfg = Release|Win32 45 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.Build.0 = Release|Win32 46 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.ActiveCfg = Release|x64 47 | {9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.Build.0 = Release|x64 48 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|Win32.ActiveCfg = Debug|Win32 49 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|Win32.Build.0 = Debug|Win32 50 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|x64.ActiveCfg = Debug|x64 51 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Debug|x64.Build.0 = Debug|x64 52 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.ActiveCfg = Release|Win32 53 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.Build.0 = Release|Win32 54 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.ActiveCfg = Release|x64 55 | {4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.Build.0 = Release|x64 56 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|Win32.ActiveCfg = Debug|Win32 57 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|Win32.Build.0 = Debug|Win32 58 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|x64.ActiveCfg = Debug|x64 59 | {345A953E-A004-4648-B442-DC5F9F11068C}.Debug|x64.Build.0 = Debug|x64 60 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|Win32.ActiveCfg = Release|Win32 61 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|Win32.Build.0 = Release|Win32 62 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|x64.ActiveCfg = Release|x64 63 | {345A953E-A004-4648-B442-DC5F9F11068C}.Release|x64.Build.0 = Release|x64 64 | EndGlobalSection 65 | GlobalSection(SolutionProperties) = preSolution 66 | HideSolutionNode = FALSE 67 | EndGlobalSection 68 | EndGlobal 69 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_allegro5.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer + Platform Binding for: Allegro 5 2 | // (Info: Allegro 5 is a cross-platform general purpose library for handling windows, inputs, graphics, etc.) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ALLEGRO_BITMAP*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // Issues: 8 | // [ ] Renderer: The renderer is suboptimal as we need to convert vertices. 9 | // [ ] Platform: Missing clipboard support via al_set_clipboard_text/al_clipboard_has_text. 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 12 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 13 | // https://github.com/ocornut/imgui, Original Allegro 5 code by @birthggd 14 | 15 | #pragma once 16 | 17 | struct ALLEGRO_DISPLAY; 18 | union ALLEGRO_EVENT; 19 | 20 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display); 21 | IMGUI_IMPL_API void ImGui_ImplAllegro5_Shutdown(); 22 | IMGUI_IMPL_API void ImGui_ImplAllegro5_NewFrame(); 23 | IMGUI_IMPL_API void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data); 24 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_ProcessEvent(ALLEGRO_EVENT* event); 25 | 26 | // Use if you want to reset your rendering device without losing ImGui state. 27 | IMGUI_IMPL_API bool ImGui_ImplAllegro5_CreateDeviceObjects(); 28 | IMGUI_IMPL_API void ImGui_ImplAllegro5_InvalidateDeviceObjects(); 29 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_dx10.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: DirectX10 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D10ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | struct ID3D10Device; 12 | 13 | IMGUI_IMPL_API bool ImGui_ImplDX10_Init(ID3D10Device* device); 14 | IMGUI_IMPL_API void ImGui_ImplDX10_Shutdown(); 15 | IMGUI_IMPL_API void ImGui_ImplDX10_NewFrame(); 16 | IMGUI_IMPL_API void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data); 17 | 18 | // Use if you want to reset your rendering device without losing ImGui state. 19 | IMGUI_IMPL_API void ImGui_ImplDX10_InvalidateDeviceObjects(); 20 | IMGUI_IMPL_API bool ImGui_ImplDX10_CreateDeviceObjects(); 21 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_dx11.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: DirectX11 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'ID3D11ShaderResourceView*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | struct ID3D11Device; 12 | struct ID3D11DeviceContext; 13 | 14 | IMGUI_IMPL_API bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_context); 15 | IMGUI_IMPL_API void ImGui_ImplDX11_Shutdown(); 16 | IMGUI_IMPL_API void ImGui_ImplDX11_NewFrame(); 17 | IMGUI_IMPL_API void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data); 18 | 19 | // Use if you want to reset your rendering device without losing ImGui state. 20 | IMGUI_IMPL_API void ImGui_ImplDX11_InvalidateDeviceObjects(); 21 | IMGUI_IMPL_API bool ImGui_ImplDX11_CreateDeviceObjects(); 22 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_dx12.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: DirectX12 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'D3D12_GPU_DESCRIPTOR_HANDLE' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | // Issues: 7 | // [ ] 64-bit only for now! (Because sizeof(ImTextureId) == sizeof(void*)). See github.com/ocornut/imgui/pull/301 8 | 9 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 10 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 11 | // https://github.com/ocornut/imgui 12 | 13 | enum DXGI_FORMAT; 14 | struct ID3D12Device; 15 | struct ID3D12GraphicsCommandList; 16 | struct D3D12_CPU_DESCRIPTOR_HANDLE; 17 | struct D3D12_GPU_DESCRIPTOR_HANDLE; 18 | 19 | // cmd_list is the command list that the implementation will use to render imgui draw lists. 20 | // Before calling the render function, caller must prepare cmd_list by resetting it and setting the appropriate 21 | // render target and descriptor heap that contains font_srv_cpu_desc_handle/font_srv_gpu_desc_handle. 22 | // font_srv_cpu_desc_handle and font_srv_gpu_desc_handle are handles to a single SRV descriptor to use for the internal font texture. 23 | IMGUI_IMPL_API bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, 24 | D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle, D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle); 25 | IMGUI_IMPL_API void ImGui_ImplDX12_Shutdown(); 26 | IMGUI_IMPL_API void ImGui_ImplDX12_NewFrame(); 27 | IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandList* graphics_command_list); 28 | 29 | // Use if you want to reset your rendering device without losing ImGui state. 30 | IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects(); 31 | IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects(); 32 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_dx9.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: DirectX9 2 | // This needs to be used along with a Platform Binding (e.g. Win32) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | struct IDirect3DDevice9; 12 | 13 | IMGUI_IMPL_API bool ImGui_ImplDX9_Init(IDirect3DDevice9* device); 14 | IMGUI_IMPL_API void ImGui_ImplDX9_Shutdown(); 15 | IMGUI_IMPL_API void ImGui_ImplDX9_NewFrame(); 16 | IMGUI_IMPL_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data); 17 | 18 | // Use if you want to reset your rendering device without losing ImGui state. 19 | IMGUI_IMPL_API void ImGui_ImplDX9_InvalidateDeviceObjects(); 20 | IMGUI_IMPL_API bool ImGui_ImplDX9_CreateDeviceObjects(); 21 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_freeglut.cpp: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: FreeGLUT 2 | // This needs to be used along with a Renderer (e.g. OpenGL2) 3 | 4 | // Issues: 5 | // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | // CHANGELOG 12 | // (minor and older changes stripped away, please see git history for details) 13 | // 2018-03-22: Added FreeGLUT Platform binding. 14 | 15 | #include "imgui.h" 16 | #include "imgui_impl_freeglut.h" 17 | #include 18 | 19 | #ifdef _MSC_VER 20 | #pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff) 21 | #endif 22 | 23 | static int g_Time = 0; // Current time, in milliseconds 24 | 25 | bool ImGui_ImplFreeGLUT_Init() 26 | { 27 | ImGuiIO& io = ImGui::GetIO(); 28 | g_Time = 0; 29 | 30 | // Glut has 1 function for characters and one for "special keys". We map the characters in the 0..255 range and the keys above. 31 | io.KeyMap[ImGuiKey_Tab] = '\t'; // == 9 == CTRL+I 32 | io.KeyMap[ImGuiKey_LeftArrow] = 256 + GLUT_KEY_LEFT; 33 | io.KeyMap[ImGuiKey_RightArrow] = 256 + GLUT_KEY_RIGHT; 34 | io.KeyMap[ImGuiKey_UpArrow] = 256 + GLUT_KEY_UP; 35 | io.KeyMap[ImGuiKey_DownArrow] = 256 + GLUT_KEY_DOWN; 36 | io.KeyMap[ImGuiKey_PageUp] = 256 + GLUT_KEY_PAGE_UP; 37 | io.KeyMap[ImGuiKey_PageDown] = 256 + GLUT_KEY_PAGE_DOWN; 38 | io.KeyMap[ImGuiKey_Home] = 256 + GLUT_KEY_HOME; 39 | io.KeyMap[ImGuiKey_End] = 256 + GLUT_KEY_END; 40 | io.KeyMap[ImGuiKey_Insert] = 256 + GLUT_KEY_INSERT; 41 | io.KeyMap[ImGuiKey_Delete] = 127; 42 | io.KeyMap[ImGuiKey_Backspace] = 8; // == CTRL+H 43 | io.KeyMap[ImGuiKey_Space] = ' '; 44 | io.KeyMap[ImGuiKey_Enter] = 13; // == CTRL+M 45 | io.KeyMap[ImGuiKey_Escape] = 27; 46 | io.KeyMap[ImGuiKey_A] = 'A'; 47 | io.KeyMap[ImGuiKey_C] = 'C'; 48 | io.KeyMap[ImGuiKey_V] = 'V'; 49 | io.KeyMap[ImGuiKey_X] = 'X'; 50 | io.KeyMap[ImGuiKey_Y] = 'Y'; 51 | io.KeyMap[ImGuiKey_Z] = 'Z'; 52 | 53 | return true; 54 | } 55 | 56 | void ImGui_ImplFreeGLUT_InstallFuncs() 57 | { 58 | glutReshapeFunc(ImGui_ImplFreeGLUT_ReshapeFunc); 59 | glutMotionFunc(ImGui_ImplFreeGLUT_MotionFunc); 60 | glutPassiveMotionFunc(ImGui_ImplFreeGLUT_MotionFunc); 61 | glutMouseFunc(ImGui_ImplFreeGLUT_MouseFunc); 62 | glutMouseWheelFunc(ImGui_ImplFreeGLUT_MouseWheelFunc); 63 | glutKeyboardFunc(ImGui_ImplFreeGLUT_KeyboardFunc); 64 | glutKeyboardUpFunc(ImGui_ImplFreeGLUT_KeyboardUpFunc); 65 | glutSpecialFunc(ImGui_ImplFreeGLUT_SpecialFunc); 66 | glutSpecialUpFunc(ImGui_ImplFreeGLUT_SpecialUpFunc); 67 | } 68 | 69 | void ImGui_ImplFreeGLUT_Shutdown() 70 | { 71 | } 72 | 73 | void ImGui_ImplFreeGLUT_NewFrame() 74 | { 75 | // Setup time step 76 | ImGuiIO& io = ImGui::GetIO(); 77 | int current_time = glutGet(GLUT_ELAPSED_TIME); 78 | io.DeltaTime = (current_time - g_Time) / 1000.0f; 79 | g_Time = current_time; 80 | 81 | // Start the frame 82 | ImGui::NewFrame(); 83 | } 84 | 85 | static void ImGui_ImplFreeGLUT_UpdateKeyboardMods() 86 | { 87 | ImGuiIO& io = ImGui::GetIO(); 88 | int mods = glutGetModifiers(); 89 | io.KeyCtrl = (mods & GLUT_ACTIVE_CTRL) != 0; 90 | io.KeyShift = (mods & GLUT_ACTIVE_SHIFT) != 0; 91 | io.KeyAlt = (mods & GLUT_ACTIVE_ALT) != 0; 92 | } 93 | 94 | void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y) 95 | { 96 | // Send character to imgui 97 | //printf("char_down_func %d '%c'\n", c, c); 98 | ImGuiIO& io = ImGui::GetIO(); 99 | if (c >= 32) 100 | io.AddInputCharacter(c); 101 | 102 | // Store letters in KeysDown[] array as both uppercase and lowercase + Handle GLUT translating CTRL+A..CTRL+Z as 1..26. 103 | // This is a hacky mess but GLUT is unable to distinguish e.g. a TAB key from CTRL+I so this is probably the best we can do here. 104 | if (c >= 1 && c <= 26) 105 | io.KeysDown[c] = io.KeysDown[c - 1 + 'a'] = io.KeysDown[c - 1 + 'A'] = true; 106 | else if (c >= 'a' && c <= 'z') 107 | io.KeysDown[c] = io.KeysDown[c - 'a' + 'A'] = true; 108 | else if (c >= 'A' && c <= 'Z') 109 | io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = true; 110 | else 111 | io.KeysDown[c] = true; 112 | ImGui_ImplFreeGLUT_UpdateKeyboardMods(); 113 | (void)x; (void)y; // Unused 114 | } 115 | 116 | void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y) 117 | { 118 | //printf("char_up_func %d '%c'\n", c, c); 119 | ImGuiIO& io = ImGui::GetIO(); 120 | if (c >= 1 && c <= 26) 121 | io.KeysDown[c] = io.KeysDown[c - 1 + 'a'] = io.KeysDown[c - 1 + 'A'] = false; 122 | else if (c >= 'a' && c <= 'z') 123 | io.KeysDown[c] = io.KeysDown[c - 'a' + 'A'] = false; 124 | else if (c >= 'A' && c <= 'Z') 125 | io.KeysDown[c] = io.KeysDown[c - 'A' + 'a'] = false; 126 | else 127 | io.KeysDown[c] = false; 128 | ImGui_ImplFreeGLUT_UpdateKeyboardMods(); 129 | (void)x; (void)y; // Unused 130 | } 131 | 132 | void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y) 133 | { 134 | //printf("key_down_func %d\n", key); 135 | ImGuiIO& io = ImGui::GetIO(); 136 | if (key + 256 < IM_ARRAYSIZE(io.KeysDown)) 137 | io.KeysDown[key + 256] = true; 138 | ImGui_ImplFreeGLUT_UpdateKeyboardMods(); 139 | (void)x; (void)y; // Unused 140 | } 141 | 142 | void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y) 143 | { 144 | //printf("key_up_func %d\n", key); 145 | ImGuiIO& io = ImGui::GetIO(); 146 | if (key + 256 < IM_ARRAYSIZE(io.KeysDown)) 147 | io.KeysDown[key + 256] = false; 148 | ImGui_ImplFreeGLUT_UpdateKeyboardMods(); 149 | (void)x; (void)y; // Unused 150 | } 151 | 152 | void ImGui_ImplFreeGLUT_MouseFunc(int glut_button, int state, int x, int y) 153 | { 154 | ImGuiIO& io = ImGui::GetIO(); 155 | io.MousePos = ImVec2((float)x, (float)y); 156 | int button = -1; 157 | if (glut_button == GLUT_LEFT_BUTTON) button = 0; 158 | if (glut_button == GLUT_RIGHT_BUTTON) button = 1; 159 | if (glut_button == GLUT_MIDDLE_BUTTON) button = 2; 160 | if (button != -1 && state == GLUT_DOWN) 161 | io.MouseDown[button] = true; 162 | if (button != -1 && state == GLUT_UP) 163 | io.MouseDown[button] = false; 164 | } 165 | 166 | void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y) 167 | { 168 | ImGuiIO& io = ImGui::GetIO(); 169 | io.MousePos = ImVec2((float)x, (float)y); 170 | if (dir > 0) 171 | io.MouseWheel += 1.0; 172 | else if (dir < 0) 173 | io.MouseWheel -= 1.0; 174 | (void)button; // Unused 175 | } 176 | 177 | void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h) 178 | { 179 | ImGuiIO& io = ImGui::GetIO(); 180 | io.DisplaySize = ImVec2((float)w, (float)h); 181 | } 182 | 183 | void ImGui_ImplFreeGLUT_MotionFunc(int x, int y) 184 | { 185 | ImGuiIO& io = ImGui::GetIO(); 186 | io.MousePos = ImVec2((float)x, (float)y); 187 | } 188 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_freeglut.h: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: FreeGLUT 2 | // This needs to be used along with a Renderer (e.g. OpenGL2) 3 | 4 | // Issues: 5 | // [ ] Platform: GLUT is unable to distinguish e.g. Backspace from CTRL+H or TAB from CTRL+I 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | IMGUI_IMPL_API bool ImGui_ImplFreeGLUT_Init(); 12 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_InstallFuncs(); 13 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_Shutdown(); 14 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_NewFrame(); 15 | 16 | // You can call ImGui_ImplFreeGLUT_InstallFuncs() to get all those functions installed automatically, 17 | // or call them yourself from your own GLUT handlers. We are using the same weird names as GLUT for consistency.. 18 | //---------------------------------------- GLUT name --------------------------------------------- Decent Name --------- 19 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_ReshapeFunc(int w, int h); // ~ ResizeFunc 20 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_MotionFunc(int x, int y); // ~ MouseMoveFunc 21 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_MouseFunc(int button, int state, int x, int y); // ~ MouseButtonFunc 22 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_MouseWheelFunc(int button, int dir, int x, int y); // ~ MouseWheelFunc 23 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_KeyboardFunc(unsigned char c, int x, int y); // ~ CharPressedFunc 24 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_KeyboardUpFunc(unsigned char c, int x, int y); // ~ CharReleasedFunc 25 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_SpecialFunc(int key, int x, int y); // ~ KeyPressedFunc 26 | IMGUI_IMPL_API void ImGui_ImplFreeGLUT_SpecialUpFunc(int key, int x, int y); // ~ KeyReleasedFunc 27 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: GLFW 2 | // This needs to be used along with a Renderer (e.g. OpenGL3, Vulkan..) 3 | // (Info: GLFW is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Clipboard support. 7 | // [X] Platform: Gamepad navigation mapping. Enable with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'. 8 | // [x] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. FIXME: 3 cursors types are missing from GLFW. 9 | // [X] Platform: Keyboard arrays indexed using GLFW_KEY_* codes, e.g. ImGui::IsKeyPressed(GLFW_KEY_SPACE). 10 | 11 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 12 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 13 | // https://github.com/ocornut/imgui 14 | 15 | // About GLSL version: 16 | // The 'glsl_version' initialization parameter defaults to "#version 150" if NULL. 17 | // Only override if your GL version doesn't handle this GLSL version. Keep NULL if unsure! 18 | 19 | struct GLFWwindow; 20 | 21 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOpenGL(GLFWwindow* window, bool install_callbacks); 22 | IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForVulkan(GLFWwindow* window, bool install_callbacks); 23 | IMGUI_IMPL_API void ImGui_ImplGlfw_Shutdown(); 24 | IMGUI_IMPL_API void ImGui_ImplGlfw_NewFrame(); 25 | 26 | // GLFW callbacks (installed by default if you enable 'install_callbacks' during initialization) 27 | // Provided here if you want to chain callbacks. 28 | // You can also handle inputs yourself and use those as a reference. 29 | IMGUI_IMPL_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 30 | IMGUI_IMPL_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 31 | IMGUI_IMPL_API void ImGui_ImplGlfw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 32 | IMGUI_IMPL_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 33 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_marmalade.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer + Platform Binding for: Marmalade + IwGx 2 | 3 | // Implemented features: 4 | // [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 5 | 6 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 7 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 8 | // https://github.com/ocornut/imgui 9 | 10 | // Copyright (C) 2015 by Giovanni Zito 11 | // This file is part of ImGui 12 | 13 | IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks); 14 | IMGUI_IMPL_API void ImGui_Marmalade_Shutdown(); 15 | IMGUI_IMPL_API void ImGui_Marmalade_NewFrame(); 16 | IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data); 17 | 18 | // Use if you want to reset your rendering device without losing ImGui state. 19 | IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects(); 20 | IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects(); 21 | 22 | // Callbacks (installed by default if you enable 'install_callbacks' during initialization) 23 | // You can also handle inputs yourself and use those as a reference. 24 | IMGUI_IMPL_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data); 25 | IMGUI_IMPL_API int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data); 26 | IMGUI_IMPL_API int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data); 27 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_metal.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: Metal 2 | // This needs to be used along with a Platform Binding (e.g. OSX) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | @class MTLRenderPassDescriptor; 12 | @protocol MTLDevice, MTLCommandBuffer, MTLRenderCommandEncoder; 13 | 14 | IMGUI_IMPL_API bool ImGui_ImplMetal_Init(id device); 15 | IMGUI_IMPL_API void ImGui_ImplMetal_Shutdown(); 16 | IMGUI_IMPL_API void ImGui_ImplMetal_NewFrame(MTLRenderPassDescriptor *renderPassDescriptor); 17 | IMGUI_IMPL_API void ImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, 18 | id commandBuffer, 19 | id commandEncoder); 20 | 21 | // Called by Init/NewFrame/Shutdown 22 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateFontsTexture(id device); 23 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyFontsTexture(); 24 | IMGUI_IMPL_API bool ImGui_ImplMetal_CreateDeviceObjects(id device); 25 | IMGUI_IMPL_API void ImGui_ImplMetal_DestroyDeviceObjects(); 26 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_opengl2.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: OpenGL2 (legacy OpenGL, fixed pipeline) 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Implemented features: 5 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | // **DO NOT USE THIS CODE IF YOUR CODE/ENGINE IS USING MODERN OPENGL (SHADERS, VBO, VAO, etc.)** 12 | // **Prefer using the code in imgui_impl_opengl3.cpp** 13 | // This code is mostly provided as a reference to learn how ImGui integration works, because it is shorter to read. 14 | // If your code is using GL3+ context or any semi modern OpenGL calls, using this is likely to make everything more 15 | // complicated, will require your code to reset every single OpenGL attributes to their initial state, and might 16 | // confuse your GPU driver. 17 | // The GL2 code is unable to reset attributes or even call e.g. "glUseProgram(0)" because they don't exist in that API. 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_Init(); 20 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_Shutdown(); 21 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_NewFrame(); 22 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data); 23 | 24 | // Called by Init/NewFrame/Shutdown 25 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateFontsTexture(); 26 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyFontsTexture(); 27 | IMGUI_IMPL_API bool ImGui_ImplOpenGL2_CreateDeviceObjects(); 28 | IMGUI_IMPL_API void ImGui_ImplOpenGL2_DestroyDeviceObjects(); 29 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_opengl3.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: OpenGL3 / OpenGL ES2 / OpenGL ES3 (modern OpenGL with shaders / programmatic pipeline) 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | // (Note: We are using GL3W as a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc..) 4 | 5 | // Implemented features: 6 | // [X] Renderer: User texture binding. Use 'GLuint' OpenGL texture identifier as void*/ImTextureID. Read the FAQ about ImTextureID in imgui.cpp. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 10 | // https://github.com/ocornut/imgui 11 | 12 | // About OpenGL function loaders: 13 | // About OpenGL function loaders: modern OpenGL doesn't have a standard header file and requires individual function pointers to be loaded manually. 14 | // Helper libraries are often used for this purpose! Here we are supporting a few common ones: gl3w, glew, glad. 15 | // You may use another loader/header of your choice (glext, glLoadGen, etc.), or chose to manually implement your own. 16 | 17 | // About GLSL version: 18 | // The 'glsl_version' initialization parameter should be NULL (default) or a "#version XXX" string. 19 | // On computer platform the GLSL version default to "#version 130". On OpenGL ES 3 platform it defaults to "#version 300 es" 20 | // Only override if your GL version doesn't handle this GLSL version. See GLSL version table at the top of imgui_impl_opengl3.cpp. 21 | 22 | // Set default OpenGL loader to be gl3w 23 | #if !defined(IMGUI_IMPL_OPENGL_LOADER_GL3W) \ 24 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLEW) \ 25 | && !defined(IMGUI_IMPL_OPENGL_LOADER_GLAD) \ 26 | && !defined(IMGUI_IMPL_OPENGL_LOADER_CUSTOM) 27 | #define IMGUI_IMPL_OPENGL_LOADER_GL3W 28 | #endif 29 | 30 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); 31 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 32 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 33 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 34 | 35 | // Called by Init/NewFrame/Shutdown 36 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 37 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 38 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 39 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 40 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_osx.h: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: OSX / Cocoa 2 | // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..) 3 | // [BETA] Beta bindings, not well tested. If you want a portable application, prefer using the Glfw or SDL platform bindings on Mac. 4 | 5 | // Issues: 6 | // [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters].. 7 | // [ ] Platform: Mouse cursor shapes and visibility are not supported (see end of https://github.com/glfw/glfw/issues/427) 8 | 9 | @class NSEvent; 10 | @class NSView; 11 | 12 | IMGUI_API bool ImGui_ImplOSX_Init(); 13 | IMGUI_API void ImGui_ImplOSX_Shutdown(); 14 | IMGUI_API void ImGui_ImplOSX_NewFrame(NSView *_Nonnull view); 15 | IMGUI_API bool ImGui_ImplOSX_HandleEvent(NSEvent *_Nonnull event, NSView *_Nullable view); 16 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_sdl.h: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: SDL2 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | // (Info: SDL2 is a cross-platform general purpose library for handling windows, inputs, graphics context creation, etc.) 4 | 5 | // Implemented features: 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Clipboard support. 8 | // [X] Platform: Keyboard arrays indexed using SDL_SCANCODE_* codes, e.g. ImGui::IsKeyPressed(SDL_SCANCODE_SPACE). 9 | // Missing features: 10 | // [ ] Platform: SDL2 handling of IME under Windows appears to be broken and it explicitly disable the regular Windows IME. You can restore Windows IME by compiling SDL with SDL_DISABLE_WINDOWS_IME. 11 | 12 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 13 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 14 | // https://github.com/ocornut/imgui 15 | 16 | struct SDL_Window; 17 | typedef union SDL_Event SDL_Event; 18 | 19 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* sdl_gl_context); 20 | IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window); 21 | IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown(); 22 | IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame(SDL_Window* window); 23 | IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(SDL_Event* event); 24 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_vulkan.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: Vulkan 2 | // This needs to be used along with a Platform Binding (e.g. GLFW, SDL, Win32, custom..) 3 | 4 | // Missing features: 5 | // [ ] Renderer: User texture binding. Changes of ImTextureID aren't supported by this binding! See https://github.com/ocornut/imgui/pull/914 6 | 7 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 8 | // If you are new to dear imgui, read examples/README.txt and read the documentation at the top of imgui.cpp. 9 | // https://github.com/ocornut/imgui 10 | 11 | // The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification. 12 | // IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/ 13 | 14 | #include 15 | 16 | #define IMGUI_VK_QUEUED_FRAMES 2 17 | 18 | // Please zero-clear before use. 19 | struct ImGui_ImplVulkan_InitInfo 20 | { 21 | VkInstance Instance; 22 | VkPhysicalDevice PhysicalDevice; 23 | VkDevice Device; 24 | uint32_t QueueFamily; 25 | VkQueue Queue; 26 | VkPipelineCache PipelineCache; 27 | VkDescriptorPool DescriptorPool; 28 | const VkAllocationCallbacks* Allocator; 29 | void (*CheckVkResultFn)(VkResult err); 30 | }; 31 | 32 | // Called by user code 33 | IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass); 34 | IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown(); 35 | IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame(); 36 | IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer); 37 | IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer); 38 | IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateFontUploadObjects(); 39 | 40 | // Called by ImGui_ImplVulkan_Init() might be useful elsewhere. 41 | IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateDeviceObjects(); 42 | IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateDeviceObjects(); 43 | 44 | 45 | //------------------------------------------------------------------------- 46 | // Internal / Miscellaneous Vulkan Helpers 47 | //------------------------------------------------------------------------- 48 | // You probably do NOT need to use or care about those functions. 49 | // Those functions only exist because: 50 | // 1) they facilitate the readability and maintenance of the multiple main.cpp examples files. 51 | // 2) the upcoming multi-viewport feature will need them internally. 52 | // Generally we avoid exposing any kind of superfluous high-level helpers in the bindings, 53 | // but it is too much code to duplicate everywhere so we exceptionally expose them. 54 | // Your application/engine will likely already have code to setup all that stuff (swap chain, render pass, frame buffers, etc.). 55 | // You may read this code to learn about Vulkan, but it is recommended you use you own custom tailored code to do equivalent work. 56 | // (those functions do not interact with any of the state used by the regular ImGui_ImplVulkan_XXX functions) 57 | //------------------------------------------------------------------------- 58 | 59 | struct ImGui_ImplVulkanH_FrameData; 60 | struct ImGui_ImplVulkanH_WindowData; 61 | 62 | IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator); 63 | IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator, int w, int h); 64 | IMGUI_IMPL_API void ImGui_ImplVulkanH_DestroyWindowData(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator); 65 | IMGUI_IMPL_API VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkFormat* request_formats, int request_formats_count, VkColorSpaceKHR request_color_space); 66 | IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count); 67 | IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode); 68 | 69 | // Helper structure to hold the data needed by one rendering frame 70 | struct ImGui_ImplVulkanH_FrameData 71 | { 72 | uint32_t BackbufferIndex; // Keep track of recently rendered swapchain frame indices 73 | VkCommandPool CommandPool; 74 | VkCommandBuffer CommandBuffer; 75 | VkFence Fence; 76 | VkSemaphore ImageAcquiredSemaphore; 77 | VkSemaphore RenderCompleteSemaphore; 78 | 79 | IMGUI_IMPL_API ImGui_ImplVulkanH_FrameData(); 80 | }; 81 | 82 | // Helper structure to hold the data needed by one rendering context into one OS window 83 | struct ImGui_ImplVulkanH_WindowData 84 | { 85 | int Width; 86 | int Height; 87 | VkSwapchainKHR Swapchain; 88 | VkSurfaceKHR Surface; 89 | VkSurfaceFormatKHR SurfaceFormat; 90 | VkPresentModeKHR PresentMode; 91 | VkRenderPass RenderPass; 92 | bool ClearEnable; 93 | VkClearValue ClearValue; 94 | uint32_t BackBufferCount; 95 | VkImage BackBuffer[16]; 96 | VkImageView BackBufferView[16]; 97 | VkFramebuffer Framebuffer[16]; 98 | uint32_t FrameIndex; 99 | ImGui_ImplVulkanH_FrameData Frames[IMGUI_VK_QUEUED_FRAMES]; 100 | 101 | IMGUI_IMPL_API ImGui_ImplVulkanH_WindowData(); 102 | }; 103 | 104 | -------------------------------------------------------------------------------- /imgui/examples/imgui_impl_win32.h: -------------------------------------------------------------------------------- 1 | // ImGui Platform Binding for: Windows (standard windows API for 32 and 64 bits applications) 2 | // This needs to be used along with a Renderer (e.g. DirectX11, OpenGL3, Vulkan..) 3 | 4 | // Implemented features: 5 | // [X] Platform: Clipboard support (for Win32 this is actually part of core imgui) 6 | // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'. 7 | // [X] Platform: Keyboard arrays indexed using VK_* Virtual Key Codes, e.g. ImGui::IsKeyPressed(VK_SPACE). 8 | 9 | IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd); 10 | IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown(); 11 | IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame(); 12 | 13 | // Handler for Win32 messages, update mouse/keyboard data. 14 | // You may or not need this for your implementation, but it can serve as reference for handling inputs. 15 | // Intentionally commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code. 16 | /* 17 | IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); 18 | */ 19 | -------------------------------------------------------------------------------- /imgui/examples/libs/glfw/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /imgui/examples/libs/glfw/lib-vc2010-32/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/examples/libs/glfw/lib-vc2010-32/glfw3.lib -------------------------------------------------------------------------------- /imgui/examples/libs/glfw/lib-vc2010-64/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/examples/libs/glfw/lib-vc2010-64/glfw3.lib -------------------------------------------------------------------------------- /imgui/examples/libs/usynergy/README.txt: -------------------------------------------------------------------------------- 1 | 2 | uSynergy client -- Implementation for the embedded Synergy client library 3 | version 1.0.0, July 7th, 2012 4 | Copyright (c) 2012 Alex Evans 5 | 6 | This is a copy of the files once found at: 7 | https://github.com/symless/synergy-core/tree/790d108a56ada9caad8e56ff777d444485a69da9/src/micro 8 | 9 | -------------------------------------------------------------------------------- /imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // COMPILE-TIME OPTIONS FOR DEAR IMGUI 3 | // Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure. 4 | // You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions. 5 | //----------------------------------------------------------------------------- 6 | // A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h) 7 | // B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h" 8 | // If you do so you need to make sure that configuration settings are defined consistently _everywhere_ dear imgui is used, which include 9 | // the imgui*.cpp files but also _any_ of your code that uses imgui. This is because some compile-time options have an affect on data structures. 10 | // Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts. 11 | // Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using. 12 | //----------------------------------------------------------------------------- 13 | 14 | #pragma once 15 | 16 | //---- Define assertion handler. Defaults to calling assert(). 17 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 18 | //#define IM_ASSERT(_EXPR) ((void)(_EXPR)) // Disable asserts 19 | 20 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows. 21 | //#define IMGUI_API __declspec( dllexport ) 22 | //#define IMGUI_API __declspec( dllimport ) 23 | 24 | //---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names. 25 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 26 | 27 | //---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty) 28 | //---- It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp. 29 | //#define IMGUI_DISABLE_DEMO_WINDOWS 30 | 31 | //---- Don't implement some functions to reduce linkage requirements. 32 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. 33 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // [Win32] Don't implement default IME handler. Won't use and link with ImmGetContext/ImmSetCompositionWindow. 34 | //#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Don't implement ImFormatString/ImFormatStringV so you can implement them yourself if you don't want to link with vsnprintf. 35 | //#define IMGUI_DISABLE_MATH_FUNCTIONS // Don't implement ImFabs/ImSqrt/ImPow/ImFmod/ImCos/ImSin/ImAcos/ImAtan2 wrapper so you can implement them yourself. Declare your prototypes in imconfig.h. 36 | //#define IMGUI_DISABLE_DEFAULT_ALLOCATORS // Don't implement default allocators calling malloc()/free() to avoid linking with them. You will need to call ImGui::SetAllocatorFunctions(). 37 | 38 | //---- Include imgui_user.h at the end of imgui.h as a convenience 39 | //#define IMGUI_INCLUDE_IMGUI_USER_H 40 | 41 | //---- Pack colors to BGRA8 instead of RGBA8 (to avoid converting from one to another) 42 | //#define IMGUI_USE_BGRA_PACKED_COLOR 43 | 44 | //---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version 45 | // By default the embedded implementations are declared static and not available outside of imgui cpp files. 46 | //#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h" 47 | //#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h" 48 | //#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION 49 | //#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION 50 | 51 | //---- Define constructor and implicit cast operators to convert back<>forth between your math types and ImVec2/ImVec4. 52 | // This will be inlined as part of ImVec2 and ImVec4 class declarations. 53 | /* 54 | #define IM_VEC2_CLASS_EXTRA \ 55 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 56 | operator MyVec2() const { return MyVec2(x,y); } 57 | 58 | #define IM_VEC4_CLASS_EXTRA \ 59 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 60 | operator MyVec4() const { return MyVec4(x,y,z,w); } 61 | */ 62 | 63 | //---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it. 64 | //#define ImDrawIdx unsigned int 65 | 66 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 67 | /* 68 | namespace ImGui 69 | { 70 | void MyFunction(const char* name, const MyMatrix44& v); 71 | } 72 | */ 73 | -------------------------------------------------------------------------------- /imgui/misc/fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/misc/fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /imgui/misc/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/misc/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /imgui/misc/fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/misc/fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /imgui/misc/fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/misc/fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /imgui/misc/fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/misc/fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /imgui/misc/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/imgui/misc/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /imgui/misc/freetype/README.md: -------------------------------------------------------------------------------- 1 | # imgui_freetype 2 | 3 | This is an attempt to replace stb_truetype (the default imgui's font rasterizer) with FreeType. 4 | Currently not optimal and probably has some limitations or bugs. 5 | By [Vuhdo](https://github.com/Vuhdo) (Aleksei Skriabin). Improvements by @mikesart. Maintained by @ocornut. 6 | 7 | **Usage** 8 | 1. Get latest FreeType binaries or build yourself. 9 | 2. Add imgui_freetype.h/cpp alongside your imgui sources. 10 | 3. Include imgui_freetype.h after imgui.h. 11 | 4. Call ImGuiFreeType::BuildFontAtlas() *BEFORE* calling ImFontAtlas::GetTexDataAsRGBA32() or ImFontAtlas::Build() (so normal Build() won't be called): 12 | 13 | ```cpp 14 | // See ImGuiFreeType::RasterizationFlags 15 | unsigned int flags = ImGuiFreeType::NoHinting; 16 | ImGuiFreeType::BuildFontAtlas(io.Fonts, flags); 17 | io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); 18 | ``` 19 | 20 | **Gamma Correct Blending** 21 | FreeType assumes blending in linear space rather than gamma space. 22 | See FreeType note for [FT_Render_Glyph](https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Render_Glyph). 23 | For correct results you need to be using sRGB and convert to linear space in the pixel shader output. 24 | The default imgui styles will be impacted by this change (alpha values will need tweaking). 25 | 26 | **Test code Usage** 27 | ```cpp 28 | #include "misc/freetype/imgui_freetype.h" 29 | #include "misc/freetype/imgui_freetype.cpp" 30 | 31 | // Load various small fonts 32 | ImGuiIO& io = ImGui::GetIO(); 33 | io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 13.0f); 34 | io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 13.0f); 35 | io.Fonts->AddFontDefault(); 36 | 37 | FreeTypeTest freetype_test; 38 | 39 | // Main Loop 40 | while (true) 41 | { 42 | if (freetype_test.UpdateRebuild()) 43 | { 44 | // REUPLOAD FONT TEXTURE TO GPU 45 | // e.g ImGui_ImplGlfwGL3_InvalidateDeviceObjects() + ImGui_ImplGlfwGL3_CreateDeviceObjects() 46 | } 47 | ImGui::NewFrame(); 48 | freetype_test.ShowFreetypeOptionsWindow(); 49 | ... 50 | } 51 | } 52 | ``` 53 | 54 | **Test code** 55 | ```cpp 56 | #include "misc/freetype/imgui_freetype.h" 57 | #include "misc/freetype/imgui_freetype.cpp" 58 | 59 | struct FreeTypeTest 60 | { 61 | enum FontBuildMode 62 | { 63 | FontBuildMode_FreeType, 64 | FontBuildMode_Stb, 65 | }; 66 | 67 | FontBuildMode BuildMode; 68 | bool WantRebuild; 69 | float FontsMultiply; 70 | unsigned int FontsFlags; 71 | 72 | FreeTypeTest() 73 | { 74 | BuildMode = FontBuildMode_FreeType; 75 | WantRebuild = true; 76 | FontsMultiply = 1.0f; 77 | FontsFlags = 0; 78 | } 79 | 80 | // Call _BEFORE_ NewFrame() 81 | bool UpdateRebuild() 82 | { 83 | if (!WantRebuild) 84 | return false; 85 | ImGuiIO& io = ImGui::GetIO(); 86 | for (int n = 0; n < io.Fonts->Fonts.Size; n++) 87 | { 88 | io.Fonts->Fonts[n]->ConfigData->RasterizerMultiply = FontsMultiply; 89 | io.Fonts->Fonts[n]->ConfigData->RasterizerFlags = (BuildMode == FontBuildMode_FreeType) ? FontsFlags : 0x00; 90 | } 91 | if (BuildMode == FontBuildMode_FreeType) 92 | ImGuiFreeType::BuildFontAtlas(io.Fonts, FontsFlags); 93 | else if (BuildMode == FontBuildMode_Stb) 94 | io.Fonts->Build(); 95 | WantRebuild = false; 96 | return true; 97 | } 98 | 99 | // Call to draw interface 100 | void ShowFreetypeOptionsWindow() 101 | { 102 | ImGui::Begin("FreeType Options"); 103 | ImGui::ShowFontSelector("Fonts"); 104 | WantRebuild |= ImGui::RadioButton("FreeType", (int*)&BuildMode, FontBuildMode_FreeType); 105 | ImGui::SameLine(); 106 | WantRebuild |= ImGui::RadioButton("Stb (Default)", (int*)&BuildMode, FontBuildMode_Stb); 107 | WantRebuild |= ImGui::DragFloat("Multiply", &FontsMultiply, 0.001f, 0.0f, 2.0f); 108 | if (BuildMode == FontBuildMode_FreeType) 109 | { 110 | WantRebuild |= ImGui::CheckboxFlags("NoHinting", &FontsFlags, ImGuiFreeType::NoHinting); 111 | WantRebuild |= ImGui::CheckboxFlags("NoAutoHint", &FontsFlags, ImGuiFreeType::NoAutoHint); 112 | WantRebuild |= ImGui::CheckboxFlags("ForceAutoHint", &FontsFlags, ImGuiFreeType::ForceAutoHint); 113 | WantRebuild |= ImGui::CheckboxFlags("LightHinting", &FontsFlags, ImGuiFreeType::LightHinting); 114 | WantRebuild |= ImGui::CheckboxFlags("MonoHinting", &FontsFlags, ImGuiFreeType::MonoHinting); 115 | WantRebuild |= ImGui::CheckboxFlags("Bold", &FontsFlags, ImGuiFreeType::Bold); 116 | WantRebuild |= ImGui::CheckboxFlags("Oblique", &FontsFlags, ImGuiFreeType::Oblique); 117 | } 118 | ImGui::End(); 119 | } 120 | }; 121 | ``` 122 | 123 | **Known issues** 124 | - Output texture has excessive resolution (lots of vertical waste). 125 | - FreeType's memory allocator is not overridden. 126 | - `cfg.OversampleH`, `OversampleV` are ignored (but perhaps not so necessary with this rasterizer). 127 | 128 | **Obligatory comparison screenshots** 129 | 130 | Using Windows built-in segoeui.ttf font. Open in new browser tabs, view at 1080p+. 131 | 132 | ![freetype rasterizer](https://raw.githubusercontent.com/wiki/ocornut/imgui_club/images/freetype_20170817.png) 133 | 134 | -------------------------------------------------------------------------------- /imgui/misc/freetype/imgui_freetype.h: -------------------------------------------------------------------------------- 1 | // Wrapper to use Freetype (instead of stb_truetype) for Dear ImGui 2 | // Get latest version at https://github.com/ocornut/imgui/tree/master/misc/freetype 3 | // Original code by @Vuhdo (Aleksei Skriabin), maintained by @ocornut 4 | 5 | #pragma once 6 | 7 | #include "imgui.h" // IMGUI_API, ImFontAtlas 8 | 9 | namespace ImGuiFreeType 10 | { 11 | // Hinting greatly impacts visuals (and glyph sizes). 12 | // When disabled, FreeType generates blurrier glyphs, more or less matches the stb's output. 13 | // The Default hinting mode usually looks good, but may distort glyphs in an unusual way. 14 | // The Light hinting mode generates fuzzier glyphs but better matches Microsoft's rasterizer. 15 | 16 | // You can set those flags on a per font basis in ImFontConfig::RasterizerFlags. 17 | // Use the 'extra_flags' parameter of BuildFontAtlas() to force a flag on all your fonts. 18 | enum RasterizerFlags 19 | { 20 | // By default, hinting is enabled and the font's native hinter is preferred over the auto-hinter. 21 | NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes. 22 | NoAutoHint = 1 << 1, // Disable auto-hinter. 23 | ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter. 24 | LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text. 25 | MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output. 26 | Bold = 1 << 5, // Styling: Should we artificially embolden the font? 27 | Oblique = 1 << 6 // Styling: Should we slant the font, emulating italic style? 28 | }; 29 | 30 | IMGUI_API bool BuildFontAtlas(ImFontAtlas* atlas, unsigned int extra_flags = 0); 31 | } 32 | -------------------------------------------------------------------------------- /imgui/misc/natvis/README.txt: -------------------------------------------------------------------------------- 1 | 2 | Natvis file to describe types in Visual Studio debugger. 3 | You can include this in a project file, or install in Visual Studio folder. 4 | -------------------------------------------------------------------------------- /imgui/misc/natvis/imgui.natvis: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {{Size={Size} Capacity={Capacity}}} 9 | 10 | 11 | Size 12 | Data 13 | 14 | 15 | 16 | 17 | 18 | {{x={x,g} y={y,g}}} 19 | 20 | 21 | 22 | {{x={x,g} y={y,g} z={z,g} w={w,g}}} 23 | 24 | 25 | 26 | {{Min=({Min.x,g} {Min.y,g}) Max=({Max.x,g} {Max.y,g}) Size=({Max.x-Min.x,g} {Max.y-Min.y,g})}} 27 | 28 | Min 29 | Max 30 | Max.x - Min.x 31 | Max.y - Min.y 32 | 33 | 34 | 35 | 36 | {{Name={Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags & 0x01000000)?1:0,d} Popup {(Flags & 0x04000000)?1:0,d}} 37 | 38 | 39 | -------------------------------------------------------------------------------- /imgui/misc/stl/imgui_stl.cpp: -------------------------------------------------------------------------------- 1 | // imgui_stl.cpp 2 | // Wrappers for C++ standard library (STL) types (std::string, etc.) 3 | // This is also an example of how you may wrap your own similar types. 4 | 5 | // Compatibility: 6 | // - std::string support is only guaranteed to work from C++11. 7 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 8 | 9 | #include "imgui.h" 10 | #include "imgui_stl.h" 11 | 12 | struct InputTextCallback_UserData 13 | { 14 | std::string* Str; 15 | ImGuiInputTextCallback ChainCallback; 16 | void* ChainCallbackUserData; 17 | }; 18 | 19 | static int InputTextCallback(ImGuiInputTextCallbackData* data) 20 | { 21 | InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData; 22 | if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) 23 | { 24 | // Resize string callback 25 | std::string* str = user_data->Str; 26 | IM_ASSERT(data->Buf == str->c_str()); 27 | str->resize(data->BufTextLen); 28 | data->Buf = (char*)str->c_str(); 29 | } 30 | else if (user_data->ChainCallback) 31 | { 32 | // Forward to user callback, if any 33 | data->UserData = user_data->ChainCallbackUserData; 34 | return user_data->ChainCallback(data); 35 | } 36 | return 0; 37 | } 38 | 39 | bool ImGui::InputText(const char* label, std::string* str, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 40 | { 41 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 42 | flags |= ImGuiInputTextFlags_CallbackResize; 43 | 44 | InputTextCallback_UserData cb_user_data; 45 | cb_user_data.Str = str; 46 | cb_user_data.ChainCallback = callback; 47 | cb_user_data.ChainCallbackUserData = user_data; 48 | return InputText(label, (char*)str->c_str(), str->capacity() + 1, flags, InputTextCallback, &cb_user_data); 49 | } 50 | 51 | bool ImGui::InputTextMultiline(const char* label, std::string* str, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data) 52 | { 53 | IM_ASSERT((flags & ImGuiInputTextFlags_CallbackResize) == 0); 54 | flags |= ImGuiInputTextFlags_CallbackResize; 55 | 56 | InputTextCallback_UserData cb_user_data; 57 | cb_user_data.Str = str; 58 | cb_user_data.ChainCallback = callback; 59 | cb_user_data.ChainCallbackUserData = user_data; 60 | return InputTextMultiline(label, (char*)str->c_str(), str->capacity() + 1, size, flags, InputTextCallback, &cb_user_data); 61 | } 62 | -------------------------------------------------------------------------------- /imgui/misc/stl/imgui_stl.h: -------------------------------------------------------------------------------- 1 | // imgui_stl.h 2 | // Wrappers for C++ standard library (STL) types (std::string, etc.) 3 | // This is also an example of how you may wrap your own similar types. 4 | 5 | // Compatibility: 6 | // - std::string support is only guaranteed to work from C++11. 7 | // If you try to use it pre-C++11, please share your findings (w/ info about compiler/architecture) 8 | 9 | // Changelog: 10 | // - v0.10: Initial version. Added InputText() / InputTextMultiline() calls with std::string 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace ImGui 17 | { 18 | // ImGui::InputText() with std::string 19 | // Because text input needs dynamic resizing, we need to setup a callback to grow the capacity 20 | IMGUI_API bool InputText(const char* label, std::string* str, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 21 | IMGUI_API bool InputTextMultiline(const char* label, std::string* str, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL); 22 | } 23 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright 2017 Intel Corporation 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /metrics_gui/include/metrics_gui/metrics_gui.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | #ifndef METRICS_GUI_H 23 | #define METRICS_GUI_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | struct MetricsGuiMetric { 30 | enum Flags { 31 | NONE = 0, 32 | USE_SI_UNIT_PREFIX = 1u << 1, 33 | KNOWN_MIN_VALUE = 1u << 2, 34 | KNOWN_MAX_VALUE = 1u << 3, 35 | }; 36 | 37 | enum { NUM_HISTORY_SAMPLES = 256 }; 38 | 39 | std::string mDescription; 40 | std::string mUnits; 41 | double mTotalInHistory; // needs to be double for precision reasons (accumulating small deltas) 42 | uint32_t mHistoryCount; 43 | float mColor[4]; 44 | float mHistory[NUM_HISTORY_SAMPLES]; // Don't forget to update mTotalInHistory if you modify this outside of AddNewValue() 45 | float mKnownMinValue; 46 | float mKnownMaxValue; 47 | uint32_t mFlags; 48 | bool mSelected; 49 | 50 | MetricsGuiMetric(); 51 | MetricsGuiMetric(char const* description, char const* units, uint32_t flags); 52 | void Initialize(char const* description, char const* units, uint32_t flags); 53 | 54 | void AddNewValue(float value); 55 | float GetAverageValue() const; 56 | 57 | // Get and set values in the history buffer. prevIndex==0 gets/sets last 58 | // value added, prevIndex==NUM_HISTORY_SAMPLES-1 gets/sets the oldest 59 | // stored value. 60 | void SetLastValue(float value, uint32_t prevIndex = 0); 61 | float GetLastValue(uint32_t prevIndex = 0) const; 62 | }; 63 | 64 | struct MetricsGuiPlot { 65 | struct WidthInfo { 66 | std::vector mLinkedPlots; 67 | float mDescWidth; 68 | float mValueWidth; 69 | float mLegendWidth; 70 | bool mInitialized; 71 | explicit WidthInfo(MetricsGuiPlot* plot); 72 | void Initialize(); 73 | }; 74 | 75 | std::vector mMetrics; 76 | std::vector > mMetricRange; 77 | WidthInfo* mWidthInfo; 78 | float mMinValue; 79 | float mMaxValue; 80 | bool mRangeInitialized; 81 | 82 | // Draw/update options: 83 | float mBarRounding; // amount of rounding on bars 84 | float mRangeDampening; // weight of historic range on axis range [0,1] 85 | uint32_t mInlinePlotRowCount; // height of DrawList() inline plots, in text rows 86 | uint32_t mPlotRowCount; // height of DrawHistory() plots, in text rows 87 | uint32_t mVBarMinWidth; // min width of bar graph bar in pixels 88 | uint32_t mVBarGapWidth; // width of bar graph inter-bar gap in pixels 89 | bool mShowAverage; // draw horizontal line at series average 90 | bool mShowInlineGraphs; // show history plot in DrawList() 91 | bool mShowOnlyIfSelected; // draw show selected metrics 92 | bool mShowLegendDesc; // show series description in legend 93 | bool mShowLegendColor; // use series color in legend 94 | bool mShowLegendUnits; // show units in legend values 95 | bool mShowLegendAverage; // show series average in legend 96 | bool mShowLegendMin; // show plot y-axis minimum in legend 97 | bool mShowLegendMax; // show plot y-axis maximum in legend 98 | bool mBarGraph; // use bars to draw history 99 | bool mStacked; // stack series when drawing history 100 | bool mSharedAxis; // use first series' axis range 101 | bool mFilterHistory; // allow single plot point to represent more than on history value 102 | 103 | MetricsGuiPlot(); 104 | MetricsGuiPlot(MetricsGuiPlot const& copy); 105 | ~MetricsGuiPlot(); 106 | 107 | void AddMetric(MetricsGuiMetric* metric); 108 | void AddMetrics(MetricsGuiMetric* metrics, size_t metricCount); 109 | 110 | void SortMetricsByName(); 111 | 112 | // Linking legends of multiple plots makes their legend widths the same. 113 | void LinkLegends(MetricsGuiPlot* plot); 114 | 115 | void UpdateAxes(); 116 | 117 | // ----------------------------------------------------------------- 118 | // | description | padding | bar........ | padding | quanity units | 119 | // ----------------------------------------------------------------- 120 | // | inline plot.............................| Max: quantity units | 121 | // | ........................................| Min: quantity units | 122 | // ----------------------------------------------------------------- 123 | void DrawList(); 124 | 125 | // ----------------------------------------------------------------- 126 | // | plot....................................| Description | 127 | // | ........................................| Max: quantity units | 128 | // | ........................................| Cur: quantity units | 129 | // | ........................................| Min: quantity units | 130 | // ----------------------------------------------------------------- 131 | void DrawHistory(); 132 | }; 133 | 134 | #endif // ifndef METRICS_GUI_H 135 | -------------------------------------------------------------------------------- /portable/README.md: -------------------------------------------------------------------------------- 1 | # portable 2 | A collection of utility functions useful for porting between windows and osx 3 | -------------------------------------------------------------------------------- /portable/countof.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | 23 | #ifdef _WIN32 24 | #include 25 | #else // ifdef _WIN32 26 | #include 27 | template 28 | constexpr size_t _countof(T (&)[N]) 29 | { 30 | return std::extent::value; 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /portable/perf_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017-2018 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | #ifdef _WIN32 23 | #define WIN32_LEAN_AND_MEAN 24 | #include 25 | #include 26 | 27 | struct PerfTimerFrequency { 28 | uint64_t Numerator; 29 | enum { Denominator = 1 }; 30 | }; 31 | 32 | inline uint64_t GetPerfTimerCount() 33 | { 34 | LARGE_INTEGER t; 35 | QueryPerformanceCounter(&t); 36 | return t.QuadPart; 37 | } 38 | 39 | inline PerfTimerFrequency GetPerfTimerFrequency() 40 | { 41 | PerfTimerFrequency f; 42 | QueryPerformanceFrequency((LARGE_INTEGER*) &f.Numerator); 43 | return f; 44 | } 45 | #else // ifdef _WIN32 46 | #include 47 | #include 48 | 49 | struct PerfTimerFrequency { 50 | uint64_t Numerator; 51 | uint32_t Denominator; 52 | }; 53 | 54 | inline uint64_t GetPerfTimerCount() 55 | { 56 | return mach_absolute_time(); 57 | } 58 | 59 | inline PerfTimerFrequency GetPerfTimerFrequency() 60 | { 61 | mach_timebase_info_data_t i; 62 | mach_timebase_info(&i); 63 | 64 | PerfTimerFrequency f; 65 | f.Numerator = 1000000000ull * i.denom; 66 | f.Denominator = i.numer; 67 | return f; 68 | } 69 | #endif // ifdef _WIN32 70 | -------------------------------------------------------------------------------- /portable/snprintf.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | 23 | #include 24 | 25 | #if defined(_MSC_VER) && (_MSC_VER < 1900) 26 | #include 27 | inline int snprintf( 28 | char* buf, 29 | size_t bufCount, 30 | char const* format, 31 | ...) 32 | { 33 | va_list args; 34 | va_start(args, format); 35 | #pragma warning(suppress: 4996) 36 | int r = vsnprintf(buf, bufCount, format, args); 37 | return r; 38 | } 39 | #endif 40 | -------------------------------------------------------------------------------- /sample/impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | 23 | struct ID3D11Device; 24 | struct ID3D11DeviceContext; 25 | struct ID3D12Device; 26 | 27 | struct Vertex { 28 | float position[2]; 29 | float color[3]; 30 | }; 31 | 32 | struct ImplD3DBase; 33 | 34 | struct ImplD3DBase { 35 | virtual ~ImplD3DBase() {} 36 | virtual bool Initialize(HWND hwnd) = 0; 37 | virtual void Finalize() = 0; 38 | virtual void Resize(UINT width, UINT height) = 0; 39 | virtual void Render(uint32_t resourcesIndex) = 0; 40 | virtual uint32_t WaitForResources() = 0; 41 | virtual ID3D11Device* GetD3D11Device() const = 0; 42 | virtual ID3D11DeviceContext* GetD3D11DeviceContext() const = 0; 43 | virtual ID3D12Device* GetD3D12Device() const = 0; 44 | }; 45 | 46 | #ifdef NDEBUG 47 | #define HR_CHECK(_HR) (void) _HR 48 | #else 49 | #define HR_CHECK(_HR) assert(SUCCEEDED(_HR)) 50 | #endif 51 | 52 | template 53 | inline void SafeRelease(T*& t, ULONG expectedCount=0) 54 | { 55 | if (t == nullptr) { 56 | return; 57 | } 58 | 59 | auto count = t->Release(); 60 | if (count != expectedCount) { 61 | DebugBreak(); 62 | } 63 | 64 | t = nullptr; 65 | } 66 | -------------------------------------------------------------------------------- /sample/impl_d3d11.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | #include 23 | #include 24 | 25 | struct ImplD3D11 : public ImplD3DBase { 26 | HWND HWnd; 27 | UINT Width; 28 | UINT Height; 29 | 30 | IDXGIFactory1* DXGIFactory1; 31 | 32 | ID3D11Device* Device; 33 | ID3D11DeviceContext* DeviceContext; 34 | 35 | IDXGISwapChain1* DXGISwapChain1; 36 | ID3D11RenderTargetView* BackBufferRTV; 37 | 38 | ID3D11InputLayout* InputLayout; 39 | ID3D11VertexShader* VertexShader; 40 | ID3D11PixelShader* PixelShader; 41 | ID3D11RasterizerState* RasterizerState; 42 | ID3D11BlendState* BlendState; 43 | ID3D11DepthStencilState* DepthStencilState; 44 | ID3D11Buffer* VertexBuffer; 45 | 46 | ImplD3D11(); 47 | virtual ~ImplD3D11() {} 48 | virtual bool Initialize(HWND hwnd) override; 49 | virtual void Finalize() override; 50 | virtual void Resize(UINT width, UINT height) override; 51 | virtual void Render(uint32_t resourcesIndex) override; 52 | virtual uint32_t WaitForResources() override { return 0; } 53 | virtual ID3D11Device* GetD3D11Device() const override { return Device; } 54 | virtual ID3D11DeviceContext* GetD3D11DeviceContext() const override { return DeviceContext; } 55 | virtual ID3D12Device* GetD3D12Device() const override { return nullptr; } 56 | }; 57 | -------------------------------------------------------------------------------- /sample/impl_d3d12.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Intel Corporation 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | enum { 27 | D3D12_NUM_BACK_BUFFERS = 3, 28 | D3D12_NUM_FRAMES_IN_FLIGHT = 3, 29 | }; 30 | 31 | struct D3D12RenderTargetInfo { 32 | ID3D12Resource* Resource; 33 | D3D12_CPU_DESCRIPTOR_HANDLE Handle; 34 | }; 35 | 36 | struct D3D12FrameContext { 37 | ID3D12CommandAllocator* CommandAllocator; 38 | 39 | UINT64 FenceValue; 40 | bool FenceSignalled; 41 | }; 42 | 43 | struct ImplD3D12 : public ImplD3DBase { 44 | HWND HWnd; 45 | UINT Width; 46 | UINT Height; 47 | 48 | IDXGIFactory4* DxgiFactory4; 49 | IDXGISwapChain3* DxgiSwapChain3; 50 | HANDLE SwapChainWaitableObject; 51 | 52 | ID3D12Device* Device; 53 | ID3D12CommandQueue* CommandQueue; 54 | 55 | ID3D12Fence* Fence; 56 | HANDLE FenceEvent; 57 | UINT64 LastSignalledFenceValue; 58 | 59 | D3D12RenderTargetInfo BackBuffer[D3D12_NUM_BACK_BUFFERS]; 60 | 61 | D3D12FrameContext FrameCtxt[D3D12_NUM_FRAMES_IN_FLIGHT]; 62 | UINT FrameIndex; 63 | 64 | ID3D12DescriptorHeap* RTVHeap; 65 | ID3D12DescriptorHeap* SRVHeap; 66 | ID3D12GraphicsCommandList* CmdList; 67 | ID3D12PipelineState* PipelineState; 68 | ID3D12RootSignature* RootSignature; 69 | ID3D12Resource* VertexBuffer; 70 | D3D12_VERTEX_BUFFER_VIEW VertexBufferView; 71 | 72 | ImplD3D12(); 73 | virtual ~ImplD3D12() {} 74 | virtual bool Initialize(HWND hwnd) override; 75 | virtual void Finalize() override; 76 | virtual void Resize(UINT width, UINT height) override; 77 | virtual void Render(uint32_t resourcesIndex) override; 78 | virtual uint32_t WaitForResources() override; 79 | virtual ID3D11Device* GetD3D11Device() const override { return nullptr; } 80 | virtual ID3D11DeviceContext* GetD3D11DeviceContext() const override { return nullptr; } 81 | virtual ID3D12Device* GetD3D12Device() const override { return Device; } 82 | 83 | void WaitForLastSubmittedFrame(); 84 | }; 85 | -------------------------------------------------------------------------------- /sample/ps.hlsl: -------------------------------------------------------------------------------- 1 | void main( 2 | in float4 inPosition : Sv_Position, 3 | in float3 inColor : COLOR, 4 | out float4 outColor : Sv_Target0) 5 | { 6 | outColor = float4(inColor.xyz, 1.0); 7 | } 8 | -------------------------------------------------------------------------------- /sample/sample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28010.2046 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample", "sample.vcxproj", "{F6BE1E98-E164-40A8-BCA5-1631F2E16618}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | debug|x64 = debug|x64 11 | debug-nodx12|x64 = debug-nodx12|x64 12 | release|x64 = release|x64 13 | release-nodx12|x64 = release-nodx12|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.debug|x64.ActiveCfg = debug|x64 17 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.debug|x64.Build.0 = debug|x64 18 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.debug-nodx12|x64.ActiveCfg = debug|x64 19 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.debug-nodx12|x64.Build.0 = debug|x64 20 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.release|x64.ActiveCfg = debug|x64 21 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.release|x64.Build.0 = debug|x64 22 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.release-nodx12|x64.ActiveCfg = debug|x64 23 | {F6BE1E98-E164-40A8-BCA5-1631F2E16618}.release-nodx12|x64.Build.0 = debug|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {5D985404-D794-4982-A3A6-F04FF4539AD9} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /sample/sample.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | ImGui 12 | 13 | 14 | ImGui 15 | 16 | 17 | MetricsGui 18 | 19 | 20 | ImGui 21 | 22 | 23 | ImGui 24 | 25 | 26 | ImGui 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | ImGui 35 | 36 | 37 | ImGui 38 | 39 | 40 | ImGui 41 | 42 | 43 | MetricsGui 44 | 45 | 46 | ImGui 47 | 48 | 49 | ImGui 50 | 51 | 52 | ImGui 53 | 54 | 55 | 56 | 57 | {a4c74acf-e348-4e8d-a4c4-b47f2efb94c3} 58 | 59 | 60 | {c4173451-4325-4b8b-8867-6735f1889515} 61 | 62 | 63 | -------------------------------------------------------------------------------- /sample/vs.hlsl: -------------------------------------------------------------------------------- 1 | void main( 2 | in float2 inPosition : POSITION, 3 | in float3 inColor : COLOR, 4 | out float4 outPosition : SV_POSITION, 5 | out float3 outColor : COLOR) 6 | { 7 | outPosition = float4(inPosition.xy, 0.0, 1.0); 8 | outColor = inColor; 9 | } 10 | -------------------------------------------------------------------------------- /sample_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GameTechDev/MetricsGui/b3d79054b92682ae6feaf4038b8462732d11e17f/sample_screen.png --------------------------------------------------------------------------------