├── .gitignore ├── CMakeLists.txt ├── README.md ├── client ├── README.md ├── peeper.c └── peeper.h ├── ext └── imgui │ ├── .github │ ├── CONTRIBUTING.md │ ├── issue_template.md │ └── pull_request_template.md │ ├── .travis.yml │ ├── CHANGELOG.txt │ ├── LICENSE.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_opengles3 │ │ ├── Makefile │ │ └── 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_opengles3.cpp │ ├── imgui_impl_opengles3.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 │ ├── 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 │ ├── stb_rect_pack.h │ ├── stb_textedit.h │ └── stb_truetype.h └── src ├── Main.cpp ├── SharedMem.h ├── Tester.cpp └── Types.h /.gitignore: -------------------------------------------------------------------------------- 1 | gdb.txt 2 | *.so 3 | *.cbp 4 | CMakeFiles/* 5 | CMakeFiles/ 6 | cmake-build-* 7 | .idea/* 8 | .idea/ 9 | CMakeCache.txt 10 | .gdb* 11 | Makefile 12 | cmake_install.cmake 13 | tester -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | project(peeper) 3 | 4 | if(NOT CMAKE_BUILD_TYPE) 5 | message(STATUS "No build type selected, default to Release") 6 | set(CMAKE_BUILD_TYPE RELEASE) 7 | endif(NOT CMAKE_BUILD_TYPE) 8 | 9 | set(src_main 10 | ./src/Main.cpp 11 | ./ext/imgui/examples/imgui_impl_glfw.cpp 12 | ./ext/imgui/examples/imgui_impl_opengles3.cpp 13 | ./ext/imgui/imgui.cpp 14 | ./ext/imgui/imgui_demo.cpp 15 | ./ext/imgui/imgui_draw.cpp 16 | ./ext/imgui/examples/libs/gl3w/GL/gl3w.c 17 | src/Types.h) 18 | 19 | include_directories("${CMAKE_SOURCE_DIR}/ext/imgui/") 20 | include_directories("${CMAKE_SOURCE_DIR}/ext/imgui/examples/") 21 | include_directories("${CMAKE_SOURCE_DIR}/ext/imgui/examples/libs/") 22 | include_directories("${CMAKE_SOURCE_DIR}/ext/imgui/examples/libs/gl3w/") 23 | 24 | add_definitions(-D__EGL__) 25 | add_library(peeper SHARED ${src_main}) 26 | target_compile_options(peeper PRIVATE -O3 -g -std=c++17 -Wall -ldl -fpic -shared) 27 | target_link_libraries(peeper SDL2 GL dl EGL glfw rt) 28 | 29 | add_executable(tester ./src/Tester.cpp client/peeper.c) 30 | target_link_libraries(tester rt pthread) 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # peeper 2 | receive and draw primitives with SwapBuffers hook and imgui. 3 | 4 | Requires a few libraries (TODO) 5 | 6 | # build 7 | `cmake . && make -j4` 8 | 9 | # usage 10 | `LD_PRELOAD=/home/lwss/Documents/peeper/libpeeper.so ./looking-glass-client -s` 11 | 12 | # Example Screenshots 13 | ![lg-imgui](https://i.imgur.com/bVX5Kkc.png) 14 | [TuxKov](https://github.com/Qemu-Gang/Escape-from-TuxKov) 15 | ![tuxkov](https://i.imgur.com/jiT7atn.png) 16 | -------------------------------------------------------------------------------- /client/README.md: -------------------------------------------------------------------------------- 1 | Include peeper.h/peeper.cpp in your projects to interact with peeper. 2 | -------------------------------------------------------------------------------- /client/peeper.c: -------------------------------------------------------------------------------- 1 | #include "peeper.h" 2 | // Do not include this file in your project 3 | #include "../src/SharedMem.h" 4 | 5 | #include 6 | #include /* For mode constants */ 7 | #include 8 | #include /* For O_* constants */ 9 | #include //memcpy 10 | #include //ftruncate 11 | 12 | // yeah i'm not including just for these 13 | #define MIN(a,b) (((a)<(b))?(a):(b)) 14 | #define MAX(a,b) (((a)>(b))?(a):(b)) 15 | 16 | // This is an array index for the DrawRequests[] 17 | static int currentDrawIndex = 0; 18 | 19 | static bool IsRequestBufferFull() 20 | { 21 | return (currentDrawIndex >= (MAX_REQUESTS-1)); 22 | } 23 | 24 | bool AddLine( int x0, int y0, int x1, int y1, struct Color color, float thickness ) { 25 | if( IsRequestBufferFull() ) 26 | return false; 27 | 28 | sharedRegion->requests[currentDrawIndex].type = DRAW_LINE; 29 | sharedRegion->requests[currentDrawIndex].x0 = x0; 30 | sharedRegion->requests[currentDrawIndex].y0 = y0; 31 | sharedRegion->requests[currentDrawIndex].x1 = x1; 32 | sharedRegion->requests[currentDrawIndex].y1 = y1; 33 | sharedRegion->requests[currentDrawIndex].color = color; 34 | sharedRegion->requests[currentDrawIndex].thickness = thickness; 35 | 36 | currentDrawIndex++; 37 | return true; 38 | } 39 | 40 | bool AddRect( int x0, int y0, int x1, int y1, struct Color color, float thickness ) { 41 | if( IsRequestBufferFull() ) 42 | return false; 43 | 44 | sharedRegion->requests[currentDrawIndex].type = DRAW_RECT; 45 | sharedRegion->requests[currentDrawIndex].x0 = x0; 46 | sharedRegion->requests[currentDrawIndex].y0 = y0; 47 | sharedRegion->requests[currentDrawIndex].x1 = x1; 48 | sharedRegion->requests[currentDrawIndex].y1 = y1; 49 | sharedRegion->requests[currentDrawIndex].color = color; 50 | sharedRegion->requests[currentDrawIndex].thickness = thickness; 51 | 52 | currentDrawIndex++; 53 | return true; 54 | } 55 | 56 | bool AddRectFilled( int x0, int y0, int x1, int y1, struct Color color ) { 57 | if( IsRequestBufferFull() ) 58 | return false; 59 | 60 | sharedRegion->requests[currentDrawIndex].type = DRAW_RECT_FILLED; 61 | sharedRegion->requests[currentDrawIndex].x0 = x0; 62 | sharedRegion->requests[currentDrawIndex].y0 = y0; 63 | sharedRegion->requests[currentDrawIndex].x1 = x1; 64 | sharedRegion->requests[currentDrawIndex].y1 = y1; 65 | sharedRegion->requests[currentDrawIndex].color = color; 66 | 67 | currentDrawIndex++; 68 | return true; 69 | } 70 | 71 | bool AddCircle( int x0, int y0, struct Color color, float circleRadius, int circleSegments, float thickness ) { 72 | if( IsRequestBufferFull() ) 73 | return false; 74 | 75 | sharedRegion->requests[currentDrawIndex].type = DRAW_CIRCLE; 76 | sharedRegion->requests[currentDrawIndex].x0 = x0; 77 | sharedRegion->requests[currentDrawIndex].y0 = y0; 78 | sharedRegion->requests[currentDrawIndex].color = color; 79 | sharedRegion->requests[currentDrawIndex].circleRadius = circleRadius; 80 | sharedRegion->requests[currentDrawIndex].circleSegments = circleSegments; 81 | sharedRegion->requests[currentDrawIndex].thickness = thickness; 82 | 83 | currentDrawIndex++; 84 | return true; 85 | } 86 | 87 | bool AddCircleFilled( int x0, int y0, struct Color color, float circleRadius, int circleSegments ) { 88 | if( IsRequestBufferFull() ) 89 | return false; 90 | 91 | sharedRegion->requests[currentDrawIndex].type = DRAW_CIRCLE_FILLED; 92 | sharedRegion->requests[currentDrawIndex].x0 = x0; 93 | sharedRegion->requests[currentDrawIndex].y0 = y0; 94 | sharedRegion->requests[currentDrawIndex].color = color; 95 | sharedRegion->requests[currentDrawIndex].circleRadius = circleRadius; 96 | sharedRegion->requests[currentDrawIndex].circleSegments = circleSegments; 97 | 98 | currentDrawIndex++; 99 | return true; 100 | } 101 | 102 | bool AddText(int x0, int y0, struct Color color, const char *text) { 103 | if( IsRequestBufferFull() ) 104 | return false; 105 | 106 | sharedRegion->requests[currentDrawIndex].type = DRAW_TEXT; 107 | sharedRegion->requests[currentDrawIndex].x0 = x0; 108 | sharedRegion->requests[currentDrawIndex].y0 = y0; 109 | sharedRegion->requests[currentDrawIndex].color = color; 110 | strncpy( sharedRegion->requests[currentDrawIndex].text, text, MAX_TEXT_LEN-1 ); 111 | sharedRegion->requests[currentDrawIndex].text[MAX_TEXT_LEN-1] = '\0'; 112 | 113 | currentDrawIndex++; 114 | return true; 115 | } 116 | 117 | void SubmitDraws( ) { 118 | if( currentDrawIndex <= 0 ){ 119 | ClearDraws(); 120 | return; 121 | } 122 | 123 | sharedRegion->numRequests = MIN(currentDrawIndex, MAX_REQUESTS-1); 124 | 125 | // release semaphore to peeper so it can copy drawRequests 126 | sem_post( semaphore ); 127 | 128 | // wait until peeper has copied them out. 129 | //sem_wait( semaphore ); 130 | 131 | currentDrawIndex = 0; 132 | } 133 | 134 | void ClearDraws( ) { 135 | if( sharedRegion->numRequests != 0 ){ 136 | sharedRegion->numRequests = 0; 137 | sem_post( semaphore ); 138 | } 139 | } 140 | 141 | int Open( ) { 142 | // Open /dev/shm/ shared memory 143 | sharedMemoryFD = shm_open( SHM_NAME, O_RDWR, 0); 144 | if( sharedMemoryFD < 0 ){ 145 | return 1; 146 | } 147 | 148 | // Set the size. 149 | ftruncate( sharedMemoryFD, sizeof(struct SharedRegion) ); 150 | 151 | // Allocate the memory with the mmap and the fd 152 | sharedRegion = (struct SharedRegion*)mmap( NULL, sizeof(struct SharedRegion), PROT_READ | PROT_WRITE, MAP_SHARED, sharedMemoryFD, 0 ); 153 | 154 | if( sharedRegion == MAP_FAILED ){ 155 | return 2; 156 | } 157 | 158 | // Open/Create a semaphore by it's unique name 159 | semaphore = sem_open( SEMAPHORE_NAME, O_RDWR, S_IRWXU, 0); 160 | if( semaphore == (void*)-1 ){ 161 | return 3; 162 | } 163 | 164 | return 0; 165 | } 166 | 167 | 168 | void Close( ) { 169 | munmap( sharedRegion, sizeof(struct SharedRegion) ); 170 | sem_close( semaphore ); 171 | close( sharedMemoryFD ); 172 | } 173 | 174 | -------------------------------------------------------------------------------- /client/peeper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../src/Types.h" 4 | 5 | #include 6 | 7 | // Non-zero on fail 8 | int Open(); 9 | void Close(); 10 | 11 | // Call this after you've updated all the primitives 12 | // Peeper Primitives are cached, so it will draw the same shapes until you give it new data. 13 | void SubmitDraws(); 14 | // Call this only when you stop drawing and want to clear the screen 15 | void ClearDraws(); 16 | 17 | // Primitive shapes that are drawn. Must be called after Open() 18 | bool AddLine( int x0, int y0, int x1, int y1, struct Color color, float thickness ); 19 | bool AddRect( int x0, int y0, int x1, int y1, struct Color color, float thickness ); 20 | bool AddRectFilled( int x0, int y0, int x1, int y1, struct Color color ); 21 | bool AddCircle( int x0, int y0, struct Color color, float circleRadius, int circleSegments, float thickness ); 22 | bool AddCircleFilled( int x0, int y0, struct Color color, float circleRadius, int circleSegments ); 23 | bool AddText( int x0, int y0, struct Color color, const char *text ); -------------------------------------------------------------------------------- /ext/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 | **Prerequisites for new users of dear imgui:** 8 | - Please read the FAQ in imgui.cpp. 9 | - Please read misc/fonts/README.txt if your question relates to fonts or text. 10 | - Please run ImGui::ShowDemoWindow() to explore the demo and its sources. 11 | - Please use the Search function of GitHub to look for similar issues. You may also browse issues by tags. 12 | - Please use the Search function of your IDE to search in the code for comments related to your situation. 13 | - If you get a assert, use a debugger to locate the line triggering it and read the comments around the assert. 14 | 15 | **Guidelines to report an issue or ask a question:** 16 | - Please provide your imgui version number. 17 | - If you are discussing an assert or a crash, please provide a debugger callstack. 18 | - Please state if you have made substantial modifications to your copy of imgui. 19 | - 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 one of the back-end (imgui_impl_xxx files), or a modified one, or if you built your own. 20 | - 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. 21 | - 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). 22 | - When requesting a new feature, please describe the usage context (how you intend to use it, why you need it, etc.). 23 | - Due to frequent abuse of this service from a certain category of users, if your GitHub account is anonymous and was created five minutes ago please understand that your post will receive more scrutiny and less patience for incomplete questions. 24 | 25 | If you have been using dear imgui for a while and/or have been using C/C++ for several years and/or have demonstrated good behavior here, it is ok to not fullfill every item to the letter. Those are guidelines and experienced users of dear imgui will know what information are useful in a given context. 26 | 27 | ## How to create an Pull Request 28 | 29 | - If you are adding a feature, please describe the usage context (how you intend to use it, why you need it, etc.). 30 | - 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). 31 | - 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). 32 | -------------------------------------------------------------------------------- /ext/imgui/.github/issue_template.md: -------------------------------------------------------------------------------- 1 | You may use the Issue Tracker to ask for help and submit bug reports, feature requests or suggestions. 2 | 3 | PLEASE CAREFULLY READ THIS DOCUMENT before doing so: 4 | [CONTRIBUTING.md](https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md). 5 | 6 | SELECT "PREVIEW CHANGES" TO TURN THE URL ABOVE INTO A CLICKABLE LINK. 7 | 8 | (Delete everything above this section before submitting your issue. Please read the CONTRIBUTING.md file!) 9 | 10 | ---- 11 | 12 | **Version/Branch of Dear ImGui:** 13 | 14 | XXX 15 | 16 | **Back-end file/Renderer/OS:** _(if the question is related to inputs/rendering/build, otherwise delete this section)_ 17 | 18 | XXX 19 | 20 | **My Issue/Question:** _(please provide context)_ 21 | 22 | **Standalone, minimal, complete and verifiable example:** _(see CONTRIBUTING.md)_ 23 | ``` 24 | ImGui::Begin("Example Bug"); 25 | MoreCodeToExplainMyIssue(); 26 | ImGui::End(); 27 | ``` 28 | 29 | **Screenshots/Video** _(you can drag files here)_ 30 | -------------------------------------------------------------------------------- /ext/imgui/.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | - If you are adding a feature, please explain the context of the change: what do you need the feature for? 2 | - Try to attach screenshots to clarify the context and demonstrate the feature at a glance. 3 | - 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. 4 | - You can read [CONTRIBUTING.md](https://github.com/ocornut/imgui/blob/master/.github/CONTRIBUTING.md) for more details. 5 | 6 | (Clear this form before submitting your PR) 7 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/imgui/examples/.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | */Debug/* 3 | */Release/* 4 | */ipch/* 5 | */x64/* 6 | *.opensdf 7 | *.sdf 8 | *.suo 9 | *.user 10 | *.o 11 | *.obj 12 | *.exe 13 | *.log 14 | *.pdb 15 | *.ilk 16 | *.VC.db 17 | *.VC.VC.opendb 18 | 19 | ## Xcode cruft 20 | .DS_Store 21 | project.xcworkspace 22 | xcuserdata 23 | 24 | ## Emscripten output 25 | *.out.js 26 | *.out.wasm 27 | 28 | ## Unix executables 29 | example_glfw_opengl2/example_glfw_opengl2 30 | example_glfw_opengl3/example_glfw_opengl3 31 | example_sdl_opengl2/example_sdl_opengl2 32 | example_sdl_opengl3/example_sdl_opengl3 33 | 34 | ## Dear ImGui Ini files 35 | imgui.ini 36 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 33 | 34 | imgui 35 | 36 | 37 | imgui 38 | 39 | 40 | imgui 41 | 42 | 43 | sources 44 | 45 | 46 | 47 | 48 | 49 | sources 50 | 51 | 52 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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, "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 ImGui frame 79 | ImGui_ImplAllegro5_NewFrame(); 80 | ImGui::NewFrame(); 81 | 82 | // 1. Show a simple window. 83 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 84 | { 85 | static float f = 0.0f; 86 | static int counter = 0; 87 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 88 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 89 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 90 | 91 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 92 | ImGui::Checkbox("Another Window", &show_another_window); 93 | 94 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 95 | counter++; 96 | ImGui::SameLine(); 97 | ImGui::Text("counter = %d", counter); 98 | 99 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 100 | } 101 | 102 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 103 | if (show_another_window) 104 | { 105 | ImGui::Begin("Another Window", &show_another_window); 106 | ImGui::Text("Hello from another window!"); 107 | if (ImGui::Button("Close Me")) 108 | show_another_window = false; 109 | ImGui::End(); 110 | } 111 | 112 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 113 | if (show_demo_window) 114 | { 115 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 116 | ImGui::ShowDemoWindow(&show_demo_window); 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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 69 | [renderEncoder pushDebugGroup:@"Draw ImGui"]; 70 | 71 | ImGui_ImplMetal_NewFrame(renderPassDescriptor); 72 | #if TARGET_OS_OSX 73 | ImGui_ImplOSX_NewFrame(view); 74 | #endif 75 | ImGui::NewFrame(); 76 | 77 | { 78 | static float f = 0.0f; 79 | static int counter = 0; 80 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 81 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 82 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 83 | 84 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 85 | ImGui::Checkbox("Another Window", &show_another_window); 86 | 87 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 88 | counter++; 89 | ImGui::SameLine(); 90 | ImGui::Text("counter = %d", counter); 91 | 92 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 93 | } 94 | 95 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 96 | if (show_another_window) 97 | { 98 | ImGui::Begin("Another Window", &show_another_window); 99 | ImGui::Text("Hello from another window!"); 100 | if (ImGui::Button("Close Me")) 101 | show_another_window = false; 102 | ImGui::End(); 103 | } 104 | 105 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 106 | if (show_demo_window) 107 | { 108 | // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. 109 | // Here we just want to make the demo initial state a bit more friendly! 110 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); 111 | ImGui::ShowDemoWindow(&show_demo_window); 112 | } 113 | 114 | ImGui::Render(); 115 | ImDrawData *drawData = ImGui::GetDrawData(); 116 | ImGui_ImplMetal_RenderDrawData(drawData, commandBuffer, renderEncoder); 117 | 118 | [renderEncoder popDebugGroup]; 119 | 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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/imgui/examples/example_apple_metal/iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/examples/example_apple_metal/iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 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 | -------------------------------------------------------------------------------- /ext/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 a simple window. 21 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 22 | { 23 | static float f = 0.0f; 24 | static int counter = 0; 25 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 26 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 27 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 28 | 29 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 30 | ImGui::Checkbox("Another Window", &show_another_window); 31 | 32 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 33 | counter++; 34 | ImGui::SameLine(); 35 | ImGui::Text("counter = %d", counter); 36 | 37 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 38 | } 39 | 40 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 41 | if (show_another_window) 42 | { 43 | ImGui::Begin("Another Window", &show_another_window); 44 | ImGui::Text("Hello from another window!"); 45 | if (ImGui::Button("Close Me")) 46 | show_another_window = false; 47 | ImGui::End(); 48 | } 49 | 50 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 51 | if (show_demo_window) 52 | { 53 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 54 | ImGui::ShowDemoWindow(&show_demo_window); 55 | } 56 | } 57 | 58 | void glut_display_func() 59 | { 60 | ImGui_ImplOpenGL2_NewFrame(); 61 | ImGui_ImplFreeGLUT_NewFrame(); 62 | 63 | my_display_code(); 64 | 65 | ImGui::Render(); 66 | 67 | ImGuiIO& io = ImGui::GetIO(); 68 | glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y); 69 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 70 | glClear(GL_COLOR_BUFFER_BIT); 71 | //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. 72 | ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData()); 73 | 74 | glutSwapBuffers(); 75 | glutPostRedisplay(); 76 | } 77 | 78 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 79 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 80 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 81 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 82 | 83 | int main(int argc, char** argv) 84 | { 85 | // Create GLUT window 86 | glutInit(&argc, argv); 87 | glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); 88 | glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE); 89 | glutInitWindowSize(1280, 720); 90 | glutCreateWindow("ImGui FreeGLUT+OpenGL2 Example"); 91 | 92 | // Setup GLUT display function 93 | // We will also call ImGui_ImplFreeGLUT_InstallFuncs() to get all the other functions installed for us, 94 | // otherwise it is possible to install our own functions and call the imgui_impl_freeglut.h functions ourselves. 95 | glutDisplayFunc(glut_display_func); 96 | 97 | // Setup ImGui binding 98 | ImGui::CreateContext(); 99 | ImGuiIO& io = ImGui::GetIO(); (void)io; 100 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 101 | 102 | ImGui_ImplFreeGLUT_Init(); 103 | ImGui_ImplFreeGLUT_InstallFuncs(); 104 | ImGui_ImplOpenGL2_Init(); 105 | 106 | // Setup style 107 | ImGui::StyleColorsDark(); 108 | //ImGui::StyleColorsClassic(); 109 | 110 | // Load Fonts 111 | // - 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. 112 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 113 | // - 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). 114 | // - 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. 115 | // - Read 'misc/fonts/README.txt' for more instructions and details. 116 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 117 | //io.Fonts->AddFontDefault(); 118 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 119 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 120 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 121 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 122 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 123 | //IM_ASSERT(font != NULL); 124 | 125 | glutMainLoop(); 126 | 127 | // Cleanup 128 | ImGui_ImplOpenGL2_Shutdown(); 129 | ImGui_ImplFreeGLUT_Shutdown(); 130 | ImGui::DestroyContext(); 131 | 132 | return 0; 133 | } 134 | -------------------------------------------------------------------------------- /ext/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 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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 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 | -------------------------------------------------------------------------------- /ext/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, "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 ImGui frame 76 | ImGui_ImplOpenGL2_NewFrame(); 77 | ImGui_ImplGlfw_NewFrame(); 78 | ImGui::NewFrame(); 79 | 80 | // 1. Show a simple window. 81 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 82 | { 83 | static float f = 0.0f; 84 | static int counter = 0; 85 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 86 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 87 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 88 | 89 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 90 | ImGui::Checkbox("Another Window", &show_another_window); 91 | 92 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 93 | counter++; 94 | ImGui::SameLine(); 95 | ImGui::Text("counter = %d", counter); 96 | 97 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 98 | } 99 | 100 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 101 | if (show_another_window) 102 | { 103 | ImGui::Begin("Another Window", &show_another_window); 104 | ImGui::Text("Hello from another window!"); 105 | if (ImGui::Button("Close Me")) 106 | show_another_window = false; 107 | ImGui::End(); 108 | } 109 | 110 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 111 | if (show_demo_window) 112 | { 113 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 114 | ImGui::ShowDemoWindow(&show_demo_window); 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 | -------------------------------------------------------------------------------- /ext/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 21 | SOURCES += ../libs/gl3w/GL/gl3w.c 22 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 23 | 24 | UNAME_S := $(shell uname -s) 25 | 26 | 27 | ifeq ($(UNAME_S), Linux) #LINUX 28 | ECHO_MESSAGE = "Linux" 29 | LIBS = -lGL `pkg-config --static --libs glfw3` 30 | 31 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3` 32 | CXXFLAGS += -Wall -Wformat 33 | CFLAGS = $(CXXFLAGS) 34 | endif 35 | 36 | ifeq ($(UNAME_S), Darwin) #APPLE 37 | ECHO_MESSAGE = "Mac OS X" 38 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 39 | #LIBS += -L/usr/local/lib -lglfw3 40 | LIBS += -L/usr/local/lib -lglfw 41 | 42 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w -I/usr/local/include 43 | CXXFLAGS += -Wall -Wformat 44 | CFLAGS = $(CXXFLAGS) 45 | endif 46 | 47 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 48 | ECHO_MESSAGE = "Windows" 49 | LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32 50 | 51 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3` 52 | CXXFLAGS += -Wall -Wformat 53 | CFLAGS = $(CXXFLAGS) 54 | endif 55 | 56 | 57 | %.o:%.cpp 58 | $(CXX) $(CXXFLAGS) -c -o $@ $< 59 | 60 | %.o:../%.cpp 61 | $(CXX) $(CXXFLAGS) -c -o $@ $< 62 | 63 | %.o:../../%.cpp 64 | $(CXX) $(CXXFLAGS) -c -o $@ $< 65 | 66 | %.o:../libs/gl3w/GL/%.c 67 | $(CC) $(CFLAGS) -c -o $@ $< 68 | 69 | all: $(EXE) 70 | @echo Build complete for $(ECHO_MESSAGE) 71 | 72 | $(EXE): $(OBJS) 73 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 74 | 75 | clean: 76 | rm -f $(EXE) $(OBJS) 77 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | gl3w 47 | 48 | 49 | gl3w 50 | 51 | 52 | imgui 53 | 54 | 55 | sources 56 | 57 | 58 | sources 59 | 60 | 61 | 62 | 63 | 64 | sources 65 | 66 | 67 | -------------------------------------------------------------------------------- /ext/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 | // (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.) 5 | 6 | #include "imgui.h" 7 | #include "imgui_impl_glfw.h" 8 | #include "imgui_impl_opengl3.h" 9 | #include 10 | 11 | #include // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc. 12 | //#include 13 | //#include 14 | //#include 15 | 16 | #include // Include glfw3.h after our OpenGL definitions 17 | 18 | static void glfw_error_callback(int error, const char* description) 19 | { 20 | fprintf(stderr, "Glfw Error %d: %s\n", error, description); 21 | } 22 | 23 | int main(int, char**) 24 | { 25 | // Setup window 26 | glfwSetErrorCallback(glfw_error_callback); 27 | if (!glfwInit()) 28 | return 1; 29 | 30 | // Decide GL+GLSL versions 31 | #if __APPLE__ 32 | // GL 3.2 + GLSL 150 33 | const char* glsl_version = "#version 150"; 34 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 35 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); 36 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only 37 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac 38 | #else 39 | // GL 3.0 + GLSL 130 40 | const char* glsl_version = "#version 130"; 41 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 42 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); 43 | //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only 44 | //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only 45 | #endif 46 | 47 | // Create window with graphics context 48 | GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+OpenGL3 example", NULL, NULL); 49 | if (window == NULL) 50 | return 1; 51 | glfwMakeContextCurrent(window); 52 | glfwSwapInterval(1); // Enable vsync 53 | gl3wInit(); 54 | 55 | // Setup Dear ImGui binding 56 | IMGUI_CHECKVERSION(); 57 | ImGui::CreateContext(); 58 | ImGuiIO& io = ImGui::GetIO(); (void)io; 59 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 60 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls 61 | 62 | ImGui_ImplGlfw_InitForOpenGL(window, true); 63 | ImGui_ImplOpenGL3_Init(glsl_version); 64 | 65 | // Setup style 66 | ImGui::StyleColorsDark(); 67 | //ImGui::StyleColorsClassic(); 68 | 69 | // Load Fonts 70 | // - 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. 71 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 72 | // - 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). 73 | // - 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. 74 | // - Read 'misc/fonts/README.txt' for more instructions and details. 75 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 76 | //io.Fonts->AddFontDefault(); 77 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 78 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 79 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 80 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 81 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 82 | //IM_ASSERT(font != NULL); 83 | 84 | bool show_demo_window = true; 85 | bool show_another_window = false; 86 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 87 | 88 | // Main loop 89 | while (!glfwWindowShouldClose(window)) 90 | { 91 | // Poll and handle events (inputs, window resize, etc.) 92 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 93 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 94 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 95 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 96 | glfwPollEvents(); 97 | 98 | // Start the ImGui frame 99 | ImGui_ImplOpenGL3_NewFrame(); 100 | ImGui_ImplGlfw_NewFrame(); 101 | ImGui::NewFrame(); 102 | 103 | // 1. Show a simple window. 104 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 105 | { 106 | static float f = 0.0f; 107 | static int counter = 0; 108 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 109 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 110 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 111 | 112 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 113 | ImGui::Checkbox("Another Window", &show_another_window); 114 | 115 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 116 | counter++; 117 | ImGui::SameLine(); 118 | ImGui::Text("counter = %d", counter); 119 | 120 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 121 | } 122 | 123 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 124 | if (show_another_window) 125 | { 126 | ImGui::Begin("Another Window", &show_another_window); 127 | ImGui::Text("Hello from another window!"); 128 | if (ImGui::Button("Close Me")) 129 | show_another_window = false; 130 | ImGui::End(); 131 | } 132 | 133 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 134 | if (show_demo_window) 135 | { 136 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 137 | ImGui::ShowDemoWindow(&show_demo_window); 138 | } 139 | 140 | // Rendering 141 | ImGui::Render(); 142 | int display_w, display_h; 143 | glfwMakeContextCurrent(window); 144 | glfwGetFramebufferSize(window, &display_w, &display_h); 145 | glViewport(0, 0, display_w, display_h); 146 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 147 | glClear(GL_COLOR_BUFFER_BIT); 148 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); 149 | 150 | glfwMakeContextCurrent(window); 151 | glfwSwapBuffers(window); 152 | } 153 | 154 | // Cleanup 155 | ImGui_ImplOpenGL3_Shutdown(); 156 | ImGui_ImplGlfw_Shutdown(); 157 | ImGui::DestroyContext(); 158 | 159 | glfwDestroyWindow(window); 160 | glfwTerminate(); 161 | 162 | return 0; 163 | } 164 | -------------------------------------------------------------------------------- /ext/imgui/examples/example_glfw_opengles3/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_opengles3 18 | SOURCES = main.cpp 19 | SOURCES += ../imgui_impl_glfw.cpp ../imgui_impl_opengles3.cpp 20 | SOURCES += ../../imgui.cpp ../../imgui_demo.cpp ../../imgui_draw.cpp 21 | SOURCES += ../libs/gl3w/GL/gl3w.c 22 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 23 | 24 | UNAME_S := $(shell uname -s) 25 | 26 | 27 | ifeq ($(UNAME_S), Linux) #LINUX 28 | ECHO_MESSAGE = "Linux" 29 | LIBS = -lEGL -lGLESv2 `pkg-config --static --libs glfw3` 30 | 31 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3` 32 | CXXFLAGS += -Wall -Wformat -D__EGL__ 33 | CFLAGS = $(CXXFLAGS) 34 | endif 35 | 36 | ifeq ($(UNAME_S), Darwin) #APPLE 37 | ECHO_MESSAGE = "Mac OS X" 38 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo 39 | #LIBS += -L/usr/local/lib -lglfw3 40 | LIBS += -L/usr/local/lib -lglfw 41 | 42 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w -I/usr/local/include 43 | CXXFLAGS += -Wall -Wformat 44 | CFLAGS = $(CXXFLAGS) 45 | endif 46 | 47 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 48 | ECHO_MESSAGE = "Windows" 49 | LIBS = -lglfw3 -lgdi32 -lopengl32 -limm32 50 | 51 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags glfw3` 52 | CXXFLAGS += -Wall -Wformat 53 | CFLAGS = $(CXXFLAGS) 54 | endif 55 | 56 | 57 | %.o:%.cpp 58 | $(CXX) $(CXXFLAGS) -c -o $@ $< 59 | 60 | %.o:../%.cpp 61 | $(CXX) $(CXXFLAGS) -c -o $@ $< 62 | 63 | %.o:../../%.cpp 64 | $(CXX) $(CXXFLAGS) -c -o $@ $< 65 | 66 | %.o:../libs/gl3w/GL/%.c 67 | $(CC) $(CFLAGS) -c -o $@ $< 68 | 69 | all: $(EXE) 70 | @echo Build complete for $(ECHO_MESSAGE) 71 | 72 | $(EXE): $(OBJS) 73 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 74 | 75 | clean: 76 | rm -f $(EXE) $(OBJS) 77 | -------------------------------------------------------------------------------- /ext/imgui/examples/example_glfw_opengles3/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 | // (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.) 5 | 6 | #include "imgui.h" 7 | #include "imgui_impl_glfw.h" 8 | #include "imgui_impl_opengles3.h" 9 | #include 10 | 11 | #include // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc. 12 | //#include 13 | //#include 14 | //#include 15 | 16 | #include // Include glfw3.h after our OpenGL definitions 17 | 18 | static void glfw_error_callback(int error, const char* description) 19 | { 20 | fprintf(stderr, "Glfw Error %d: %s\n", error, description); 21 | } 22 | 23 | int main(int, char**) 24 | { 25 | // Setup window 26 | glfwSetErrorCallback(glfw_error_callback); 27 | if (!glfwInit()) 28 | return 1; 29 | 30 | // Decide GL+GLSL versions 31 | #if __APPLE__ 32 | // GL 3.2 + GLSL 150 33 | const char* glsl_version = "#version 150"; 34 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 35 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); 36 | glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only 37 | glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // Required on Mac 38 | #else 39 | // GLES 3.0 + GLSL 100 40 | const char* glsl_version = "#version 100"; 41 | glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); 42 | glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); 43 | glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); 44 | glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); 45 | //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // 3.2+ only 46 | //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); // 3.0+ only 47 | #endif 48 | 49 | // Create window with graphics context 50 | GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui GLFW+OpenGLES3 example", NULL, NULL); 51 | if (window == NULL) 52 | return 1; 53 | glfwMakeContextCurrent(window); 54 | glfwSwapInterval(1); // Enable vsync 55 | gl3wInit(); 56 | 57 | // Setup Dear ImGui binding 58 | IMGUI_CHECKVERSION(); 59 | ImGui::CreateContext(); 60 | ImGuiIO& io = ImGui::GetIO(); (void)io; 61 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 62 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls 63 | 64 | ImGui_ImplGlfw_InitForOpenGL(window, true); 65 | ImGui_ImplOpenGL3_Init(glsl_version); 66 | 67 | // Setup style 68 | ImGui::StyleColorsDark(); 69 | //ImGui::StyleColorsClassic(); 70 | 71 | // Load Fonts 72 | // - 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. 73 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 74 | // - 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). 75 | // - 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. 76 | // - Read 'misc/fonts/README.txt' for more instructions and details. 77 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 78 | //io.Fonts->AddFontDefault(); 79 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 80 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 81 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 82 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 83 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 84 | //IM_ASSERT(font != NULL); 85 | 86 | bool show_demo_window = true; 87 | bool show_another_window = false; 88 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 89 | 90 | // Main loop 91 | while (!glfwWindowShouldClose(window)) 92 | { 93 | // Poll and handle events (inputs, window resize, etc.) 94 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 95 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 96 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 97 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 98 | glfwPollEvents(); 99 | 100 | // Start the ImGui frame 101 | ImGui_ImplOpenGL3_NewFrame(); 102 | ImGui_ImplGlfw_NewFrame(); 103 | ImGui::NewFrame(); 104 | 105 | // 1. Show a simple window. 106 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 107 | { 108 | static float f = 0.0f; 109 | static int counter = 0; 110 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 111 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 112 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 113 | 114 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 115 | ImGui::Checkbox("Another Window", &show_another_window); 116 | 117 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 118 | counter++; 119 | ImGui::SameLine(); 120 | ImGui::Text("counter = %d", counter); 121 | 122 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 123 | } 124 | 125 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 126 | if (show_another_window) 127 | { 128 | ImGui::Begin("Another Window", &show_another_window); 129 | ImGui::Text("Hello from another window!"); 130 | if (ImGui::Button("Close Me")) 131 | show_another_window = false; 132 | ImGui::End(); 133 | } 134 | 135 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 136 | if (show_demo_window) 137 | { 138 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 139 | ImGui::ShowDemoWindow(&show_demo_window); 140 | } 141 | 142 | // Rendering 143 | ImGui::Render(); 144 | int display_w, display_h; 145 | glfwMakeContextCurrent(window); 146 | glfwGetFramebufferSize(window, &display_w, &display_h); 147 | glViewport(0, 0, display_w, display_h); 148 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 149 | glClear(GL_COLOR_BUFFER_BIT); 150 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); 151 | 152 | glfwMakeContextCurrent(window); 153 | glfwSwapBuffers(window); 154 | } 155 | 156 | // Cleanup 157 | ImGui_ImplOpenGL3_Shutdown(); 158 | ImGui_ImplGlfw_Shutdown(); 159 | ImGui::DestroyContext(); 160 | 161 | glfwDestroyWindow(window); 162 | glfwTerminate(); 163 | 164 | return 0; 165 | } 166 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 ImGui frame 64 | ImGui_Marmalade_NewFrame(); 65 | ImGui::NewFrame(); 66 | 67 | // 1. Show a simple window. 68 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 69 | { 70 | static float f = 0.0f; 71 | static int counter = 0; 72 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 73 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 74 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 75 | 76 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 77 | ImGui::Checkbox("Another Window", &show_another_window); 78 | 79 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 80 | counter++; 81 | ImGui::SameLine(); 82 | ImGui::Text("counter = %d", counter); 83 | 84 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 85 | } 86 | 87 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 88 | if (show_another_window) 89 | { 90 | ImGui::Begin("Another Window", &show_another_window); 91 | ImGui::Text("Hello from another window!"); 92 | if (ImGui::Button("Close Me")) 93 | show_another_window = false; 94 | ImGui::End(); 95 | } 96 | 97 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 98 | if (show_demo_window) 99 | { 100 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 101 | ImGui::ShowDemoWindow(&show_demo_window); 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 | -------------------------------------------------------------------------------- /ext/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 | ../../imconfig.h 37 | ../../imgui.h 38 | ../../imgui_internal.h 39 | 40 | ["imgui","Marmalade binding"] 41 | ../imgui_impl_marmalade.h 42 | ../imgui_impl_marmalade.cpp 43 | main.cpp 44 | 45 | } 46 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 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 | -------------------------------------------------------------------------------- /ext/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 ..\.. 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 ../.. 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 ../.. main.cpp ../imgui_impl_sdl.cpp ../imgui_impl_opengl2.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl 22 | ``` 23 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 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 | -------------------------------------------------------------------------------- /ext/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("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 ImGui frame 87 | ImGui_ImplOpenGL2_NewFrame(); 88 | ImGui_ImplSDL2_NewFrame(window); 89 | ImGui::NewFrame(); 90 | 91 | // 1. Show a simple window. 92 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 93 | { 94 | static float f = 0.0f; 95 | static int counter = 0; 96 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 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 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 101 | ImGui::Checkbox("Another Window", &show_another_window); 102 | 103 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 104 | counter++; 105 | ImGui::SameLine(); 106 | ImGui::Text("counter = %d", counter); 107 | 108 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 109 | } 110 | 111 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 112 | if (show_another_window) 113 | { 114 | ImGui::Begin("Another Window", &show_another_window); 115 | ImGui::Text("Hello from another window!"); 116 | if (ImGui::Button("Close Me")) 117 | show_another_window = false; 118 | ImGui::End(); 119 | } 120 | 121 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 122 | if (show_demo_window) 123 | { 124 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 125 | ImGui::ShowDemoWindow(&show_demo_window); 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 | -------------------------------------------------------------------------------- /ext/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 21 | SOURCES += ../libs/gl3w/GL/gl3w.c 22 | OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES)))) 23 | 24 | UNAME_S := $(shell uname -s) 25 | 26 | 27 | ifeq ($(UNAME_S), Linux) #LINUX 28 | ECHO_MESSAGE = "Linux" 29 | LIBS = -lGL -ldl `sdl2-config --libs` 30 | 31 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `sdl2-config --cflags` 32 | CXXFLAGS += -Wall -Wformat 33 | CFLAGS = $(CXXFLAGS) 34 | endif 35 | 36 | ifeq ($(UNAME_S), Darwin) #APPLE 37 | ECHO_MESSAGE = "Mac OS X" 38 | LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs` 39 | 40 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w -I/usr/local/include `sdl2-config --cflags` 41 | CXXFLAGS += -Wall -Wformat 42 | CFLAGS = $(CXXFLAGS) 43 | endif 44 | 45 | ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) 46 | ECHO_MESSAGE = "Windows" 47 | LIBS = -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` 48 | 49 | CXXFLAGS = -I../ -I../../ -I../libs/gl3w `pkg-config --cflags sdl2` 50 | CXXFLAGS += -Wall -Wformat 51 | CFLAGS = $(CXXFLAGS) 52 | endif 53 | 54 | 55 | %.o:%.cpp 56 | $(CXX) $(CXXFLAGS) -c -o $@ $< 57 | 58 | %.o:../%.cpp 59 | $(CXX) $(CXXFLAGS) -c -o $@ $< 60 | 61 | %.o:../../%.cpp 62 | $(CXX) $(CXXFLAGS) -c -o $@ $< 63 | 64 | %.o:../libs/gl3w/GL/%.c 65 | $(CC) $(CFLAGS) -c -o $@ $< 66 | 67 | all: $(EXE) 68 | @echo Build complete for $(ECHO_MESSAGE) 69 | 70 | $(EXE): $(OBJS) 71 | $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) 72 | 73 | clean: 74 | rm -f $(EXE) $(OBJS) 75 | -------------------------------------------------------------------------------- /ext/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 ..\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 ../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 ../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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 39 | 40 | imgui 41 | 42 | 43 | imgui 44 | 45 | 46 | imgui 47 | 48 | 49 | gl3w 50 | 51 | 52 | gl3w 53 | 54 | 55 | sources 56 | 57 | 58 | sources 59 | 60 | 61 | 62 | 63 | 64 | sources 65 | 66 | 67 | -------------------------------------------------------------------------------- /ext/imgui/examples/example_sdl_opengl3/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 | // (GL3W is a helper library to access OpenGL functions since there is no standard header to access modern OpenGL functions easily. Alternatives are GLEW, Glad, etc.) 5 | 6 | #include "imgui.h" 7 | #include "imgui_impl_sdl.h" 8 | #include "imgui_impl_opengl3.h" 9 | #include 10 | #include 11 | 12 | #include // This example is using gl3w to access OpenGL functions. You may use another OpenGL loader/header such as: glew, glext, glad, glLoadGen, etc. 13 | //#include 14 | //#include 15 | //#include 16 | 17 | int main(int, char**) 18 | { 19 | // Setup SDL 20 | if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) != 0) 21 | { 22 | printf("Error: %s\n", SDL_GetError()); 23 | return -1; 24 | } 25 | 26 | // Decide GL+GLSL versions 27 | #if __APPLE__ 28 | // GL 3.2 Core + GLSL 150 29 | const char* glsl_version = "#version 150"; 30 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac 31 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); 32 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); 33 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); 34 | #else 35 | // GL 3.0 + GLSL 130 36 | const char* glsl_version = "#version 130"; 37 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); 38 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); 39 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); 40 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); 41 | #endif 42 | 43 | // Create window with graphics context 44 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); 45 | SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); 46 | SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); 47 | SDL_DisplayMode current; 48 | SDL_GetCurrentDisplayMode(0, ¤t); 49 | SDL_Window* window = SDL_CreateWindow("ImGui SDL2+OpenGL3 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL|SDL_WINDOW_RESIZABLE); 50 | SDL_GLContext gl_context = SDL_GL_CreateContext(window); 51 | SDL_GL_SetSwapInterval(1); // Enable vsync 52 | gl3wInit(); 53 | 54 | // Setup Dear ImGui binding 55 | IMGUI_CHECKVERSION(); 56 | ImGui::CreateContext(); 57 | ImGuiIO& io = ImGui::GetIO(); (void)io; 58 | //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls 59 | 60 | ImGui_ImplSDL2_InitForOpenGL(window, gl_context); 61 | ImGui_ImplOpenGL3_Init(glsl_version); 62 | 63 | // Setup style 64 | ImGui::StyleColorsDark(); 65 | //ImGui::StyleColorsClassic(); 66 | 67 | // Load Fonts 68 | // - 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. 69 | // - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple. 70 | // - 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). 71 | // - 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. 72 | // - Read 'misc/fonts/README.txt' for more instructions and details. 73 | // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ ! 74 | //io.Fonts->AddFontDefault(); 75 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f); 76 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f); 77 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f); 78 | //io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f); 79 | //ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese()); 80 | //IM_ASSERT(font != NULL); 81 | 82 | bool show_demo_window = true; 83 | bool show_another_window = false; 84 | ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); 85 | 86 | // Main loop 87 | bool done = false; 88 | while (!done) 89 | { 90 | // Poll and handle events (inputs, window resize, etc.) 91 | // You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs. 92 | // - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. 93 | // - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. 94 | // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags. 95 | SDL_Event event; 96 | while (SDL_PollEvent(&event)) 97 | { 98 | ImGui_ImplSDL2_ProcessEvent(&event); 99 | if (event.type == SDL_QUIT) 100 | done = true; 101 | if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window)) 102 | done = true; 103 | } 104 | 105 | // Start the ImGui frame 106 | ImGui_ImplOpenGL3_NewFrame(); 107 | ImGui_ImplSDL2_NewFrame(window); 108 | ImGui::NewFrame(); 109 | 110 | // 1. Show a simple window. 111 | // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets automatically appears in a window called "Debug". 112 | { 113 | static float f = 0.0f; 114 | static int counter = 0; 115 | ImGui::Text("Hello, world!"); // Display some text (you can use a format string too) 116 | ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f 117 | ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color 118 | 119 | ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our windows open/close state 120 | ImGui::Checkbox("Another Window", &show_another_window); 121 | 122 | if (ImGui::Button("Button")) // Buttons return true when clicked (NB: most widgets return true when edited/activated) 123 | counter++; 124 | ImGui::SameLine(); 125 | ImGui::Text("counter = %d", counter); 126 | 127 | ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); 128 | } 129 | 130 | // 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows. 131 | if (show_another_window) 132 | { 133 | ImGui::Begin("Another Window", &show_another_window); 134 | ImGui::Text("Hello from another window!"); 135 | if (ImGui::Button("Close Me")) 136 | show_another_window = false; 137 | ImGui::End(); 138 | } 139 | 140 | // 3. Show the ImGui demo window. Most of the sample code is in ImGui::ShowDemoWindow(). Read its code to learn more about Dear ImGui! 141 | if (show_demo_window) 142 | { 143 | ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiCond_FirstUseEver); // Normally user code doesn't need/want to call this because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly! 144 | ImGui::ShowDemoWindow(&show_demo_window); 145 | } 146 | 147 | // Rendering 148 | ImGui::Render(); 149 | SDL_GL_MakeCurrent(window, gl_context); 150 | glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y); 151 | glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w); 152 | glClear(GL_COLOR_BUFFER_BIT); 153 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); 154 | SDL_GL_SwapWindow(window); 155 | } 156 | 157 | // Cleanup 158 | ImGui_ImplOpenGL3_Shutdown(); 159 | ImGui_ImplSDL2_Shutdown(); 160 | ImGui::DestroyContext(); 161 | 162 | SDL_GL_DeleteContext(gl_context); 163 | SDL_DestroyWindow(window); 164 | SDL_Quit(); 165 | 166 | return 0; 167 | } 168 | -------------------------------------------------------------------------------- /ext/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 | 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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 49 | 50 | 51 | sources 52 | 53 | 54 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 49 | 50 | 51 | sources 52 | 53 | 54 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/imgui/examples/example_win32_directx9/example_win32_directx9.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {4165A294-21F2-44CA-9B38-E3F935ABADF5} 23 | example_win32_directx9 24 | 25 | 26 | 27 | Application 28 | true 29 | Unicode 30 | 31 | 32 | Application 33 | true 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | false 45 | true 46 | Unicode 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | $(ProjectDir)$(Configuration)\ 66 | $(ProjectDir)$(Configuration)\ 67 | 68 | 69 | $(ProjectDir)$(Configuration)\ 70 | $(ProjectDir)$(Configuration)\ 71 | 72 | 73 | $(ProjectDir)$(Configuration)\ 74 | $(ProjectDir)$(Configuration)\ 75 | 76 | 77 | $(ProjectDir)$(Configuration)\ 78 | $(ProjectDir)$(Configuration)\ 79 | 80 | 81 | 82 | Level4 83 | Disabled 84 | ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include; 85 | 86 | 87 | true 88 | $(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) 89 | d3d9.lib;%(AdditionalDependencies) 90 | Console 91 | 92 | 93 | 94 | 95 | Level4 96 | Disabled 97 | ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include; 98 | 99 | 100 | true 101 | $(DXSDK_DIR)Lib\x64;%(AdditionalLibraryDirectories) 102 | d3d9.lib;%(AdditionalDependencies) 103 | Console 104 | 105 | 106 | 107 | 108 | Level4 109 | MaxSpeed 110 | true 111 | true 112 | ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include; 113 | false 114 | 115 | 116 | true 117 | true 118 | true 119 | $(DXSDK_DIR)Lib\x86;%(AdditionalLibraryDirectories) 120 | d3d9.lib;%(AdditionalDependencies) 121 | Console 122 | 123 | 124 | 125 | 126 | Level4 127 | MaxSpeed 128 | true 129 | true 130 | ..\..;..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include; 131 | false 132 | 133 | 134 | true 135 | true 136 | true 137 | $(DXSDK_DIR)Lib\x64;%(AdditionalLibraryDirectories) 138 | d3d9.lib;%(AdditionalDependencies) 139 | Console 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /ext/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 | 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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/imgui/examples/imgui_impl_opengl3.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: OpenGL3 (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 GLSL version: 13 | // The 'glsl_version' initialization parameter defaults to "#version 130" if NULL. 14 | // Only override if your GL version doesn't handle this GLSL version (see table at the top of imgui_impl_opengl3.cpp). Keep NULL if unsure! 15 | 16 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); 17 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 18 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 19 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 20 | 21 | // Called by Init/NewFrame/Shutdown 22 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 23 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 24 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 25 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 26 | -------------------------------------------------------------------------------- /ext/imgui/examples/imgui_impl_opengles3.h: -------------------------------------------------------------------------------- 1 | // ImGui Renderer for: OpenGL3 (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 GLSL version: 13 | // The 'glsl_version' initialization parameter defaults to "#version 130" if NULL. 14 | // Only override if your GL version doesn't handle this GLSL version (see table at the top of imgui_impl_opengl3.cpp). Keep NULL if unsure! 15 | 16 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_Init(const char* glsl_version = NULL); 17 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_Shutdown(); 18 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_NewFrame(); 19 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data); 20 | 21 | // Called by Init/NewFrame/Shutdown 22 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateFontsTexture(); 23 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyFontsTexture(); 24 | IMGUI_IMPL_API bool ImGui_ImplOpenGL3_CreateDeviceObjects(); 25 | IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects(); 26 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | #include 12 | 13 | #define IMGUI_VK_QUEUED_FRAMES 2 14 | 15 | struct ImGui_ImplVulkan_InitInfo 16 | { 17 | VkInstance Instance; 18 | VkPhysicalDevice PhysicalDevice; 19 | VkDevice Device; 20 | uint32_t QueueFamily; 21 | VkQueue Queue; 22 | VkPipelineCache PipelineCache; 23 | VkDescriptorPool DescriptorPool; 24 | const VkAllocationCallbacks* Allocator; 25 | void (*CheckVkResultFn)(VkResult err); 26 | }; 27 | 28 | IMGUI_IMPL_API bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass render_pass); 29 | IMGUI_IMPL_API void ImGui_ImplVulkan_Shutdown(); 30 | IMGUI_IMPL_API void ImGui_ImplVulkan_NewFrame(); 31 | IMGUI_IMPL_API void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer command_buffer); 32 | 33 | // Called by Init/NewFrame/Shutdown 34 | IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateFontUploadObjects(); 35 | IMGUI_IMPL_API void ImGui_ImplVulkan_InvalidateDeviceObjects(); 36 | IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer); 37 | IMGUI_IMPL_API bool ImGui_ImplVulkan_CreateDeviceObjects(); 38 | 39 | //------------------------------------------------------------------------- 40 | // Miscellaneous Vulkan Helpers 41 | // Generally we try to NOT provide any kind of superfluous high-level helpers in the examples. 42 | // But for the upcoming multi-viewport feature, the Vulkan will need this code anyway, so we decided to shared it and use it in the examples' main.cpp 43 | // If your application/engine already has code to create all that data (swap chain, render pass, frame buffers, etc.) you can ignore all of this. 44 | //------------------------------------------------------------------------- 45 | // NB: Those functions do NOT use any of the state used/affected by the regular ImGui_ImplVulkan_XXX functions. 46 | //------------------------------------------------------------------------- 47 | 48 | struct ImGui_ImplVulkanH_FrameData; 49 | struct ImGui_ImplVulkanH_WindowData; 50 | 51 | IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateWindowDataCommandBuffers(VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator); 52 | IMGUI_IMPL_API void ImGui_ImplVulkanH_CreateWindowDataSwapChainAndFramebuffer(VkPhysicalDevice physical_device, VkDevice device, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator, int w, int h); 53 | IMGUI_IMPL_API void ImGui_ImplVulkanH_DestroyWindowData(VkInstance instance, VkDevice device, ImGui_ImplVulkanH_WindowData* wd, const VkAllocationCallbacks* allocator); 54 | IMGUI_IMPL_API VkSurfaceFormatKHR ImGui_ImplVulkanH_SelectSurfaceFormat(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkFormat* request_formats, int request_formats_count, VkColorSpaceKHR request_color_space); 55 | IMGUI_IMPL_API VkPresentModeKHR ImGui_ImplVulkanH_SelectPresentMode(VkPhysicalDevice physical_device, VkSurfaceKHR surface, const VkPresentModeKHR* request_modes, int request_modes_count); 56 | IMGUI_IMPL_API int ImGui_ImplVulkanH_GetMinImageCountFromPresentMode(VkPresentModeKHR present_mode); 57 | 58 | struct ImGui_ImplVulkanH_FrameData 59 | { 60 | uint32_t BackbufferIndex; // keep track of recently rendered swapchain frame indices 61 | VkCommandPool CommandPool; 62 | VkCommandBuffer CommandBuffer; 63 | VkFence Fence; 64 | VkSemaphore ImageAcquiredSemaphore; 65 | VkSemaphore RenderCompleteSemaphore; 66 | 67 | IMGUI_IMPL_API ImGui_ImplVulkanH_FrameData(); 68 | }; 69 | 70 | struct ImGui_ImplVulkanH_WindowData 71 | { 72 | int Width; 73 | int Height; 74 | VkSwapchainKHR Swapchain; 75 | VkSurfaceKHR Surface; 76 | VkSurfaceFormatKHR SurfaceFormat; 77 | VkPresentModeKHR PresentMode; 78 | VkRenderPass RenderPass; 79 | bool ClearEnable; 80 | VkClearValue ClearValue; 81 | uint32_t BackBufferCount; 82 | VkImage BackBuffer[16]; 83 | VkImageView BackBufferView[16]; 84 | VkFramebuffer Framebuffer[16]; 85 | uint32_t FrameIndex; 86 | ImGui_ImplVulkanH_FrameData Frames[IMGUI_VK_QUEUED_FRAMES]; 87 | 88 | IMGUI_IMPL_API ImGui_ImplVulkanH_WindowData(); 89 | }; 90 | 91 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/imgui/examples/libs/glfw/lib-vc2010-32/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/examples/libs/glfw/lib-vc2010-32/glfw3.lib -------------------------------------------------------------------------------- /ext/imgui/examples/libs/glfw/lib-vc2010-64/glfw3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/examples/libs/glfw/lib-vc2010-64/glfw3.lib -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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(). 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 (if you needed to convert from one to another anyway) 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 from 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 | -------------------------------------------------------------------------------- /ext/imgui/misc/fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/misc/fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /ext/imgui/misc/fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/misc/fonts/DroidSans.ttf -------------------------------------------------------------------------------- /ext/imgui/misc/fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/misc/fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /ext/imgui/misc/fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/misc/fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /ext/imgui/misc/fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/misc/fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /ext/imgui/misc/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LWSS/peeper/0e6ab5354182737cf0b143e10ad808f8e23c336b/ext/imgui/misc/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /ext/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 | -------------------------------------------------------------------------------- /src/SharedMem.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include "Types.h" 5 | 6 | /** Internal Peeper Header, do not include **/ 7 | 8 | #define SHM_NAME "peeper" 9 | #define SEMAPHORE_NAME "peeper_semaphore" 10 | #define MAX_REQUESTS 2048 11 | #define MAX_TEXT_LEN 256 12 | 13 | enum DrawType 14 | { 15 | DRAW_LINE, 16 | DRAW_RECT, 17 | DRAW_RECT_FILLED, 18 | DRAW_CIRCLE, 19 | DRAW_CIRCLE_FILLED, 20 | DRAW_TEXT 21 | }; 22 | 23 | struct DrawRequest 24 | { 25 | #ifdef __cplusplus 26 | DrawRequest(){} 27 | #endif 28 | int type; 29 | int x0, y0, x1, y1; 30 | int circleSegments; 31 | float circleRadius; 32 | float thickness; 33 | struct Color color; 34 | char text[MAX_TEXT_LEN]; 35 | }; 36 | 37 | struct Settings 38 | { 39 | bool bTest; 40 | }; 41 | 42 | struct SharedRegion 43 | { 44 | uint8_t version; 45 | struct Settings settings; 46 | uint16_t numRequests; 47 | struct DrawRequest requests[MAX_REQUESTS]; 48 | }; 49 | 50 | /**** Each cpp file that includes this file gets these. ****/ 51 | static struct SharedRegion *sharedRegion; 52 | 53 | static int sharedMemoryFD; // /dev/shm file descriptor 54 | static sem_t *semaphore; 55 | /***********************************************************/ -------------------------------------------------------------------------------- /src/Tester.cpp: -------------------------------------------------------------------------------- 1 | // peeper example code 2 | #include 3 | #include 4 | 5 | #include "../client/peeper.h" 6 | 7 | int main() 8 | { 9 | // open and init peeper 10 | int open = Peeper::Open(); 11 | if( open ){ 12 | printf("Peeper open failed! Code: %d\n", open); 13 | return 1; 14 | } 15 | for( int i = 0; i < 50; i++ ){ 16 | Peeper::AddLine( 0, 0, (1920 / 50) * i, 1080, Color(255, 0, 0, 255), 1.0f ); 17 | } 18 | bool filled = false; 19 | for( int i = 0; i < 50; i++ ){ 20 | if( filled ){ 21 | Peeper::AddCircleFilled( (1920/50) * i, 500, Color(255, 0, 0, 255), 20.0f, 10 ); 22 | } else { 23 | Peeper::AddCircle( (1920/50) * i, 500, Color(255, 0, 0, 255), 20.0f, 10, 1.0f ); 24 | } 25 | filled = !filled; 26 | } 27 | 28 | for( int i = 0; i < 50; i++ ){ 29 | if( filled ){ 30 | Peeper::AddRectFilled( (1920/50) * i, 250, ((1920/50) * i) + 30, 270, Color( 0, 255, 0, 255 ) ); 31 | } else { 32 | Peeper::AddRect( (1920/50) * i, 250, ((1920/50) * i) + 30, 270, Color( 0, 255, 0, 255 ), 1.0f ); 33 | } 34 | filled = !filled; 35 | } 36 | 37 | Peeper::AddText(900, 100, Color(255, 165, 0, 255), "This is the Peeper test screen. Enjoy the shapes! This will close in several seconds. Hope you have 1080p lol.\n"); 38 | 39 | Peeper::SubmitDraws(); 40 | sleep(8); 41 | 42 | 43 | // Draw requests are cached in peeper in case of low data update-rate. (ex: your game only updates at 20hz, it will draw the old data until new data is there) 44 | // You need to clear the screen before stopping otherwise it will be left there. 45 | Peeper::ClearDraws(); 46 | 47 | // dont forget to cleanup the objects. 48 | Peeper::Close(); 49 | return 0; 50 | } -------------------------------------------------------------------------------- /src/Types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct Color 4 | { 5 | #ifdef __cplusplus 6 | Color (){} 7 | Color( unsigned char _r, unsigned char _g, unsigned char _b, unsigned char _a ) 8 | { 9 | r = _r; 10 | g = _g; 11 | b = _b; 12 | a = _a; 13 | } 14 | #endif 15 | unsigned char r; 16 | unsigned char g; 17 | unsigned char b; 18 | unsigned char a; 19 | }; --------------------------------------------------------------------------------