mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 16:29:54 +02:00
Compare commits
216 Commits
Author | SHA1 | Date | |
---|---|---|---|
931b8dcdaf | |||
c603534d38 | |||
8738147aee | |||
b148f70f83 | |||
1c2dac2a90 | |||
b5b165b989 | |||
04e91500c5 | |||
374d160234 | |||
bda0269133 | |||
eb4ffd5dbd | |||
446d8abfb0 | |||
df37df821e | |||
0539be7067 | |||
475498f2eb | |||
03ff2faacb | |||
c4cb768432 | |||
01f74781b0 | |||
9417df2a26 | |||
abd0e85fc6 | |||
5ea23977f7 | |||
f1f3424cdd | |||
73d1126bf4 | |||
448b262b37 | |||
83770e5e40 | |||
0db6bac590 | |||
9ace617e7e | |||
616a7e6c61 | |||
d86785ac98 | |||
4144c59ce4 | |||
15a26a479b | |||
f0781d3a24 | |||
aaefe462bb | |||
78dc54ab3d | |||
7847100ad8 | |||
733e079081 | |||
95e2afcad6 | |||
46a27cdb6b | |||
123fd73c8c | |||
cd9244ab15 | |||
dcc7df2b21 | |||
235cca4f97 | |||
1cb6a294b0 | |||
b0a9bbf6f6 | |||
f8b7d5c76d | |||
938528e5ee | |||
5b0861768e | |||
8c4c421f74 | |||
70f2ff0e5a | |||
99ff45ad2e | |||
90db64d4e3 | |||
487500d291 | |||
7d28fe5915 | |||
d05c1d58c3 | |||
405785ea62 | |||
0a7024c198 | |||
3d36c81241 | |||
d69f2f57ee | |||
904e187f70 | |||
3c264827fd | |||
f841097e99 | |||
f26de46350 | |||
e6ac9e88aa | |||
b8ee48a74b | |||
843219daec | |||
7b8b5754bc | |||
6f32684f15 | |||
15113f682e | |||
3a6e6645e6 | |||
90cf77b191 | |||
6b3ccd3edf | |||
0db122bc3b | |||
fdce095101 | |||
d009a85de4 | |||
63a39dd08e | |||
cdb5e16f70 | |||
4eeba016f6 | |||
83b10f77a9 | |||
fd0108dbef | |||
98540370a0 | |||
bb8cdcb916 | |||
83cb040d20 | |||
44ed5640d3 | |||
0836f69d9b | |||
6c749934ec | |||
9abcbf73cb | |||
63aa035f59 | |||
8c1d7daef8 | |||
1ab1712849 | |||
48ede93a58 | |||
3498617a3c | |||
53892ab893 | |||
292f08b11e | |||
14bcfef041 | |||
8cfae35042 | |||
89d1340225 | |||
485832fe06 | |||
e6b1e39847 | |||
e7097d6176 | |||
882b4a5eb4 | |||
7fbe6574c6 | |||
8a6d543bc9 | |||
6a1eba2d0a | |||
14ab9708be | |||
df276b82da | |||
30a0193d73 | |||
e43c5cd3d3 | |||
92ded00fd9 | |||
6ee65fc5af | |||
da53caf310 | |||
b6f3c97e3b | |||
0cdd050cd7 | |||
6da8a77fa3 | |||
9bdacaf08d | |||
75ec4841df | |||
e674df8101 | |||
097fe51f97 | |||
060f879816 | |||
7184de24b8 | |||
0e8c2f9d41 | |||
a17c930d1f | |||
09abf11e56 | |||
4bd43bdb35 | |||
7f3f3891c0 | |||
88d7b3de23 | |||
f2b738648f | |||
e0594340ff | |||
6251d37987 | |||
f44526cc45 | |||
e912bcb36d | |||
ecda785cbc | |||
4250357ed2 | |||
79a95256e8 | |||
3115e546aa | |||
c1b55991c0 | |||
70f83a3a65 | |||
81937d34a8 | |||
fa0f0f4507 | |||
1fe2906923 | |||
900394a612 | |||
222a9231bb | |||
d9ca8f3145 | |||
d9b2a90773 | |||
748072c045 | |||
e57ee2852a | |||
1e4c22c206 | |||
5df542c3c0 | |||
4b088ec7e8 | |||
9d9cf31972 | |||
ad79db32c7 | |||
30552ecfd6 | |||
356a37edcf | |||
03720acaff | |||
9be3319653 | |||
9e307d60e3 | |||
515e0c6122 | |||
317744489f | |||
5082182790 | |||
ba7a4fc034 | |||
7fb704d308 | |||
79198fd6a5 | |||
34aad73fd8 | |||
141ac8beab | |||
33a2fd368a | |||
b3faed610d | |||
fcd08ed8d4 | |||
94b7c9e307 | |||
cd2ec7868c | |||
99a1a85f1f | |||
4a41ce9414 | |||
c2c43928a9 | |||
8ac9036db3 | |||
4913668ea4 | |||
bb2d3a8b41 | |||
6c1084eaa1 | |||
f293bec97c | |||
d23709ce35 | |||
9fe654c6e4 | |||
debe6522bb | |||
33e8fb85cf | |||
dd2a578012 | |||
f46557d2d6 | |||
c36172ebef | |||
85b8967291 | |||
13c3f11c66 | |||
fbbe7fee53 | |||
25d8c1af91 | |||
e7ffcea33d | |||
b1b23d6ca9 | |||
0ca7926b94 | |||
a3a10d4a3c | |||
47e875314b | |||
d84b5737a6 | |||
99e315d2b2 | |||
221f36e116 | |||
a3560b274e | |||
6ca4b31bf8 | |||
a906738ba7 | |||
1b5795c96d | |||
81bf614821 | |||
7fac4013a4 | |||
4e292bf67d | |||
376a6a5af0 | |||
46f55fe6f6 | |||
3f7f256752 | |||
19f7bf90f8 | |||
07ebb14ce2 | |||
ad7f600e0d | |||
68ccdc4fb8 | |||
8fbb42cc6f | |||
2440a30444 | |||
bd23c11a93 | |||
1d90f099bd | |||
6844952d56 | |||
18a00c7060 | |||
c93a562b06 | |||
9119f58ce5 |
16
README.md
16
README.md
@ -32,7 +32,7 @@ Demo
|
|||||||
----
|
----
|
||||||
|
|
||||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at the features of ImGui, you can download binaries of the demo app here.
|
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at the features of ImGui, you can download binaries of the demo app here.
|
||||||
- [imgui-demo-binaries-20150321.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20150321.zip) (Windows binaries, ImGui 1.37 WIP 2015/03/31, 4 executables, 391 KB)
|
- [imgui-demo-binaries-20150531.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20150531.zip) (Windows binaries, ImGui 1.40 WIP 2015/05/31, 4 executables, 432 KB)
|
||||||
|
|
||||||
|
|
||||||
Gallery
|
Gallery
|
||||||
@ -42,7 +42,9 @@ Gallery
|
|||||||

|

|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
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:
|
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:
|
||||||
```
|
```
|
||||||
@ -127,13 +129,13 @@ Embeds [stb_textedit.h, stb_truetype.h, stb_rectpack.h](https://github.com/nothi
|
|||||||
|
|
||||||
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. And everybody posting feedback, questions and patches on the GitHub.
|
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. And everybody posting feedback, questions and patches on the GitHub.
|
||||||
|
|
||||||
ImGui is financially supported on [**Patreon**](http://www.patreon.com/imgui).
|
ImGui development is financially supported on [**Patreon**](http://www.patreon.com/imgui).
|
||||||
|
|
||||||
Special supporters
|
Special supporters:
|
||||||
- Jetha Chan, Mārtiņš Možeiko, Alex Evans, Pastagames, Wild Sheep Studio
|
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Stefano Cristiano.
|
||||||
|
|
||||||
And
|
And:
|
||||||
- Dale Kim, Michel Courtine, Paul Patrashcu, Rui Figueira
|
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly.
|
||||||
|
|
||||||
And other supporters; thanks!
|
And other supporters; thanks!
|
||||||
|
|
||||||
|
@ -26,7 +26,8 @@ static ID3D10Blob * g_pPixelShaderBlob = NULL;
|
|||||||
static ID3D11PixelShader* g_pPixelShader = NULL;
|
static ID3D11PixelShader* g_pPixelShader = NULL;
|
||||||
static ID3D11SamplerState* g_pFontSampler = NULL;
|
static ID3D11SamplerState* g_pFontSampler = NULL;
|
||||||
static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
|
static ID3D11ShaderResourceView*g_pFontTextureView = NULL;
|
||||||
static ID3D11BlendState* g_blendState = NULL;
|
static ID3D11RasterizerState* g_pRasterizerState = NULL;
|
||||||
|
static ID3D11BlendState* g_pBlendState = NULL;
|
||||||
static int VERTEX_BUFFER_SIZE = 30000; // TODO: Make vertex buffer smaller and grow dynamically as needed.
|
static int VERTEX_BUFFER_SIZE = 30000; // TODO: Make vertex buffer smaller and grow dynamically as needed.
|
||||||
|
|
||||||
struct VERTEX_CONSTANT_BUFFER
|
struct VERTEX_CONSTANT_BUFFER
|
||||||
@ -100,7 +101,8 @@ static void ImGui_ImplDX11_RenderDrawLists(ImDrawList** const cmd_lists, int cmd
|
|||||||
|
|
||||||
// Setup render state
|
// Setup render state
|
||||||
const float blendFactor[4] = { 0.f, 0.f, 0.f, 0.f };
|
const float blendFactor[4] = { 0.f, 0.f, 0.f, 0.f };
|
||||||
g_pd3dDeviceContext->OMSetBlendState(g_blendState, blendFactor, 0xffffffff);
|
g_pd3dDeviceContext->OMSetBlendState(g_pBlendState, blendFactor, 0xffffffff);
|
||||||
|
g_pd3dDeviceContext->RSSetState(g_pRasterizerState);
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
int vtx_offset = 0;
|
int vtx_offset = 0;
|
||||||
@ -230,6 +232,10 @@ static void ImGui_ImplDX11_CreateFontsTexture()
|
|||||||
samplerDesc.MaxLOD = 0.f;
|
samplerDesc.MaxLOD = 0.f;
|
||||||
g_pd3dDevice->CreateSamplerState(&samplerDesc, &g_pFontSampler);
|
g_pd3dDevice->CreateSamplerState(&samplerDesc, &g_pFontSampler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cleanup (don't clear the input data if you want to append new fonts later)
|
||||||
|
io.Fonts->ClearInputData();
|
||||||
|
io.Fonts->ClearTexData();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplDX11_CreateDeviceObjects()
|
bool ImGui_ImplDX11_CreateDeviceObjects()
|
||||||
@ -335,19 +341,30 @@ bool ImGui_ImplDX11_CreateDeviceObjects()
|
|||||||
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
|
||||||
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
|
||||||
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
|
||||||
g_pd3dDevice->CreateBlendState(&desc, &g_blendState);
|
g_pd3dDevice->CreateBlendState(&desc, &g_pBlendState);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the rasterizer state
|
||||||
|
{
|
||||||
|
D3D11_RASTERIZER_DESC desc;
|
||||||
|
ZeroMemory(&desc, sizeof(desc));
|
||||||
|
desc.FillMode = D3D11_FILL_SOLID;
|
||||||
|
desc.CullMode = D3D11_CULL_NONE;
|
||||||
|
desc.ScissorEnable = true;
|
||||||
|
desc.DepthClipEnable = true;
|
||||||
|
g_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the vertex buffer
|
// Create the vertex buffer
|
||||||
{
|
{
|
||||||
D3D11_BUFFER_DESC bufferDesc;
|
D3D11_BUFFER_DESC desc;
|
||||||
memset(&bufferDesc, 0, sizeof(D3D11_BUFFER_DESC));
|
memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
|
||||||
bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
|
desc.Usage = D3D11_USAGE_DYNAMIC;
|
||||||
bufferDesc.ByteWidth = VERTEX_BUFFER_SIZE * sizeof(ImDrawVert);
|
desc.ByteWidth = VERTEX_BUFFER_SIZE * sizeof(ImDrawVert);
|
||||||
bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||||
bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||||
bufferDesc.MiscFlags = 0;
|
desc.MiscFlags = 0;
|
||||||
if (g_pd3dDevice->CreateBuffer(&bufferDesc, NULL, &g_pVB) < 0)
|
if (g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pVB) < 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +382,8 @@ void ImGui_ImplDX11_InvalidateDeviceObjects()
|
|||||||
if (g_pFontTextureView) { g_pFontTextureView->Release(); ImGui::GetIO().Fonts->TexID = 0; }
|
if (g_pFontTextureView) { g_pFontTextureView->Release(); ImGui::GetIO().Fonts->TexID = 0; }
|
||||||
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
if (g_pVB) { g_pVB->Release(); g_pVB = NULL; }
|
||||||
|
|
||||||
if (g_blendState) { g_blendState->Release(); g_blendState = NULL; }
|
if (g_pBlendState) { g_pBlendState->Release(); g_pBlendState = NULL; }
|
||||||
|
if (g_pRasterizerState) { g_pRasterizerState->Release(); g_pRasterizerState = NULL; }
|
||||||
if (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }
|
if (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }
|
||||||
if (g_pPixelShaderBlob) { g_pPixelShaderBlob->Release(); g_pPixelShaderBlob = NULL; }
|
if (g_pPixelShaderBlob) { g_pPixelShaderBlob->Release(); g_pPixelShaderBlob = NULL; }
|
||||||
if (g_pVertexConstantBuffer) { g_pVertexConstantBuffer->Release(); g_pVertexConstantBuffer = NULL; }
|
if (g_pVertexConstantBuffer) { g_pVertexConstantBuffer->Release(); g_pVertexConstantBuffer = NULL; }
|
||||||
@ -390,7 +408,7 @@ bool ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContex
|
|||||||
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
|
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
|
||||||
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
|
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
|
||||||
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
|
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
|
||||||
io.KeyMap[ImGuiKey_DownArrow] = VK_UP;
|
io.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;
|
||||||
io.KeyMap[ImGuiKey_Home] = VK_HOME;
|
io.KeyMap[ImGuiKey_Home] = VK_HOME;
|
||||||
io.KeyMap[ImGuiKey_End] = VK_END;
|
io.KeyMap[ImGuiKey_End] = VK_END;
|
||||||
io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
|
io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
|
||||||
@ -446,6 +464,9 @@ void ImGui_ImplDX11_NewFrame()
|
|||||||
// io.MouseDown : filled by WM_*BUTTON* events
|
// io.MouseDown : filled by WM_*BUTTON* events
|
||||||
// io.MouseWheel : filled by WM_MOUSEWHEEL events
|
// io.MouseWheel : filled by WM_MOUSEWHEEL events
|
||||||
|
|
||||||
|
// Hide OS mouse cursor if ImGui is drawing it
|
||||||
|
SetCursor(io.MouseDrawCursor ? NULL : LoadCursor(NULL, IDC_ARROW));
|
||||||
|
|
||||||
// Start the frame
|
// Start the frame
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device)
|
|||||||
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
|
io.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;
|
||||||
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
|
io.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;
|
||||||
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
|
io.KeyMap[ImGuiKey_UpArrow] = VK_UP;
|
||||||
io.KeyMap[ImGuiKey_DownArrow] = VK_UP;
|
io.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;
|
||||||
io.KeyMap[ImGuiKey_Home] = VK_HOME;
|
io.KeyMap[ImGuiKey_Home] = VK_HOME;
|
||||||
io.KeyMap[ImGuiKey_End] = VK_END;
|
io.KeyMap[ImGuiKey_End] = VK_END;
|
||||||
io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
|
io.KeyMap[ImGuiKey_Delete] = VK_DELETE;
|
||||||
@ -224,6 +224,10 @@ static void ImGui_ImplDX9_CreateFontsTexture()
|
|||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)pTexture;
|
io.Fonts->TexID = (void *)pTexture;
|
||||||
|
|
||||||
|
// Cleanup (don't clear the input data if you want to append new fonts later)
|
||||||
|
io.Fonts->ClearInputData();
|
||||||
|
io.Fonts->ClearTexData();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplDX9_CreateDeviceObjects()
|
bool ImGui_ImplDX9_CreateDeviceObjects()
|
||||||
@ -281,6 +285,9 @@ void ImGui_ImplDX9_NewFrame()
|
|||||||
// io.MouseDown : filled by WM_*BUTTON* events
|
// io.MouseDown : filled by WM_*BUTTON* events
|
||||||
// io.MouseWheel : filled by WM_MOUSEWHEEL events
|
// io.MouseWheel : filled by WM_MOUSEWHEEL events
|
||||||
|
|
||||||
|
// Hide OS mouse cursor if ImGui is drawing it
|
||||||
|
SetCursor(io.MouseDrawCursor ? NULL : LoadCursor(NULL, IDC_ARROW));
|
||||||
|
|
||||||
// Start the frame
|
// Start the frame
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,10 @@ void ImGui_ImplGlfwGL3_CreateFontsTexture()
|
|||||||
|
|
||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
||||||
|
|
||||||
|
// Cleanup (don't clear the input data if you want to append new fonts later)
|
||||||
|
io.Fonts->ClearInputData();
|
||||||
|
io.Fonts->ClearTexData();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplGlfwGL3_CreateDeviceObjects()
|
bool ImGui_ImplGlfwGL3_CreateDeviceObjects()
|
||||||
@ -354,7 +358,7 @@ void ImGui_ImplGlfwGL3_NewFrame()
|
|||||||
io.MouseWheel = g_MouseWheel;
|
io.MouseWheel = g_MouseWheel;
|
||||||
g_MouseWheel = 0.0f;
|
g_MouseWheel = 0.0f;
|
||||||
|
|
||||||
// Hide/show hardware mouse cursor
|
// Hide OS mouse cursor if ImGui is drawing it
|
||||||
glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
|
||||||
|
|
||||||
// Start the frame
|
// Start the frame
|
||||||
|
@ -20,6 +20,9 @@ int main(int, char**)
|
|||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
#if __APPLE__
|
||||||
|
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
|
#endif
|
||||||
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui OpenGL3 example", NULL, NULL);
|
GLFWwindow* window = glfwCreateWindow(1280, 720, "ImGui OpenGL3 example", NULL, NULL);
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
gl3wInit();
|
gl3wInit();
|
||||||
@ -72,7 +75,7 @@ int main(int, char**)
|
|||||||
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
|
ImGui::SetNextWindowPos(ImVec2(650, 20), ImGuiSetCond_FirstUseEver);
|
||||||
ImGui::ShowTestWindow(&show_test_window);
|
ImGui::ShowTestWindow(&show_test_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
|
glViewport(0, 0, (int)io.DisplaySize.x, (int)io.DisplaySize.y);
|
||||||
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
glClearColor(clear_color.x, clear_color.y, clear_color.z, clear_color.w);
|
||||||
|
@ -156,6 +156,10 @@ bool ImGui_ImplGlfw_CreateDeviceObjects()
|
|||||||
// Store our identifier
|
// Store our identifier
|
||||||
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
io.Fonts->TexID = (void *)(intptr_t)g_FontTexture;
|
||||||
|
|
||||||
|
// Cleanup (don't clear the input data if you want to append new fonts later)
|
||||||
|
io.Fonts->ClearInputData();
|
||||||
|
io.Fonts->ClearTexData();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +263,7 @@ void ImGui_ImplGlfw_NewFrame()
|
|||||||
io.MouseWheel = g_MouseWheel;
|
io.MouseWheel = g_MouseWheel;
|
||||||
g_MouseWheel = 0.0f;
|
g_MouseWheel = 0.0f;
|
||||||
|
|
||||||
// Hide/show hardware mouse cursor
|
// Hide OS mouse cursor if ImGui is drawing it
|
||||||
glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
|
glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL);
|
||||||
|
|
||||||
// Start the frame
|
// Start the frame
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
//---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty)
|
//---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty)
|
||||||
//#define IMGUI_DISABLE_TEST_WINDOWS
|
//#define IMGUI_DISABLE_TEST_WINDOWS
|
||||||
|
|
||||||
|
//---- Don't define obsolete functions names
|
||||||
|
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
|
||||||
//---- Implement STB libraries in a namespace to avoid conflicts
|
//---- Implement STB libraries in a namespace to avoid conflicts
|
||||||
//#define IMGUI_STB_NAMESPACE ImStb
|
//#define IMGUI_STB_NAMESPACE ImStb
|
||||||
|
|
||||||
|
358
imgui.h
358
imgui.h
@ -1,4 +1,4 @@
|
|||||||
// ImGui library v1.38
|
// ImGui library v1.40
|
||||||
// See .cpp file for documentation.
|
// See .cpp file for documentation.
|
||||||
// See ImGui::ShowTestWindow() for sample code.
|
// See ImGui::ShowTestWindow() for sample code.
|
||||||
// Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
|
// Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include <stdlib.h> // NULL, malloc, free, qsort, atoi
|
#include <stdlib.h> // NULL, malloc, free, qsort, atoi
|
||||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||||
|
|
||||||
#define IMGUI_VERSION "1.38"
|
#define IMGUI_VERSION "1.40"
|
||||||
|
|
||||||
// Define assertion handler.
|
// Define assertion handler.
|
||||||
#ifndef IM_ASSERT
|
#ifndef IM_ASSERT
|
||||||
@ -36,12 +36,13 @@ struct ImGuiStorage;
|
|||||||
struct ImGuiStyle;
|
struct ImGuiStyle;
|
||||||
|
|
||||||
typedef unsigned int ImU32;
|
typedef unsigned int ImU32;
|
||||||
typedef unsigned short ImWchar; // character for display
|
typedef unsigned short ImWchar; // character for keyboard input/display
|
||||||
typedef void* ImTextureID; // user data to refer to a texture (e.g. store your texture handle/id)
|
typedef void* ImTextureID; // user data to refer to a texture (e.g. store your texture handle/id)
|
||||||
typedef ImU32 ImGuiID; // unique ID used by widgets (typically hashed from a stack of string)
|
typedef ImU32 ImGuiID; // unique ID used by widgets (typically hashed from a stack of string)
|
||||||
typedef int ImGuiCol; // enum ImGuiCol_
|
typedef int ImGuiCol; // enum ImGuiCol_
|
||||||
typedef int ImGuiStyleVar; // enum ImGuiStyleVar_
|
typedef int ImGuiStyleVar; // enum ImGuiStyleVar_
|
||||||
typedef int ImGuiKey; // enum ImGuiKey_
|
typedef int ImGuiKey; // enum ImGuiKey_
|
||||||
|
typedef int ImGuiAlign; // enum ImGuiAlign_
|
||||||
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
||||||
typedef int ImGuiMouseCursor; // enum ImGuiMouseCursor_
|
typedef int ImGuiMouseCursor; // enum ImGuiMouseCursor_
|
||||||
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
||||||
@ -72,79 +73,18 @@ struct ImVec4
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ImGui
|
|
||||||
{
|
|
||||||
// Proxy functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO(). The only reason they exist here is to allow ImVector<> to compile inline.
|
|
||||||
IMGUI_API void* MemAlloc(size_t sz);
|
|
||||||
IMGUI_API void MemFree(void* ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
|
|
||||||
// Use '#define ImVector std::vector' if you want to use the STL type or your own type.
|
|
||||||
// Our implementation does NOT call c++ constructors! because the data types we use don't need them (but that could be added as well). Only provide the minimum functionalities we need.
|
|
||||||
#ifndef ImVector
|
|
||||||
template<typename T>
|
|
||||||
class ImVector
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
size_t Size;
|
|
||||||
size_t Capacity;
|
|
||||||
T* Data;
|
|
||||||
|
|
||||||
public:
|
|
||||||
typedef T value_type;
|
|
||||||
typedef value_type* iterator;
|
|
||||||
typedef const value_type* const_iterator;
|
|
||||||
|
|
||||||
ImVector() { Size = Capacity = 0; Data = NULL; }
|
|
||||||
~ImVector() { if (Data) ImGui::MemFree(Data); }
|
|
||||||
|
|
||||||
inline bool empty() const { return Size == 0; }
|
|
||||||
inline size_t size() const { return Size; }
|
|
||||||
inline size_t capacity() const { return Capacity; }
|
|
||||||
|
|
||||||
inline value_type& at(size_t i) { IM_ASSERT(i < Size); return Data[i]; }
|
|
||||||
inline const value_type& at(size_t i) const { IM_ASSERT(i < Size); return Data[i]; }
|
|
||||||
inline value_type& operator[](size_t i) { IM_ASSERT(i < Size); return Data[i]; }
|
|
||||||
inline const value_type& operator[](size_t i) const { IM_ASSERT(i < Size); return Data[i]; }
|
|
||||||
|
|
||||||
inline void clear() { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } }
|
|
||||||
inline iterator begin() { return Data; }
|
|
||||||
inline const_iterator begin() const { return Data; }
|
|
||||||
inline iterator end() { return Data + Size; }
|
|
||||||
inline const_iterator end() const { return Data + Size; }
|
|
||||||
inline value_type& front() { IM_ASSERT(Size > 0); return Data[0]; }
|
|
||||||
inline const value_type& front() const { IM_ASSERT(Size > 0); return Data[0]; }
|
|
||||||
inline value_type& back() { IM_ASSERT(Size > 0); return Data[Size-1]; }
|
|
||||||
inline const value_type& back() const { IM_ASSERT(Size > 0); return Data[Size-1]; }
|
|
||||||
inline void swap(ImVector<T>& rhs) { const size_t rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; const size_t rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
|
|
||||||
|
|
||||||
inline void resize(size_t new_size) { if (new_size > Capacity) reserve(new_size); Size = new_size; }
|
|
||||||
inline void reserve(size_t new_capacity)
|
|
||||||
{
|
|
||||||
if (new_capacity <= Capacity) return;
|
|
||||||
T* new_data = (value_type*)ImGui::MemAlloc(new_capacity * sizeof(value_type));
|
|
||||||
memcpy(new_data, Data, Size * sizeof(value_type));
|
|
||||||
ImGui::MemFree(Data);
|
|
||||||
Data = new_data;
|
|
||||||
Capacity = new_capacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; }
|
|
||||||
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
|
||||||
|
|
||||||
inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const ptrdiff_t off = it - begin(); memmove(Data + off, Data + off + 1, (Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; }
|
|
||||||
inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const ptrdiff_t off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; }
|
|
||||||
};
|
|
||||||
#endif // #ifndef ImVector
|
|
||||||
|
|
||||||
// Helpers at bottom of the file:
|
// Helpers at bottom of the file:
|
||||||
|
// - class ImVector<> // Lightweight std::vector like class. Use '#define ImVector std::vector' if you want to use the STL type or your own type.
|
||||||
// - IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times)
|
// - IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times)
|
||||||
// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
||||||
// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
|
// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
|
||||||
// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually)
|
// - struct ImGuiStorage // Custom key value storage (if you need to alter open/close states manually)
|
||||||
|
// - struct ImGuiTextEditCallbackData // Shared state of ImGui::InputText() when using custom callbacks
|
||||||
|
// - struct ImGuiListClipper // Helper to manually clip large list of items.
|
||||||
|
// - struct ImColor // Helper functions to created packed 32-bit RGBA color values
|
||||||
// - struct ImDrawList // Draw command list
|
// - struct ImDrawList // Draw command list
|
||||||
// - struct ImFont // TTF font loader, bake glyphs into bitmap
|
// - struct ImFontAtlas // Bake multiple fonts into a single texture, TTF font loader, bake glyphs into bitmap
|
||||||
|
// - struct ImFont // Single font
|
||||||
|
|
||||||
// ImGui end-user API
|
// ImGui end-user API
|
||||||
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
||||||
@ -159,14 +99,14 @@ namespace ImGui
|
|||||||
IMGUI_API void ShowUserGuide(); // help block
|
IMGUI_API void ShowUserGuide(); // help block
|
||||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block
|
||||||
IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features
|
IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features
|
||||||
IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window
|
IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window for debugging imgui
|
||||||
|
|
||||||
// Window
|
// Window
|
||||||
// See implementation in .cpp for details
|
// See implementation in .cpp for details
|
||||||
IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. 'bool* p_opened' creates a widget on the upper-right to close the window (which sets your bool to false).
|
IMGUI_API bool Begin(const char* name = "Debug", bool* p_opened = NULL, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code. 'bool* p_opened' creates a widget on the upper-right to close the window (which sets your bool to false).
|
||||||
IMGUI_API bool Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // this is the older/longer API. call SetNextWindowSize() instead if you want to set a window size. For regular windows, 'size_on_first_use' only applies to the first time EVER the window is created and probably not what you want! maybe obsolete this API eventually.
|
IMGUI_API bool Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_use, float bg_alpha = -1.0f, ImGuiWindowFlags flags = 0); // this is the older/longer API. call SetNextWindowSize() instead if you want to set a window size. For regular windows, 'size_on_first_use' only applies to the first time EVER the window is created and probably not what you want! maybe obsolete this API eventually.
|
||||||
IMGUI_API void End();
|
IMGUI_API void End();
|
||||||
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
|
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400).
|
||||||
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
||||||
IMGUI_API void EndChild();
|
IMGUI_API void EndChild();
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
||||||
@ -176,10 +116,10 @@ namespace ImGui
|
|||||||
IMGUI_API ImFont* GetWindowFont();
|
IMGUI_API ImFont* GetWindowFont();
|
||||||
IMGUI_API float GetWindowFontSize(); // size (also height in pixels) of current font with current scale applied
|
IMGUI_API float GetWindowFontSize(); // size (also height in pixels) of current font with current scale applied
|
||||||
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows
|
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows
|
||||||
IMGUI_API ImVec2 GetWindowPos(); // you should rarely need/care about the window position, but it can be useful if you want to do your own drawing
|
IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (useful if you want to do your own drawing via the DrawList api)
|
||||||
IMGUI_API ImVec2 GetWindowSize(); // get current window position
|
IMGUI_API ImVec2 GetWindowSize(); // get current window size
|
||||||
IMGUI_API float GetWindowWidth();
|
IMGUI_API float GetWindowWidth();
|
||||||
IMGUI_API bool GetWindowCollapsed();
|
IMGUI_API bool IsWindowCollapsed();
|
||||||
|
|
||||||
IMGUI_API void SetNextWindowPos(const ImVec2& pos, ImGuiSetCond cond = 0); // set next window position - call before Begin()
|
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 SetNextWindowSize(const ImVec2& size, ImGuiSetCond cond = 0); // set next window size. set to ImVec2(0,0) to force an auto-fit
|
||||||
@ -211,13 +151,15 @@ namespace ImGui
|
|||||||
IMGUI_API void PopStyleVar(int count = 1);
|
IMGUI_API void PopStyleVar(int count = 1);
|
||||||
|
|
||||||
// Parameters stacks (current window)
|
// Parameters stacks (current window)
|
||||||
IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -0.01f always align width to the right side)
|
IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side)
|
||||||
IMGUI_API void PopItemWidth();
|
IMGUI_API void PopItemWidth();
|
||||||
IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position
|
IMGUI_API float CalcItemWidth(); // width of item given pushed settings and current cursor position
|
||||||
IMGUI_API void PushAllowKeyboardFocus(bool v); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
|
IMGUI_API void PushAllowKeyboardFocus(bool v); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets
|
||||||
IMGUI_API void PopAllowKeyboardFocus();
|
IMGUI_API void PopAllowKeyboardFocus();
|
||||||
IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
|
IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space
|
||||||
IMGUI_API void PopTextWrapPos();
|
IMGUI_API void PopTextWrapPos();
|
||||||
|
IMGUI_API void PushButtonRepeat(bool repeat); // in 'repeat' mode, Button*() functions return true multiple times as you hold them (uses io.KeyRepeatDelay/io.KeyRepeatRate for now)
|
||||||
|
IMGUI_API void PopButtonRepeat();
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins
|
IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins
|
||||||
@ -226,18 +168,24 @@ namespace ImGui
|
|||||||
IMGUI_API void EndTooltip();
|
IMGUI_API void EndTooltip();
|
||||||
|
|
||||||
// Popup
|
// Popup
|
||||||
IMGUI_API void BeginPopup(bool* p_opened);
|
IMGUI_API void OpenPopup(const char* str_id); // mark popup as open. popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level). close childs popups if any. will close popup when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.
|
||||||
|
IMGUI_API bool BeginPopup(const char* str_id); // return true if popup if opened and start outputting to it. only call EndPopup() if BeginPopup() returned true!
|
||||||
|
IMGUI_API bool BeginPopupContextItem(const char* str_id, int mouse_button = 1); // open and begin popup when clicked on last item
|
||||||
|
IMGUI_API bool BeginPopupContextWindow(bool also_over_items = true, const char* str_id = NULL, int mouse_button = 1); // open and begin popup when clicked on current window
|
||||||
|
IMGUI_API bool BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1); // open and begin popup when clicked in void (no window)
|
||||||
IMGUI_API void EndPopup();
|
IMGUI_API void EndPopup();
|
||||||
|
IMGUI_API void CloseCurrentPopup(); // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
|
||||||
|
|
||||||
// Layout
|
// Cursor / Layout
|
||||||
IMGUI_API void BeginGroup();
|
IMGUI_API void BeginGroup(); // once closing a group it is seen as a single item (so you can use IsItemHovered() on a group, SameLine() between groups, etc.
|
||||||
IMGUI_API void EndGroup();
|
IMGUI_API void EndGroup();
|
||||||
IMGUI_API void Separator(); // horizontal line
|
IMGUI_API void Separator(); // horizontal line
|
||||||
IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets or groups to layout them horizontally
|
IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets or groups to layout them horizontally
|
||||||
IMGUI_API void Spacing(); // add vertical spacing
|
IMGUI_API void Spacing(); // add spacing
|
||||||
|
IMGUI_API void Dummy(const ImVec2& size); // add a dummy item of given size
|
||||||
IMGUI_API void Indent(); // move content position toward the right by style.IndentSpacing pixels
|
IMGUI_API void Indent(); // move content position toward the right by style.IndentSpacing pixels
|
||||||
IMGUI_API void Unindent(); // move content position back to the left (cancel Indent)
|
IMGUI_API void Unindent(); // move content position back to the left (cancel Indent)
|
||||||
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns
|
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns. use an identifier to distinguish multiple column sets. close with Columns(1).
|
||||||
IMGUI_API void NextColumn(); // next column
|
IMGUI_API void NextColumn(); // next column
|
||||||
IMGUI_API int GetColumnIndex(); // get current column index
|
IMGUI_API int GetColumnIndex(); // get current column index
|
||||||
IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this
|
IMGUI_API float GetColumnOffset(int column_index = -1); // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetcolumnsCount() inclusive. column 0 is usually 0.0f and not resizable unless you call this
|
||||||
@ -254,7 +202,8 @@ namespace ImGui
|
|||||||
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates [0..io.DisplaySize]
|
IMGUI_API void SetCursorScreenPos(const ImVec2& pos); // cursor position in absolute screen coordinates [0..io.DisplaySize]
|
||||||
IMGUI_API void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets
|
IMGUI_API void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets
|
||||||
IMGUI_API float GetTextLineHeight(); // height of font == GetWindowFontSize()
|
IMGUI_API float GetTextLineHeight(); // height of font == GetWindowFontSize()
|
||||||
IMGUI_API float GetTextLineHeightWithSpacing(); // spacing (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
|
IMGUI_API float GetTextLineHeightWithSpacing(); // distance (in pixels) between 2 consecutive lines of text == GetWindowFontSize() + GetStyle().ItemSpacing.y
|
||||||
|
IMGUI_API float GetItemsLineHeightWithSpacing(); // distance (in pixels) between 2 consecutive lines of standard height widgets == GetWindowFontSize() + GetStyle().FramePadding.y*2 + GetStyle().ItemSpacing.y
|
||||||
|
|
||||||
// ID scopes
|
// ID scopes
|
||||||
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
|
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
|
||||||
@ -273,7 +222,9 @@ namespace ImGui
|
|||||||
IMGUI_API void TextV(const char* fmt, va_list args);
|
IMGUI_API void TextV(const char* fmt, va_list args);
|
||||||
IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
|
IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
|
||||||
IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
|
IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
|
||||||
IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
|
IMGUI_API void TextDisabled(const char* fmt, ...); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor();
|
||||||
|
IMGUI_API void TextDisabledV(const char* fmt, va_list args);
|
||||||
|
IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize().
|
||||||
IMGUI_API void TextWrappedV(const char* fmt, va_list args);
|
IMGUI_API void TextWrappedV(const char* fmt, va_list args);
|
||||||
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 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 LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets
|
||||||
@ -281,7 +232,7 @@ namespace ImGui
|
|||||||
IMGUI_API void Bullet();
|
IMGUI_API void Bullet();
|
||||||
IMGUI_API void BulletText(const char* fmt, ...);
|
IMGUI_API void BulletText(const char* fmt, ...);
|
||||||
IMGUI_API void BulletTextV(const char* fmt, va_list args);
|
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);
|
IMGUI_API bool Button(const char* label, const ImVec2& size = ImVec2(0,0));
|
||||||
IMGUI_API bool SmallButton(const char* label);
|
IMGUI_API bool SmallButton(const char* label);
|
||||||
IMGUI_API bool InvisibleButton(const char* str_id, const ImVec2& size);
|
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 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));
|
||||||
@ -303,6 +254,27 @@ namespace ImGui
|
|||||||
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
|
IMGUI_API void PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0), size_t stride = sizeof(float));
|
||||||
IMGUI_API void PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
|
IMGUI_API void PlotHistogram(const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0,0));
|
||||||
|
|
||||||
|
// Widgets: Drags (tip: ctrl+click on a drag box to input text)
|
||||||
|
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
||||||
|
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||||
|
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||||
|
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||||
|
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_min >= v_max we have no bound
|
||||||
|
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||||
|
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||||
|
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||||
|
|
||||||
|
// Widgets: Input
|
||||||
|
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||||
|
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);
|
||||||
|
|
||||||
// Widgets: Sliders (tip: ctrl+click on a slider to input text)
|
// Widgets: Sliders (tip: ctrl+click on a slider to input text)
|
||||||
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 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 SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||||
@ -316,27 +288,6 @@ namespace ImGui
|
|||||||
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||||
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
||||||
|
|
||||||
// Widgets: Drags (tip: ctrl+click on a drag box to input text)
|
|
||||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_max >= v_max we have no bound
|
|
||||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
||||||
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
||||||
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
|
||||||
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_max >= v_max we have no bound
|
|
||||||
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
|
||||||
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
|
||||||
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
|
||||||
|
|
||||||
// Widgets: Input
|
|
||||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
|
||||||
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
|
||||||
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
|
|
||||||
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1);
|
|
||||||
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1);
|
|
||||||
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
|
||||||
IMGUI_API bool InputInt2(const char* label, int v[2]);
|
|
||||||
IMGUI_API bool InputInt3(const char* label, int v[3]);
|
|
||||||
IMGUI_API bool InputInt4(const char* label, int v[4]);
|
|
||||||
|
|
||||||
// Widgets: Trees
|
// Widgets: 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_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 char* str_id, const char* fmt, ...); // "
|
||||||
@ -357,7 +308,17 @@ namespace ImGui
|
|||||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
||||||
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
||||||
|
|
||||||
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
|
// Widgets: Menus
|
||||||
|
IMGUI_API bool BeginMainMenuBar(); // create and append to a full screen menu-bar. only call EndMainMenuBar() if this returns true!
|
||||||
|
IMGUI_API void EndMainMenuBar();
|
||||||
|
IMGUI_API bool BeginMenuBar(); // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set). only call EndMenuBar() if this returns true!
|
||||||
|
IMGUI_API void EndMenuBar();
|
||||||
|
IMGUI_API bool BeginMenu(const char* label, bool enabled = true); // create a sub-menu entry. only call EndMenu() if this returns true!
|
||||||
|
IMGUI_API void EndMenu();
|
||||||
|
IMGUI_API bool MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true); // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment
|
||||||
|
IMGUI_API bool MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true); // return true when activated + toggle (*p_selected) if p_selected != NULL
|
||||||
|
|
||||||
|
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
|
||||||
IMGUI_API void Value(const char* prefix, bool b);
|
IMGUI_API void Value(const char* prefix, bool b);
|
||||||
IMGUI_API void Value(const char* prefix, int v);
|
IMGUI_API void Value(const char* prefix, int v);
|
||||||
IMGUI_API void Value(const char* prefix, unsigned int v);
|
IMGUI_API void Value(const char* prefix, unsigned int v);
|
||||||
@ -377,16 +338,19 @@ namespace ImGui
|
|||||||
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse?
|
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse?
|
||||||
IMGUI_API bool IsItemHoveredRect(); // was the last item hovered by mouse? even if another item is active while we are hovering this
|
IMGUI_API bool IsItemHoveredRect(); // was the last item hovered by mouse? even if another item is active while we are hovering this
|
||||||
IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
||||||
IMGUI_API bool IsAnyItemActive(); //
|
|
||||||
IMGUI_API bool IsItemVisible();
|
IMGUI_API bool IsItemVisible();
|
||||||
|
IMGUI_API bool IsAnyItemHovered();
|
||||||
|
IMGUI_API bool IsAnyItemActive();
|
||||||
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space
|
IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space
|
||||||
IMGUI_API ImVec2 GetItemRectMax(); // "
|
IMGUI_API ImVec2 GetItemRectMax(); // "
|
||||||
IMGUI_API ImVec2 GetItemRectSize(); // "
|
IMGUI_API ImVec2 GetItemRectSize(); // "
|
||||||
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
||||||
IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
IMGUI_API bool IsRootWindowFocused(); // is current root window focused (top parent window in case of child windows)
|
||||||
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
||||||
IMGUI_API bool IsRectClipped(const ImVec2& size); // test if rectangle of given size starting from cursor pos is out of clipping region. to perform coarse clipping on user's side (as an optimization)
|
IMGUI_API bool IsRectVisible(const ImVec2& size); // test if rectangle of given size starting from cursor pos is visible (not clipped). to perform coarse clipping on user's side (as an optimization)
|
||||||
IMGUI_API bool IsKeyPressed(int key_index, bool repeat = true); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
|
IMGUI_API bool IsKeyDown(int key_index); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
|
||||||
|
IMGUI_API bool IsKeyPressed(int key_index, bool repeat = true); // "
|
||||||
|
IMGUI_API bool IsMouseDown(int button);
|
||||||
IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
||||||
IMGUI_API bool IsMouseDoubleClicked(int button);
|
IMGUI_API bool IsMouseDoubleClicked(int button);
|
||||||
IMGUI_API bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window)
|
IMGUI_API bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window)
|
||||||
@ -404,7 +368,7 @@ namespace ImGui
|
|||||||
IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
||||||
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f); // utility to find the closest point the last item bounding rectangle edge. useful to visually link items
|
IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f); // utility to find the closest point the last item bounding rectangle edge. useful to visually link items
|
||||||
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
||||||
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // helper to manually clip large list of items. see comments in implementation
|
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.
|
||||||
|
|
||||||
IMGUI_API void BeginChildFrame(ImGuiID id, const ImVec2& size); // helper to create a child window / scrolling region that looks like a normal widget frame
|
IMGUI_API void BeginChildFrame(ImGuiID id, const ImVec2& size); // helper to create a child window / scrolling region that looks like a normal widget frame
|
||||||
IMGUI_API void EndChildFrame();
|
IMGUI_API void EndChildFrame();
|
||||||
@ -413,20 +377,28 @@ namespace ImGui
|
|||||||
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
IMGUI_API void ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);
|
||||||
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
||||||
|
|
||||||
// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
|
// Helpers functions to access the MemAllocFn/MemFreeFn pointers in ImGui::GetIO()
|
||||||
|
IMGUI_API void* MemAlloc(size_t sz);
|
||||||
|
IMGUI_API void MemFree(void* ptr);
|
||||||
|
|
||||||
|
// Internal state/context access - if you want to use multiple ImGui context, or share context between modules (e.g. DLL), or allocate the memory yourself
|
||||||
IMGUI_API const char* GetVersion();
|
IMGUI_API const char* GetVersion();
|
||||||
IMGUI_API void* GetInternalState();
|
IMGUI_API void* GetInternalState();
|
||||||
IMGUI_API size_t GetInternalStateSize();
|
IMGUI_API size_t GetInternalStateSize();
|
||||||
IMGUI_API void SetInternalState(void* state, bool construct = false);
|
IMGUI_API void SetInternalState(void* state, bool construct = false);
|
||||||
|
|
||||||
// Obsolete (will be removed)
|
// Obsolete (will be removed)
|
||||||
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size); // OBSOLETE
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); } // OBSOLETE
|
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size); // OBSOLETE 1.30+
|
||||||
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE
|
static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); } // OBSOLETE 1.34+
|
||||||
static inline ImVec2 GetItemBoxMin() { return GetItemRectMin(); } // OBSOLETE
|
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE 1.36+
|
||||||
static inline ImVec2 GetItemBoxMax() { return GetItemRectMax(); } // OBSOLETE
|
static inline bool GetWindowCollapsed() { return ImGui::IsWindowCollapsed(); } // OBSOLETE 1.39+
|
||||||
static inline bool IsClipped(const ImVec2& size) { return IsRectClipped(size); } // OBSOLETE
|
static inline ImVec2 GetItemBoxMin() { return GetItemRectMin(); } // OBSOLETE 1.36+
|
||||||
static inline bool IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); } // OBSOLETE
|
static inline ImVec2 GetItemBoxMax() { return GetItemRectMax(); } // OBSOLETE 1.36+
|
||||||
|
static inline bool IsClipped(const ImVec2& size) { return !IsRectVisible(size); } // OBSOLETE 1.38+
|
||||||
|
static inline bool IsRectClipped(const ImVec2& size) { return !IsRectVisible(size); } // OBSOLETE 1.39+
|
||||||
|
static inline bool IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); } // OBSOLETE 1.36+
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace ImGui
|
} // namespace ImGui
|
||||||
|
|
||||||
@ -443,13 +415,15 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
ImGuiWindowFlags_AlwaysAutoResize = 1 << 6, // Resize every window to its content every frame
|
||||||
ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items
|
ImGuiWindowFlags_ShowBorders = 1 << 7, // Show borders around windows and items
|
||||||
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
||||||
|
ImGuiWindowFlags_MenuBar = 1 << 9, // Has a menu-bar
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiWindowFlags_ChildWindow = 1 << 9, // For internal use by BeginChild()
|
ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild()
|
||||||
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 10, // For internal use by BeginChild()
|
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild()
|
||||||
ImGuiWindowFlags_ChildWindowAutoFitY = 1 << 11, // For internal use by BeginChild()
|
ImGuiWindowFlags_ChildWindowAutoFitY = 1 << 22, // Don't use! For internal use by BeginChild()
|
||||||
ImGuiWindowFlags_ComboBox = 1 << 12, // For internal use by ComboBox()
|
ImGuiWindowFlags_ComboBox = 1 << 23, // Don't use! For internal use by ComboBox()
|
||||||
ImGuiWindowFlags_Tooltip = 1 << 13, // For internal use by BeginTooltip()
|
ImGuiWindowFlags_Tooltip = 1 << 24, // Don't use! For internal use by BeginTooltip()
|
||||||
ImGuiWindowFlags_Popup = 1 << 14 // For internal use by BeginPopup()
|
ImGuiWindowFlags_Popup = 1 << 25, // Don't use! For internal use by BeginPopup()
|
||||||
|
ImGuiWindowFlags_ChildMenu = 1 << 26 // Don't use! For internal use by BeginMenu()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Flags for ImGui::InputText()
|
// Flags for ImGui::InputText()
|
||||||
@ -495,6 +469,7 @@ enum ImGuiKey_
|
|||||||
enum ImGuiCol_
|
enum ImGuiCol_
|
||||||
{
|
{
|
||||||
ImGuiCol_Text,
|
ImGuiCol_Text,
|
||||||
|
ImGuiCol_TextDisabled,
|
||||||
ImGuiCol_WindowBg,
|
ImGuiCol_WindowBg,
|
||||||
ImGuiCol_ChildWindowBg,
|
ImGuiCol_ChildWindowBg,
|
||||||
ImGuiCol_Border,
|
ImGuiCol_Border,
|
||||||
@ -504,6 +479,7 @@ enum ImGuiCol_
|
|||||||
ImGuiCol_FrameBgActive,
|
ImGuiCol_FrameBgActive,
|
||||||
ImGuiCol_TitleBg,
|
ImGuiCol_TitleBg,
|
||||||
ImGuiCol_TitleBgCollapsed,
|
ImGuiCol_TitleBgCollapsed,
|
||||||
|
ImGuiCol_MenuBarBg,
|
||||||
ImGuiCol_ScrollbarBg,
|
ImGuiCol_ScrollbarBg,
|
||||||
ImGuiCol_ScrollbarGrab,
|
ImGuiCol_ScrollbarGrab,
|
||||||
ImGuiCol_ScrollbarGrabHovered,
|
ImGuiCol_ScrollbarGrabHovered,
|
||||||
@ -543,6 +519,7 @@ enum ImGuiStyleVar_
|
|||||||
ImGuiStyleVar_Alpha, // float
|
ImGuiStyleVar_Alpha, // float
|
||||||
ImGuiStyleVar_WindowPadding, // ImVec2
|
ImGuiStyleVar_WindowPadding, // ImVec2
|
||||||
ImGuiStyleVar_WindowRounding, // float
|
ImGuiStyleVar_WindowRounding, // float
|
||||||
|
ImGuiStyleVar_WindowMinSize, // ImVec2
|
||||||
ImGuiStyleVar_ChildWindowRounding, // float
|
ImGuiStyleVar_ChildWindowRounding, // float
|
||||||
ImGuiStyleVar_FramePadding, // ImVec2
|
ImGuiStyleVar_FramePadding, // ImVec2
|
||||||
ImGuiStyleVar_FrameRounding, // float
|
ImGuiStyleVar_FrameRounding, // float
|
||||||
@ -552,6 +529,16 @@ enum ImGuiStyleVar_
|
|||||||
ImGuiStyleVar_GrabMinSize // float
|
ImGuiStyleVar_GrabMinSize // float
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ImGuiAlign_
|
||||||
|
{
|
||||||
|
ImGuiAlign_Left = 1 << 0,
|
||||||
|
ImGuiAlign_Center = 1 << 1,
|
||||||
|
ImGuiAlign_Right = 1 << 2,
|
||||||
|
ImGuiAlign_Top = 1 << 3,
|
||||||
|
ImGuiAlign_VCenter = 1 << 4,
|
||||||
|
ImGuiAlign_Default = ImGuiAlign_Left | ImGuiAlign_Top,
|
||||||
|
};
|
||||||
|
|
||||||
// Enumeration for ColorEditMode()
|
// Enumeration for ColorEditMode()
|
||||||
enum ImGuiColorEditMode_
|
enum ImGuiColorEditMode_
|
||||||
{
|
{
|
||||||
@ -581,7 +568,8 @@ enum ImGuiSetCond_
|
|||||||
{
|
{
|
||||||
ImGuiSetCond_Always = 1 << 0, // Set the variable
|
ImGuiSetCond_Always = 1 << 0, // Set the variable
|
||||||
ImGuiSetCond_Once = 1 << 1, // Only set the variable on the first call per runtime session
|
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
|
ImGuiSetCond_FirstUseEver = 1 << 2, // Only set the variable if the window doesn't exist in the .ini file
|
||||||
|
ImGuiSetCond_Appearing = 1 << 3 // Only set the variable if the window is appearing after being inactive (or the first time)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiStyle
|
struct ImGuiStyle
|
||||||
@ -590,19 +578,21 @@ struct ImGuiStyle
|
|||||||
ImVec2 WindowPadding; // Padding within a window
|
ImVec2 WindowPadding; // Padding within a window
|
||||||
ImVec2 WindowMinSize; // Minimum window size
|
ImVec2 WindowMinSize; // Minimum window size
|
||||||
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
||||||
|
ImGuiAlign WindowTitleAlign; // Alignment for title bar text
|
||||||
float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
|
float ChildWindowRounding; // Radius of child window corners rounding. Set to 0.0f to have rectangular windows
|
||||||
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets)
|
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets)
|
||||||
float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
|
float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
|
||||||
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines
|
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines
|
||||||
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||||||
ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
||||||
ImVec2 AutoFitPadding; // Extra space after auto-fit (double-clicking on resize grip)
|
|
||||||
float WindowFillAlphaDefault; // Default alpha of window background, if not specified in ImGui::Begin()
|
float WindowFillAlphaDefault; // Default alpha of window background, if not specified in ImGui::Begin()
|
||||||
float IndentSpacing; // Horizontal indentation when e.g. entering a tree node
|
float IndentSpacing; // Horizontal indentation when e.g. entering a tree node
|
||||||
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
|
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
|
||||||
float ScrollbarWidth; // Width of the vertical scrollbar
|
float ScrollbarWidth; // Width of the vertical scrollbar
|
||||||
float GrabMinSize; // Minimum width/height of a slider or scrollbar grab
|
float ScrollbarRounding; // Radius of grab corners for scrollbar
|
||||||
ImVec2 DisplaySafeAreaPadding; // Window positions are clamped to be visible within the display area. If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding.
|
float GrabMinSize; // Minimum width/height of a grab box for slider/scrollbar
|
||||||
|
ImVec2 DisplayWindowPadding; // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.
|
||||||
|
ImVec2 DisplaySafeAreaPadding; // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.
|
||||||
ImVec4 Colors[ImGuiCol_COUNT];
|
ImVec4 Colors[ImGuiCol_COUNT];
|
||||||
|
|
||||||
IMGUI_API ImGuiStyle();
|
IMGUI_API ImGuiStyle();
|
||||||
@ -625,6 +615,8 @@ struct ImGuiIO
|
|||||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||||
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging
|
float MouseDragThreshold; // = 6.0f // Distance threshold before considering we are dragging
|
||||||
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array
|
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array
|
||||||
|
float KeyRepeatDelay; // = 0.250f // When holding a key/button, time before it starts repeating, in seconds. (for actions where 'repeat' is active)
|
||||||
|
float KeyRepeatRate; // = 0.020f // When holding a key/button, rate at which it repeats, in seconds.
|
||||||
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
void* UserData; // = NULL // Store your own data for retrieval by callbacks.
|
||||||
|
|
||||||
ImFontAtlas* Fonts; // <auto> // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
|
ImFontAtlas* Fonts; // <auto> // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.
|
||||||
@ -680,7 +672,9 @@ struct ImGuiIO
|
|||||||
bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
|
bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
|
||||||
bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input)
|
bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input)
|
||||||
float Framerate; // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames
|
float Framerate; // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames
|
||||||
|
int MetricsAllocs; // Number of active memory allocations
|
||||||
int MetricsRenderVertices; // Vertices processed during last call to Render()
|
int MetricsRenderVertices; // Vertices processed during last call to Render()
|
||||||
|
int MetricsActiveWindows; // Number of visible windows (exclude child windows)
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// [Internal] ImGui will maintain those fields for you
|
// [Internal] ImGui will maintain those fields for you
|
||||||
@ -704,6 +698,67 @@ struct ImGuiIO
|
|||||||
// Helpers
|
// Helpers
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
|
||||||
|
// Use '#define ImVector std::vector' if you want to use the STL type or your own type.
|
||||||
|
// Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code!
|
||||||
|
#ifndef ImVector
|
||||||
|
template<typename T>
|
||||||
|
class ImVector
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
size_t Size;
|
||||||
|
size_t Capacity;
|
||||||
|
T* Data;
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
typedef value_type* iterator;
|
||||||
|
typedef const value_type* const_iterator;
|
||||||
|
|
||||||
|
ImVector() { Size = Capacity = 0; Data = NULL; }
|
||||||
|
~ImVector() { if (Data) ImGui::MemFree(Data); }
|
||||||
|
|
||||||
|
inline bool empty() const { return Size == 0; }
|
||||||
|
inline size_t size() const { return Size; }
|
||||||
|
inline size_t capacity() const { return Capacity; }
|
||||||
|
|
||||||
|
inline value_type& at(size_t i) { IM_ASSERT(i < Size); return Data[i]; }
|
||||||
|
inline const value_type& at(size_t i) const { IM_ASSERT(i < Size); return Data[i]; }
|
||||||
|
inline value_type& operator[](size_t i) { IM_ASSERT(i < Size); return Data[i]; }
|
||||||
|
inline const value_type& operator[](size_t i) const { IM_ASSERT(i < Size); return Data[i]; }
|
||||||
|
|
||||||
|
inline void clear() { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } }
|
||||||
|
inline iterator begin() { return Data; }
|
||||||
|
inline const_iterator begin() const { return Data; }
|
||||||
|
inline iterator end() { return Data + Size; }
|
||||||
|
inline const_iterator end() const { return Data + Size; }
|
||||||
|
inline value_type& front() { IM_ASSERT(Size > 0); return Data[0]; }
|
||||||
|
inline const value_type& front() const { IM_ASSERT(Size > 0); return Data[0]; }
|
||||||
|
inline value_type& back() { IM_ASSERT(Size > 0); return Data[Size-1]; }
|
||||||
|
inline const value_type& back() const { IM_ASSERT(Size > 0); return Data[Size-1]; }
|
||||||
|
inline void swap(ImVector<T>& rhs) { const size_t rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; const size_t rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }
|
||||||
|
|
||||||
|
inline size_t _grow_capacity(size_t new_size) { size_t new_capacity = Capacity ? (Capacity + Capacity/2) : 8; return new_capacity > new_size ? new_capacity : new_size; }
|
||||||
|
|
||||||
|
inline void resize(size_t new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }
|
||||||
|
inline void reserve(size_t new_capacity)
|
||||||
|
{
|
||||||
|
if (new_capacity <= Capacity) return;
|
||||||
|
T* new_data = (value_type*)ImGui::MemAlloc(new_capacity * sizeof(value_type));
|
||||||
|
memcpy(new_data, Data, Size * sizeof(value_type));
|
||||||
|
ImGui::MemFree(Data);
|
||||||
|
Data = new_data;
|
||||||
|
Capacity = new_capacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size+1)); Data[Size++] = v; }
|
||||||
|
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
||||||
|
|
||||||
|
inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const ptrdiff_t off = it - begin(); memmove(Data + off, Data + off + 1, (Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; }
|
||||||
|
inline iterator insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const ptrdiff_t off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; }
|
||||||
|
};
|
||||||
|
#endif // #ifndef ImVector
|
||||||
|
|
||||||
// Helper: execute a block of code once a frame only
|
// Helper: execute a block of code once a frame only
|
||||||
// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
||||||
// Usage:
|
// Usage:
|
||||||
@ -804,6 +859,7 @@ struct ImGuiStorage
|
|||||||
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
|
// - You can also use this to quickly create temporary editable values during a session of using Edit&Continue, without restarting your application.
|
||||||
IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
|
IMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);
|
||||||
IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0);
|
IMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0);
|
||||||
|
IMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);
|
||||||
|
|
||||||
// Use on your own storage if you know only integer are being stored (open/close all tree nodes)
|
// Use on your own storage if you know only integer are being stored (open/close all tree nodes)
|
||||||
IMGUI_API void SetAllInt(int val);
|
IMGUI_API void SetAllInt(int val);
|
||||||
@ -848,6 +904,38 @@ struct ImColor
|
|||||||
static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r,g,b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r,g,b,a); }
|
static ImColor HSV(float h, float s, float v, float a = 1.0f) { float r,g,b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r,g,b,a); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Helper: Manually clip large list of items.
|
||||||
|
// If you are displaying thousands of even spaced items and you have a random access to the list, you can perform clipping yourself to save on CPU.
|
||||||
|
// Usage:
|
||||||
|
// ImGuiListClipper clipper(count, ImGui::GetTextLineHeightWithSpacing());
|
||||||
|
// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) // display only visible items
|
||||||
|
// ImGui::Text("line number %d", i);
|
||||||
|
// clipper.End();
|
||||||
|
struct ImGuiListClipper
|
||||||
|
{
|
||||||
|
float ItemsHeight;
|
||||||
|
int ItemsCount, DisplayStart, DisplayEnd;
|
||||||
|
|
||||||
|
ImGuiListClipper() { ItemsHeight = 0.0f; ItemsCount = DisplayStart = DisplayEnd = -1; }
|
||||||
|
ImGuiListClipper(int count, float height) { ItemsCount = -1; Begin(count, height); }
|
||||||
|
~ImGuiListClipper() { IM_ASSERT(ItemsCount == -1); } // user forgot to call End()
|
||||||
|
|
||||||
|
void Begin(int count, float height) // items_height: generally pass GetTextLineHeightWithSpacing() or GetItemsLineHeightWithSpacing()
|
||||||
|
{
|
||||||
|
IM_ASSERT(ItemsCount == -1);
|
||||||
|
ItemsCount = count;
|
||||||
|
ItemsHeight = height;
|
||||||
|
ImGui::CalcListClipping(ItemsCount, ItemsHeight, &DisplayStart, &DisplayEnd); // calculate how many to clip/display
|
||||||
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + DisplayStart * ItemsHeight); // advance cursor
|
||||||
|
}
|
||||||
|
void End()
|
||||||
|
{
|
||||||
|
IM_ASSERT(ItemsCount >= 0);
|
||||||
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ItemsCount - DisplayEnd) * ItemsHeight); // advance cursor
|
||||||
|
ItemsCount = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Draw List
|
// Draw List
|
||||||
// Hold a series of drawing commands. The user provides a renderer for ImDrawList.
|
// Hold a series of drawing commands. The user provides a renderer for ImDrawList.
|
||||||
@ -957,10 +1045,12 @@ struct ImFontAtlas
|
|||||||
IMGUI_API ~ImFontAtlas();
|
IMGUI_API ~ImFontAtlas();
|
||||||
IMGUI_API ImFont* AddFontDefault();
|
IMGUI_API ImFont* AddFontDefault();
|
||||||
IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0);
|
IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0);
|
||||||
IMGUI_API ImFont* AddFontFromMemoryTTF(void* in_ttf_data, unsigned int in_ttf_data_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // Pass ownership of 'in_ttf_data' memory, will be deleted after build
|
IMGUI_API ImFont* AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // Transfer ownership of 'ttf_data' to ImFontAtlas, will be deleted after Build()
|
||||||
IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* in_compressed_ttf_data, unsigned int in_compressed_ttf_data_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // 'in_compressed_ttf_data' untouched and still owned by caller. compress with binary_to_compressed_c.
|
IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // 'compressed_ttf_data' untouched and still owned by caller. Compress with binary_to_compressed_c.cpp
|
||||||
IMGUI_API void ClearTexData(); // Saves RAM once the texture has been copied to graphics memory.
|
IMGUI_API void ClearTexData(); // Clear the CPU-side texture data. Saves RAM once the texture has been copied to graphics memory.
|
||||||
IMGUI_API void Clear();
|
IMGUI_API void ClearInputData(); // Clear the input TTF data (inc sizes, glyph ranges)
|
||||||
|
IMGUI_API void ClearFonts(); // Clear the ImGui-side font data (glyphs storage, UV coordinates)
|
||||||
|
IMGUI_API void Clear(); // Clear all
|
||||||
|
|
||||||
// Retrieve texture data
|
// Retrieve texture data
|
||||||
// User is in charge of copying the pixels into graphics memory, then call SetTextureUserID()
|
// User is in charge of copying the pixels into graphics memory, then call SetTextureUserID()
|
||||||
@ -991,7 +1081,6 @@ struct ImFontAtlas
|
|||||||
struct ImFontAtlasData;
|
struct ImFontAtlasData;
|
||||||
ImVector<ImFontAtlasData*> InputData; // Internal data
|
ImVector<ImFontAtlasData*> InputData; // Internal data
|
||||||
IMGUI_API bool Build(); // Build pixels data. This is automatically for you by the GetTexData*** functions.
|
IMGUI_API bool Build(); // Build pixels data. This is automatically for you by the GetTexData*** functions.
|
||||||
IMGUI_API void ClearInputData(); // Clear the input TTF data.
|
|
||||||
IMGUI_API void RenderCustomTexData(int pass, void* rects);
|
IMGUI_API void RenderCustomTexData(int pass, void* rects);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1015,6 +1104,7 @@ struct ImFont
|
|||||||
signed short XOffset, YOffset;
|
signed short XOffset, YOffset;
|
||||||
float U0, V0, U1, V1; // Texture coordinates
|
float U0, V0, U1, V1; // Texture coordinates
|
||||||
};
|
};
|
||||||
|
float BaseLine; // Distance from top to bottom of e.g. 'A' [0..FontSize]
|
||||||
ImFontAtlas* ContainerAtlas; // What we has been loaded into
|
ImFontAtlas* ContainerAtlas; // What we has been loaded into
|
||||||
ImVector<Glyph> Glyphs;
|
ImVector<Glyph> Glyphs;
|
||||||
const Glyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
|
const Glyph* FallbackGlyph; // == FindGlyph(FontFallbackChar)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// [ImGui] this is a slightly modified version of stb_truetype.h 1.02
|
// [ImGui] this is a slightly modified version of stb_truetype.h 1.05
|
||||||
// [ImGui] we added stbtt_PackFontRangesGatherRects() and stbtt_PackFontRangesRenderIntoRects() and modified stbtt_PackBegin()
|
// [ImGui] we added stbtt_PackFontRangesGatherRects() and stbtt_PackFontRangesRenderIntoRects() and modified stbtt_PackBegin()
|
||||||
|
|
||||||
// stb_truetype.h - v1.02 - public domain
|
// stb_truetype.h - v1.05 - public domain
|
||||||
// authored from 2009-2014 by Sean Barrett / RAD Game Tools
|
// authored from 2009-2014 by Sean Barrett / RAD Game Tools
|
||||||
//
|
//
|
||||||
// This library processes TrueType files:
|
// This library processes TrueType files:
|
||||||
@ -37,12 +37,20 @@
|
|||||||
// Johan Duparc
|
// Johan Duparc
|
||||||
// Hou Qiming
|
// Hou Qiming
|
||||||
// Fabian "ryg" Giesen
|
// Fabian "ryg" Giesen
|
||||||
|
// Martins Mozeiko
|
||||||
|
// Cap Petschulat
|
||||||
|
// Omar Cornut
|
||||||
|
// github:aloucks
|
||||||
|
// Peter LaValle
|
||||||
//
|
//
|
||||||
// Misc other:
|
// Misc other:
|
||||||
// Ryan Gordon
|
// Ryan Gordon
|
||||||
//
|
//
|
||||||
// VERSION HISTORY
|
// VERSION HISTORY
|
||||||
//
|
//
|
||||||
|
// 1.05 (2015-04-15) fix misplaced definitions for STBTT_STATIC
|
||||||
|
// 1.04 (2015-04-15) typo in example
|
||||||
|
// 1.03 (2015-04-12) STBTT_STATIC, fix memory leak in new packing, various fixes
|
||||||
// 1.02 (2014-12-10) fix various warnings & compile issues w/ stb_rect_pack, C++
|
// 1.02 (2014-12-10) fix various warnings & compile issues w/ stb_rect_pack, C++
|
||||||
// 1.01 (2014-12-08) fix subpixel position when oversampling to exactly match
|
// 1.01 (2014-12-08) fix subpixel position when oversampling to exactly match
|
||||||
// non-oversampled; STBTT_POINT_SIZE for packed case only
|
// non-oversampled; STBTT_POINT_SIZE for packed case only
|
||||||
@ -86,6 +94,9 @@
|
|||||||
// before the #include of this file. This expands out the actual
|
// before the #include of this file. This expands out the actual
|
||||||
// implementation into that C/C++ file.
|
// implementation into that C/C++ file.
|
||||||
//
|
//
|
||||||
|
// To make the implementation private to the file that generates the implementation,
|
||||||
|
// #define STBTT_STATIC
|
||||||
|
//
|
||||||
// Simple 3D API (don't ship this, but it's fine for tools and quick start)
|
// Simple 3D API (don't ship this, but it's fine for tools and quick start)
|
||||||
// stbtt_BakeFontBitmap() -- bake a font to a bitmap for use as texture
|
// stbtt_BakeFontBitmap() -- bake a font to a bitmap for use as texture
|
||||||
// stbtt_GetBakedQuad() -- compute quad to draw for a given char
|
// stbtt_GetBakedQuad() -- compute quad to draw for a given char
|
||||||
@ -225,16 +236,16 @@
|
|||||||
#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation
|
#define STB_TRUETYPE_IMPLEMENTATION // force following include to generate implementation
|
||||||
#include "stb_truetype.h"
|
#include "stb_truetype.h"
|
||||||
|
|
||||||
char ttf_buffer[1<<20];
|
unsigned char ttf_buffer[1<<20];
|
||||||
unsigned char temp_bitmap[512*512];
|
unsigned char temp_bitmap[512*512];
|
||||||
|
|
||||||
stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs
|
stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs
|
||||||
GLstbtt_uint ftex;
|
GLuint ftex;
|
||||||
|
|
||||||
void my_stbtt_initfont(void)
|
void my_stbtt_initfont(void)
|
||||||
{
|
{
|
||||||
fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
|
fread(ttf_buffer, 1, 1<<20, fopen("c:/windows/fonts/times.ttf", "rb"));
|
||||||
stbtt_BakeFontBitmap(data,0, 32.0, temp_bitmap,512,512, 32,96, cdata); // no guarantee this fits!
|
stbtt_BakeFontBitmap(ttf_buffer,0, 32.0, temp_bitmap,512,512, 32,96, cdata); // no guarantee this fits!
|
||||||
// can free ttf_buffer at this point
|
// can free ttf_buffer at this point
|
||||||
glGenTextures(1, &ftex);
|
glGenTextures(1, &ftex);
|
||||||
glBindTexture(GL_TEXTURE_2D, ftex);
|
glBindTexture(GL_TEXTURE_2D, ftex);
|
||||||
@ -246,6 +257,7 @@ void my_stbtt_initfont(void)
|
|||||||
void my_stbtt_print(float x, float y, char *text)
|
void my_stbtt_print(float x, float y, char *text)
|
||||||
{
|
{
|
||||||
// assume orthographic projection with units = screen pixels, origin at top left
|
// assume orthographic projection with units = screen pixels, origin at top left
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, ftex);
|
glBindTexture(GL_TEXTURE_2D, ftex);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
while (*text) {
|
while (*text) {
|
||||||
@ -379,12 +391,6 @@ int main(int arg, char **argv)
|
|||||||
typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1];
|
typedef char stbtt__check_size32[sizeof(stbtt_int32)==4 ? 1 : -1];
|
||||||
typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1];
|
typedef char stbtt__check_size16[sizeof(stbtt_int16)==2 ? 1 : -1];
|
||||||
|
|
||||||
#ifdef STBTT_STATIC
|
|
||||||
#define STBTT_DEF static
|
|
||||||
#else
|
|
||||||
#define STBTT_DEF extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// #define your own STBTT_sort() to override this to avoid qsort
|
// #define your own STBTT_sort() to override this to avoid qsort
|
||||||
#ifndef STBTT_sort
|
#ifndef STBTT_sort
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -437,6 +443,12 @@ int main(int arg, char **argv)
|
|||||||
#ifndef __STB_INCLUDE_STB_TRUETYPE_H__
|
#ifndef __STB_INCLUDE_STB_TRUETYPE_H__
|
||||||
#define __STB_INCLUDE_STB_TRUETYPE_H__
|
#define __STB_INCLUDE_STB_TRUETYPE_H__
|
||||||
|
|
||||||
|
#ifdef STBTT_STATIC
|
||||||
|
#define STBTT_DEF static
|
||||||
|
#else
|
||||||
|
#define STBTT_DEF extern
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -1059,7 +1071,6 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
|
|||||||
stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1;
|
stbtt_uint16 searchRange = ttUSHORT(data+index_map+8) >> 1;
|
||||||
stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10);
|
stbtt_uint16 entrySelector = ttUSHORT(data+index_map+10);
|
||||||
stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1;
|
stbtt_uint16 rangeShift = ttUSHORT(data+index_map+12) >> 1;
|
||||||
stbtt_uint16 item, offset, start, end;
|
|
||||||
|
|
||||||
// do a binary search of the segments
|
// do a binary search of the segments
|
||||||
stbtt_uint32 endCount = index_map + 14;
|
stbtt_uint32 endCount = index_map + 14;
|
||||||
@ -1076,8 +1087,8 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
|
|||||||
// now decrement to bias correctly to find smallest
|
// now decrement to bias correctly to find smallest
|
||||||
search -= 2;
|
search -= 2;
|
||||||
while (entrySelector) {
|
while (entrySelector) {
|
||||||
|
stbtt_uint16 end;
|
||||||
searchRange >>= 1;
|
searchRange >>= 1;
|
||||||
start = ttUSHORT(data + search + searchRange*2 + segcount*2 + 2);
|
|
||||||
end = ttUSHORT(data + search + searchRange*2);
|
end = ttUSHORT(data + search + searchRange*2);
|
||||||
if (unicode_codepoint > end)
|
if (unicode_codepoint > end)
|
||||||
search += searchRange*2;
|
search += searchRange*2;
|
||||||
@ -1085,19 +1096,21 @@ STBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codep
|
|||||||
}
|
}
|
||||||
search += 2;
|
search += 2;
|
||||||
|
|
||||||
item = (stbtt_uint16) ((search - endCount) >> 1);
|
{
|
||||||
|
stbtt_uint16 offset, start;
|
||||||
|
stbtt_uint16 item = (stbtt_uint16) ((search - endCount) >> 1);
|
||||||
|
|
||||||
STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));
|
STBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2*item));
|
||||||
start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);
|
start = ttUSHORT(data + index_map + 14 + segcount*2 + 2 + 2*item);
|
||||||
end = ttUSHORT(data + index_map + 14 + 2 + 2*item);
|
if (unicode_codepoint < start)
|
||||||
if (unicode_codepoint < start)
|
return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);
|
offset = ttUSHORT(data + index_map + 14 + segcount*6 + 2 + 2*item);
|
||||||
if (offset == 0)
|
if (offset == 0)
|
||||||
return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item));
|
return (stbtt_uint16) (unicode_codepoint + ttSHORT(data + index_map + 14 + segcount*4 + 2 + 2*item));
|
||||||
|
|
||||||
return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);
|
return ttUSHORT(data + offset + (unicode_codepoint-start)*2 + index_map + 14 + segcount*6 + 2 + 2*item);
|
||||||
|
}
|
||||||
} else if (format == 12 || format == 13) {
|
} else if (format == 12 || format == 13) {
|
||||||
stbtt_uint32 ngroups = ttULONG(data+index_map+12);
|
stbtt_uint32 ngroups = ttULONG(data+index_map+12);
|
||||||
stbtt_int32 low,high;
|
stbtt_int32 low,high;
|
||||||
@ -2054,8 +2067,8 @@ STBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int
|
|||||||
float d3d_bias = opengl_fillrule ? 0 : -0.5f;
|
float d3d_bias = opengl_fillrule ? 0 : -0.5f;
|
||||||
float ipw = 1.0f / pw, iph = 1.0f / ph;
|
float ipw = 1.0f / pw, iph = 1.0f / ph;
|
||||||
stbtt_bakedchar *b = chardata + char_index;
|
stbtt_bakedchar *b = chardata + char_index;
|
||||||
int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5);
|
int round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f);
|
||||||
int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5);
|
int round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f);
|
||||||
|
|
||||||
q->x0 = round_x + d3d_bias;
|
q->x0 = round_x + d3d_bias;
|
||||||
q->y0 = round_y + d3d_bias;
|
q->y0 = round_y + d3d_bias;
|
||||||
@ -2209,7 +2222,7 @@ static void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_i
|
|||||||
for (j=0; j < h; ++j) {
|
for (j=0; j < h; ++j) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int total;
|
unsigned int total;
|
||||||
memset(buffer, 0, kernel_width);
|
STBTT_memset(buffer, 0, kernel_width);
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
|
|
||||||
@ -2263,7 +2276,7 @@ static void stbtt__v_prefilter(unsigned char *pixels, int w, int h, int stride_i
|
|||||||
for (j=0; j < w; ++j) {
|
for (j=0; j < w; ++j) {
|
||||||
int i;
|
int i;
|
||||||
unsigned int total;
|
unsigned int total;
|
||||||
memset(buffer, 0, kernel_width);
|
STBTT_memset(buffer, 0, kernel_width);
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
|
|
||||||
@ -2333,7 +2346,7 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, stbtt_fon
|
|||||||
for (j=0; j < ranges[i].num_chars_in_range; ++j) {
|
for (j=0; j < ranges[i].num_chars_in_range; ++j) {
|
||||||
int x0,y0,x1,y1;
|
int x0,y0,x1,y1;
|
||||||
int glyph = stbtt_FindGlyphIndex(info,ranges[i].first_unicode_char_in_range + j);
|
int glyph = stbtt_FindGlyphIndex(info,ranges[i].first_unicode_char_in_range + j);
|
||||||
if (glyph) {
|
if (glyph) {
|
||||||
stbtt_GetGlyphBitmapBoxSubpixel(info,glyph,
|
stbtt_GetGlyphBitmapBoxSubpixel(info,glyph,
|
||||||
scale * spc->h_oversample,
|
scale * spc->h_oversample,
|
||||||
scale * spc->v_oversample,
|
scale * spc->v_oversample,
|
||||||
@ -2341,10 +2354,10 @@ STBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, stbtt_fon
|
|||||||
&x0,&y0,&x1,&y1);
|
&x0,&y0,&x1,&y1);
|
||||||
rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1);
|
rects[k].w = (stbrp_coord) (x1-x0 + spc->padding + spc->h_oversample-1);
|
||||||
rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1);
|
rects[k].h = (stbrp_coord) (y1-y0 + spc->padding + spc->v_oversample-1);
|
||||||
} else {
|
} else {
|
||||||
rects[k].w = rects[k].h = 1;
|
rects[k].w = rects[k].h = 1;
|
||||||
}
|
}
|
||||||
++k;
|
++k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2453,6 +2466,7 @@ STBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontd
|
|||||||
|
|
||||||
return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects);
|
return_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects);
|
||||||
|
|
||||||
|
STBTT_free(rects, spc->user_allocator_context);
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2473,8 +2487,8 @@ STBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, i
|
|||||||
stbtt_packedchar *b = chardata + char_index;
|
stbtt_packedchar *b = chardata + char_index;
|
||||||
|
|
||||||
if (align_to_integer) {
|
if (align_to_integer) {
|
||||||
float x = (float) STBTT_ifloor((*xpos + b->xoff) + 0.5);
|
float x = (float) STBTT_ifloor((*xpos + b->xoff) + 0.5f);
|
||||||
float y = (float) STBTT_ifloor((*ypos + b->yoff) + 0.5);
|
float y = (float) STBTT_ifloor((*ypos + b->yoff) + 0.5f);
|
||||||
q->x0 = x;
|
q->x0 = x;
|
||||||
q->y0 = y;
|
q->y0 = y;
|
||||||
q->x1 = x + b->xoff2 - b->xoff;
|
q->x1 = x + b->xoff2 - b->xoff;
|
||||||
|
BIN
web/examples_03.png
Normal file
BIN
web/examples_03.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
web/test_window_05_menus.png
Normal file
BIN
web/test_window_05_menus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Reference in New Issue
Block a user