mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 16:29:54 +02:00
Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
f4458f7571 | |||
0faf0e6948 | |||
4cdcbbff8c | |||
85c71170af | |||
f18febca11 | |||
4535644fcb | |||
9b6fa29022 | |||
b911f96a56 | |||
dc7cdb3025 | |||
6fecf90e32 | |||
5aaf0cd2dc | |||
3ed38f3313 | |||
00270b837f | |||
37d8d5c5be | |||
40b04a3701 | |||
2177b11682 | |||
ea17240b96 | |||
d369e6b333 | |||
ebe363c951 | |||
6927d5872e | |||
6d89285f59 | |||
0ece471a71 | |||
1d7b0084cb | |||
819c114c34 | |||
7591252607 | |||
037ec09ffe | |||
168a811d11 | |||
441679d9d4 | |||
fe48562171 | |||
8bcf2f25f2 | |||
3220471237 | |||
9c4972ee9d | |||
fc322fde0f | |||
546460cd26 | |||
c2a68bb413 | |||
c51be42f28 | |||
0df8ff6931 |
@ -8,8 +8,8 @@ compiler:
|
||||
- clang
|
||||
|
||||
before_install:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo add-apt-repository -y ppa:pyglfw/pyglfw && sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends libglfw3-dev libglew-dev libxrandr-dev libxi-dev libxxf86vm-dev; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install glew && brew install glfw3; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo add-apt-repository -y ppa:pyglfw/pyglfw && sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends libglfw3-dev libxrandr-dev libxi-dev libxxf86vm-dev; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install glfw3; fi
|
||||
|
||||
script:
|
||||
- make -C examples/opengl_example
|
||||
|
@ -36,9 +36,13 @@ Gallery
|
||||

|
||||

|
||||
|
||||
ImGui can load TTF fonts. UTF-8 is supported for text display and input. Here using Arial Unicode font to display Japanese:
|
||||
ImGui can load TTF fonts. UTF-8 is supported for text display and input. Here using Arial Unicode font to display Japanese. Initialize custom font with:
|
||||
|
||||

|
||||
```
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->AddFontFromFileTTF("ArialUni.ttf", 18.0f, io.Fonts->GetGlyphRangesJapanese());
|
||||
```
|
||||

|
||||
|
||||
References
|
||||
----------
|
||||
|
16
examples/README.txt
Normal file
16
examples/README.txt
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
directx9_example/
|
||||
DirectX9 example application (Windows).
|
||||
|
||||
directx11_example/
|
||||
DirectX11 example (Windows).
|
||||
|
||||
opengl_example/
|
||||
OpenGL exemple, using fixed pipeline (Windows/OSX/Linux etc., using glfw+glew)
|
||||
This is simple and should work for all OpenGL enabled applications.
|
||||
|
||||
opengl3_example/
|
||||
OpenGL exemple, using programmable pipeline (Windows/OSX/Linux etc., using glfw+glew)
|
||||
This uses more modern calls and custom shaders.
|
||||
I don't think there is an advantage using this over the "simpler example, but it is provided for information.
|
||||
|
@ -36,7 +36,14 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
@ -582,7 +582,7 @@ int main(int argc, char** argv)
|
||||
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
|
||||
if (show_test_window)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCondition_FirstUseEver); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
|
||||
ImGui::ShowTestWindow(&show_test_window);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,14 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
@ -348,7 +348,7 @@ int main(int argc, char** argv)
|
||||
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
|
||||
if (show_test_window)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCondition_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::ShowTestWindow(&show_test_window);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,7 @@
|
||||
#
|
||||
#
|
||||
# if you using Mac OS X:
|
||||
# You should install glew via homebrew
|
||||
# brew install glew
|
||||
# Also you'll need glfw
|
||||
# You'll need glfw
|
||||
# http://www.glfw.org
|
||||
#
|
||||
|
||||
@ -15,27 +13,30 @@
|
||||
|
||||
OBJS = main.o
|
||||
OBJS += ../../imgui.o
|
||||
OBJS += ../opengl_example/gl3w/GL/gl3w.o
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
|
||||
ifeq ($(UNAME_S), Linux) #LINUX
|
||||
ECHO_MESSAGE = "Linux"
|
||||
CXXFLAGS = -I../../ `pkg-config --cflags glfw3`
|
||||
LIBS = `pkg-config --static --libs glfw3`
|
||||
|
||||
CXXFLAGS = -I../../ -I../opengl_example/gl3w `pkg-config --cflags glfw3`
|
||||
CXXFLAGS += -Wall
|
||||
LIBS = `pkg-config --static --libs glfw3` -lGLEW
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
||||
ECHO_MESSAGE = "Mac OS X"
|
||||
|
||||
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
|
||||
LIBS += -L/usr/local/Cellar/glew/1.10.0/lib -L/usr/local/lib
|
||||
LIBS += -lglew -lglfw3
|
||||
LIBS += -L/usr/local/lib
|
||||
LIBS += -lglfw3
|
||||
|
||||
CXXFLAGS = -I../../ -I/usr/local/Cellar/glew/1.10.0/include -I/usr/local/include
|
||||
CXXFLAGS = -I../../ -I../opengl_example/gl3w -I/usr/local/Cellar/glew/1.10.0/include -I/usr/local/include
|
||||
CXXFLAGS += -Wall
|
||||
# CXXFLAGS += -D__APPLE__
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
.cpp.o:
|
||||
|
@ -10,9 +10,8 @@
|
||||
#include "../../imgui.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// Glfw/Glew
|
||||
#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
// Gl3w/Glfw
|
||||
#include <GL/gl3w.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
|
||||
@ -168,11 +167,7 @@ void InitGL()
|
||||
glfwSetScrollCallback(window, glfw_scroll_callback);
|
||||
glfwSetCharCallback(window, glfw_char_callback);
|
||||
|
||||
glewExperimental = GL_TRUE;
|
||||
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
|
||||
gl3wInit();
|
||||
|
||||
const GLchar *vertex_shader =
|
||||
"#version 330\n"
|
||||
@ -360,7 +355,7 @@ int main(int argc, char** argv)
|
||||
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
|
||||
if (show_test_window)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCondition_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::ShowTestWindow(&show_test_window);
|
||||
}
|
||||
|
||||
|
@ -36,18 +36,26 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\opengl_example\glfw\include;$(ProjectDir)..\opengl_example\glew\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\opengl_example\glfw\include;$(ProjectDir)..\opengl_example\glew\include;$(ProjectDir)..\opengl_example\gl3w;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)..\opengl_example\glfw\lib-msvc100;$(ProjectDir)..\opengl_example\glew\lib\Release\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;glew32s.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@ -56,19 +64,22 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\opengl_example\glfw\include;$(ProjectDir)..\opengl_example\glew\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\opengl_example\glfw\include;$(ProjectDir)..\opengl_example\glew\include;$(ProjectDir)..\opengl_example\gl3w;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)..\opengl_example\glfw\lib-msvc100;$(ProjectDir)..\opengl_example\glew\lib\Release\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;glew32s.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\imgui.cpp" />
|
||||
<ClCompile Include="..\opengl_example\gl3w\GL\gl3w.c" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -16,6 +16,9 @@
|
||||
<ClCompile Include="..\..\imgui.cpp">
|
||||
<Filter>imgui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\opengl_example\gl3w\GL\gl3w.c">
|
||||
<Filter>sources</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\imconfig.h">
|
||||
|
@ -5,9 +5,7 @@
|
||||
#
|
||||
#
|
||||
# if you using Mac OS X:
|
||||
# You should install glew via homebrew
|
||||
# brew install glew
|
||||
# Also you'll need glfw
|
||||
# You'll need glfw
|
||||
# http://www.glfw.org
|
||||
#
|
||||
|
||||
@ -21,21 +19,23 @@ UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S), Linux) #LINUX
|
||||
ECHO_MESSAGE = "Linux"
|
||||
LIBS = `pkg-config --static --libs glfw3`
|
||||
|
||||
CXXFLAGS = -I../../ `pkg-config --cflags glfw3`
|
||||
CXXFLAGS += -Wall
|
||||
LIBS = `pkg-config --static --libs glfw3` -lGLEW
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
||||
ECHO_MESSAGE = "Mac OS X"
|
||||
|
||||
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
|
||||
LIBS += -L/usr/local/Cellar/glew/1.10.0/lib -L/usr/local/lib
|
||||
LIBS += -lglew -lglfw3
|
||||
LIBS += -L/usr/local/lib
|
||||
LIBS += -lglfw3
|
||||
|
||||
CXXFLAGS = -I../../ -I/usr/local/Cellar/glew/1.10.0/include -I/usr/local/include
|
||||
CXXFLAGS = -I../../ -I/usr/local/include
|
||||
CXXFLAGS += -Wall
|
||||
# CXXFLAGS += -D__APPLE__
|
||||
CFLAGS = $(CXXFLAGS)
|
||||
endif
|
||||
|
||||
.cpp.o:
|
||||
|
Binary file not shown.
1339
examples/opengl_example/gl3w/GL/gl3w.c
Normal file
1339
examples/opengl_example/gl3w/GL/gl3w.c
Normal file
File diff suppressed because it is too large
Load Diff
1234
examples/opengl_example/gl3w/GL/gl3w.h
Normal file
1234
examples/opengl_example/gl3w/GL/gl3w.h
Normal file
File diff suppressed because it is too large
Load Diff
4533
examples/opengl_example/gl3w/GL/glcorearb.h
Normal file
4533
examples/opengl_example/gl3w/GL/glcorearb.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,73 +0,0 @@
|
||||
The OpenGL Extension Wrangler Library
|
||||
Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||
Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
Copyright (C) 2002, Lev Povalahev
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of the author may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
Mesa 3-D graphics library
|
||||
Version: 7.0
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Copyright (c) 2007 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
@ -1,18 +0,0 @@
|
||||
See doc/index.html for more information.
|
||||
|
||||
If you downloaded the tarball from the GLEW website, you just need to:
|
||||
|
||||
Unix:
|
||||
|
||||
make
|
||||
|
||||
Windows:
|
||||
|
||||
use the project file in build/vc6/
|
||||
|
||||
If you wish to build GLEW from scratch (update the extension data from
|
||||
the net or add your own extension information), you need a Unix
|
||||
environment (including wget, perl, and GNU make). The extension data
|
||||
is regenerated from the top level source directory with:
|
||||
|
||||
make extensions
|
@ -1,12 +0,0 @@
|
||||
Major:
|
||||
- add support for windows mini-client drivers
|
||||
- add windows installer (msi)
|
||||
- separate build of static and shared object files (for mingw and
|
||||
cygwin)
|
||||
- start designing GLEW 2.0
|
||||
|
||||
Minor:
|
||||
- make auto scripts work with text mode cygwin mounts
|
||||
- add support for all SUN, MTX, and OML extensions
|
||||
- make auto/Makefile more robust against auto/core/*~ mistakes
|
||||
- web poll on separating glew, glxew and wglew
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -10,9 +10,7 @@
|
||||
#include "../../imgui.h"
|
||||
#include <stdio.h>
|
||||
|
||||
// Glfw/Glew
|
||||
#define GLEW_STATIC
|
||||
#include <GL/glew.h>
|
||||
// Glfw
|
||||
#include <GLFW/glfw3.h>
|
||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
||||
|
||||
@ -141,8 +139,6 @@ void InitGL()
|
||||
glfwSetMouseButtonCallback(window, glfw_mouse_button_callback);
|
||||
glfwSetScrollCallback(window, glfw_scroll_callback);
|
||||
glfwSetCharCallback(window, glfw_char_callback);
|
||||
|
||||
glewInit();
|
||||
}
|
||||
|
||||
void LoadFontsTexture()
|
||||
@ -269,7 +265,7 @@ int main(int argc, char** argv)
|
||||
// 3. Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
|
||||
if (show_test_window)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCondition_FirstUseEver);
|
||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
|
||||
ImGui::ShowTestWindow(&show_test_window);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,14 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
@ -46,8 +53,9 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)\glfw\lib-msvc100;$(ProjectDir)\glew\lib\Release\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;glew32s.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@ -63,8 +71,10 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(ProjectDir)\glfw\lib-msvc100;$(ProjectDir)\glew\lib\Release\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;glew32s.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>opengl32.lib;imm32.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -14,6 +14,10 @@
|
||||
//---- Define assertion handler. Defaults to calling assert().
|
||||
//#define IM_ASSERT(_EXPR) MyAssert(_EXPR)
|
||||
|
||||
//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
||||
//#define IMGUI_API __declspec( dllexport )
|
||||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't implement default clipboard handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
|
||||
|
||||
@ -36,7 +40,7 @@
|
||||
|
||||
//---- Freely implement extra functions within the ImGui:: namespace.
|
||||
//---- Declare helpers or widgets implemented in imgui_user.inl or elsewhere, so end-user doesn't need to include multiple files.
|
||||
//---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types.
|
||||
//---- e.g. you can create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers.
|
||||
/*
|
||||
namespace ImGui
|
||||
{
|
||||
|
281
imgui.cpp
281
imgui.cpp
@ -1,4 +1,4 @@
|
||||
// ImGui library v1.33
|
||||
// ImGui library v1.34
|
||||
// See ImGui::ShowTestWindow() for sample code.
|
||||
// Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
|
||||
// Get latest version at https://github.com/ocornut/imgui
|
||||
@ -129,6 +129,8 @@
|
||||
Occasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix.
|
||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||
|
||||
- 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond), kept inline redirection function.
|
||||
- 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once.
|
||||
- 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now.
|
||||
- 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior
|
||||
- 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing()
|
||||
@ -289,7 +291,6 @@
|
||||
- text edit: flag to disable live update of the user buffer.
|
||||
- text edit: field resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
||||
- text edit: add multi-line text edit
|
||||
- tree: reformulate OpenNextNode() into SetNextWindowCollapsed() api
|
||||
- tree: add treenode/treepush int variants? because (void*) cast from int warns on some platforms/settings
|
||||
- settings: write more decent code to allow saving/loading new fields
|
||||
- settings: api for per-tool simple persistent data (bool,int,float) in .ini file
|
||||
@ -416,13 +417,13 @@ static void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool
|
||||
static void RenderCollapseTriangle(ImVec2 p_min, bool opened, float scale = 1.0f, bool shadow = false);
|
||||
|
||||
static void SetFont(ImFont* font);
|
||||
static bool ItemAdd(const ImGuiAabb& aabb, const ImGuiID* id);
|
||||
static bool ItemAdd(const ImGuiAabb& bb, const ImGuiID* id);
|
||||
static void ItemSize(ImVec2 size, ImVec2* adjust_start_offset = NULL);
|
||||
static void ItemSize(const ImGuiAabb& aabb, ImVec2* adjust_start_offset = NULL);
|
||||
static void ItemSize(const ImGuiAabb& bb, ImVec2* adjust_start_offset = NULL);
|
||||
static void PushColumnClipRect(int column_index = -1);
|
||||
static bool IsClipped(const ImGuiAabb& aabb);
|
||||
static bool IsClipped(const ImGuiAabb& bb);
|
||||
|
||||
static bool IsMouseHoveringBox(const ImGuiAabb& box);
|
||||
static bool IsMouseHoveringBox(const ImGuiAabb& bb);
|
||||
static bool IsKeyPressedMap(ImGuiKey key, bool repeat = true);
|
||||
|
||||
static bool CloseWindowButton(bool* p_opened = NULL);
|
||||
@ -889,7 +890,6 @@ struct ImGuiDrawContext
|
||||
ImVector<float> TextWrapPos;
|
||||
ImGuiColorEditMode ColorEditMode;
|
||||
ImGuiStorage* StateStorage;
|
||||
int OpenNextNode; // FIXME: Reformulate this feature like SetNextWindowCollapsed() API
|
||||
|
||||
float ColumnsStartX; // Start position from left of window (increased by TreePush/TreePop, etc.)
|
||||
float ColumnsOffsetX; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
||||
@ -912,7 +912,6 @@ struct ImGuiDrawContext
|
||||
LastItemAabb = ImGuiAabb(0.0f,0.0f,0.0f,0.0f);
|
||||
LastItemHovered = false;
|
||||
StateStorage = NULL;
|
||||
OpenNextNode = -1;
|
||||
|
||||
ColumnsStartX = 0.0f;
|
||||
ColumnsOffsetX = 0.0f;
|
||||
@ -994,17 +993,22 @@ struct ImGuiState
|
||||
ImGuiID ActiveIdPreviousFrame;
|
||||
bool ActiveIdIsAlive;
|
||||
bool ActiveIdIsFocusedOnly; // Set only by active widget. Denote focus but no active interaction.
|
||||
ImGuiWindow* MovedWindow; // Track the child window we clicked on to move a window. Only valid if ActiveID is the "#MOVE" identifier of a window.
|
||||
float SettingsDirtyTimer;
|
||||
ImVector<ImGuiIniData*> Settings;
|
||||
ImVector<ImGuiColMod> ColorModifiers;
|
||||
ImVector<ImGuiStyleMod> StyleModifiers;
|
||||
ImVector<ImFont*> FontStack;
|
||||
|
||||
ImVec2 SetNextWindowPosVal;
|
||||
ImGuiSetCondition SetNextWindowPosCond;
|
||||
ImGuiSetCond SetNextWindowPosCond;
|
||||
ImVec2 SetNextWindowSizeVal;
|
||||
ImGuiSetCondition SetNextWindowSizeCond;
|
||||
ImGuiSetCond SetNextWindowSizeCond;
|
||||
bool SetNextWindowCollapsedVal;
|
||||
ImGuiSetCondition SetNextWindowCollapsedCond;
|
||||
ImGuiSetCond SetNextWindowCollapsedCond;
|
||||
bool SetNextWindowFocus;
|
||||
bool SetNextTreeNodeOpenedVal;
|
||||
ImGuiSetCond SetNextTreeNodeOpenedCond;
|
||||
|
||||
// Render
|
||||
ImVector<ImDrawList*> RenderDrawLists;
|
||||
@ -1049,13 +1053,18 @@ struct ImGuiState
|
||||
ActiveIdPreviousFrame = 0;
|
||||
ActiveIdIsAlive = false;
|
||||
ActiveIdIsFocusedOnly = false;
|
||||
MovedWindow = NULL;
|
||||
SettingsDirtyTimer = 0.0f;
|
||||
|
||||
SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
|
||||
SetNextWindowPosCond = 0;
|
||||
SetNextWindowSizeVal = ImVec2(0.0f, 0.0f);
|
||||
SetNextWindowSizeCond = 0;
|
||||
SetNextWindowCollapsedVal = false;
|
||||
SetNextWindowCollapsedCond = 0;
|
||||
SetNextWindowFocus = false;
|
||||
SetNextTreeNodeOpenedVal = false;
|
||||
SetNextTreeNodeOpenedCond = 0;
|
||||
|
||||
SliderAsInputTextId = 0;
|
||||
ActiveComboID = 0;
|
||||
@ -1096,9 +1105,9 @@ struct ImGuiWindow
|
||||
bool SkipItems; // == Visible && !Collapsed
|
||||
int AutoFitFrames;
|
||||
bool AutoFitOnlyGrows;
|
||||
int SetWindowPosAllowFlags; // bit ImGuiSetCondition_*** specify if SetWindowPos() call is allowed with this particular flag.
|
||||
int SetWindowSizeAllowFlags; // bit ImGuiSetCondition_*** specify if SetWindowSize() call is allowed with this particular flag.
|
||||
int SetWindowCollapsedAllowFlags; // bit ImGuiSetCondition_*** specify if SetWindowCollapsed() call is allowed with this particular flag.
|
||||
int SetWindowPosAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowPos() call is allowed with this particular flag.
|
||||
int SetWindowSizeAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowSize() call is allowed with this particular flag.
|
||||
int SetWindowCollapsedAllowFlags; // bit ImGuiSetCond_*** specify if SetWindowCollapsed() call is allowed with this particular flag.
|
||||
|
||||
ImGuiDrawContext DC;
|
||||
ImVector<ImGuiID> IDStack;
|
||||
@ -1295,7 +1304,6 @@ ImGuiTextFilter::ImGuiTextFilter(const char* default_filter)
|
||||
|
||||
void ImGuiTextFilter::Draw(const char* label, float width)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (width > 0.0f)
|
||||
ImGui::PushItemWidth(width);
|
||||
ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));
|
||||
@ -1430,7 +1438,7 @@ ImGuiWindow::ImGuiWindow(const char* name)
|
||||
SkipItems = false;
|
||||
AutoFitFrames = -1;
|
||||
AutoFitOnlyGrows = false;
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCondition_Always | ImGuiSetCondition_FirstUseThisSession | ImGuiSetCondition_FirstUseEver;
|
||||
SetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiSetCond_Always | ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver;
|
||||
|
||||
IDStack.push_back(ID);
|
||||
LastFrameDrawn = -1;
|
||||
@ -1761,6 +1769,8 @@ void ImGui::NewFrame()
|
||||
SetActiveId(0);
|
||||
g.ActiveIdPreviousFrame = g.ActiveId;
|
||||
g.ActiveIdIsAlive = false;
|
||||
if (!g.ActiveId)
|
||||
g.MovedWindow = NULL;
|
||||
|
||||
// Delay saving settings so we don't spam disk too much
|
||||
if (g.SettingsDirtyTimer > 0.0f)
|
||||
@ -1835,13 +1845,11 @@ void ImGui::NewFrame()
|
||||
}
|
||||
|
||||
// Mark all windows as not visible
|
||||
// Clear root windows at this point.
|
||||
for (size_t i = 0; i != g.Windows.size(); i++)
|
||||
{
|
||||
ImGuiWindow* window = g.Windows[i];
|
||||
window->Visible = false;
|
||||
window->Accessed = false;
|
||||
window->RootWindow = NULL;
|
||||
}
|
||||
|
||||
// No window should be open at the beginning of the frame.
|
||||
@ -1972,9 +1980,13 @@ void ImGui::Render()
|
||||
g.CurrentWindow->Visible = false;
|
||||
ImGui::End();
|
||||
|
||||
// Select window for move/focus when we're done with all our widgets (we only consider non-child windows here)
|
||||
// Select window for move/focus when we're done with all our widgets (we use the root window ID here)
|
||||
if (g.ActiveId == 0 && g.HoveredId == 0 && g.HoveredRootWindow != NULL && g.IO.MouseClicked[0])
|
||||
{
|
||||
IM_ASSERT(g.MovedWindow == NULL);
|
||||
g.MovedWindow = g.HoveredWindow;
|
||||
SetActiveId(g.HoveredRootWindow->GetID("#MOVE"));
|
||||
}
|
||||
|
||||
// Sort the window list so that all child windows are after their parent
|
||||
// We cannot do that on FocusWindow() because childs may not exist yet
|
||||
@ -2346,13 +2358,13 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
|
||||
// Test if mouse cursor is hovering given aabb
|
||||
// NB- Box is clipped by our current clip setting
|
||||
// NB- Expand the aabb to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
|
||||
static bool IsMouseHoveringBox(const ImGuiAabb& box)
|
||||
static bool IsMouseHoveringBox(const ImGuiAabb& bb)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
// Clip
|
||||
ImGuiAabb box_clipped = box;
|
||||
ImGuiAabb box_clipped = bb;
|
||||
if (!window->ClipRectStack.empty())
|
||||
{
|
||||
const ImVec4 clip_rect = window->ClipRectStack.back();
|
||||
@ -2603,10 +2615,11 @@ void ImGui::EndChildFrame()
|
||||
|
||||
static ImGuiWindow* FindWindowByName(const char* name)
|
||||
{
|
||||
// FIXME-OPT: Consider optimizing this (e.g. sorted hashes to window pointers)
|
||||
// FIXME-OPT: Store sorted hashes -> pointers.
|
||||
ImGuiID id = ImCrc32(name, 0, 0);
|
||||
ImGuiState& g = *GImGui;
|
||||
for (size_t i = 0; i != g.Windows.size(); i++)
|
||||
if (strcmp(g.Windows[i]->Name, name) == 0)
|
||||
for (size_t i = 0; i < g.Windows.size(); i++)
|
||||
if (g.Windows[i]->ID == id)
|
||||
return g.Windows[i];
|
||||
return NULL;
|
||||
}
|
||||
@ -2639,9 +2652,9 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
||||
}
|
||||
else
|
||||
{
|
||||
window->SetWindowPosAllowFlags &= ~ImGuiSetCondition_FirstUseEver;
|
||||
window->SetWindowSizeAllowFlags &= ~ImGuiSetCondition_FirstUseEver;
|
||||
window->SetWindowCollapsedAllowFlags &= ~ImGuiSetCondition_FirstUseEver;
|
||||
window->SetWindowPosAllowFlags &= ~ImGuiSetCond_FirstUseEver;
|
||||
window->SetWindowSizeAllowFlags &= ~ImGuiSetCond_FirstUseEver;
|
||||
window->SetWindowCollapsedAllowFlags &= ~ImGuiSetCond_FirstUseEver;
|
||||
}
|
||||
|
||||
if (settings->Pos.x != FLT_MAX)
|
||||
@ -2666,7 +2679,7 @@ static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFl
|
||||
// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file). Note that you can use ## to append unique data that isn't displayed, e.g. "My window##1" will use "My window##1" as unique window ID but display "My window" to the user.
|
||||
// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.
|
||||
// - Passing 'bool* p_opened' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.
|
||||
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCondition_FirstUseEver) prior to calling Begin().
|
||||
// - Passing non-zero 'size' is roughly equivalent to calling SetNextWindowSize(size, ImGuiSetCond_FirstUseEver) prior to calling Begin().
|
||||
bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg_alpha, ImGuiWindowFlags flags)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
@ -2704,11 +2717,16 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
|
||||
ImGui::SetWindowCollapsed(g.SetNextWindowCollapsedVal, g.SetNextWindowCollapsedCond);
|
||||
g.SetNextWindowCollapsedCond = 0;
|
||||
}
|
||||
if (g.SetNextWindowFocus)
|
||||
{
|
||||
ImGui::SetWindowFocus();
|
||||
g.SetNextWindowFocus = false;
|
||||
}
|
||||
|
||||
// Find parent
|
||||
ImGuiWindow* parent_window = (flags & ImGuiWindowFlags_ChildWindow) != 0 ? g.CurrentWindowStack[g.CurrentWindowStack.size()-2] : NULL;
|
||||
|
||||
// Find root (if we are a child window)
|
||||
// Update known root window (if we are a child window, otherwise window == window->RootWindow)
|
||||
size_t root_idx = g.CurrentWindowStack.size() - 1;
|
||||
while (root_idx > 0)
|
||||
{
|
||||
@ -2763,7 +2781,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
|
||||
window->IDStack.resize(0);
|
||||
ImGui::PushID(window);
|
||||
|
||||
// Move window (at the beginning of the frame to avoid input lag or sheering)
|
||||
// Move window (at the beginning of the frame to avoid input lag or sheering). Only valid for root windows.
|
||||
const ImGuiID move_id = window->GetID("#MOVE");
|
||||
RegisterAliveId(move_id);
|
||||
if (g.ActiveId == move_id)
|
||||
@ -2776,11 +2794,13 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
|
||||
if (!(window->Flags & ImGuiWindowFlags_NoSavedSettings))
|
||||
MarkSettingsDirty();
|
||||
}
|
||||
FocusWindow(window);
|
||||
IM_ASSERT(g.MovedWindow != NULL);
|
||||
FocusWindow(g.MovedWindow);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetActiveId(0);
|
||||
g.MovedWindow = NULL; // Not strictly necessary but doing it for sanity.
|
||||
}
|
||||
}
|
||||
|
||||
@ -3028,7 +3048,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size, float bg
|
||||
window->DC.ColumnsCellMinY = window->DC.ColumnsCellMaxY = window->DC.ColumnsStartPos.y;
|
||||
window->DC.TreeDepth = 0;
|
||||
window->DC.StateStorage = &window->StateStorage;
|
||||
window->DC.OpenNextNode = -1;
|
||||
|
||||
// Reset contents size for auto-fitting
|
||||
window->SizeContentsFit = ImVec2(0.0f, 0.0f);
|
||||
@ -3108,7 +3127,7 @@ void ImGui::End()
|
||||
ImGui::LogFinish();
|
||||
|
||||
// Pop
|
||||
// NB: we don't clear 'window->RootWindow' yet, it will be used then cleared in NewFrame()
|
||||
// NB: we don't clear 'window->RootWindow'. The pointer is allowed to live until the next call to Begin().
|
||||
g.CurrentWindowStack.pop_back();
|
||||
g.CurrentWindow = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back();
|
||||
}
|
||||
@ -3117,8 +3136,14 @@ void ImGui::End()
|
||||
static void FocusWindow(ImGuiWindow* window)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
|
||||
// Always mark the window we passed as focused. This is used for keyboard interactions such as tabbing.
|
||||
g.FocusedWindow = window;
|
||||
|
||||
// And move its root window to the top of the pile
|
||||
if (window->RootWindow)
|
||||
window = window->RootWindow;
|
||||
|
||||
if (g.Windows.back() == window)
|
||||
return;
|
||||
|
||||
@ -3379,14 +3404,12 @@ ImVec2 ImGui::GetWindowPos()
|
||||
return window->Pos;
|
||||
}
|
||||
|
||||
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCondition cond)
|
||||
static void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowPosAllowFlags & cond) == 0)
|
||||
return;
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiSetCondition_FirstUseThisSession | ImGuiSetCondition_FirstUseEver);
|
||||
window->SetWindowPosAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver);
|
||||
|
||||
// Set
|
||||
const ImVec2 old_pos = window->Pos;
|
||||
@ -3395,20 +3418,31 @@ void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCondition cond)
|
||||
window->DC.CursorPos += (window->Pos - old_pos); // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor
|
||||
}
|
||||
|
||||
void ImGui::SetWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
SetWindowPos(window, pos, cond);
|
||||
}
|
||||
|
||||
void ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (window)
|
||||
SetWindowPos(window, pos, cond);
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetWindowSize()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return window->Size;
|
||||
}
|
||||
|
||||
void ImGui::SetWindowSize(const ImVec2& size, ImGuiSetCondition cond)
|
||||
static void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowSizeAllowFlags & cond) == 0)
|
||||
return;
|
||||
window->SetWindowSizeAllowFlags &= ~(ImGuiSetCondition_FirstUseThisSession | ImGuiSetCondition_FirstUseEver);
|
||||
window->SetWindowSizeAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver);
|
||||
|
||||
// Set
|
||||
if (ImLengthSqr(size) > 0.00001f)
|
||||
@ -3424,38 +3458,87 @@ void ImGui::SetWindowSize(const ImVec2& size, ImGuiSetCondition cond)
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::SetWindowCollapsed(bool collapsed, ImGuiSetCondition cond)
|
||||
void ImGui::SetWindowSize(const ImVec2& size, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
SetWindowSize(window, size, cond);
|
||||
}
|
||||
|
||||
void ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (window)
|
||||
SetWindowSize(window, size, cond);
|
||||
}
|
||||
|
||||
static void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiSetCond cond)
|
||||
{
|
||||
// Test condition (NB: bit 0 is always true) and clear flags for next time
|
||||
if (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0)
|
||||
return;
|
||||
window->SetWindowCollapsedAllowFlags &= ~(ImGuiSetCondition_FirstUseThisSession | ImGuiSetCondition_FirstUseEver);
|
||||
window->SetWindowCollapsedAllowFlags &= ~(ImGuiSetCond_Once | ImGuiSetCond_FirstUseEver);
|
||||
|
||||
// Set
|
||||
window->Collapsed = collapsed;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCondition cond)
|
||||
void ImGui::SetWindowCollapsed(bool collapsed, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
SetWindowCollapsed(window, collapsed, cond);
|
||||
}
|
||||
|
||||
bool ImGui::GetWindowCollapsed()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
return window->Collapsed;
|
||||
}
|
||||
|
||||
void ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (window)
|
||||
SetWindowCollapsed(window, collapsed, cond);
|
||||
}
|
||||
|
||||
void ImGui::SetWindowFocus()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
FocusWindow(window);
|
||||
}
|
||||
|
||||
void ImGui::SetWindowFocus(const char* name)
|
||||
{
|
||||
ImGuiWindow* window = FindWindowByName(name);
|
||||
if (window)
|
||||
FocusWindow(window);
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowPosVal = pos;
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiSetCondition_Always;
|
||||
g.SetNextWindowPosCond = cond ? cond : ImGuiSetCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond)
|
||||
void ImGui::SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowSizeVal = size;
|
||||
g.SetNextWindowSizeCond = cond ? cond : ImGuiSetCondition_Always;
|
||||
g.SetNextWindowSizeCond = cond ? cond : ImGuiSetCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiSetCondition cond)
|
||||
void ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowCollapsedVal = collapsed;
|
||||
g.SetNextWindowCollapsedCond = cond ? cond : ImGuiSetCondition_Always;
|
||||
g.SetNextWindowCollapsedCond = cond ? cond : ImGuiSetCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::SetNextWindowFocus()
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextWindowFocus = true;
|
||||
}
|
||||
|
||||
ImVec2 ImGui::GetContentRegionMax()
|
||||
@ -4145,7 +4228,7 @@ void ImGui::LogButtons()
|
||||
LogToClipboard(g.LogAutoExpandMaxDepth);
|
||||
}
|
||||
|
||||
bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool display_frame, const bool default_open)
|
||||
bool ImGui::CollapsingHeader(const char* label, const char* str_id, bool display_frame, bool default_open)
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -4161,14 +4244,31 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool d
|
||||
label = str_id;
|
||||
const ImGuiID id = window->GetID(str_id);
|
||||
|
||||
// We only write to the tree storage if the user clicks
|
||||
// We only write to the tree storage if the user clicks (or explicitely use SetNextTreeNode*** functions)
|
||||
ImGuiStorage* storage = window->DC.StateStorage;
|
||||
bool opened;
|
||||
if (window->DC.OpenNextNode != -1)
|
||||
if (g.SetNextTreeNodeOpenedCond != 0)
|
||||
{
|
||||
opened = window->DC.OpenNextNode > 0;
|
||||
storage->SetInt(id, opened);
|
||||
window->DC.OpenNextNode = -1;
|
||||
if (g.SetNextTreeNodeOpenedCond & ImGuiSetCond_Always)
|
||||
{
|
||||
opened = g.SetNextTreeNodeOpenedVal;
|
||||
storage->SetInt(id, opened);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We treat ImGuiSetCondition_Once and ImGuiSetCondition_FirstUseEver the same because tree node state are not saved persistently.
|
||||
const int stored_value = storage->GetInt(id, -1);
|
||||
if (stored_value == -1)
|
||||
{
|
||||
opened = g.SetNextTreeNodeOpenedVal;
|
||||
storage->SetInt(id, opened);
|
||||
}
|
||||
else
|
||||
{
|
||||
opened = stored_value != 0;
|
||||
}
|
||||
}
|
||||
g.SetNextTreeNodeOpenedCond = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4242,6 +4342,28 @@ bool ImGui::CollapsingHeader(const char* label, const char* str_id, const bool d
|
||||
return opened;
|
||||
}
|
||||
|
||||
void ImGui::Bullet()
|
||||
{
|
||||
ImGuiState& g = *GImGui;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const float line_height = window->FontSize();
|
||||
const ImGuiAabb bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(line_height, line_height));
|
||||
ItemSize(bb);
|
||||
if (!ItemAdd(bb, NULL))
|
||||
return;
|
||||
|
||||
// Render
|
||||
const float bullet_size = line_height*0.15f;
|
||||
window->DrawList->AddCircleFilled(bb.Min + ImVec2(style.FramePadding.x + line_height*0.5f, line_height*0.5f), bullet_size, window->Color(ImGuiCol_Text));
|
||||
|
||||
// Stay on same line
|
||||
ImGui::SameLine(0, -1);
|
||||
}
|
||||
|
||||
// Text with a little bullet aligned to the typical tree node.
|
||||
void ImGui::BulletTextV(const char* fmt, va_list args)
|
||||
{
|
||||
@ -4250,12 +4372,11 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
|
||||
if (window->SkipItems)
|
||||
return;
|
||||
|
||||
const ImGuiStyle& style = g.Style;
|
||||
|
||||
static char buf[1024];
|
||||
const char* text_begin = buf;
|
||||
const char* text_end = text_begin + ImFormatStringV(buf, IM_ARRAYSIZE(buf), fmt, args);
|
||||
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const float line_height = window->FontSize();
|
||||
const ImVec2 text_size = CalcTextSize(text_begin, text_end, true);
|
||||
const ImGuiAabb bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(line_height + (text_size.x > 0.0f ? (style.FramePadding.x*2) : 0.0f),0) + text_size); // Empty text doesn't add padding
|
||||
@ -4338,10 +4459,11 @@ bool ImGui::TreeNode(const char* str_label_id)
|
||||
return TreeNode(str_label_id, "%s", str_label_id);
|
||||
}
|
||||
|
||||
void ImGui::OpenNextNode(bool open)
|
||||
void ImGui::SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
window->DC.OpenNextNode = open ? 1 : 0;
|
||||
ImGuiState& g = *GImGui;
|
||||
g.SetNextTreeNodeOpenedVal = opened;
|
||||
g.SetNextTreeNodeOpenedCond = cond ? cond : ImGuiSetCond_Always;
|
||||
}
|
||||
|
||||
void ImGui::PushID(const char* str_id)
|
||||
@ -5644,7 +5766,8 @@ bool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputT
|
||||
edit_state.InputCursorScreenPos = cursor_pos;
|
||||
}
|
||||
|
||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
||||
if (text_size.x > 0)
|
||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
||||
|
||||
if ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)
|
||||
return enter_pressed;
|
||||
@ -5786,12 +5909,8 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
|
||||
RenderTextClipped(frame_bb.Min + style.FramePadding, item_text, NULL, NULL, value_bb.Max);
|
||||
}
|
||||
|
||||
// Empty text doesn't add padding
|
||||
if (text_size.x > 0)
|
||||
{
|
||||
ImGui::SameLine(0, (int)style.ItemInnerSpacing.x);
|
||||
ImGui::TextUnformatted(label, FindTextDisplayEnd(label));
|
||||
}
|
||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
||||
|
||||
ImGui::PushID((int)id);
|
||||
bool menu_toggled = false;
|
||||
@ -6249,9 +6368,9 @@ static void ItemSize(ImVec2 size, ImVec2* adjust_vertical_offset)
|
||||
window->DC.CurrentLineHeight = 0.0f;
|
||||
}
|
||||
|
||||
static void ItemSize(const ImGuiAabb& aabb, ImVec2* adjust_start_offset)
|
||||
static void ItemSize(const ImGuiAabb& bb, ImVec2* adjust_start_offset)
|
||||
{
|
||||
ItemSize(aabb.GetSize(), adjust_start_offset);
|
||||
ItemSize(bb.GetSize(), adjust_start_offset);
|
||||
}
|
||||
|
||||
static bool IsClipped(const ImGuiAabb& bb)
|
||||
@ -6380,7 +6499,7 @@ void ImGui::SetColumnOffset(int column_index, float offset)
|
||||
const float min_x = window->DC.ColumnsStartX;
|
||||
const float max_x = window->Size.x - (g.Style.ScrollBarWidth);// - window->WindowPadding().x;
|
||||
const float t = (offset - min_x) / (max_x - min_x);
|
||||
window->StateStorage.SetFloat(column_id, t);
|
||||
window->DC.StateStorage->SetFloat(column_id, t);
|
||||
window->DC.ColumnsOffsetsT[column_index] = t;
|
||||
}
|
||||
|
||||
@ -6473,7 +6592,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
||||
const ImGuiID column_id = window->DC.ColumnsSetID + ImGuiID(column_index);
|
||||
RegisterAliveId(column_id);
|
||||
const float default_t = column_index / (float)window->DC.ColumnsCount;
|
||||
const float t = window->StateStorage.GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store an union into the map?)
|
||||
const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store an union into the map?)
|
||||
window->DC.ColumnsOffsetsT[column_index] = t;
|
||||
}
|
||||
|
||||
@ -7361,7 +7480,9 @@ const ImWchar* ImFontAtlas::GetGlyphRangesChinese()
|
||||
static const ImWchar ranges[] =
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x3040, 0x309F, // Hiragana, Katakana
|
||||
0x3000, 0x3000, // Ideographic Space
|
||||
0x3040, 0x30FF, // Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
0x4e00, 0x9FAF, // CJK Ideograms
|
||||
0,
|
||||
@ -7409,18 +7530,19 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese()
|
||||
109,2,18,23,0,0,9,61,3,0,28,41,77,27,19,17,81,5,2,14,5,83,57,252,14,154,263,14,20,8,13,6,57,39,38,
|
||||
};
|
||||
static int ranges_unpacked = false;
|
||||
static ImWchar ranges[6 + 1 + IM_ARRAYSIZE(offsets_from_0x4E00)*2] =
|
||||
static ImWchar ranges[10 + IM_ARRAYSIZE(offsets_from_0x4E00)*2 + 1] =
|
||||
{
|
||||
0x0020, 0x00FF, // Basic Latin + Latin Supplement
|
||||
0x3040, 0x309F, // Hiragana, Katakana
|
||||
0x3000, 0x3000, // Ideographic Space
|
||||
0x3040, 0x30FF, // Hiragana, Katakana
|
||||
0x31F0, 0x31FF, // Katakana Phonetic Extensions
|
||||
0xFF00, 0xFFEF, // Half-width characters
|
||||
0,
|
||||
};
|
||||
if (!ranges_unpacked)
|
||||
{
|
||||
// Unpack
|
||||
int codepoint = 0x4e00;
|
||||
ImWchar* dst = &ranges[6];
|
||||
ImWchar* dst = &ranges[10];
|
||||
for (int n = 0; n < IM_ARRAYSIZE(offsets_from_0x4E00); n++, dst += 2)
|
||||
dst[0] = dst[1] = (ImWchar)(codepoint += (offsets_from_0x4E00[n] + 1));
|
||||
dst[0] = 0;
|
||||
@ -7453,7 +7575,7 @@ void ImFont::BuildLookupTable()
|
||||
|
||||
// Create a glyph to handle TAB
|
||||
// FIXME: Needs proper TAB handling but it needs to be contextualized (can arbitrary say that each string starts at "column 0"
|
||||
if (const ImFont::Glyph* space_glyph = FindGlyph((unsigned short)' '))
|
||||
if (FindGlyph((unsigned short)' '))
|
||||
{
|
||||
Glyphs.resize(Glyphs.size() + 1);
|
||||
ImFont::Glyph& tab_glyph = Glyphs.back();
|
||||
@ -8302,7 +8424,9 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
{
|
||||
ImGui::BulletText("Bullet point 1");
|
||||
ImGui::BulletText("Bullet point 2\nOn multiple lines");
|
||||
ImGui::BulletText("Bullet point 3");
|
||||
ImGui::Bullet(); ImGui::Text("Bullet point 3 (two calls)");
|
||||
ImGui::Bullet(); ImGui::SmallButton("Button 1");
|
||||
ImGui::Bullet(); ImGui::SmallButton("Button 2");
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
@ -8554,9 +8678,10 @@ void ImGui::ShowTestWindow(bool* opened)
|
||||
ImGui::ColorEdit4("color 2", col2);
|
||||
|
||||
const char* listbox_items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
|
||||
static int listbox_item_current = 1, listbox_item_current2 = 2;
|
||||
static int listbox_item_current = 1;
|
||||
ImGui::ListBox("listbox\n(single select)", &listbox_item_current, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
||||
|
||||
//static int listbox_item_current2 = 2;
|
||||
//ImGui::PushItemWidth(-1);
|
||||
//ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
||||
//ImGui::PopItemWidth();
|
||||
|
45
imgui.h
45
imgui.h
@ -1,4 +1,4 @@
|
||||
// ImGui library v1.33
|
||||
// ImGui library v1.34
|
||||
// See .cpp file for documentation.
|
||||
// See ImGui::ShowTestWindow() for sample code.
|
||||
// Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
|
||||
@ -23,11 +23,13 @@ struct ImGuiWindow;
|
||||
#include <stdlib.h> // NULL, malloc
|
||||
#include <string.h> // memset, memmove
|
||||
|
||||
// Define assertion handler.
|
||||
#ifndef IM_ASSERT
|
||||
#include <assert.h>
|
||||
#define IM_ASSERT(_EXPR) assert(_EXPR)
|
||||
#endif
|
||||
|
||||
// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
||||
#ifndef IMGUI_API
|
||||
#define IMGUI_API
|
||||
#endif
|
||||
@ -41,7 +43,7 @@ typedef int ImGuiStyleVar; // enum ImGuiStyleVar_
|
||||
typedef int ImGuiKey; // enum ImGuiKey_
|
||||
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
||||
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
||||
typedef int ImGuiSetCondition; // enum ImGuiSetCondition_
|
||||
typedef int ImGuiSetCond; // enum ImGuiSetCondition_
|
||||
typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_
|
||||
struct ImGuiTextEditCallbackData; // for advanced uses of InputText()
|
||||
typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
|
||||
@ -175,12 +177,19 @@ namespace ImGui
|
||||
IMGUI_API ImVec2 GetWindowSize(); // get current window position.
|
||||
IMGUI_API float GetWindowWidth();
|
||||
IMGUI_API bool GetWindowCollapsed();
|
||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0); // set next window position - call before Begin().
|
||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0); // set next window size. set to ImVec2(0,0) to force an auto-fit.
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0); // set next window collapsed state.
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiSetCondition cond = 0); // set current window position - call within Begin()/End(). may incur tearing.
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiSetCondition cond = 0); // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCondition cond = 0); // set current window collapsed state.
|
||||
|
||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set next window position - call before Begin().
|
||||
IMGUI_API void SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set next window size. set to ImVec2(0,0) to force an auto-fit.
|
||||
IMGUI_API void SetNextWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set next window collapsed state.
|
||||
IMGUI_API void SetNextWindowFocus(); // set next window to be focused / front-most
|
||||
IMGUI_API void SetWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set current window position - call within Begin()/End(). may incur tearing.
|
||||
IMGUI_API void SetWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set current window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
|
||||
IMGUI_API void SetWindowCollapsed(bool collapsed, ImGuiSetCond cond = 0); // set current window collapsed state.
|
||||
IMGUI_API void SetWindowFocus(); // set current window to be focused / front-most
|
||||
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing.
|
||||
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing.
|
||||
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state.
|
||||
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most
|
||||
|
||||
IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
||||
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget.
|
||||
@ -252,6 +261,7 @@ namespace ImGui
|
||||
IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text.
|
||||
IMGUI_API void LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets
|
||||
IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args);
|
||||
IMGUI_API void Bullet();
|
||||
IMGUI_API void BulletText(const char* fmt, ...);
|
||||
IMGUI_API void BulletTextV(const char* fmt, va_list args);
|
||||
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0), bool repeat_when_held = false);
|
||||
@ -259,7 +269,7 @@ namespace ImGui
|
||||
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size);
|
||||
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), const ImVec4& tint_col = ImVec4(1,1,1,1), const ImVec4& border_col = ImVec4(0,0,0,0));
|
||||
IMGUI_API bool ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0,0), const ImVec2& uv1 = ImVec2(1,1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0,0,0,1), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no paddnig.
|
||||
IMGUI_API bool CollapsingHeader(const char* label, const char* str_id = NULL, const bool display_frame = true, const bool default_open = false);
|
||||
IMGUI_API bool CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false);
|
||||
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders.
|
||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
@ -290,6 +300,8 @@ namespace ImGui
|
||||
IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
||||
IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
||||
IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
||||
|
||||
// Trees
|
||||
IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop
|
||||
IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...); // "
|
||||
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...); // "
|
||||
@ -298,7 +310,7 @@ namespace ImGui
|
||||
IMGUI_API void TreePush(const char* str_id = NULL); // already called by TreeNode(), but you can call Push/Pop yourself for layouting purpose
|
||||
IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
||||
IMGUI_API void TreePop();
|
||||
IMGUI_API void OpenNextNode(bool open); // force open/close the next TreeNode or CollapsingHeader
|
||||
IMGUI_API void SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond = 0); // set next tree node to be opened.
|
||||
|
||||
// Selectable / Lists
|
||||
IMGUI_API bool Selectable(const char* label, bool selected, const ImVec2& size = ImVec2(0,0));
|
||||
@ -360,6 +372,7 @@ namespace ImGui
|
||||
|
||||
// Obsolete (will be removed)
|
||||
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); }
|
||||
|
||||
} // namespace ImGui
|
||||
|
||||
@ -493,13 +506,13 @@ enum ImGuiColorEditMode_
|
||||
ImGuiColorEditMode_HEX = 2
|
||||
};
|
||||
|
||||
// Condition flags for ImGui::SetWindow***() and SetNextWindow***() functions
|
||||
// Those functions treat 0 as a shortcut to ImGuiSetCondition_Always
|
||||
enum ImGuiSetCondition_
|
||||
// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions
|
||||
// All those functions treat 0 as a shortcut to ImGuiSetCond_Always
|
||||
enum ImGuiSetCond_
|
||||
{
|
||||
ImGuiSetCondition_Always = 1 << 0, // Set the variable
|
||||
ImGuiSetCondition_FirstUseThisSession = 1 << 1, // Only set the variable on the first call per runtime session
|
||||
ImGuiSetCondition_FirstUseEver = 1 << 2 // Only set the variable if the window doesn't exist in the .ini file
|
||||
ImGuiSetCond_Always = 1 << 0, // Set the variable
|
||||
ImGuiSetCond_Once = 1 << 1, // Only set the variable on the first call per runtime session
|
||||
ImGuiSetCond_FirstUseEver = 1 << 2 // Only set the variable if the window doesn't exist in the .ini file
|
||||
};
|
||||
|
||||
struct ImGuiStyle
|
||||
|
BIN
web/code_sample_01_jp.png
Normal file
BIN
web/code_sample_01_jp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Reference in New Issue
Block a user