mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Merge remote-tracking branch 'origin' into 2016-02-colorpicker
This commit is contained in:
commit
1b5bbf725b
@ -13,6 +13,6 @@ before_install:
|
|||||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install glfw3; fi
|
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install glfw3; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- make -C examples/opengl_example
|
- make -C examples/opengl2_example
|
||||||
- make -C examples/opengl3_example
|
- make -C examples/opengl3_example
|
||||||
|
|
||||||
|
11
README.md
11
README.md
@ -7,9 +7,9 @@ dear imgui,
|
|||||||
|
|
||||||
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/imgui) [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/imgui) [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
||||||
|
|
||||||
dear imgui (AKA ImGui), is a bloat-free graphical user interface library for C++. It outputs vertex buffers that you can render in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).
|
dear imgui (AKA ImGui), is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).
|
||||||
|
|
||||||
ImGui is designed to enable fast iteration and empower programmers to create content creation tools and visualization/debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and thus lacks certain features normally found in more high-level libraries.
|
ImGui is designed to enable fast iteration and empower programmers to create content creation tools and visualization/ debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and thus lacks certain features normally found in more high-level libraries.
|
||||||
|
|
||||||
ImGui is particularly suited to integration in realtime 3D applications, fullscreen applications, embedded applications, games, or any applications on consoles platforms where operating system features are non-standard.
|
ImGui is particularly suited to integration in realtime 3D applications, fullscreen applications, embedded applications, games, or any applications on consoles platforms where operating system features are non-standard.
|
||||||
|
|
||||||
@ -33,6 +33,8 @@ Your code passes mouse/keyboard inputs and settings to ImGui (see example applic
|
|||||||
|
|
||||||
ImGui outputs vertex buffers and simple command-lists that you can render in your application. The number of draw calls and state changes is typically very small. Because it doesn't know or touch graphics state directly, you can call ImGui commands anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate ImGui with your existing codebase.
|
ImGui outputs vertex buffers and simple command-lists that you can render in your application. The number of draw calls and state changes is typically very small. Because it doesn't know or touch graphics state directly, you can call ImGui commands anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate ImGui with your existing codebase.
|
||||||
|
|
||||||
|
_A common misunderstanding is that some people think immediate mode gui == immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes, as the gui functions as called by the user. Some lazy IMGUI-style librairies may work this way but this is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are rather optimal and you can render them later, in your app or even remotely._
|
||||||
|
|
||||||
ImGui allows you create elaborate tools as well as very short-lived ones. On the extreme side of short-liveness: using the Edit&Continue feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, etc.
|
ImGui allows you create elaborate tools as well as very short-lived ones. On the extreme side of short-liveness: using the Edit&Continue feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, etc.
|
||||||
|
|
||||||
Demo
|
Demo
|
||||||
@ -109,7 +111,7 @@ See the FAQ in imgui.cpp for answers.
|
|||||||
|
|
||||||
<b>How do you use ImGui on a platform that may not have a mouse or keyboard?</b>
|
<b>How do you use ImGui on a platform that may not have a mouse or keyboard?</b>
|
||||||
|
|
||||||
I recommend using [Synergy](http://synergy-project.org) ([sources](https://github.com/synergy/synergy)). In particular, the _src/micro/uSynergy.c_ file contains a small client that you can use on any platform to connect to your host PC. You can seamlessly use your PC input devices from a video game console or a tablet. ImGui allows to increase the hit box of widgets (via the _TouchPadding_ setting) to accommodate a little for the lack of precision of touch inputs, but it is recommended you use a mouse to allow optimising for screen real-estate.
|
I recommend using [Synergy](http://synergy-project.org) ([sources](https://github.com/symless/synergy)). In particular, the _src/micro/uSynergy.c_ file contains a small client that you can use on any platform to connect to your host PC. You can seamlessly use your PC input devices from a video game console or a tablet. ImGui allows to increase the hit box of widgets (via the _TouchPadding_ setting) to accommodate a little for the lack of precision of touch inputs, but it is recommended you use a mouse to allow optimising for screen real-estate.
|
||||||
|
|
||||||
<b>Can you create elaborate/serious tools with ImGui?</b>
|
<b>Can you create elaborate/serious tools with ImGui?</b>
|
||||||
|
|
||||||
@ -170,12 +172,13 @@ Ongoing ImGui development is financially supported on [**Patreon**](http://www.p
|
|||||||
Double-chocolate sponsors:
|
Double-chocolate sponsors:
|
||||||
- Media Molecule
|
- Media Molecule
|
||||||
- Mobigame
|
- Mobigame
|
||||||
|
- Insomniac Games (sponsored the gamepad/keyboard navigation branch)
|
||||||
|
|
||||||
Salty caramel supporters:
|
Salty caramel supporters:
|
||||||
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Stefano Cristiano, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko.
|
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Stefano Cristiano, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko.
|
||||||
|
|
||||||
Caramel supporters:
|
Caramel supporters:
|
||||||
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Jeff Roberts, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society.
|
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Jeff Roberts, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, [Kit framework](http://svkonsult.se/kit), Josh Faust, Martin Donlon.
|
||||||
|
|
||||||
And other supporters; thanks!
|
And other supporters; thanks!
|
||||||
|
|
||||||
|
10
examples/.gitignore
vendored
10
examples/.gitignore
vendored
@ -15,11 +15,11 @@ directx11_example/Debug/*
|
|||||||
directx11_example/Release/*
|
directx11_example/Release/*
|
||||||
directx11_example/ipch/*
|
directx11_example/ipch/*
|
||||||
directx11_example/x64/*
|
directx11_example/x64/*
|
||||||
opengl_example/Debug/*
|
opengl2_example/Debug/*
|
||||||
opengl_example/Release/*
|
opengl2_example/Release/*
|
||||||
opengl_example/ipch/*
|
opengl2_example/ipch/*
|
||||||
opengl_example/x64/*
|
opengl2_example/x64/*
|
||||||
opengl_example/opengl_example
|
opengl2_example/opengl_example
|
||||||
opengl3_example/Debug/*
|
opengl3_example/Debug/*
|
||||||
opengl3_example/Release/*
|
opengl3_example/Release/*
|
||||||
opengl3_example/ipch/*
|
opengl3_example/ipch/*
|
||||||
|
@ -8,11 +8,13 @@ Third party languages and frameworks bindings: https://github.com/ocornut/imgui/
|
|||||||
|
|
||||||
TL;DR;
|
TL;DR;
|
||||||
- Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
|
- Newcomers, read 'PROGRAMMER GUIDE' in imgui.cpp for notes on how to setup ImGui in your codebase.
|
||||||
- Refer to 'opengl_example' to understand how the library is setup, it is the simplest one.
|
- Refer to 'opengl2_example' to LEARN how the library is setup, it is the simplest one.
|
||||||
The other examples requires more boilerplate and are harder to read.
|
The other examples requires more boilerplate and are harder to read.
|
||||||
|
- If you are using OpenGL in your application, probably use an opengl3_xxx backend.
|
||||||
|
Mixing old fixed pipeline OpenGL2 and programmable pipeline OpenGL3+ isn't well supported by drivers.
|
||||||
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
|
- If you are using of the backend provided here, so you can copy the imgui_impl_xxx.cpp/h files
|
||||||
to your project and use them unmodified.
|
to your project and use them unmodified.
|
||||||
- If you have your own engine, you probably want to start from 'opengl_example' and adapt it to
|
- If you have your own engine, you probably want to start from one of the OpenGL example and adapt it to
|
||||||
your engine, but you can read the other examples as well.
|
your engine, but you can read the other examples as well.
|
||||||
|
|
||||||
ImGui is highly portable and only requires a few things to run:
|
ImGui is highly portable and only requires a few things to run:
|
||||||
@ -36,20 +38,19 @@ ImGui has zero frame of lag for most behaviors and one frame of lag for some beh
|
|||||||
At 60 FPS your experience should be pleasant. Consider that OS mouse cursors are typically drawn through
|
At 60 FPS your experience should be pleasant. Consider that OS mouse cursors are typically drawn through
|
||||||
a specific hardware accelerated route and may feel smoother than other GPU rendered contents. You may
|
a specific hardware accelerated route and may feel smoother than other GPU rendered contents. You may
|
||||||
experiment with the io.MouseDrawCursor flag to request ImGui to draw a mouse cursor itself, to visualize
|
experiment with the io.MouseDrawCursor flag to request ImGui to draw a mouse cursor itself, to visualize
|
||||||
the lag between an hardware cursor and a software cursor. It might be beneficial to the user experience
|
the lag between a hardware cursor and a software cursor. It might be beneficial to the user experience
|
||||||
to switch to a software rendered cursor when an interactive drag is in progress.
|
to switch to a software rendered cursor when an interactive drag is in progress.
|
||||||
Also note that some setup or GPU drivers may be causing extra lag (possibly by enforcing triple buffering),
|
Also note that some setup or GPU drivers may be causing extra lag (possibly by enforcing triple buffering),
|
||||||
leaving you with no option but sadness/anger (Intel GPU drivers were reported as such).
|
leaving you with no option but sadness/anger (Intel GPU drivers were reported as such).
|
||||||
|
|
||||||
opengl_example/
|
opengl2_example/
|
||||||
OpenGL example, using GLFW + fixed pipeline.
|
GLFW + OpenGL example (old fixed pipeline).
|
||||||
This is simple and should work for all OpenGL enabled applications.
|
This is simple to read. Prefer following this example to learn how ImGui works!
|
||||||
Prefer following this example to learn how ImGui works!
|
(You might be able to use this code in a GL3/GL4 context but make sure you disable the programmable
|
||||||
(You can use this code in a GL3/GL4 context but make sure you disable the programmable pipeline
|
pipeline by calling "glUseProgram(0)" before ImGui::Render.)
|
||||||
by calling "glUseProgram(0)" before ImGui::Render.)
|
|
||||||
|
|
||||||
opengl3_example/
|
opengl3_example/
|
||||||
OpenGL example, using GLFW/GL3W + programmable pipeline.
|
GLFW + OpenGL example (programmable pipeline, binding modern functions with GL3W).
|
||||||
This uses more modern OpenGL calls and custom shaders. It's more messy.
|
This uses more modern OpenGL calls and custom shaders. It's more messy.
|
||||||
|
|
||||||
directx9_example/
|
directx9_example/
|
||||||
@ -68,8 +69,8 @@ apple_example/
|
|||||||
On iOS, Using Synergy to access keyboard/mouse data from server computer.
|
On iOS, Using Synergy to access keyboard/mouse data from server computer.
|
||||||
Synergy keyboard integration is rather hacky.
|
Synergy keyboard integration is rather hacky.
|
||||||
|
|
||||||
sdl_opengl_example/
|
sdl_opengl2_example/
|
||||||
SDL2 + OpenGL example.
|
SDL2 + OpenGL example (old fixed pipeline).
|
||||||
|
|
||||||
sdl_opengl3_example/
|
sdl_opengl3_example/
|
||||||
SDL2 + OpenGL3 example.
|
SDL2 + OpenGL3 example.
|
||||||
|
@ -46,8 +46,8 @@ void ImGui_ImplA5_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
|
|
||||||
// FIXME-OPT: Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats
|
// FIXME-OPT: Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats
|
||||||
static ImVector<ImDrawVertAllegro> vertices;
|
static ImVector<ImDrawVertAllegro> vertices;
|
||||||
vertices.resize(cmd_list->VtxBuffer.size());
|
vertices.resize(cmd_list->VtxBuffer.Size);
|
||||||
for (int i = 0; i < cmd_list->VtxBuffer.size(); ++i)
|
for (int i = 0; i < cmd_list->VtxBuffer.Size; ++i)
|
||||||
{
|
{
|
||||||
const ImDrawVert &dv = cmd_list->VtxBuffer[i];
|
const ImDrawVert &dv = cmd_list->VtxBuffer[i];
|
||||||
ImDrawVertAllegro v;
|
ImDrawVertAllegro v;
|
||||||
@ -61,12 +61,12 @@ void ImGui_ImplA5_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
// FIXME-OPT: Unfortunately Allegro doesn't support 16-bit indices
|
// FIXME-OPT: Unfortunately Allegro doesn't support 16-bit indices
|
||||||
// You can also use '#define ImDrawIdx unsigned int' in imconfig.h and request ImGui to output 32-bit indices
|
// You can also use '#define ImDrawIdx unsigned int' in imconfig.h and request ImGui to output 32-bit indices
|
||||||
static ImVector<int> indices;
|
static ImVector<int> indices;
|
||||||
indices.resize(cmd_list->IdxBuffer.size());
|
indices.resize(cmd_list->IdxBuffer.Size);
|
||||||
for (int i = 0; i < cmd_list->IdxBuffer.size(); ++i)
|
for (int i = 0; i < cmd_list->IdxBuffer.Size; ++i)
|
||||||
indices[i] = (int)cmd_list->IdxBuffer.Data[i];
|
indices[i] = (int)cmd_list->IdxBuffer.Data[i];
|
||||||
|
|
||||||
int idx_offset = 0;
|
int idx_offset = 0;
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
|
@ -191,7 +191,7 @@ uSynergyBool ImGui_ConnectFunc(uSynergyCookie cookie)
|
|||||||
// connect it to the address and port we passed in to getaddrinfo():
|
// connect it to the address and port we passed in to getaddrinfo():
|
||||||
int ret = connect(usynergy_sockfd, res->ai_addr, res->ai_addrlen);
|
int ret = connect(usynergy_sockfd, res->ai_addr, res->ai_addrlen);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
NSLog( @"Connect suceeded...");
|
NSLog( @"Connect succeeded...");
|
||||||
} else {
|
} else {
|
||||||
NSLog( @"Connect failed, %d", ret );
|
NSLog( @"Connect failed, %d", ret );
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
|
|||||||
ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||||
int needed_vtx_size = cmd_list->VtxBuffer.size() * sizeof(ImDrawVert);
|
const int needed_vtx_size = cmd_list->VtxBuffer.Size * sizeof(ImDrawVert);
|
||||||
if (g_VboSize < needed_vtx_size)
|
if (g_VboSize < needed_vtx_size)
|
||||||
{
|
{
|
||||||
// Grow our buffer if needed
|
// Grow our buffer if needed
|
||||||
@ -659,11 +659,12 @@ static void ImGui_ImplIOS_RenderDrawLists (ImDrawData *draw_data)
|
|||||||
unsigned char* vtx_data = (unsigned char*)glMapBufferRange(GL_ARRAY_BUFFER, 0, needed_vtx_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
unsigned char* vtx_data = (unsigned char*)glMapBufferRange(GL_ARRAY_BUFFER, 0, needed_vtx_size, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
|
||||||
if (!vtx_data)
|
if (!vtx_data)
|
||||||
continue;
|
continue;
|
||||||
memcpy(vtx_data, &cmd_list->VtxBuffer[0], cmd_list->VtxBuffer.size() * sizeof(ImDrawVert));
|
memcpy(vtx_data, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||||
|
|
||||||
for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end(); pcmd++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
{
|
{
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
|
@ -97,7 +97,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1A1A0F4D1CB3C54D0090F036 /* libglfw3.dylib */,
|
1A1A0F4D1CB3C54D0090F036 /* libglfw3.dylib */,
|
||||||
1A1A0F351CB3A1B20090F036 /* opengl_example */,
|
1A1A0F351CB3A1B20090F036 /* opengl2_example */,
|
||||||
1A1A0F211CB39FB50090F036 /* AppDelegate.h */,
|
1A1A0F211CB39FB50090F036 /* AppDelegate.h */,
|
||||||
1A1A0F221CB39FB50090F036 /* AppDelegate.m */,
|
1A1A0F221CB39FB50090F036 /* AppDelegate.m */,
|
||||||
1A1A0F271CB39FB50090F036 /* Assets.xcassets */,
|
1A1A0F271CB39FB50090F036 /* Assets.xcassets */,
|
||||||
@ -114,15 +114,15 @@
|
|||||||
name = "Supporting Files";
|
name = "Supporting Files";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
1A1A0F351CB3A1B20090F036 /* opengl_example */ = {
|
1A1A0F351CB3A1B20090F036 /* opengl2_example */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw.cpp */,
|
1A1A0F371CB3A1B20090F036 /* imgui_impl_glfw.cpp */,
|
||||||
1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw.h */,
|
1A1A0F381CB3A1B20090F036 /* imgui_impl_glfw.h */,
|
||||||
1A1A0F391CB3A1B20090F036 /* main.cpp */,
|
1A1A0F391CB3A1B20090F036 /* main.cpp */,
|
||||||
);
|
);
|
||||||
name = opengl_example;
|
name = opengl2_example;
|
||||||
path = ../../opengl_example;
|
path = ../../opengl2_example;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
6D1E39141B35EEF10017B40F /* usynergy */ = {
|
6D1E39141B35EEF10017B40F /* usynergy */ = {
|
||||||
|
@ -87,10 +87,10 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
memcpy(vtx_dst, &cmd_list->VtxBuffer[0], cmd_list->VtxBuffer.size() * sizeof(ImDrawVert));
|
memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||||
memcpy(idx_dst, &cmd_list->IdxBuffer[0], cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx));
|
memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
|
||||||
vtx_dst += cmd_list->VtxBuffer.size();
|
vtx_dst += cmd_list->VtxBuffer.Size;
|
||||||
idx_dst += cmd_list->IdxBuffer.size();
|
idx_dst += cmd_list->IdxBuffer.Size;
|
||||||
}
|
}
|
||||||
g_pVB->Unmap();
|
g_pVB->Unmap();
|
||||||
g_pIB->Unmap();
|
g_pIB->Unmap();
|
||||||
@ -189,7 +189,7 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
@ -205,7 +205,7 @@ void ImGui_ImplDX10_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
idx_offset += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.size();
|
vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified DX state
|
// Restore modified DX state
|
||||||
@ -345,7 +345,7 @@ bool ImGui_ImplDX10_CreateDeviceObjects()
|
|||||||
|
|
||||||
// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
|
// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
|
||||||
// If you would like to use this DX11 sample code but remove this dependency you can:
|
// If you would like to use this DX11 sample code but remove this dependency you can:
|
||||||
// 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [prefered solution]
|
// 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]
|
||||||
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
|
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
|
||||||
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
|
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
|
||||||
|
|
||||||
|
@ -89,10 +89,10 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
memcpy(vtx_dst, &cmd_list->VtxBuffer[0], cmd_list->VtxBuffer.size() * sizeof(ImDrawVert));
|
memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||||
memcpy(idx_dst, &cmd_list->IdxBuffer[0], cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx));
|
memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
|
||||||
vtx_dst += cmd_list->VtxBuffer.size();
|
vtx_dst += cmd_list->VtxBuffer.Size;
|
||||||
idx_dst += cmd_list->IdxBuffer.size();
|
idx_dst += cmd_list->IdxBuffer.Size;
|
||||||
}
|
}
|
||||||
ctx->Unmap(g_pVB, 0);
|
ctx->Unmap(g_pVB, 0);
|
||||||
ctx->Unmap(g_pIB, 0);
|
ctx->Unmap(g_pIB, 0);
|
||||||
@ -194,7 +194,7 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
@ -210,7 +210,7 @@ void ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
idx_offset += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.size();
|
vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified DX state
|
// Restore modified DX state
|
||||||
@ -347,7 +347,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
|||||||
|
|
||||||
// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
|
// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
|
||||||
// If you would like to use this DX11 sample code but remove this dependency you can:
|
// If you would like to use this DX11 sample code but remove this dependency you can:
|
||||||
// 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [prefered solution]
|
// 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]
|
||||||
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
|
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
|
||||||
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
|
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
const ImDrawVert* vtx_src = &cmd_list->VtxBuffer[0];
|
const ImDrawVert* vtx_src = cmd_list->VtxBuffer.Data;
|
||||||
for (int i = 0; i < cmd_list->VtxBuffer.size(); i++)
|
for (int i = 0; i < cmd_list->VtxBuffer.Size; i++)
|
||||||
{
|
{
|
||||||
vtx_dst->pos[0] = vtx_src->pos.x;
|
vtx_dst->pos[0] = vtx_src->pos.x;
|
||||||
vtx_dst->pos[1] = vtx_src->pos.y;
|
vtx_dst->pos[1] = vtx_src->pos.y;
|
||||||
@ -85,8 +85,8 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
vtx_dst++;
|
vtx_dst++;
|
||||||
vtx_src++;
|
vtx_src++;
|
||||||
}
|
}
|
||||||
memcpy(idx_dst, &cmd_list->IdxBuffer[0], cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx));
|
memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
|
||||||
idx_dst += cmd_list->IdxBuffer.size();
|
idx_dst += cmd_list->IdxBuffer.Size;
|
||||||
}
|
}
|
||||||
g_pVB->Unlock();
|
g_pVB->Unlock();
|
||||||
g_pIB->Unlock();
|
g_pIB->Unlock();
|
||||||
@ -138,7 +138,7 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
@ -150,11 +150,11 @@ void ImGui_ImplDX9_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
const RECT r = { (LONG)pcmd->ClipRect.x, (LONG)pcmd->ClipRect.y, (LONG)pcmd->ClipRect.z, (LONG)pcmd->ClipRect.w };
|
const RECT r = { (LONG)pcmd->ClipRect.x, (LONG)pcmd->ClipRect.y, (LONG)pcmd->ClipRect.z, (LONG)pcmd->ClipRect.w };
|
||||||
g_pd3dDevice->SetTexture(0, (LPDIRECT3DTEXTURE9)pcmd->TextureId);
|
g_pd3dDevice->SetTexture(0, (LPDIRECT3DTEXTURE9)pcmd->TextureId);
|
||||||
g_pd3dDevice->SetScissorRect(&r);
|
g_pd3dDevice->SetScissorRect(&r);
|
||||||
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtx_offset, 0, (UINT)cmd_list->VtxBuffer.size(), idx_offset, pcmd->ElemCount/3);
|
g_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, vtx_offset, 0, (UINT)cmd_list->VtxBuffer.Size, idx_offset, pcmd->ElemCount/3);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
idx_offset += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.size();
|
vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore the DX9 state
|
// Restore the DX9 state
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||||
# Visual Studio 2010
|
# Visual Studio 2010
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl_example", "opengl_example\opengl_example.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opengl2_example", "opengl2_example\opengl2_example.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "directx9_example", "directx9_example\directx9_example.vcxproj", "{4165A294-21F2-44CA-9B38-E3F935ABADF5}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "directx9_example", "directx9_example\directx9_example.vcxproj", "{4165A294-21F2-44CA-9B38-E3F935ABADF5}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -40,9 +40,8 @@ void ImGui_Marmalade_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for(int n = 0; n < draw_data->CmdListsCount; n++)
|
for(int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
const unsigned char* vtx_buffer = (const unsigned char*)&cmd_list->VtxBuffer.front();
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
const ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
const int nVert = cmd_list->VtxBuffer.Size;
|
||||||
int nVert = cmd_list->VtxBuffer.size();
|
|
||||||
CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
||||||
CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
||||||
CIwColour* pColStream = IW_GX_ALLOC(CIwColour, nVert);
|
CIwColour* pColStream = IW_GX_ALLOC(CIwColour, nVert);
|
||||||
@ -62,12 +61,12 @@ void ImGui_Marmalade_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
IwGxSetColStream(pColStream, nVert);
|
IwGxSetColStream(pColStream, nVert);
|
||||||
IwGxSetNormStream(0);
|
IwGxSetNormStream(0);
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
{
|
{
|
||||||
pcmd->UserCallback(cmd_list,pcmd);
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#CXX = g++
|
#CXX = g++
|
||||||
|
|
||||||
EXE = opengl_example
|
EXE = opengl2_example
|
||||||
OBJS = main.o imgui_impl_glfw.o
|
OBJS = main.o imgui_impl_glfw.o
|
||||||
OBJS += ../../imgui.o ../../imgui_demo.o ../../imgui_draw.o
|
OBJS += ../../imgui.o ../../imgui_demo.o ../../imgui_draw.o
|
||||||
|
|
@ -1,3 +1,3 @@
|
|||||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
||||||
mkdir Debug
|
mkdir Debug
|
||||||
cl /nologo /Zi /MD /I ..\.. /I ..\libs\glfw\include *.cpp ..\..\*.cpp /FeDebug/opengl_example.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
|
cl /nologo /Zi /MD /I ..\.. /I ..\libs\glfw\include *.cpp ..\..\*.cpp /FeDebug/opengl2_example.exe /FoDebug/ /link /LIBPATH:..\libs\glfw\lib-vc2010-32 glfw3.lib opengl32.lib gdi32.lib shell32.lib
|
@ -46,6 +46,7 @@ void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
||||||
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||||
|
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||||
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@ -73,13 +74,13 @@ void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
const unsigned char* vtx_buffer = (const unsigned char*)&cmd_list->VtxBuffer.front();
|
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||||
const ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer + OFFSETOF(ImDrawVert, pos)));
|
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)((char*)vtx_buffer + OFFSETOF(ImDrawVert, pos)));
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer + OFFSETOF(ImDrawVert, uv)));
|
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)((char*)vtx_buffer + OFFSETOF(ImDrawVert, uv)));
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (void*)(vtx_buffer + OFFSETOF(ImDrawVert, col)));
|
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (void*)((char*)vtx_buffer + OFFSETOF(ImDrawVert, col)));
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
@ -108,6 +109,7 @@ void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* ImGui_ImplGlfw_GetClipboardText()
|
static const char* ImGui_ImplGlfw_GetClipboardText()
|
||||||
@ -159,7 +161,7 @@ bool ImGui_ImplGlfw_CreateDeviceObjects()
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
unsigned char* pixels;
|
unsigned char* pixels;
|
||||||
int width, height;
|
int width, height;
|
||||||
io.Fonts->GetTexDataAsAlpha8(&pixels, &width, &height);
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||||
|
|
||||||
// Upload texture to graphics system
|
// Upload texture to graphics system
|
||||||
GLint last_texture;
|
GLint last_texture;
|
||||||
@ -168,7 +170,7 @@ bool ImGui_ImplGlfw_CreateDeviceObjects()
|
|||||||
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
glBindTexture(GL_TEXTURE_2D, g_FontTexture);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, pixels);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
@ -20,7 +20,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>{9CDA7840-B7A5-496D-A527-E95571496D18}</ProjectGuid>
|
<ProjectGuid>{9CDA7840-B7A5-496D-A527-E95571496D18}</ProjectGuid>
|
||||||
<RootNamespace>opengl_example</RootNamespace>
|
<RootNamespace>opengl2_example</RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
@ -3,9 +3,10 @@
|
|||||||
# Compatible with Ubuntu 14.04.1 and Mac OS X
|
# Compatible with Ubuntu 14.04.1 and Mac OS X
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# if you using Mac OS X:
|
# You will need GLFW (http://www.glfw.org)
|
||||||
# You'll need glfw
|
#
|
||||||
# http://www.glfw.org
|
# apt-get install libglfw-dev # Linux
|
||||||
|
# brew install glfw # Mac OS X
|
||||||
#
|
#
|
||||||
|
|
||||||
#CXX = g++
|
#CXX = g++
|
||||||
@ -31,8 +32,9 @@ ifeq ($(UNAME_S), Darwin) #APPLE
|
|||||||
ECHO_MESSAGE = "Mac OS X"
|
ECHO_MESSAGE = "Mac OS X"
|
||||||
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
|
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo
|
||||||
LIBS += -L/usr/local/lib -lglfw3
|
LIBS += -L/usr/local/lib -lglfw3
|
||||||
|
#LIBS += -L/usr/local/lib -lglfw
|
||||||
|
|
||||||
CXXFLAGS = -I../../ -I../libs/gl3w -I/usr/local/Cellar/glew/1.10.0/include -I/usr/local/include
|
CXXFLAGS = -I../../ -I../libs/gl3w -I/usr/local/include
|
||||||
CXXFLAGS += -Wall -Wformat
|
CXXFLAGS += -Wall -Wformat
|
||||||
# CXXFLAGS += -D__APPLE__
|
# CXXFLAGS += -D__APPLE__
|
||||||
CFLAGS = $(CXXFLAGS)
|
CFLAGS = $(CXXFLAGS)
|
||||||
|
@ -55,6 +55,7 @@ void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb);
|
GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb);
|
||||||
GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha);
|
GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha);
|
||||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||||
|
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||||
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
||||||
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||||
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||||
@ -89,13 +90,14 @@ void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
const ImDrawIdx* idx_buffer_offset = 0;
|
const ImDrawIdx* idx_buffer_offset = 0;
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.size() * sizeof(ImDrawVert), (GLvoid*)&cmd_list->VtxBuffer.front(), GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx), (GLvoid*)&cmd_list->IdxBuffer.front(), GL_STREAM_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
||||||
|
|
||||||
for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end(); pcmd++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
{
|
{
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
@ -124,6 +126,7 @@ void ImGui_ImplGlfwGL3_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
||||||
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
||||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* ImGui_ImplGlfwGL3_GetClipboardText()
|
static const char* ImGui_ImplGlfwGL3_GetClipboardText()
|
||||||
@ -175,7 +178,7 @@ bool ImGui_ImplGlfwGL3_CreateFontsTexture()
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
unsigned char* pixels;
|
unsigned char* pixels;
|
||||||
int width, height;
|
int width, height;
|
||||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
||||||
|
|
||||||
// Upload texture to graphics system
|
// Upload texture to graphics system
|
||||||
GLint last_texture;
|
GLint last_texture;
|
||||||
|
@ -35,6 +35,7 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
||||||
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
|
||||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||||
|
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||||
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT | GL_TRANSFORM_BIT);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
@ -62,13 +63,13 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
const unsigned char* vtx_buffer = (const unsigned char*)&cmd_list->VtxBuffer.front();
|
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||||
const ImDrawIdx* idx_buffer = &cmd_list->IdxBuffer.front();
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer + OFFSETOF(ImDrawVert, pos)));
|
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)((char*)vtx_buffer + OFFSETOF(ImDrawVert, pos)));
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)(vtx_buffer + OFFSETOF(ImDrawVert, uv)));
|
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (void*)((char*)vtx_buffer + OFFSETOF(ImDrawVert, uv)));
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (void*)(vtx_buffer + OFFSETOF(ImDrawVert, col)));
|
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (void*)((char*)vtx_buffer + OFFSETOF(ImDrawVert, col)));
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
@ -97,6 +98,7 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* ImGui_ImplSdl_GetClipboardText()
|
static const char* ImGui_ImplSdl_GetClipboardText()
|
@ -49,6 +49,7 @@ void ImGui_ImplSdlGL3_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb);
|
GLint last_blend_equation_rgb; glGetIntegerv(GL_BLEND_EQUATION_RGB, &last_blend_equation_rgb);
|
||||||
GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha);
|
GLint last_blend_equation_alpha; glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &last_blend_equation_alpha);
|
||||||
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
GLint last_viewport[4]; glGetIntegerv(GL_VIEWPORT, last_viewport);
|
||||||
|
GLint last_scissor_box[4]; glGetIntegerv(GL_SCISSOR_BOX, last_scissor_box);
|
||||||
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
GLboolean last_enable_blend = glIsEnabled(GL_BLEND);
|
||||||
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
GLboolean last_enable_cull_face = glIsEnabled(GL_CULL_FACE);
|
||||||
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
GLboolean last_enable_depth_test = glIsEnabled(GL_DEPTH_TEST);
|
||||||
@ -83,13 +84,14 @@ void ImGui_ImplSdlGL3_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
const ImDrawIdx* idx_buffer_offset = 0;
|
const ImDrawIdx* idx_buffer_offset = 0;
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
|
||||||
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.size() * sizeof(ImDrawVert), (GLvoid*)&cmd_list->VtxBuffer.front(), GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||||
|
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_ElementsHandle);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx), (GLvoid*)&cmd_list->IdxBuffer.front(), GL_STREAM_DRAW);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
||||||
|
|
||||||
for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != cmd_list->CmdBuffer.end(); pcmd++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
{
|
{
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
@ -118,6 +120,7 @@ void ImGui_ImplSdlGL3_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
if (last_enable_depth_test) glEnable(GL_DEPTH_TEST); else glDisable(GL_DEPTH_TEST);
|
||||||
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
if (last_enable_scissor_test) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST);
|
||||||
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
glViewport(last_viewport[0], last_viewport[1], (GLsizei)last_viewport[2], (GLsizei)last_viewport[3]);
|
||||||
|
glScissor(last_scissor_box[0], last_scissor_box[1], (GLsizei)last_scissor_box[2], (GLsizei)last_scissor_box[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char* ImGui_ImplSdlGL3_GetClipboardText()
|
static const char* ImGui_ImplSdlGL3_GetClipboardText()
|
||||||
|
@ -9,7 +9,7 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES")
|
|||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES")
|
||||||
|
|
||||||
# GLFW
|
# GLFW
|
||||||
set(GLFW_DIR ../../../glfw) # Set this to point to a up-to-date GLFW repo
|
set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo
|
||||||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
|
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
|
||||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
|
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
|
||||||
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
|
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
|
||||||
|
@ -315,10 +315,10 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
memcpy(vtx_dst, &cmd_list->VtxBuffer[0], cmd_list->VtxBuffer.size() * sizeof(ImDrawVert));
|
memcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));
|
||||||
memcpy(idx_dst, &cmd_list->IdxBuffer[0], cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx));
|
memcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));
|
||||||
vtx_dst += cmd_list->VtxBuffer.size();
|
vtx_dst += cmd_list->VtxBuffer.Size;
|
||||||
idx_dst += cmd_list->IdxBuffer.size();
|
idx_dst += cmd_list->IdxBuffer.Size;
|
||||||
}
|
}
|
||||||
VkMappedMemoryRange range[2] = {};
|
VkMappedMemoryRange range[2] = {};
|
||||||
range[0].sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
range[0].sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
||||||
@ -378,7 +378,7 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
if (pcmd->UserCallback)
|
if (pcmd->UserCallback)
|
||||||
@ -388,16 +388,16 @@ void ImGui_ImplGlfwVulkan_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
VkRect2D scissor;
|
VkRect2D scissor;
|
||||||
scissor.offset.x = static_cast<int32_t>(pcmd->ClipRect.x);
|
scissor.offset.x = (int32_t)(pcmd->ClipRect.x);
|
||||||
scissor.offset.y = static_cast<int32_t>(pcmd->ClipRect.y);
|
scissor.offset.y = (int32_t)(pcmd->ClipRect.y);
|
||||||
scissor.extent.width = static_cast<uint32_t>(pcmd->ClipRect.z - pcmd->ClipRect.x);
|
scissor.extent.width = (uint32_t)(pcmd->ClipRect.z - pcmd->ClipRect.x);
|
||||||
scissor.extent.height = static_cast<uint32_t>(pcmd->ClipRect.w - pcmd->ClipRect.y + 1); // TODO: + 1??????
|
scissor.extent.height = (uint32_t)(pcmd->ClipRect.w - pcmd->ClipRect.y + 1); // TODO: + 1??????
|
||||||
vkCmdSetScissor(g_CommandBuffer, 0, 1, &scissor);
|
vkCmdSetScissor(g_CommandBuffer, 0, 1, &scissor);
|
||||||
vkCmdDrawIndexed(g_CommandBuffer, pcmd->ElemCount, 1, idx_offset, vtx_offset, 0);
|
vkCmdDrawIndexed(g_CommandBuffer, pcmd->ElemCount, 1, idx_offset, vtx_offset, 0);
|
||||||
}
|
}
|
||||||
idx_offset += pcmd->ElemCount;
|
idx_offset += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
vtx_offset += cmd_list->VtxBuffer.size();
|
vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,6 +725,7 @@ bool ImGui_ImplGlfwVulkan_CreateDeviceObjects()
|
|||||||
raster_info.polygonMode = VK_POLYGON_MODE_FILL;
|
raster_info.polygonMode = VK_POLYGON_MODE_FILL;
|
||||||
raster_info.cullMode = VK_CULL_MODE_NONE;
|
raster_info.cullMode = VK_CULL_MODE_NONE;
|
||||||
raster_info.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
raster_info.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||||
|
raster_info.lineWidth = 1.0f;
|
||||||
|
|
||||||
VkPipelineMultisampleStateCreateInfo ms_info = {};
|
VkPipelineMultisampleStateCreateInfo ms_info = {};
|
||||||
ms_info.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
ms_info.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||||
@ -740,6 +741,9 @@ bool ImGui_ImplGlfwVulkan_CreateDeviceObjects()
|
|||||||
color_attachment[0].alphaBlendOp = VK_BLEND_OP_ADD;
|
color_attachment[0].alphaBlendOp = VK_BLEND_OP_ADD;
|
||||||
color_attachment[0].colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
color_attachment[0].colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||||
|
|
||||||
|
VkPipelineDepthStencilStateCreateInfo depth_info = {};
|
||||||
|
depth_info.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
||||||
|
|
||||||
VkPipelineColorBlendStateCreateInfo blend_info = {};
|
VkPipelineColorBlendStateCreateInfo blend_info = {};
|
||||||
blend_info.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
blend_info.sType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO;
|
||||||
blend_info.attachmentCount = 1;
|
blend_info.attachmentCount = 1;
|
||||||
@ -761,6 +765,7 @@ bool ImGui_ImplGlfwVulkan_CreateDeviceObjects()
|
|||||||
info.pViewportState = &viewport_info;
|
info.pViewportState = &viewport_info;
|
||||||
info.pRasterizationState = &raster_info;
|
info.pRasterizationState = &raster_info;
|
||||||
info.pMultisampleState = &ms_info;
|
info.pMultisampleState = &ms_info;
|
||||||
|
info.pDepthStencilState = &depth_info;
|
||||||
info.pColorBlendState = &blend_info;
|
info.pColorBlendState = &blend_info;
|
||||||
info.pDynamicState = &dynamic_state;
|
info.pDynamicState = &dynamic_state;
|
||||||
info.layout = g_PipelineLayout;
|
info.layout = g_PipelineLayout;
|
||||||
|
@ -79,11 +79,18 @@ bool binary_to_compressed_c(const char* filename, const char* symbol, bool use_b
|
|||||||
if (use_base85_encoding)
|
if (use_base85_encoding)
|
||||||
{
|
{
|
||||||
fprintf(out, "static const char %s_%sdata_base85[%d+1] =\n \"", symbol, compressed_str, (int)((compressed_sz+3)/4)*5);
|
fprintf(out, "static const char %s_%sdata_base85[%d+1] =\n \"", symbol, compressed_str, (int)((compressed_sz+3)/4)*5);
|
||||||
for (int i = 0; i < compressed_sz; i += 4)
|
char prev_c = 0;
|
||||||
|
for (int src_i = 0; src_i < compressed_sz; src_i += 4)
|
||||||
{
|
{
|
||||||
unsigned int d = *(unsigned int*)(compressed + i);
|
// This is made a little more complicated by the fact that ??X sequences are interpreted as trigraphs by old C/C++ compilers. So we need to escape pairs of ??.
|
||||||
fprintf(out, "%c%c%c%c%c", Encode85Byte(d), Encode85Byte(d/85), Encode85Byte(d/7225), Encode85Byte(d/614125), Encode85Byte(d/52200625));
|
unsigned int d = *(unsigned int*)(compressed + src_i);
|
||||||
if ((i % 112) == 112-4)
|
for (unsigned int n5 = 0; n5 < 5; n5++, d /= 85)
|
||||||
|
{
|
||||||
|
char c = Encode85Byte(d);
|
||||||
|
fprintf(out, (c == '?' && prev_c == '?') ? "\\%c" : "%c", c);
|
||||||
|
prev_c = c;
|
||||||
|
}
|
||||||
|
if ((src_i % 112) == 112-4)
|
||||||
fprintf(out, "\"\n \"");
|
fprintf(out, "\"\n \"");
|
||||||
}
|
}
|
||||||
fprintf(out, "\";\n\n");
|
fprintf(out, "\";\n\n");
|
||||||
|
33
imgui.cpp
33
imgui.cpp
@ -80,7 +80,7 @@
|
|||||||
- read the FAQ below this section!
|
- read the FAQ below this section!
|
||||||
- your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs.
|
- your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention on your side, no state duplication, less sync, less bugs.
|
||||||
- call and read ImGui::ShowTestWindow() for demo code demonstrating most features.
|
- call and read ImGui::ShowTestWindow() for demo code demonstrating most features.
|
||||||
- see examples/ folder for standalone sample applications. Prefer reading examples/opengl_example/ first as it is the simplest.
|
- see examples/ folder for standalone sample applications. Prefer reading examples/opengl2_example/ first as it is the simplest.
|
||||||
you may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
|
you may be able to grab and copy a ready made imgui_impl_*** file from the examples/.
|
||||||
- customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
|
- customization: PushStyleColor()/PushStyleVar() or the style editor to tweak the look of the interface (e.g. if you want a more compact UI or a different color scheme).
|
||||||
|
|
||||||
@ -303,7 +303,7 @@
|
|||||||
- Elements that are not clickable, such as Text() items don't need an ID.
|
- Elements that are not clickable, such as Text() items don't need an ID.
|
||||||
|
|
||||||
- Interactive widgets require state to be carried over multiple frames (most typically ImGui often needs to remember what is the "active" widget).
|
- Interactive widgets require state to be carried over multiple frames (most typically ImGui often needs to remember what is the "active" widget).
|
||||||
to do so they need an unique ID. unique ID are typically derived from a string label, an integer index or a pointer.
|
to do so they need a unique ID. unique ID are typically derived from a string label, an integer index or a pointer.
|
||||||
|
|
||||||
Button("OK"); // Label = "OK", ID = hash of "OK"
|
Button("OK"); // Label = "OK", ID = hash of "OK"
|
||||||
Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel"
|
Button("Cancel"); // Label = "Cancel", ID = hash of "Cancel"
|
||||||
@ -485,8 +485,9 @@
|
|||||||
!- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows).
|
!- main: make it so that a frame with no window registered won't refocus every window on subsequent frames (~bump LastFrameActive of all windows).
|
||||||
- main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
- main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
||||||
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
||||||
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now.
|
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
|
||||||
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
|
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
|
||||||
|
- input text: expose CursorPos in char filter event (#816)
|
||||||
- input text: flag to disable live update of the user buffer (also applies to float/int text input)
|
- input text: flag to disable live update of the user buffer (also applies to float/int text input)
|
||||||
- input text: resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
- input text: resize behavior - field could stretch when being edited? hover tooltip shows more text?
|
||||||
- input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
|
- input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
|
||||||
@ -526,7 +527,7 @@
|
|||||||
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
||||||
- popups: add variant using global identifier similar to Begin/End (#402)
|
- popups: add variant using global identifier similar to Begin/End (#402)
|
||||||
- popups: border options. richer api like BeginChild() perhaps? (#197)
|
- popups: border options. richer api like BeginChild() perhaps? (#197)
|
||||||
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last prefered button" and may teleport when moving mouse
|
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred button" and may teleport when moving mouse
|
||||||
- menus: local shortcuts, global shortcuts (#456, #126)
|
- menus: local shortcuts, global shortcuts (#456, #126)
|
||||||
- menus: icons
|
- menus: icons
|
||||||
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
|
- menus: menubars: some sort of priority / effect of main menu-bar on desktop size?
|
||||||
@ -2336,10 +2337,13 @@ void ImGui::Shutdown()
|
|||||||
}
|
}
|
||||||
g.Windows.clear();
|
g.Windows.clear();
|
||||||
g.WindowsSortBuffer.clear();
|
g.WindowsSortBuffer.clear();
|
||||||
|
g.CurrentWindow = NULL;
|
||||||
g.CurrentWindowStack.clear();
|
g.CurrentWindowStack.clear();
|
||||||
g.FocusedWindow = NULL;
|
g.FocusedWindow = NULL;
|
||||||
g.HoveredWindow = NULL;
|
g.HoveredWindow = NULL;
|
||||||
g.HoveredRootWindow = NULL;
|
g.HoveredRootWindow = NULL;
|
||||||
|
g.ActiveIdWindow = NULL;
|
||||||
|
g.MovedWindow = NULL;
|
||||||
for (int i = 0; i < g.Settings.Size; i++)
|
for (int i = 0; i < g.Settings.Size; i++)
|
||||||
ImGui::MemFree(g.Settings[i].Name);
|
ImGui::MemFree(g.Settings[i].Name);
|
||||||
g.Settings.clear();
|
g.Settings.clear();
|
||||||
@ -2348,6 +2352,8 @@ void ImGui::Shutdown()
|
|||||||
g.FontStack.clear();
|
g.FontStack.clear();
|
||||||
g.OpenPopupStack.clear();
|
g.OpenPopupStack.clear();
|
||||||
g.CurrentPopupStack.clear();
|
g.CurrentPopupStack.clear();
|
||||||
|
g.SetNextWindowSizeConstraintCallback = NULL;
|
||||||
|
g.SetNextWindowSizeConstraintCallbackUserData = NULL;
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
||||||
g.RenderDrawLists[i].clear();
|
g.RenderDrawLists[i].clear();
|
||||||
g.OverlayDrawList.ClearFreeMemory();
|
g.OverlayDrawList.ClearFreeMemory();
|
||||||
@ -2543,9 +2549,9 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
|
// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc.
|
||||||
IM_ASSERT(draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
IM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);
|
||||||
IM_ASSERT(draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
IM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);
|
||||||
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
IM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);
|
||||||
|
|
||||||
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
|
// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = 2 bytes = 64K vertices)
|
||||||
// If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
|
// If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
|
||||||
@ -3357,8 +3363,7 @@ void ImGui::EndTooltip()
|
|||||||
static bool IsPopupOpen(ImGuiID id)
|
static bool IsPopupOpen(ImGuiID id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
const bool is_open = g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
|
return g.OpenPopupStack.Size > g.CurrentPopupStack.Size && g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;
|
||||||
return is_open;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark popup as open (toggle toward open state).
|
// Mark popup as open (toggle toward open state).
|
||||||
@ -6096,7 +6101,7 @@ void ImGui::TreeAdvanceToLabelPos()
|
|||||||
g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing();
|
g.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Horizontal distance preceeding label when using TreeNode() or Bullet()
|
// Horizontal distance preceding label when using TreeNode() or Bullet()
|
||||||
float ImGui::GetTreeNodeToLabelSpacing()
|
float ImGui::GetTreeNodeToLabelSpacing()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -9316,6 +9321,7 @@ void ImGui::BeginGroup()
|
|||||||
group_data.BackupCursorPos = window->DC.CursorPos;
|
group_data.BackupCursorPos = window->DC.CursorPos;
|
||||||
group_data.BackupCursorMaxPos = window->DC.CursorMaxPos;
|
group_data.BackupCursorMaxPos = window->DC.CursorMaxPos;
|
||||||
group_data.BackupIndentX = window->DC.IndentX;
|
group_data.BackupIndentX = window->DC.IndentX;
|
||||||
|
group_data.BackupGroupOffsetX = window->DC.GroupOffsetX;
|
||||||
group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight;
|
group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight;
|
||||||
group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset;
|
group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset;
|
||||||
group_data.BackupLogLinePosY = window->DC.LogLinePosY;
|
group_data.BackupLogLinePosY = window->DC.LogLinePosY;
|
||||||
@ -9346,7 +9352,7 @@ void ImGui::EndGroup()
|
|||||||
window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight;
|
window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight;
|
||||||
window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset;
|
window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset;
|
||||||
window->DC.IndentX = group_data.BackupIndentX;
|
window->DC.IndentX = group_data.BackupIndentX;
|
||||||
window->DC.GroupOffsetX = window->DC.IndentX;
|
window->DC.GroupOffsetX = group_data.BackupGroupOffsetX;
|
||||||
window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;
|
window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;
|
||||||
|
|
||||||
if (group_data.AdvanceCursor)
|
if (group_data.AdvanceCursor)
|
||||||
@ -9594,7 +9600,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
|||||||
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index);
|
const ImGuiID column_id = window->DC.ColumnsSetId + ImGuiID(column_index);
|
||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
const float default_t = column_index / (float)window->DC.ColumnsCount;
|
const float default_t = column_index / (float)window->DC.ColumnsCount;
|
||||||
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?)
|
const float t = window->DC.StateStorage->GetFloat(column_id, default_t); // Cheaply store our floating point value inside the integer (could store a union into the map?)
|
||||||
window->DC.ColumnsData[column_index].OffsetNorm = t;
|
window->DC.ColumnsData[column_index].OffsetNorm = t;
|
||||||
}
|
}
|
||||||
window->DrawList->ChannelsSplit(window->DC.ColumnsCount);
|
window->DrawList->ChannelsSplit(window->DC.ColumnsCount);
|
||||||
@ -9706,7 +9712,7 @@ void ImGui::ValueColor(const char* prefix, ImU32 v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// PLATFORM DEPENDANT HELPERS
|
// PLATFORM DEPENDENT HELPERS
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS))
|
#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS))
|
||||||
@ -9901,6 +9907,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
if (!ImGui::TreeNode(window, "%s '%s', %d @ 0x%p", label, window->Name, window->Active || window->WasActive, window))
|
||||||
return;
|
return;
|
||||||
NodeDrawList(window->DrawList, "DrawList");
|
NodeDrawList(window->DrawList, "DrawList");
|
||||||
|
ImGui::BulletText("Pos: (%.1f,%.1f)", window->Pos.x, window->Pos.y);
|
||||||
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
ImGui::BulletText("Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)", window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);
|
||||||
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
ImGui::BulletText("Scroll: (%.2f,%.2f)", window->Scroll.x, window->Scroll.y);
|
||||||
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
if (window->RootWindow != window) NodeWindow(window->RootWindow, "RootWindow");
|
||||||
|
2
imgui.h
2
imgui.h
@ -333,7 +333,7 @@ namespace ImGui
|
|||||||
IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
||||||
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
IMGUI_API void TreePop(); // ~ Unindent()+PopId()
|
||||||
IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing()
|
IMGUI_API void TreeAdvanceToLabelPos(); // advance cursor x position by GetTreeNodeToLabelSpacing()
|
||||||
IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceeding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
|
IMGUI_API float GetTreeNodeToLabelSpacing(); // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode
|
||||||
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0); // set next TreeNode/CollapsingHeader open state.
|
IMGUI_API void SetNextTreeNodeOpen(bool is_open, ImGuiSetCond cond = 0); // set next TreeNode/CollapsingHeader open state.
|
||||||
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
|
IMGUI_API bool CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0); // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().
|
||||||
IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header
|
IMGUI_API bool CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header
|
||||||
|
@ -896,7 +896,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
|||||||
|
|
||||||
if (ImGui::TreeNode("Basic Horizontal Layout"))
|
if (ImGui::TreeNode("Basic Horizontal Layout"))
|
||||||
{
|
{
|
||||||
ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceeding item)");
|
ImGui::TextWrapped("(Use ImGui::SameLine() to keep adding items to the right of the preceding item)");
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
ImGui::Text("Two items: Hello"); ImGui::SameLine();
|
ImGui::Text("Two items: Hello"); ImGui::SameLine();
|
||||||
|
@ -1841,7 +1841,7 @@ const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const float char_width = ((int)c < IndexXAdvance.Size) ? IndexXAdvance[(int)c] * scale : FallbackXAdvance;
|
const float char_width = ((int)c < IndexXAdvance.Size ? IndexXAdvance[(int)c] : FallbackXAdvance) * scale;
|
||||||
if (ImCharIsSpace(c))
|
if (ImCharIsSpace(c))
|
||||||
{
|
{
|
||||||
if (inside_word)
|
if (inside_word)
|
||||||
@ -2324,7 +2324,7 @@ static const char proggy_clean_ttf_compressed_data_base85[11980+1] =
|
|||||||
"%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et"
|
"%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et"
|
||||||
"Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:"
|
"Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:"
|
||||||
"a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL("
|
"a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL("
|
||||||
"$/V,;(kXZejWO`<[5??ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<"
|
"$/V,;(kXZejWO`<[5?\?ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<"
|
||||||
"nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?"
|
"nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?"
|
||||||
"7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;"
|
"7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;"
|
||||||
")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M"
|
")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M"
|
||||||
|
@ -258,6 +258,7 @@ struct ImGuiGroupData
|
|||||||
ImVec2 BackupCursorPos;
|
ImVec2 BackupCursorPos;
|
||||||
ImVec2 BackupCursorMaxPos;
|
ImVec2 BackupCursorMaxPos;
|
||||||
float BackupIndentX;
|
float BackupIndentX;
|
||||||
|
float BackupGroupOffsetX;
|
||||||
float BackupCurrentLineHeight;
|
float BackupCurrentLineHeight;
|
||||||
float BackupCurrentLineTextBaseOffset;
|
float BackupCurrentLineTextBaseOffset;
|
||||||
float BackupLogLinePosY;
|
float BackupLogLinePosY;
|
||||||
|
Loading…
Reference in New Issue
Block a user