mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 16:29:54 +02:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
b0361375ee |
8
.github/issue_template.md
vendored
8
.github/issue_template.md
vendored
@ -1,12 +1,12 @@
|
|||||||
(Click "Preview" above ^ to turn URL into clickable links)
|
(Click "Preview" above ^ to turn URL into clickable links)
|
||||||
|
|
||||||
1. FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING or LOADING FONTS, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
|
1. PLEASE CAREFULLY READ: [FAQ](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md)
|
||||||
|
|
||||||
2. PLEASE CAREFULLY READ: [FAQ](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md)
|
2. PLEASE CAREFULLY READ: [Issue Submitting Guidelines](https://github.com/ocornut/imgui/issues/2261)
|
||||||
|
|
||||||
3. PLEASE CAREFULLY READ: [Issue Submitting Guidelines](https://github.com/ocornut/imgui/issues/2261)
|
3. FOR FIRST-TIME USERS ISSUES COMPILING/LINKING/RUNNING/LOADING FONTS, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
|
||||||
|
|
||||||
4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the links above.
|
4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the link provided in (1) (2).
|
||||||
|
|
||||||
5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
|
5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.
|
||||||
|
|
||||||
|
6
.github/pull_request_template.md
vendored
6
.github/pull_request_template.md
vendored
@ -1,6 +1,6 @@
|
|||||||
(Click "Preview" to turn any http URL into a clickable link)
|
(Click "Preview" to turn any http URL into a clickable link)
|
||||||
|
|
||||||
1. PLEASE CAREFULLY READ: [Issue Submitting Guidelines](https://github.com/ocornut/imgui/issues/2261)
|
PLEASE CAREFULLY READ:
|
||||||
|
https://github.com/ocornut/imgui/issues/2261
|
||||||
2. Clear this template before submitting your PR.
|
|
||||||
|
|
||||||
|
(Clear this template before submitting your PR)
|
||||||
|
67
.github/workflows/build.yml
vendored
67
.github/workflows/build.yml
vendored
@ -37,30 +37,20 @@ jobs:
|
|||||||
- name: Fix Projects
|
- name: Fix Projects
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
# CI workers do not supporter older Visual Studio versions. Fix projects to target newer available version.
|
# WARNING: This will need updating if toolset/sdk change in project files!
|
||||||
gci -recurse -filter "*.vcxproj" | ForEach-Object {
|
gci -recurse -filter "*.vcxproj" | ForEach-Object {
|
||||||
(Get-Content $_.FullName) -Replace "<PlatformToolset>v\d{3}</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
|
# Fix SDK and toolset for most samples.
|
||||||
(Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>[\d\.]+</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
|
(Get-Content $_.FullName) -Replace "<PlatformToolset>v110</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
|
||||||
|
(Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
|
||||||
|
# Fix SDK and toolset for samples that require newer SDK/toolset. At the moment it is only dx12.
|
||||||
|
(Get-Content $_.FullName) -Replace "<PlatformToolset>v140</PlatformToolset>","<PlatformToolset>v142</PlatformToolset>" | Set-Content -Path $_.FullName
|
||||||
|
(Get-Content $_.FullName) -Replace "<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>","<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>" | Set-Content -Path $_.FullName
|
||||||
}
|
}
|
||||||
|
|
||||||
# Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long.
|
# Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long.
|
||||||
- name: Build example_null (extra warnings, mingw 64-bit)
|
- name: Build example_null (extra warnings, mingw 64-bit)
|
||||||
run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1
|
run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1
|
||||||
|
|
||||||
- name: Build example_null (mingw 64-bit, as DLL)
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo '#ifdef _EXPORT' > example_single_file.cpp
|
|
||||||
echo '# define IMGUI_API __declspec(dllexport)' >> example_single_file.cpp
|
|
||||||
echo '#else' >> example_single_file.cpp
|
|
||||||
echo '# define IMGUI_API __declspec(dllimport)' >> example_single_file.cpp
|
|
||||||
echo '#endif' >> example_single_file.cpp
|
|
||||||
echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp
|
|
||||||
echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp
|
|
||||||
g++ -I. -Wall -Wformat -D_EXPORT -shared -o libimgui.dll -Wl,--out-implib,libimgui.a example_single_file.cpp -limm32
|
|
||||||
g++ -I. -Wall -Wformat -o example_null.exe examples/example_null/main.cpp -L. -limgui
|
|
||||||
rm -f example_null.exe libimgui.* example_single_file.*
|
|
||||||
|
|
||||||
- name: Build example_null (extra warnings, msvc 64-bit)
|
- name: Build example_null (extra warnings, msvc 64-bit)
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@ -236,18 +226,6 @@ jobs:
|
|||||||
make -C examples/example_null clean
|
make -C examples/example_null clean
|
||||||
CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
|
CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1
|
||||||
|
|
||||||
- name: Build example_null (extra warnings, empty IM_ASSERT)
|
|
||||||
run: |
|
|
||||||
cat > example_single_file.cpp <<'EOF'
|
|
||||||
|
|
||||||
#define IM_ASSERT(x)
|
|
||||||
#define IMGUI_IMPLEMENTATION
|
|
||||||
#include "misc/single_file/imgui_single_file.h"
|
|
||||||
#include "examples/example_null/main.cpp"
|
|
||||||
|
|
||||||
EOF
|
|
||||||
g++ -I. -Wall -Wformat -Wextra -Werror -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros -Wno-empty-body -o example_single_file example_single_file.cpp
|
|
||||||
|
|
||||||
- name: Build example_null (freetype)
|
- name: Build example_null (freetype)
|
||||||
run: |
|
run: |
|
||||||
make -C examples/example_null clean
|
make -C examples/example_null clean
|
||||||
@ -493,3 +471,34 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd examples/example_android_opengl3/android
|
cd examples/example_android_opengl3/android
|
||||||
gradle assembleDebug
|
gradle assembleDebug
|
||||||
|
|
||||||
|
Discord-CI:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
if: always()
|
||||||
|
needs: [Windows, Linux, MacOS, iOS, Emscripten, Android]
|
||||||
|
steps:
|
||||||
|
- uses: dearimgui/github_discord_notifier@latest
|
||||||
|
with:
|
||||||
|
discord-webhook: ${{ secrets.DISCORD_CI_WEBHOOK }}
|
||||||
|
github-token: ${{ github.token }}
|
||||||
|
action-task: discord-jobs
|
||||||
|
discord-filter: "'{{ github.branch }}'.match(/master|docking/g) != null && '{{ run.conclusion }}' != '{{ last_run.conclusion }}'"
|
||||||
|
discord-username: GitHub Actions
|
||||||
|
discord-job-new-failure-message: ''
|
||||||
|
discord-job-fixed-failure-message: ''
|
||||||
|
discord-job-new-failure-embed: |
|
||||||
|
{
|
||||||
|
"title": "`{{ job.name }}` job is failing on `{{ github.branch }}`!",
|
||||||
|
"description": "Commit [{{ github.context.payload.head_commit.title }}]({{ github.context.payload.head_commit.url }}) pushed to [{{ github.branch }}]({{ github.branch_url }}) broke [{{ job.name }}]({{ job.url }}) build job.\nFailing steps: {{ failing_steps }}",
|
||||||
|
"url": "{{ job.url }}",
|
||||||
|
"color": "0xFF0000",
|
||||||
|
"timestamp": "{{ run.updated_at }}"
|
||||||
|
}
|
||||||
|
discord-job-fixed-failure-embed: |
|
||||||
|
{
|
||||||
|
"title": "`{{ github.branch }}` branch is no longer failing!",
|
||||||
|
"description": "Build failures were fixed on [{{ github.branch }}]({{ github.branch_url }}) branch.",
|
||||||
|
"color": "0x00FF00",
|
||||||
|
"url": "{{ github.context.payload.head_commit.url }}",
|
||||||
|
"timestamp": "{{ run.completed_at }}"
|
||||||
|
}
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-12-08: Renderer: Fixed mishandling of the the ImDrawCmd::IdxOffset field! This is an old bug but it never had an effect until some internal rendering changes in 1.86.
|
|
||||||
// 2021-08-17: Calling io.AddFocusEvent() on ALLEGRO_EVENT_DISPLAY_SWITCH_OUT/ALLEGRO_EVENT_DISPLAY_SWITCH_IN events.
|
// 2021-08-17: Calling io.AddFocusEvent() on ALLEGRO_EVENT_DISPLAY_SWITCH_OUT/ALLEGRO_EVENT_DISPLAY_SWITCH_IN events.
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-05-19: Renderer: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
// 2021-05-19: Renderer: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||||
@ -156,6 +155,7 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
|
int idx_offset = 0;
|
||||||
ImVec2 clip_off = draw_data->DisplayPos;
|
ImVec2 clip_off = draw_data->DisplayPos;
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
@ -171,17 +171,12 @@ void ImGui_ImplAllegro5_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Draw
|
||||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
|
||||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle, Draw
|
|
||||||
ALLEGRO_BITMAP* texture = (ALLEGRO_BITMAP*)pcmd->GetTexID();
|
ALLEGRO_BITMAP* texture = (ALLEGRO_BITMAP*)pcmd->GetTexID();
|
||||||
al_set_clipping_rectangle(clip_min.x, clip_min.y, clip_max.x - clip_min.x, clip_max.y - clip_min.y);
|
al_set_clipping_rectangle(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y, pcmd->ClipRect.z - pcmd->ClipRect.x, pcmd->ClipRect.w - pcmd->ClipRect.y);
|
||||||
al_draw_prim(&vertices[0], bd->VertexDecl, texture, pcmd->IdxOffset, pcmd->IdxOffset + pcmd->ElemCount, ALLEGRO_PRIM_TRIANGLE_LIST);
|
al_draw_prim(&vertices[0], bd->VertexDecl, texture, idx_offset, idx_offset + pcmd->ElemCount, ALLEGRO_PRIM_TRIANGLE_LIST);
|
||||||
}
|
}
|
||||||
|
idx_offset += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,9 +329,8 @@ bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
|
|||||||
|
|
||||||
void ImGui_ImplAllegro5_Shutdown()
|
void ImGui_ImplAllegro5_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplAllegro5_Data* bd = ImGui_ImplAllegro5_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplAllegro5_InvalidateDeviceObjects();
|
ImGui_ImplAllegro5_InvalidateDeviceObjects();
|
||||||
if (bd->VertexDecl)
|
if (bd->VertexDecl)
|
||||||
|
@ -253,14 +253,8 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
|
||||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
|
||||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle
|
// Apply scissor/clipping rectangle
|
||||||
const D3D10_RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y };
|
const D3D10_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y)};
|
||||||
ctx->RSSetScissorRects(1, &r);
|
ctx->RSSetScissorRects(1, &r);
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
@ -556,9 +550,8 @@ bool ImGui_ImplDX10_Init(ID3D10Device* device)
|
|||||||
|
|
||||||
void ImGui_ImplDX10_Shutdown()
|
void ImGui_ImplDX10_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX10_Data* bd = ImGui_ImplDX10_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplDX10_Data* bd = ImGui_ImplDX10_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplDX10_InvalidateDeviceObjects();
|
ImGui_ImplDX10_InvalidateDeviceObjects();
|
||||||
if (bd->pFactory) { bd->pFactory->Release(); }
|
if (bd->pFactory) { bd->pFactory->Release(); }
|
||||||
|
@ -263,14 +263,8 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
|
||||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
|
||||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle
|
// Apply scissor/clipping rectangle
|
||||||
const D3D11_RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y };
|
const D3D11_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
|
||||||
ctx->RSSetScissorRects(1, &r);
|
ctx->RSSetScissorRects(1, &r);
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
@ -571,9 +565,8 @@ bool ImGui_ImplDX11_Init(ID3D11Device* device, ID3D11DeviceContext* device_co
|
|||||||
|
|
||||||
void ImGui_ImplDX11_Shutdown()
|
void ImGui_ImplDX11_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplDX11_Data* bd = ImGui_ImplDX11_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplDX11_InvalidateDeviceObjects();
|
ImGui_ImplDX11_InvalidateDeviceObjects();
|
||||||
if (bd->pFactory) { bd->pFactory->Release(); }
|
if (bd->pFactory) { bd->pFactory->Release(); }
|
||||||
|
@ -259,19 +259,16 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Apply Scissor, Bind texture, Draw
|
||||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
const D3D12_RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
|
||||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
if (r.right > r.left && r.bottom > r.top)
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
{
|
||||||
continue;
|
D3D12_GPU_DESCRIPTOR_HANDLE texture_handle = {};
|
||||||
|
texture_handle.ptr = (UINT64)pcmd->GetTexID();
|
||||||
// Apply Scissor/clipping rectangle, Bind texture, Draw
|
ctx->SetGraphicsRootDescriptorTable(1, texture_handle);
|
||||||
const D3D12_RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y };
|
ctx->RSSetScissorRects(1, &r);
|
||||||
D3D12_GPU_DESCRIPTOR_HANDLE texture_handle = {};
|
ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
||||||
texture_handle.ptr = (UINT64)pcmd->GetTexID();
|
}
|
||||||
ctx->SetGraphicsRootDescriptorTable(1, texture_handle);
|
|
||||||
ctx->RSSetScissorRects(1, &r);
|
|
||||||
ctx->DrawIndexedInstanced(pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
global_idx_offset += cmd_list->IdxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
@ -725,9 +722,8 @@ bool ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FO
|
|||||||
|
|
||||||
void ImGui_ImplDX12_Shutdown()
|
void ImGui_ImplDX12_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplDX12_Data* bd = ImGui_ImplDX12_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplDX12_InvalidateDeviceObjects();
|
ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||||
delete[] bd->pFrameResources;
|
delete[] bd->pFrameResources;
|
||||||
|
@ -9,15 +9,20 @@
|
|||||||
// This is because we need ImTextureID to carry a 64-bit value and by default ImTextureID is defined as void*.
|
// This is because we need ImTextureID to carry a 64-bit value and by default ImTextureID is defined as void*.
|
||||||
// This define is set in the example .vcxproj file and need to be replicated in your app or by adding it to your imconfig.h file.
|
// This define is set in the example .vcxproj file and need to be replicated in your app or by adding it to your imconfig.h file.
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "imgui.h" // IMGUI_IMPL_API
|
#include "imgui.h" // IMGUI_IMPL_API
|
||||||
#include <dxgiformat.h> // DXGI_FORMAT
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable: 4471) // a forward declaration of an unscoped enumeration must have an underlying type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum DXGI_FORMAT;
|
||||||
struct ID3D12Device;
|
struct ID3D12Device;
|
||||||
struct ID3D12DescriptorHeap;
|
struct ID3D12DescriptorHeap;
|
||||||
struct ID3D12GraphicsCommandList;
|
struct ID3D12GraphicsCommandList;
|
||||||
@ -37,3 +42,8 @@ IMGUI_IMPL_API void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3
|
|||||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||||
IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects();
|
IMGUI_IMPL_API void ImGui_ImplDX12_InvalidateDeviceObjects();
|
||||||
IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects();
|
IMGUI_IMPL_API bool ImGui_ImplDX12_CreateDeviceObjects();
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -248,14 +248,7 @@ void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
const RECT r = { (LONG)(pcmd->ClipRect.x - clip_off.x), (LONG)(pcmd->ClipRect.y - clip_off.y), (LONG)(pcmd->ClipRect.z - clip_off.x), (LONG)(pcmd->ClipRect.w - clip_off.y) };
|
||||||
ImVec2 clip_min(pcmd->ClipRect.x - clip_off.x, pcmd->ClipRect.y - clip_off.y);
|
|
||||||
ImVec2 clip_max(pcmd->ClipRect.z - clip_off.x, pcmd->ClipRect.w - clip_off.y);
|
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Apply Scissor/clipping rectangle, Bind texture, Draw
|
|
||||||
const RECT r = { (LONG)clip_min.x, (LONG)clip_min.y, (LONG)clip_max.x, (LONG)clip_max.y };
|
|
||||||
const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->GetTexID();
|
const LPDIRECT3DTEXTURE9 texture = (LPDIRECT3DTEXTURE9)pcmd->GetTexID();
|
||||||
bd->pd3dDevice->SetTexture(0, texture);
|
bd->pd3dDevice->SetTexture(0, texture);
|
||||||
bd->pd3dDevice->SetScissorRect(&r);
|
bd->pd3dDevice->SetScissorRect(&r);
|
||||||
@ -295,9 +288,8 @@ bool ImGui_ImplDX9_Init(IDirect3DDevice9* device)
|
|||||||
|
|
||||||
void ImGui_ImplDX9_Shutdown()
|
void ImGui_ImplDX9_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplDX9_Data* bd = ImGui_ImplDX9_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplDX9_InvalidateDeviceObjects();
|
ImGui_ImplDX9_InvalidateDeviceObjects();
|
||||||
if (bd->pd3dDevice) { bd->pd3dDevice->Release(); }
|
if (bd->pd3dDevice) { bd->pd3dDevice->Release(); }
|
||||||
|
@ -270,7 +270,6 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|||||||
|
|
||||||
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||||
bd->PrevUserCallbackWindowFocus = NULL;
|
bd->PrevUserCallbackWindowFocus = NULL;
|
||||||
bd->PrevUserCallbackCursorEnter = NULL;
|
|
||||||
bd->PrevUserCallbackMousebutton = NULL;
|
bd->PrevUserCallbackMousebutton = NULL;
|
||||||
bd->PrevUserCallbackScroll = NULL;
|
bd->PrevUserCallbackScroll = NULL;
|
||||||
bd->PrevUserCallbackKey = NULL;
|
bd->PrevUserCallbackKey = NULL;
|
||||||
@ -309,9 +308,8 @@ bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool install_callbacks)
|
|||||||
|
|
||||||
void ImGui_ImplGlfw_Shutdown()
|
void ImGui_ImplGlfw_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplGlfw_Data* bd = ImGui_ImplGlfw_GetBackendData();
|
||||||
|
|
||||||
if (bd->InstalledCallbacks)
|
if (bd->InstalledCallbacks)
|
||||||
{
|
{
|
||||||
|
318
backends/imgui_impl_marmalade.cpp
Normal file
318
backends/imgui_impl_marmalade.cpp
Normal file
@ -0,0 +1,318 @@
|
|||||||
|
// dear imgui: Renderer + Platform Backend for Marmalade + IwGx
|
||||||
|
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||||
|
// Missing features:
|
||||||
|
// [ ] Renderer: Clipping rectangles are not honored.
|
||||||
|
|
||||||
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
|
// CHANGELOG
|
||||||
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2021-05-19: Renderer: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||||
|
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
||||||
|
// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
|
||||||
|
// 2018-11-30: Misc: Setting up io.BackendPlatformName/io.BackendRendererName so they can be displayed in the About Window.
|
||||||
|
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_Marmalade_RenderDrawData() in the .h file so you can call it yourself.
|
||||||
|
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
||||||
|
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
#include "imgui_impl_marmalade.h"
|
||||||
|
|
||||||
|
#include <s3eClipboard.h>
|
||||||
|
#include <s3ePointer.h>
|
||||||
|
#include <s3eKeyboard.h>
|
||||||
|
#include <IwTexture.h>
|
||||||
|
#include <IwGx.h>
|
||||||
|
|
||||||
|
// Data
|
||||||
|
static double g_Time = 0.0f;
|
||||||
|
static bool g_MousePressed[3] = { false, false, false };
|
||||||
|
static CIwTexture* g_FontTexture = NULL;
|
||||||
|
static char* g_ClipboardText = NULL;
|
||||||
|
static bool g_osdKeyboardEnabled = false;
|
||||||
|
|
||||||
|
// use this setting to scale the interface - e.g. on device you could use 2 or 3 scale factor
|
||||||
|
static ImVec2 g_RenderScale = ImVec2(1.0f, 1.0f);
|
||||||
|
|
||||||
|
// Render function.
|
||||||
|
void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data)
|
||||||
|
{
|
||||||
|
// Avoid rendering when minimized
|
||||||
|
if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Render command lists
|
||||||
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
|
{
|
||||||
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
|
const int nVert = cmd_list->VtxBuffer.Size;
|
||||||
|
CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
||||||
|
CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
||||||
|
CIwColour* pColStream = IW_GX_ALLOC(CIwColour, nVert);
|
||||||
|
|
||||||
|
for (int i = 0; i < nVert; i++)
|
||||||
|
{
|
||||||
|
// FIXME-OPT: optimize multiplication on GPU using vertex shader/projection matrix.
|
||||||
|
pVertStream[i].x = cmd_list->VtxBuffer[i].pos.x * g_RenderScale.x;
|
||||||
|
pVertStream[i].y = cmd_list->VtxBuffer[i].pos.y * g_RenderScale.y;
|
||||||
|
pUVStream[i].x = cmd_list->VtxBuffer[i].uv.x;
|
||||||
|
pUVStream[i].y = cmd_list->VtxBuffer[i].uv.y;
|
||||||
|
pColStream[i] = cmd_list->VtxBuffer[i].col;
|
||||||
|
}
|
||||||
|
|
||||||
|
IwGxSetVertStreamScreenSpace(pVertStream, nVert);
|
||||||
|
IwGxSetUVStream(pUVStream);
|
||||||
|
IwGxSetColStream(pColStream, nVert);
|
||||||
|
IwGxSetNormStream(0);
|
||||||
|
|
||||||
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
|
{
|
||||||
|
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
||||||
|
if (pcmd->UserCallback)
|
||||||
|
{
|
||||||
|
pcmd->UserCallback(cmd_list, pcmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// FIXME: Not honoring ClipRect fields.
|
||||||
|
CIwMaterial* pCurrentMaterial = IW_GX_ALLOC_MATERIAL();
|
||||||
|
pCurrentMaterial->SetShadeMode(CIwMaterial::SHADE_FLAT);
|
||||||
|
pCurrentMaterial->SetCullMode(CIwMaterial::CULL_NONE);
|
||||||
|
pCurrentMaterial->SetFiltering(false);
|
||||||
|
pCurrentMaterial->SetAlphaMode(CIwMaterial::ALPHA_BLEND);
|
||||||
|
pCurrentMaterial->SetDepthWriteMode(CIwMaterial::DEPTH_WRITE_NORMAL);
|
||||||
|
pCurrentMaterial->SetAlphaTestMode(CIwMaterial::ALPHATEST_DISABLED);
|
||||||
|
pCurrentMaterial->SetTexture((CIwTexture*)pcmd->GetTexID());
|
||||||
|
IwGxSetMaterial(pCurrentMaterial);
|
||||||
|
IwGxDrawPrims(IW_GX_TRI_LIST, (uint16*)idx_buffer, pcmd->ElemCount);
|
||||||
|
}
|
||||||
|
idx_buffer += pcmd->ElemCount;
|
||||||
|
}
|
||||||
|
IwGxFlush();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: restore modified state (i.e. mvp matrix)
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char* ImGui_Marmalade_GetClipboardText(void* /*user_data*/)
|
||||||
|
{
|
||||||
|
if (!s3eClipboardAvailable())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (int size = s3eClipboardGetText(NULL, 0))
|
||||||
|
{
|
||||||
|
if (g_ClipboardText)
|
||||||
|
delete[] g_ClipboardText;
|
||||||
|
g_ClipboardText = new char[size];
|
||||||
|
g_ClipboardText[0] = '\0';
|
||||||
|
s3eClipboardGetText(g_ClipboardText, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_ClipboardText;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ImGui_Marmalade_SetClipboardText(void* /*user_data*/, const char* text)
|
||||||
|
{
|
||||||
|
if (s3eClipboardAvailable())
|
||||||
|
s3eClipboardSetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data)
|
||||||
|
{
|
||||||
|
// pEvent->m_Button is of type s3ePointerButton and indicates which mouse
|
||||||
|
// button was pressed. For touchscreen this should always have the value
|
||||||
|
// S3E_POINTER_BUTTON_SELECT
|
||||||
|
s3ePointerEvent* pEvent = (s3ePointerEvent*)system_data;
|
||||||
|
|
||||||
|
if (pEvent->m_Pressed == 1)
|
||||||
|
{
|
||||||
|
if (pEvent->m_Button == S3E_POINTER_BUTTON_LEFTMOUSE)
|
||||||
|
g_MousePressed[0] = true;
|
||||||
|
if (pEvent->m_Button == S3E_POINTER_BUTTON_RIGHTMOUSE)
|
||||||
|
g_MousePressed[1] = true;
|
||||||
|
if (pEvent->m_Button == S3E_POINTER_BUTTON_MIDDLEMOUSE)
|
||||||
|
g_MousePressed[2] = true;
|
||||||
|
if (pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELUP)
|
||||||
|
io.MouseWheel += pEvent->m_y;
|
||||||
|
if (pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELDOWN)
|
||||||
|
io.MouseWheel += pEvent->m_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
s3eKeyboardEvent* e = (s3eKeyboardEvent*)system_data;
|
||||||
|
if (e->m_Pressed == 1)
|
||||||
|
io.KeysDown[e->m_Key] = true;
|
||||||
|
if (e->m_Pressed == 0)
|
||||||
|
io.KeysDown[e->m_Key] = false;
|
||||||
|
|
||||||
|
io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN;
|
||||||
|
io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN;
|
||||||
|
io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN;
|
||||||
|
io.KeySuper = s3eKeyboardGetState(s3eKeyLeftWindows) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightWindows) == S3E_KEY_STATE_DOWN;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
s3eKeyboardCharEvent* e = (s3eKeyboardCharEvent*)system_data;
|
||||||
|
io.AddInputCharacter((unsigned int)e->m_Char);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_Marmalade_CreateDeviceObjects()
|
||||||
|
{
|
||||||
|
// Build texture atlas
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
unsigned char* pixels;
|
||||||
|
int width, height;
|
||||||
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
||||||
|
|
||||||
|
// Upload texture to graphics system
|
||||||
|
g_FontTexture = new CIwTexture();
|
||||||
|
g_FontTexture->SetModifiable(true);
|
||||||
|
CIwImage& image = g_FontTexture->GetImage();
|
||||||
|
image.SetFormat(CIwImage::ARGB_8888);
|
||||||
|
image.SetWidth(width);
|
||||||
|
image.SetHeight(height);
|
||||||
|
image.SetBuffers(); // allocates and own buffers
|
||||||
|
image.ReadTexels(pixels);
|
||||||
|
g_FontTexture->SetMipMapping(false);
|
||||||
|
g_FontTexture->SetFiltering(false);
|
||||||
|
g_FontTexture->Upload();
|
||||||
|
|
||||||
|
// Store our identifier
|
||||||
|
io.Fonts->SetTexID((ImTextureID)g_FontTexture);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_Marmalade_InvalidateDeviceObjects()
|
||||||
|
{
|
||||||
|
if (g_ClipboardText)
|
||||||
|
{
|
||||||
|
delete[] g_ClipboardText;
|
||||||
|
g_ClipboardText = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_FontTexture)
|
||||||
|
{
|
||||||
|
ImGui::GetIO().Fonts->SetTexID(0);
|
||||||
|
delete g_FontTexture;
|
||||||
|
g_FontTexture = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui_Marmalade_Init(bool install_callbacks)
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
io.BackendPlatformName = io.BackendRendererName = "imgui_impl_marmalade";
|
||||||
|
|
||||||
|
// Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeysDown[] array.
|
||||||
|
io.KeyMap[ImGuiKey_Tab] = s3eKeyTab
|
||||||
|
io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
|
||||||
|
io.KeyMap[ImGuiKey_RightArrow] = s3eKeyRight;
|
||||||
|
io.KeyMap[ImGuiKey_UpArrow] = s3eKeyUp;
|
||||||
|
io.KeyMap[ImGuiKey_DownArrow] = s3eKeyDown;
|
||||||
|
io.KeyMap[ImGuiKey_PageUp] = s3eKeyPageUp;
|
||||||
|
io.KeyMap[ImGuiKey_PageDown] = s3eKeyPageDown;
|
||||||
|
io.KeyMap[ImGuiKey_Home] = s3eKeyHome;
|
||||||
|
io.KeyMap[ImGuiKey_End] = s3eKeyEnd;
|
||||||
|
io.KeyMap[ImGuiKey_Insert] = s3eKeyInsert;
|
||||||
|
io.KeyMap[ImGuiKey_Delete] = s3eKeyDelete;
|
||||||
|
io.KeyMap[ImGuiKey_Backspace] = s3eKeyBackspace;
|
||||||
|
io.KeyMap[ImGuiKey_Space] = s3eKeySpace;
|
||||||
|
io.KeyMap[ImGuiKey_Enter] = s3eKeyEnter;
|
||||||
|
io.KeyMap[ImGuiKey_Escape] = s3eKeyEsc;
|
||||||
|
io.KeyMap[ImGuiKey_KeyPadEnter] = s3eKeyNumPadEnter;
|
||||||
|
io.KeyMap[ImGuiKey_A] = s3eKeyA;
|
||||||
|
io.KeyMap[ImGuiKey_C] = s3eKeyC;
|
||||||
|
io.KeyMap[ImGuiKey_V] = s3eKeyV;
|
||||||
|
io.KeyMap[ImGuiKey_X] = s3eKeyX;
|
||||||
|
io.KeyMap[ImGuiKey_Y] = s3eKeyY;
|
||||||
|
io.KeyMap[ImGuiKey_Z] = s3eKeyZ;
|
||||||
|
|
||||||
|
io.SetClipboardTextFn = ImGui_Marmalade_SetClipboardText;
|
||||||
|
io.GetClipboardTextFn = ImGui_Marmalade_GetClipboardText;
|
||||||
|
|
||||||
|
if (install_callbacks)
|
||||||
|
{
|
||||||
|
s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, ImGui_Marmalade_PointerButtonEventCallback, 0);
|
||||||
|
s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, ImGui_Marmalade_KeyCallback, 0);
|
||||||
|
s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, ImGui_Marmalade_CharCallback, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_Marmalade_Shutdown()
|
||||||
|
{
|
||||||
|
ImGui_Marmalade_InvalidateDeviceObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImGui_Marmalade_NewFrame()
|
||||||
|
{
|
||||||
|
if (!g_FontTexture)
|
||||||
|
ImGui_Marmalade_CreateDeviceObjects();
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
|
// Setup display size (every frame to accommodate for window resizing)
|
||||||
|
int w = IwGxGetScreenWidth(), h = IwGxGetScreenHeight();
|
||||||
|
io.DisplaySize = ImVec2((float)w, (float)h);
|
||||||
|
// For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
|
||||||
|
io.DisplayFramebufferScale = g_scale;
|
||||||
|
|
||||||
|
// Setup time step
|
||||||
|
double current_time = s3eTimerGetUST() / 1000.0f;
|
||||||
|
io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f / 60.0f);
|
||||||
|
g_Time = current_time;
|
||||||
|
|
||||||
|
double mouse_x, mouse_y;
|
||||||
|
mouse_x = s3ePointerGetX();
|
||||||
|
mouse_y = s3ePointerGetY();
|
||||||
|
io.MousePos = ImVec2((float)mouse_x / g_scale.x, (float)mouse_y / g_scale.y); // Mouse position (set to -FLT_MAX,-FLT_MAX if no mouse / on another screen, etc.)
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
io.MouseDown[i] = g_MousePressed[i] || s3ePointerGetState((s3ePointerButton)i) != S3E_POINTER_STATE_UP; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
||||||
|
g_MousePressed[i] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Hide OS mouse cursor if ImGui is drawing it
|
||||||
|
// s3ePointerSetInt(S3E_POINTER_HIDE_CURSOR,(io.MouseDrawCursor ? 0 : 1));
|
||||||
|
|
||||||
|
// Show/hide OSD keyboard
|
||||||
|
if (io.WantTextInput)
|
||||||
|
{
|
||||||
|
// Some text input widget is active?
|
||||||
|
if (!g_osdKeyboardEnabled)
|
||||||
|
{
|
||||||
|
g_osdKeyboardEnabled = true;
|
||||||
|
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 1); // show OSD keyboard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No text input widget is active
|
||||||
|
if (g_osdKeyboardEnabled)
|
||||||
|
{
|
||||||
|
g_osdKeyboardEnabled = false;
|
||||||
|
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 0); // hide OSD keyboard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
backends/imgui_impl_marmalade.h
Normal file
28
backends/imgui_impl_marmalade.h
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// dear imgui: Renderer + Platform Backend for Marmalade + IwGx
|
||||||
|
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
|
||||||
|
|
||||||
|
// Implemented features:
|
||||||
|
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID!
|
||||||
|
|
||||||
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "imgui.h" // IMGUI_IMPL_API
|
||||||
|
|
||||||
|
IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
|
||||||
|
IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
|
||||||
|
IMGUI_IMPL_API void ImGui_Marmalade_NewFrame();
|
||||||
|
IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data);
|
||||||
|
|
||||||
|
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
||||||
|
IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects();
|
||||||
|
IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects();
|
||||||
|
|
||||||
|
// Callbacks (installed by default if you enable 'install_callbacks' during initialization)
|
||||||
|
// You can also handle inputs yourself and use those as a reference.
|
||||||
|
IMGUI_IMPL_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data);
|
||||||
|
IMGUI_IMPL_API int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data);
|
||||||
|
IMGUI_IMPL_API int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data);
|
@ -5,14 +5,13 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID!
|
// [X] Renderer: User texture binding. Use 'MTLTexture' as ImTextureID. Read the FAQ about ImTextureID!
|
||||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-08-24: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted. (#4464)
|
|
||||||
// 2021-05-19: Metal: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
// 2021-05-19: Metal: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||||
// 2021-02-18: Metal: Change blending equation to preserve alpha in output buffer.
|
// 2021-02-18: Metal: Change blending equation to preserve alpha in output buffer.
|
||||||
// 2021-01-25: Metal: Fixed texture storage mode when building on Mac Catalyst.
|
// 2021-01-25: Metal: Fixed texture storage mode when building on Mac Catalyst.
|
||||||
@ -505,37 +504,36 @@ void ImGui_ImplMetal_DestroyDeviceObjects()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
ImVec4 clip_rect;
|
||||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
|
||||||
|
clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
|
||||||
|
|
||||||
// Clamp to viewport as setScissorRect() won't accept values that are off bounds
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }
|
|
||||||
if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }
|
|
||||||
if (clip_max.x > fb_width) { clip_max.x = (float)fb_width; }
|
|
||||||
if (clip_max.y > fb_height) { clip_max.y = (float)fb_height; }
|
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle
|
|
||||||
MTLScissorRect scissorRect =
|
|
||||||
{
|
{
|
||||||
.x = NSUInteger(clip_min.x),
|
// Apply scissor/clipping rectangle
|
||||||
.y = NSUInteger(clip_min.y),
|
MTLScissorRect scissorRect =
|
||||||
.width = NSUInteger(clip_max.x - clip_min.x),
|
{
|
||||||
.height = NSUInteger(clip_max.y - clip_min.y)
|
.x = NSUInteger(clip_rect.x),
|
||||||
};
|
.y = NSUInteger(clip_rect.y),
|
||||||
[commandEncoder setScissorRect:scissorRect];
|
.width = NSUInteger(clip_rect.z - clip_rect.x),
|
||||||
|
.height = NSUInteger(clip_rect.w - clip_rect.y)
|
||||||
|
};
|
||||||
|
[commandEncoder setScissorRect:scissorRect];
|
||||||
|
|
||||||
// Bind texture, Draw
|
|
||||||
if (ImTextureID tex_id = pcmd->GetTexID())
|
|
||||||
[commandEncoder setFragmentTexture:(__bridge id<MTLTexture>)(tex_id) atIndex:0];
|
|
||||||
|
|
||||||
[commandEncoder setVertexBufferOffset:(vertexBufferOffset + pcmd->VtxOffset * sizeof(ImDrawVert)) atIndex:0];
|
// Bind texture, Draw
|
||||||
[commandEncoder drawIndexedPrimitives:MTLPrimitiveTypeTriangle
|
if (ImTextureID tex_id = pcmd->GetTexID())
|
||||||
indexCount:pcmd->ElemCount
|
[commandEncoder setFragmentTexture:(__bridge id<MTLTexture>)(tex_id) atIndex:0];
|
||||||
indexType:sizeof(ImDrawIdx) == 2 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
|
|
||||||
indexBuffer:indexBuffer.buffer
|
[commandEncoder setVertexBufferOffset:(vertexBufferOffset + pcmd->VtxOffset * sizeof(ImDrawVert)) atIndex:0];
|
||||||
indexBufferOffset:indexBufferOffset + pcmd->IdxOffset * sizeof(ImDrawIdx)];
|
[commandEncoder drawIndexedPrimitives:MTLPrimitiveTypeTriangle
|
||||||
|
indexCount:pcmd->ElemCount
|
||||||
|
indexType:sizeof(ImDrawIdx) == 2 ? MTLIndexTypeUInt16 : MTLIndexTypeUInt32
|
||||||
|
indexBuffer:indexBuffer.buffer
|
||||||
|
indexBufferOffset:indexBufferOffset + pcmd->IdxOffset * sizeof(ImDrawIdx)];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-12-08: OpenGL: Fixed mishandling of the the ImDrawCmd::IdxOffset field! This is an old bug but it never had an effect until some internal rendering changes in 1.86.
|
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-05-19: OpenGL: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
// 2021-05-19: OpenGL: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||||
// 2021-01-03: OpenGL: Backup, setup and restore GL_SHADE_MODEL state, disable GL_STENCIL_TEST and disable GL_NORMAL_ARRAY client state to increase compatibility with legacy OpenGL applications.
|
// 2021-01-03: OpenGL: Backup, setup and restore GL_SHADE_MODEL state, disable GL_STENCIL_TEST and disable GL_NORMAL_ARRAY client state to increase compatibility with legacy OpenGL applications.
|
||||||
@ -87,9 +86,8 @@ bool ImGui_ImplOpenGL2_Init()
|
|||||||
|
|
||||||
void ImGui_ImplOpenGL2_Shutdown()
|
void ImGui_ImplOpenGL2_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplOpenGL2_Data* bd = ImGui_ImplOpenGL2_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplOpenGL2_Data* bd = ImGui_ImplOpenGL2_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplOpenGL2_DestroyDeviceObjects();
|
ImGui_ImplOpenGL2_DestroyDeviceObjects();
|
||||||
io.BackendRendererName = NULL;
|
io.BackendRendererName = NULL;
|
||||||
@ -202,18 +200,23 @@ void ImGui_ImplOpenGL2_RenderDrawData(ImDrawData* draw_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
ImVec4 clip_rect;
|
||||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
|
||||||
continue;
|
clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle (Y is inverted in OpenGL)
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y));
|
{
|
||||||
|
// Apply scissor/clipping rectangle
|
||||||
|
glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID());
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID());
|
||||||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer + pcmd->IdxOffset);
|
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
idx_buffer += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-12-15: OpenGL: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports with some Intel HD drivers.
|
|
||||||
// 2021-08-23: OpenGL: Fixed ES 3.0 shader ("#version 300 es") use normal precision floats to avoid wobbly rendering at HD resolutions.
|
|
||||||
// 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader.
|
// 2021-08-19: OpenGL: Embed and use our own minimal GL loader (imgui_impl_opengl3_loader.h), removing requirement and support for third-party loader.
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-06-25: OpenGL: Use OES_vertex_array extension on Emscripten + backup/restore current state.
|
// 2021-06-25: OpenGL: Use OES_vertex_array extension on Emscripten + backup/restore current state.
|
||||||
@ -106,9 +104,6 @@
|
|||||||
#include <GLES2/gl2ext.h>
|
#include <GLES2/gl2ext.h>
|
||||||
#endif
|
#endif
|
||||||
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
#elif defined(IMGUI_IMPL_OPENGL_ES3)
|
||||||
#if defined(__APPLE__)
|
|
||||||
#include <TargetConditionals.h>
|
|
||||||
#endif
|
|
||||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
|
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV))
|
||||||
#include <OpenGLES/ES3/gl.h> // Use GL ES 3
|
#include <OpenGLES/ES3/gl.h> // Use GL ES 3
|
||||||
#else
|
#else
|
||||||
@ -175,8 +170,6 @@ struct ImGui_ImplOpenGL3_Data
|
|||||||
GLuint AttribLocationVtxUV;
|
GLuint AttribLocationVtxUV;
|
||||||
GLuint AttribLocationVtxColor;
|
GLuint AttribLocationVtxColor;
|
||||||
unsigned int VboHandle, ElementsHandle;
|
unsigned int VboHandle, ElementsHandle;
|
||||||
GLsizeiptr VertexBufferSize;
|
|
||||||
GLsizeiptr IndexBufferSize;
|
|
||||||
bool HasClipOrigin;
|
bool HasClipOrigin;
|
||||||
|
|
||||||
ImGui_ImplOpenGL3_Data() { memset(this, 0, sizeof(*this)); }
|
ImGui_ImplOpenGL3_Data() { memset(this, 0, sizeof(*this)); }
|
||||||
@ -272,9 +265,8 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
|||||||
|
|
||||||
void ImGui_ImplOpenGL3_Shutdown()
|
void ImGui_ImplOpenGL3_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplOpenGL3_Data* bd = ImGui_ImplOpenGL3_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
||||||
io.BackendRendererName = NULL;
|
io.BackendRendererName = NULL;
|
||||||
@ -428,20 +420,8 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
|
|
||||||
// Upload vertex/index buffers
|
// Upload vertex/index buffers
|
||||||
GLsizeiptr vtx_buffer_size = (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert);
|
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
|
||||||
GLsizeiptr idx_buffer_size = (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx);
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
|
||||||
if (bd->VertexBufferSize < vtx_buffer_size)
|
|
||||||
{
|
|
||||||
bd->VertexBufferSize = vtx_buffer_size;
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, bd->VertexBufferSize, NULL, GL_STREAM_DRAW);
|
|
||||||
}
|
|
||||||
if (bd->IndexBufferSize < idx_buffer_size)
|
|
||||||
{
|
|
||||||
bd->IndexBufferSize = idx_buffer_size;
|
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, bd->IndexBufferSize, NULL, GL_STREAM_DRAW);
|
|
||||||
}
|
|
||||||
glBufferSubData(GL_ARRAY_BUFFER, 0, vtx_buffer_size, (const GLvoid*)cmd_list->VtxBuffer.Data);
|
|
||||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, idx_buffer_size, (const GLvoid*)cmd_list->IdxBuffer.Data);
|
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
@ -458,22 +438,26 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
ImVec4 clip_rect;
|
||||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
|
||||||
continue;
|
clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle (Y is inverted in OpenGL)
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
glScissor((int)clip_min.x, (int)(fb_height - clip_max.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y));
|
{
|
||||||
|
// Apply scissor/clipping rectangle
|
||||||
|
glScissor((int)clip_rect.x, (int)(fb_height - clip_rect.w), (int)(clip_rect.z - clip_rect.x), (int)(clip_rect.w - clip_rect.y));
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID());
|
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->GetTexID());
|
||||||
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
#ifdef IMGUI_IMPL_OPENGL_MAY_HAVE_VTX_OFFSET
|
||||||
if (bd->GlVersion >= 320)
|
if (bd->GlVersion >= 320)
|
||||||
glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset);
|
glDrawElementsBaseVertex(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)), (GLint)pcmd->VtxOffset);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)));
|
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)(intptr_t)(pcmd->IdxOffset * sizeof(ImDrawIdx)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -641,7 +625,7 @@ bool ImGui_ImplOpenGL3_CreateDeviceObjects()
|
|||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
const GLchar* vertex_shader_glsl_300_es =
|
const GLchar* vertex_shader_glsl_300_es =
|
||||||
"precision highp float;\n"
|
"precision mediump float;\n"
|
||||||
"layout (location = 0) in vec2 Position;\n"
|
"layout (location = 0) in vec2 Position;\n"
|
||||||
"layout (location = 1) in vec2 UV;\n"
|
"layout (location = 1) in vec2 UV;\n"
|
||||||
"layout (location = 2) in vec4 Color;\n"
|
"layout (location = 2) in vec4 Color;\n"
|
||||||
|
@ -42,7 +42,7 @@ IMGUI_IMPL_API void ImGui_ImplOpenGL3_DestroyDeviceObjects();
|
|||||||
|
|
||||||
// Try to detect GLES on matching platforms
|
// Try to detect GLES on matching platforms
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <TargetConditionals.h>
|
#include "TargetConditionals.h"
|
||||||
#endif
|
#endif
|
||||||
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
#if (defined(__APPLE__) && (TARGET_OS_IOS || TARGET_OS_TV)) || (defined(__ANDROID__))
|
||||||
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
#define IMGUI_IMPL_OPENGL_ES3 // iOS, Android -> GL ES 3, "#version 300 es"
|
||||||
|
@ -1,22 +1,3 @@
|
|||||||
//-----------------------------------------------------------------------------
|
|
||||||
// About imgui_impl_opengl3_loader.h:
|
|
||||||
//
|
|
||||||
// We embed our own OpenGL loader to not require user to provide their own or to have to use ours,
|
|
||||||
// which proved to be endless problems for users.
|
|
||||||
// Our loader is custom-generated, based on gl3w but automatically filtered to only include
|
|
||||||
// enums/functions that we use in our imgui_impl_opengl3.cpp source file in order to be small.
|
|
||||||
//
|
|
||||||
// YOU SHOULD NOT NEED TO INCLUDE/USE THIS DIRECTLY. THIS IS USED BY imgui_impl_opengl3.cpp ONLY.
|
|
||||||
// THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
|
|
||||||
//
|
|
||||||
// Regenerate with:
|
|
||||||
// python gl3w_gen.py --output ../imgui/backends/imgui_impl_opengl3_loader.h --ref ../imgui/backends/imgui_impl_opengl3.cpp ./extra_symbols.txt
|
|
||||||
//
|
|
||||||
// More info:
|
|
||||||
// https://github.com/dearimgui/gl3w_stripped
|
|
||||||
// https://github.com/ocornut/imgui/issues/4445
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file was generated with gl3w_gen.py, part of imgl3w
|
* This file was generated with gl3w_gen.py, part of imgl3w
|
||||||
* (hosted at https://github.com/dearimgui/gl3w_stripped)
|
* (hosted at https://github.com/dearimgui/gl3w_stripped)
|
||||||
@ -45,11 +26,14 @@
|
|||||||
* OTHER DEALINGS IN THE SOFTWARE.
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// We embed our own OpenGL loader to not require user to provide their own or to have to use ours, which proved to be endless problems for users.
|
||||||
|
// Our loader is custom-generated, based on gl3w but automatically filtered to only include enums/functions that we use in this source file.
|
||||||
|
// Regenerate with: python gl3w_gen.py --imgui-dir /path/to/imgui/
|
||||||
|
// see https://github.com/dearimgui/gl3w_stripped for more info.
|
||||||
#ifndef __gl3w_h_
|
#ifndef __gl3w_h_
|
||||||
#define __gl3w_h_
|
#define __gl3w_h_
|
||||||
|
|
||||||
// Adapted from KHR/khrplatform.h to avoid including entire file.
|
// Adapted from KHR/khrplatform.h to avoid including entire file.
|
||||||
#ifndef __khrplatform_h_
|
|
||||||
typedef float khronos_float_t;
|
typedef float khronos_float_t;
|
||||||
typedef signed char khronos_int8_t;
|
typedef signed char khronos_int8_t;
|
||||||
typedef unsigned char khronos_uint8_t;
|
typedef unsigned char khronos_uint8_t;
|
||||||
@ -74,7 +58,6 @@ typedef uint64_t khronos_uint64_t;
|
|||||||
typedef signed long long khronos_int64_t;
|
typedef signed long long khronos_int64_t;
|
||||||
typedef unsigned long long khronos_uint64_t;
|
typedef unsigned long long khronos_uint64_t;
|
||||||
#endif
|
#endif
|
||||||
#endif // __khrplatform_h_
|
|
||||||
|
|
||||||
#ifndef __gl_glcorearb_h_
|
#ifndef __gl_glcorearb_h_
|
||||||
#define __gl_glcorearb_h_ 1
|
#define __gl_glcorearb_h_ 1
|
||||||
@ -179,7 +162,6 @@ typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
|
|||||||
typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
|
||||||
typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
|
||||||
typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||||
typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
|
|
||||||
typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
|
||||||
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
|
||||||
typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
|
||||||
@ -195,7 +177,6 @@ GLAPI void APIENTRY glDisable (GLenum cap);
|
|||||||
GLAPI void APIENTRY glEnable (GLenum cap);
|
GLAPI void APIENTRY glEnable (GLenum cap);
|
||||||
GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
|
GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
|
||||||
GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||||
GLAPI GLenum APIENTRY glGetError (void);
|
|
||||||
GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
|
||||||
GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
|
GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
|
||||||
GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
|
GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
|
||||||
@ -249,13 +230,11 @@ typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
|
|||||||
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
|
||||||
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
|
||||||
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||||
typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
|
||||||
#ifdef GL_GLEXT_PROTOTYPES
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
|
||||||
GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
|
||||||
GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
|
||||||
GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
|
||||||
GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
|
|
||||||
#endif
|
#endif
|
||||||
#endif /* GL_VERSION_1_5 */
|
#endif /* GL_VERSION_1_5 */
|
||||||
#ifndef GL_VERSION_2_0
|
#ifndef GL_VERSION_2_0
|
||||||
@ -437,7 +416,7 @@ GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
|
|||||||
|
|
||||||
/* gl3w internal state */
|
/* gl3w internal state */
|
||||||
union GL3WProcs {
|
union GL3WProcs {
|
||||||
GL3WglProc ptr[53];
|
GL3WglProc ptr[52];
|
||||||
struct {
|
struct {
|
||||||
PFNGLACTIVETEXTUREPROC ActiveTexture;
|
PFNGLACTIVETEXTUREPROC ActiveTexture;
|
||||||
PFNGLATTACHSHADERPROC AttachShader;
|
PFNGLATTACHSHADERPROC AttachShader;
|
||||||
@ -449,7 +428,6 @@ union GL3WProcs {
|
|||||||
PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate;
|
PFNGLBLENDEQUATIONSEPARATEPROC BlendEquationSeparate;
|
||||||
PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
|
PFNGLBLENDFUNCSEPARATEPROC BlendFuncSeparate;
|
||||||
PFNGLBUFFERDATAPROC BufferData;
|
PFNGLBUFFERDATAPROC BufferData;
|
||||||
PFNGLBUFFERSUBDATAPROC BufferSubData;
|
|
||||||
PFNGLCLEARPROC Clear;
|
PFNGLCLEARPROC Clear;
|
||||||
PFNGLCLEARCOLORPROC ClearColor;
|
PFNGLCLEARCOLORPROC ClearColor;
|
||||||
PFNGLCOMPILESHADERPROC CompileShader;
|
PFNGLCOMPILESHADERPROC CompileShader;
|
||||||
@ -470,7 +448,6 @@ union GL3WProcs {
|
|||||||
PFNGLGENTEXTURESPROC GenTextures;
|
PFNGLGENTEXTURESPROC GenTextures;
|
||||||
PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
|
PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
|
||||||
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
|
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
|
||||||
PFNGLGETERRORPROC GetError;
|
|
||||||
PFNGLGETINTEGERVPROC GetIntegerv;
|
PFNGLGETINTEGERVPROC GetIntegerv;
|
||||||
PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
|
PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
|
||||||
PFNGLGETPROGRAMIVPROC GetProgramiv;
|
PFNGLGETPROGRAMIVPROC GetProgramiv;
|
||||||
@ -496,63 +473,61 @@ union GL3WProcs {
|
|||||||
} gl;
|
} gl;
|
||||||
};
|
};
|
||||||
|
|
||||||
GL3W_API extern union GL3WProcs imgl3wProcs;
|
GL3W_API extern union GL3WProcs gl3wProcs;
|
||||||
|
|
||||||
/* OpenGL functions */
|
/* OpenGL functions */
|
||||||
#define glActiveTexture imgl3wProcs.gl.ActiveTexture
|
#define glActiveTexture gl3wProcs.gl.ActiveTexture
|
||||||
#define glAttachShader imgl3wProcs.gl.AttachShader
|
#define glAttachShader gl3wProcs.gl.AttachShader
|
||||||
#define glBindBuffer imgl3wProcs.gl.BindBuffer
|
#define glBindBuffer gl3wProcs.gl.BindBuffer
|
||||||
#define glBindSampler imgl3wProcs.gl.BindSampler
|
#define glBindSampler gl3wProcs.gl.BindSampler
|
||||||
#define glBindTexture imgl3wProcs.gl.BindTexture
|
#define glBindTexture gl3wProcs.gl.BindTexture
|
||||||
#define glBindVertexArray imgl3wProcs.gl.BindVertexArray
|
#define glBindVertexArray gl3wProcs.gl.BindVertexArray
|
||||||
#define glBlendEquation imgl3wProcs.gl.BlendEquation
|
#define glBlendEquation gl3wProcs.gl.BlendEquation
|
||||||
#define glBlendEquationSeparate imgl3wProcs.gl.BlendEquationSeparate
|
#define glBlendEquationSeparate gl3wProcs.gl.BlendEquationSeparate
|
||||||
#define glBlendFuncSeparate imgl3wProcs.gl.BlendFuncSeparate
|
#define glBlendFuncSeparate gl3wProcs.gl.BlendFuncSeparate
|
||||||
#define glBufferData imgl3wProcs.gl.BufferData
|
#define glBufferData gl3wProcs.gl.BufferData
|
||||||
#define glBufferSubData imgl3wProcs.gl.BufferSubData
|
#define glClear gl3wProcs.gl.Clear
|
||||||
#define glClear imgl3wProcs.gl.Clear
|
#define glClearColor gl3wProcs.gl.ClearColor
|
||||||
#define glClearColor imgl3wProcs.gl.ClearColor
|
#define glCompileShader gl3wProcs.gl.CompileShader
|
||||||
#define glCompileShader imgl3wProcs.gl.CompileShader
|
#define glCreateProgram gl3wProcs.gl.CreateProgram
|
||||||
#define glCreateProgram imgl3wProcs.gl.CreateProgram
|
#define glCreateShader gl3wProcs.gl.CreateShader
|
||||||
#define glCreateShader imgl3wProcs.gl.CreateShader
|
#define glDeleteBuffers gl3wProcs.gl.DeleteBuffers
|
||||||
#define glDeleteBuffers imgl3wProcs.gl.DeleteBuffers
|
#define glDeleteProgram gl3wProcs.gl.DeleteProgram
|
||||||
#define glDeleteProgram imgl3wProcs.gl.DeleteProgram
|
#define glDeleteShader gl3wProcs.gl.DeleteShader
|
||||||
#define glDeleteShader imgl3wProcs.gl.DeleteShader
|
#define glDeleteTextures gl3wProcs.gl.DeleteTextures
|
||||||
#define glDeleteTextures imgl3wProcs.gl.DeleteTextures
|
#define glDeleteVertexArrays gl3wProcs.gl.DeleteVertexArrays
|
||||||
#define glDeleteVertexArrays imgl3wProcs.gl.DeleteVertexArrays
|
#define glDetachShader gl3wProcs.gl.DetachShader
|
||||||
#define glDetachShader imgl3wProcs.gl.DetachShader
|
#define glDisable gl3wProcs.gl.Disable
|
||||||
#define glDisable imgl3wProcs.gl.Disable
|
#define glDrawElements gl3wProcs.gl.DrawElements
|
||||||
#define glDrawElements imgl3wProcs.gl.DrawElements
|
#define glDrawElementsBaseVertex gl3wProcs.gl.DrawElementsBaseVertex
|
||||||
#define glDrawElementsBaseVertex imgl3wProcs.gl.DrawElementsBaseVertex
|
#define glEnable gl3wProcs.gl.Enable
|
||||||
#define glEnable imgl3wProcs.gl.Enable
|
#define glEnableVertexAttribArray gl3wProcs.gl.EnableVertexAttribArray
|
||||||
#define glEnableVertexAttribArray imgl3wProcs.gl.EnableVertexAttribArray
|
#define glGenBuffers gl3wProcs.gl.GenBuffers
|
||||||
#define glGenBuffers imgl3wProcs.gl.GenBuffers
|
#define glGenTextures gl3wProcs.gl.GenTextures
|
||||||
#define glGenTextures imgl3wProcs.gl.GenTextures
|
#define glGenVertexArrays gl3wProcs.gl.GenVertexArrays
|
||||||
#define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays
|
#define glGetAttribLocation gl3wProcs.gl.GetAttribLocation
|
||||||
#define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation
|
#define glGetIntegerv gl3wProcs.gl.GetIntegerv
|
||||||
#define glGetError imgl3wProcs.gl.GetError
|
#define glGetProgramInfoLog gl3wProcs.gl.GetProgramInfoLog
|
||||||
#define glGetIntegerv imgl3wProcs.gl.GetIntegerv
|
#define glGetProgramiv gl3wProcs.gl.GetProgramiv
|
||||||
#define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog
|
#define glGetShaderInfoLog gl3wProcs.gl.GetShaderInfoLog
|
||||||
#define glGetProgramiv imgl3wProcs.gl.GetProgramiv
|
#define glGetShaderiv gl3wProcs.gl.GetShaderiv
|
||||||
#define glGetShaderInfoLog imgl3wProcs.gl.GetShaderInfoLog
|
#define glGetString gl3wProcs.gl.GetString
|
||||||
#define glGetShaderiv imgl3wProcs.gl.GetShaderiv
|
#define glGetStringi gl3wProcs.gl.GetStringi
|
||||||
#define glGetString imgl3wProcs.gl.GetString
|
#define glGetUniformLocation gl3wProcs.gl.GetUniformLocation
|
||||||
#define glGetStringi imgl3wProcs.gl.GetStringi
|
#define glIsEnabled gl3wProcs.gl.IsEnabled
|
||||||
#define glGetUniformLocation imgl3wProcs.gl.GetUniformLocation
|
#define glLinkProgram gl3wProcs.gl.LinkProgram
|
||||||
#define glIsEnabled imgl3wProcs.gl.IsEnabled
|
#define glPixelStorei gl3wProcs.gl.PixelStorei
|
||||||
#define glLinkProgram imgl3wProcs.gl.LinkProgram
|
#define glPolygonMode gl3wProcs.gl.PolygonMode
|
||||||
#define glPixelStorei imgl3wProcs.gl.PixelStorei
|
#define glReadPixels gl3wProcs.gl.ReadPixels
|
||||||
#define glPolygonMode imgl3wProcs.gl.PolygonMode
|
#define glScissor gl3wProcs.gl.Scissor
|
||||||
#define glReadPixels imgl3wProcs.gl.ReadPixels
|
#define glShaderSource gl3wProcs.gl.ShaderSource
|
||||||
#define glScissor imgl3wProcs.gl.Scissor
|
#define glTexImage2D gl3wProcs.gl.TexImage2D
|
||||||
#define glShaderSource imgl3wProcs.gl.ShaderSource
|
#define glTexParameteri gl3wProcs.gl.TexParameteri
|
||||||
#define glTexImage2D imgl3wProcs.gl.TexImage2D
|
#define glUniform1i gl3wProcs.gl.Uniform1i
|
||||||
#define glTexParameteri imgl3wProcs.gl.TexParameteri
|
#define glUniformMatrix4fv gl3wProcs.gl.UniformMatrix4fv
|
||||||
#define glUniform1i imgl3wProcs.gl.Uniform1i
|
#define glUseProgram gl3wProcs.gl.UseProgram
|
||||||
#define glUniformMatrix4fv imgl3wProcs.gl.UniformMatrix4fv
|
#define glVertexAttribPointer gl3wProcs.gl.VertexAttribPointer
|
||||||
#define glUseProgram imgl3wProcs.gl.UseProgram
|
#define glViewport gl3wProcs.gl.Viewport
|
||||||
#define glVertexAttribPointer imgl3wProcs.gl.VertexAttribPointer
|
|
||||||
#define glViewport imgl3wProcs.gl.Viewport
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@ -696,7 +671,6 @@ static const char *proc_names[] = {
|
|||||||
"glBlendEquationSeparate",
|
"glBlendEquationSeparate",
|
||||||
"glBlendFuncSeparate",
|
"glBlendFuncSeparate",
|
||||||
"glBufferData",
|
"glBufferData",
|
||||||
"glBufferSubData",
|
|
||||||
"glClear",
|
"glClear",
|
||||||
"glClearColor",
|
"glClearColor",
|
||||||
"glCompileShader",
|
"glCompileShader",
|
||||||
@ -717,7 +691,6 @@ static const char *proc_names[] = {
|
|||||||
"glGenTextures",
|
"glGenTextures",
|
||||||
"glGenVertexArrays",
|
"glGenVertexArrays",
|
||||||
"glGetAttribLocation",
|
"glGetAttribLocation",
|
||||||
"glGetError",
|
|
||||||
"glGetIntegerv",
|
"glGetIntegerv",
|
||||||
"glGetProgramInfoLog",
|
"glGetProgramInfoLog",
|
||||||
"glGetProgramiv",
|
"glGetProgramiv",
|
||||||
@ -742,13 +715,13 @@ static const char *proc_names[] = {
|
|||||||
"glViewport",
|
"glViewport",
|
||||||
};
|
};
|
||||||
|
|
||||||
GL3W_API union GL3WProcs imgl3wProcs;
|
GL3W_API union GL3WProcs gl3wProcs;
|
||||||
|
|
||||||
static void load_procs(GL3WGetProcAddressProc proc)
|
static void load_procs(GL3WGetProcAddressProc proc)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < ARRAY_SIZE(proc_names); i++)
|
for (i = 0; i < ARRAY_SIZE(proc_names); i++)
|
||||||
imgl3wProcs.ptr[i] = proc(proc_names[i]);
|
gl3wProcs.ptr[i] = proc(proc_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -5,10 +5,10 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
|
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
|
||||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
// Issues:
|
||||||
// [X] Platform: Keyboard arrays indexed using kVK_* codes, e.g. ImGui::IsKeyPressed(kVK_Space).
|
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
@ -18,7 +18,7 @@
|
|||||||
@class NSEvent;
|
@class NSEvent;
|
||||||
@class NSView;
|
@class NSView;
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view);
|
IMGUI_IMPL_API bool ImGui_ImplOSX_Init();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
|
IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
|
||||||
IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent* _Nonnull event, NSView* _Nullable view);
|
IMGUI_IMPL_API bool ImGui_ImplOSX_HandleEvent(NSEvent* _Nonnull event, NSView* _Nullable view);
|
||||||
|
@ -5,26 +5,20 @@
|
|||||||
// Implemented features:
|
// Implemented features:
|
||||||
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
// [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
|
||||||
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
|
// [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
|
||||||
// [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
|
// Issues:
|
||||||
// [X] Platform: Keyboard arrays indexed using kVK_* codes, e.g. ImGui::IsKeyPressed(kVK_Space).
|
// [ ] Platform: Keys are all generally very broken. Best using [event keycode] and not [event characters]..
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
#import "imgui.h"
|
#include "imgui.h"
|
||||||
#import "imgui_impl_osx.h"
|
#include "imgui_impl_osx.h"
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <mach/mach_time.h>
|
|
||||||
#import <Carbon/Carbon.h>
|
|
||||||
#import <GameController/GameController.h>
|
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-12-13: *BREAKING CHANGE* Add NSView parameter to ImGui_ImplOSX_Init(). Generally fix keyboard support. Using kVK_* codes for keyboard keys.
|
|
||||||
// 2021-12-13: Add game controller support.
|
|
||||||
// 2021-09-21: Use mach_absolute_time as CFAbsoluteTimeGetCurrent can jump backwards.
|
|
||||||
// 2021-08-17: Calling io.AddFocusEvent() on NSApplicationDidBecomeActiveNotification/NSApplicationDidResignActiveNotification events.
|
// 2021-08-17: Calling io.AddFocusEvent() on NSApplicationDidBecomeActiveNotification/NSApplicationDidResignActiveNotification events.
|
||||||
// 2021-06-23: Inputs: Added a fix for shortcuts using CTRL key instead of CMD key.
|
// 2021-06-23: Inputs: Added a fix for shortcuts using CTRL key instead of CMD key.
|
||||||
// 2021-04-19: Inputs: Added a fix for keys remaining stuck in pressed state when CMD-tabbing into different application.
|
// 2021-04-19: Inputs: Added a fix for keys remaining stuck in pressed state when CMD-tabbing into different application.
|
||||||
@ -41,17 +35,14 @@
|
|||||||
// 2018-07-07: Initial version.
|
// 2018-07-07: Initial version.
|
||||||
|
|
||||||
@class ImFocusObserver;
|
@class ImFocusObserver;
|
||||||
@class KeyEventResponder;
|
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
static double g_HostClockPeriod = 0.0;
|
static CFAbsoluteTime g_Time = 0.0;
|
||||||
static double g_Time = 0.0;
|
static NSCursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
|
||||||
static NSCursor* g_MouseCursors[ImGuiMouseCursor_COUNT] = {};
|
static bool g_MouseCursorHidden = false;
|
||||||
static bool g_MouseCursorHidden = false;
|
static bool g_MouseJustPressed[ImGuiMouseButton_COUNT] = {};
|
||||||
static bool g_MouseJustPressed[ImGuiMouseButton_COUNT] = {};
|
static bool g_MouseDown[ImGuiMouseButton_COUNT] = {};
|
||||||
static bool g_MouseDown[ImGuiMouseButton_COUNT] = {};
|
static ImFocusObserver* g_FocusObserver = NULL;
|
||||||
static ImFocusObserver* g_FocusObserver = nil;
|
|
||||||
static KeyEventResponder* g_KeyEventResponder = nil;
|
|
||||||
|
|
||||||
// Undocumented methods for creating cursors.
|
// Undocumented methods for creating cursors.
|
||||||
@interface NSCursor()
|
@interface NSCursor()
|
||||||
@ -61,18 +52,6 @@ static KeyEventResponder* g_KeyEventResponder = nil;
|
|||||||
+ (id)_windowResizeEastWestCursor;
|
+ (id)_windowResizeEastWestCursor;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static void InitHostClockPeriod()
|
|
||||||
{
|
|
||||||
struct mach_timebase_info info;
|
|
||||||
mach_timebase_info(&info);
|
|
||||||
g_HostClockPeriod = 1e-9 * ((double)info.denom / (double)info.numer); // Period is the reciprocal of frequency.
|
|
||||||
}
|
|
||||||
|
|
||||||
static double GetMachAbsoluteTimeInSeconds()
|
|
||||||
{
|
|
||||||
return (double)mach_absolute_time() * g_HostClockPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void resetKeys()
|
static void resetKeys()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
@ -80,102 +59,6 @@ static void resetKeys()
|
|||||||
io.KeyCtrl = io.KeyShift = io.KeyAlt = io.KeySuper = false;
|
io.KeyCtrl = io.KeyShift = io.KeyAlt = io.KeySuper = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
KeyEventResponder implements the NSTextInputClient protocol as is required by the macOS text input manager.
|
|
||||||
|
|
||||||
The macOS text input manager is invoked by calling the interpretKeyEvents method from the keyDown method.
|
|
||||||
Keyboard events are then evaluated by the macOS input manager and valid text input is passed back via the
|
|
||||||
insertText:replacementRange method.
|
|
||||||
|
|
||||||
This is the same approach employed by other cross-platform libraries such as SDL2:
|
|
||||||
https://github.com/spurious/SDL-mirror/blob/e17aacbd09e65a4fd1e166621e011e581fb017a8/src/video/cocoa/SDL_cocoakeyboard.m#L53
|
|
||||||
and GLFW:
|
|
||||||
https://github.com/glfw/glfw/blob/b55a517ae0c7b5127dffa79a64f5406021bf9076/src/cocoa_window.m#L722-L723
|
|
||||||
*/
|
|
||||||
@interface KeyEventResponder: NSView<NSTextInputClient>
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation KeyEventResponder
|
|
||||||
|
|
||||||
- (void)viewDidMoveToWindow
|
|
||||||
{
|
|
||||||
// Ensure self is a first responder to receive the input events.
|
|
||||||
[self.window makeFirstResponder:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)keyDown:(NSEvent*)event
|
|
||||||
{
|
|
||||||
// Call to the macOS input manager system.
|
|
||||||
[self interpretKeyEvents:@[event]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)insertText:(id)aString replacementRange:(NSRange)replacementRange
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
|
|
||||||
NSString* characters;
|
|
||||||
if ([aString isKindOfClass:[NSAttributedString class]])
|
|
||||||
characters = [aString string];
|
|
||||||
else
|
|
||||||
characters = (NSString*)aString;
|
|
||||||
|
|
||||||
io.AddInputCharactersUTF8(characters.UTF8String);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)acceptsFirstResponder
|
|
||||||
{
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)doCommandBySelector:(SEL)myselector
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSAttributedString*)attributedSubstringForProposedRange:(NSRange)range actualRange:(nullable NSRangePointer)actualRange
|
|
||||||
{
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSUInteger)characterIndexForPoint:(NSPoint)point
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSRect)firstRectForCharacterRange:(NSRange)range actualRange:(nullable NSRangePointer)actualRange
|
|
||||||
{
|
|
||||||
return NSZeroRect;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)hasMarkedText
|
|
||||||
{
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSRange)markedRange
|
|
||||||
{
|
|
||||||
return NSMakeRange(NSNotFound, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSRange)selectedRange
|
|
||||||
{
|
|
||||||
return NSMakeRange(NSNotFound, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMarkedText:(nonnull id)string selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)unmarkText
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nonnull NSArray<NSAttributedStringKey>*)validAttributesForMarkedText
|
|
||||||
{
|
|
||||||
return @[];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface ImFocusObserver : NSObject
|
@interface ImFocusObserver : NSObject
|
||||||
|
|
||||||
- (void)onApplicationBecomeActive:(NSNotification*)aNotification;
|
- (void)onApplicationBecomeActive:(NSNotification*)aNotification;
|
||||||
@ -205,7 +88,7 @@ static void resetKeys()
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
bool ImGui_ImplOSX_Init(NSView* view)
|
bool ImGui_ImplOSX_Init()
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
@ -217,28 +100,29 @@ bool ImGui_ImplOSX_Init(NSView* view)
|
|||||||
io.BackendPlatformName = "imgui_impl_osx";
|
io.BackendPlatformName = "imgui_impl_osx";
|
||||||
|
|
||||||
// Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeyDown[] array.
|
// Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeyDown[] array.
|
||||||
io.KeyMap[ImGuiKey_Tab] = kVK_Tab;
|
const int offset_for_function_keys = 256 - 0xF700;
|
||||||
io.KeyMap[ImGuiKey_LeftArrow] = kVK_LeftArrow;
|
io.KeyMap[ImGuiKey_Tab] = '\t';
|
||||||
io.KeyMap[ImGuiKey_RightArrow] = kVK_RightArrow;
|
io.KeyMap[ImGuiKey_LeftArrow] = NSLeftArrowFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_UpArrow] = kVK_UpArrow;
|
io.KeyMap[ImGuiKey_RightArrow] = NSRightArrowFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_DownArrow] = kVK_DownArrow;
|
io.KeyMap[ImGuiKey_UpArrow] = NSUpArrowFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_PageUp] = kVK_PageUp;
|
io.KeyMap[ImGuiKey_DownArrow] = NSDownArrowFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_PageDown] = kVK_PageDown;
|
io.KeyMap[ImGuiKey_PageUp] = NSPageUpFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_Home] = kVK_Home;
|
io.KeyMap[ImGuiKey_PageDown] = NSPageDownFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_End] = kVK_End;
|
io.KeyMap[ImGuiKey_Home] = NSHomeFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_Insert] = kVK_F13;
|
io.KeyMap[ImGuiKey_End] = NSEndFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_Delete] = kVK_ForwardDelete;
|
io.KeyMap[ImGuiKey_Insert] = NSInsertFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_Backspace] = kVK_Delete;
|
io.KeyMap[ImGuiKey_Delete] = NSDeleteFunctionKey + offset_for_function_keys;
|
||||||
io.KeyMap[ImGuiKey_Space] = kVK_Space;
|
io.KeyMap[ImGuiKey_Backspace] = 127;
|
||||||
io.KeyMap[ImGuiKey_Enter] = kVK_Return;
|
io.KeyMap[ImGuiKey_Space] = 32;
|
||||||
io.KeyMap[ImGuiKey_Escape] = kVK_Escape;
|
io.KeyMap[ImGuiKey_Enter] = 13;
|
||||||
io.KeyMap[ImGuiKey_KeyPadEnter] = kVK_ANSI_KeypadEnter;
|
io.KeyMap[ImGuiKey_Escape] = 27;
|
||||||
io.KeyMap[ImGuiKey_A] = kVK_ANSI_A;
|
io.KeyMap[ImGuiKey_KeyPadEnter] = 3;
|
||||||
io.KeyMap[ImGuiKey_C] = kVK_ANSI_C;
|
io.KeyMap[ImGuiKey_A] = 'A';
|
||||||
io.KeyMap[ImGuiKey_V] = kVK_ANSI_V;
|
io.KeyMap[ImGuiKey_C] = 'C';
|
||||||
io.KeyMap[ImGuiKey_X] = kVK_ANSI_X;
|
io.KeyMap[ImGuiKey_V] = 'V';
|
||||||
io.KeyMap[ImGuiKey_Y] = kVK_ANSI_Y;
|
io.KeyMap[ImGuiKey_X] = 'X';
|
||||||
io.KeyMap[ImGuiKey_Z] = kVK_ANSI_Z;
|
io.KeyMap[ImGuiKey_Y] = 'Y';
|
||||||
|
io.KeyMap[ImGuiKey_Z] = 'Z';
|
||||||
|
|
||||||
// Load cursors. Some of them are undocumented.
|
// Load cursors. Some of them are undocumented.
|
||||||
g_MouseCursorHidden = false;
|
g_MouseCursorHidden = false;
|
||||||
@ -291,11 +175,6 @@ bool ImGui_ImplOSX_Init(NSView* view)
|
|||||||
name:NSApplicationDidResignActiveNotification
|
name:NSApplicationDidResignActiveNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
|
|
||||||
// Add the NSTextInputClient to the view hierarchy,
|
|
||||||
// to receive keyboard events and translate them to input text.
|
|
||||||
g_KeyEventResponder = [[KeyEventResponder alloc] initWithFrame:NSZeroRect];
|
|
||||||
[view addSubview:g_KeyEventResponder];
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,12 +209,8 @@ static void ImGui_ImplOSX_UpdateMouseCursorAndButtons()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSCursor* desired = g_MouseCursors[imgui_cursor] ?: g_MouseCursors[ImGuiMouseCursor_Arrow];
|
// Show OS mouse cursor
|
||||||
// -[NSCursor set] generates measureable overhead if called unconditionally.
|
[g_MouseCursors[g_MouseCursors[imgui_cursor] ? imgui_cursor : ImGuiMouseCursor_Arrow] set];
|
||||||
if (desired != NSCursor.currentCursor)
|
|
||||||
{
|
|
||||||
[desired set];
|
|
||||||
}
|
|
||||||
if (g_MouseCursorHidden)
|
if (g_MouseCursorHidden)
|
||||||
{
|
{
|
||||||
g_MouseCursorHidden = false;
|
g_MouseCursorHidden = false;
|
||||||
@ -344,50 +219,6 @@ static void ImGui_ImplOSX_UpdateMouseCursorAndButtons()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui_ImplOSX_UpdateGamepads()
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
memset(io.NavInputs, 0, sizeof(io.NavInputs));
|
|
||||||
if ((io.ConfigFlags & ImGuiConfigFlags_NavEnableGamepad) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
GCController* controller;
|
|
||||||
if (@available(macOS 11.0, *))
|
|
||||||
controller = GCController.current;
|
|
||||||
else
|
|
||||||
controller = GCController.controllers.firstObject;
|
|
||||||
|
|
||||||
if (controller == nil || controller.extendedGamepad == nil)
|
|
||||||
{
|
|
||||||
io.BackendFlags &= ~ImGuiBackendFlags_HasGamepad;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GCExtendedGamepad* gp = controller.extendedGamepad;
|
|
||||||
|
|
||||||
#define MAP_BUTTON(NAV_NO, NAME) { io.NavInputs[NAV_NO] = gp.NAME.isPressed ? 1.0 : 0.0; }
|
|
||||||
MAP_BUTTON(ImGuiNavInput_Activate, buttonA);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_Cancel, buttonB);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_Menu, buttonX);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_Input, buttonY);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_DpadLeft, dpad.left);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_DpadRight, dpad.right);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_DpadUp, dpad.up);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_DpadDown, dpad.down);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_FocusPrev, leftShoulder);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_FocusNext, rightShoulder);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_TweakSlow, leftTrigger);
|
|
||||||
MAP_BUTTON(ImGuiNavInput_TweakFast, rightTrigger);
|
|
||||||
#undef MAP_BUTTON
|
|
||||||
|
|
||||||
io.NavInputs[ImGuiNavInput_LStickLeft] = gp.leftThumbstick.left.value;
|
|
||||||
io.NavInputs[ImGuiNavInput_LStickRight] = gp.leftThumbstick.right.value;
|
|
||||||
io.NavInputs[ImGuiNavInput_LStickUp] = gp.leftThumbstick.up.value;
|
|
||||||
io.NavInputs[ImGuiNavInput_LStickDown] = gp.leftThumbstick.down.value;
|
|
||||||
|
|
||||||
io.BackendFlags |= ImGuiBackendFlags_HasGamepad;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplOSX_NewFrame(NSView* view)
|
void ImGui_ImplOSX_NewFrame(NSView* view)
|
||||||
{
|
{
|
||||||
// Setup display size
|
// Setup display size
|
||||||
@ -401,34 +232,25 @@ void ImGui_ImplOSX_NewFrame(NSView* view)
|
|||||||
|
|
||||||
// Setup time step
|
// Setup time step
|
||||||
if (g_Time == 0.0)
|
if (g_Time == 0.0)
|
||||||
{
|
g_Time = CFAbsoluteTimeGetCurrent();
|
||||||
InitHostClockPeriod();
|
CFAbsoluteTime current_time = CFAbsoluteTimeGetCurrent();
|
||||||
g_Time = GetMachAbsoluteTimeInSeconds();
|
|
||||||
}
|
|
||||||
double current_time = GetMachAbsoluteTimeInSeconds();
|
|
||||||
io.DeltaTime = (float)(current_time - g_Time);
|
io.DeltaTime = (float)(current_time - g_Time);
|
||||||
g_Time = current_time;
|
g_Time = current_time;
|
||||||
|
|
||||||
ImGui_ImplOSX_UpdateMouseCursorAndButtons();
|
ImGui_ImplOSX_UpdateMouseCursorAndButtons();
|
||||||
ImGui_ImplOSX_UpdateGamepads();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString* NSStringFromPhase(NSEventPhase phase)
|
static int mapCharacterToKey(int c)
|
||||||
{
|
{
|
||||||
static NSString* strings[] =
|
if (c >= 'a' && c <= 'z')
|
||||||
{
|
return c - 'a' + 'A';
|
||||||
@"none",
|
if (c == 25) // SHIFT+TAB -> TAB
|
||||||
@"began",
|
return 9;
|
||||||
@"stationary",
|
if (c >= 0 && c < 256)
|
||||||
@"changed",
|
return c;
|
||||||
@"ended",
|
if (c >= 0xF700 && c < 0xF700 + 256)
|
||||||
@"cancelled",
|
return c - 0xF700 + 256;
|
||||||
@"mayBegin",
|
return -1;
|
||||||
};
|
|
||||||
|
|
||||||
int pos = phase == NSEventPhaseNone ? 0 : __builtin_ctzl((NSUInteger)phase) + 1;
|
|
||||||
|
|
||||||
return strings[pos];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
||||||
@ -461,21 +283,6 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
|||||||
|
|
||||||
if (event.type == NSEventTypeScrollWheel)
|
if (event.type == NSEventTypeScrollWheel)
|
||||||
{
|
{
|
||||||
// Ignore canceled events.
|
|
||||||
//
|
|
||||||
// From macOS 12.1, scrolling with two fingers and then decelerating
|
|
||||||
// by tapping two fingers results in two events appearing:
|
|
||||||
//
|
|
||||||
// 1. A scroll wheel NSEvent, with a phase == NSEventPhaseMayBegin, when the user taps
|
|
||||||
// two fingers to decelerate or stop the scroll events.
|
|
||||||
//
|
|
||||||
// 2. A scroll wheel NSEvent, with a phase == NSEventPhaseCancelled, when the user releases the
|
|
||||||
// two-finger tap. It is this event that sometimes contains large values for scrollingDeltaX and
|
|
||||||
// scrollingDeltaY. When these are added to the current x and y positions of the scrolling view,
|
|
||||||
// it appears to jump up or down. It can be observed in Preview, various JetBrains IDEs and here.
|
|
||||||
if (event.phase == NSEventPhaseCancelled)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
double wheel_dx = 0.0;
|
double wheel_dx = 0.0;
|
||||||
double wheel_dy = 0.0;
|
double wheel_dy = 0.0;
|
||||||
|
|
||||||
@ -497,8 +304,6 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
|||||||
wheel_dy = [event deltaY];
|
wheel_dy = [event deltaY];
|
||||||
}
|
}
|
||||||
|
|
||||||
//NSLog(@"dx=%0.3ff, dy=%0.3f, phase=%@", wheel_dx, wheel_dy, NSStringFromPhase(event.phase));
|
|
||||||
|
|
||||||
if (fabs(wheel_dx) > 0.0)
|
if (fabs(wheel_dx) > 0.0)
|
||||||
io.MouseWheelH += (float)wheel_dx * 0.1f;
|
io.MouseWheelH += (float)wheel_dx * 0.1f;
|
||||||
if (fabs(wheel_dy) > 0.0)
|
if (fabs(wheel_dy) > 0.0)
|
||||||
@ -506,37 +311,57 @@ bool ImGui_ImplOSX_HandleEvent(NSEvent* event, NSView* view)
|
|||||||
return io.WantCaptureMouse;
|
return io.WantCaptureMouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type == NSEventTypeKeyDown || event.type == NSEventTypeKeyUp)
|
// FIXME: All the key handling is wrong and broken. Refer to GLFW's cocoa_init.mm and cocoa_window.mm.
|
||||||
|
if (event.type == NSEventTypeKeyDown)
|
||||||
{
|
{
|
||||||
unsigned short code = event.keyCode;
|
NSString* str = [event characters];
|
||||||
IM_ASSERT(code >= 0 && code < IM_ARRAYSIZE(io.KeysDown));
|
NSUInteger len = [str length];
|
||||||
io.KeysDown[code] = event.type == NSEventTypeKeyDown;
|
for (NSUInteger i = 0; i < len; i++)
|
||||||
NSEventModifierFlags flags = event.modifierFlags;
|
{
|
||||||
io.KeyCtrl = (flags & NSEventModifierFlagControl) != 0;
|
int c = [str characterAtIndex:i];
|
||||||
io.KeyShift = (flags & NSEventModifierFlagShift) != 0;
|
if (!io.KeySuper && !(c >= 0xF700 && c <= 0xFFFF) && c != 127)
|
||||||
io.KeyAlt = (flags & NSEventModifierFlagOption) != 0;
|
io.AddInputCharacter((unsigned int)c);
|
||||||
io.KeySuper = (flags & NSEventModifierFlagCommand) != 0;
|
|
||||||
|
// We must reset in case we're pressing a sequence of special keys while keeping the command pressed
|
||||||
|
int key = mapCharacterToKey(c);
|
||||||
|
if (key != -1 && key < 256 && !io.KeySuper)
|
||||||
|
resetKeys();
|
||||||
|
if (key != -1)
|
||||||
|
io.KeysDown[key] = true;
|
||||||
|
}
|
||||||
|
return io.WantCaptureKeyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type == NSEventTypeKeyUp)
|
||||||
|
{
|
||||||
|
NSString* str = [event characters];
|
||||||
|
NSUInteger len = [str length];
|
||||||
|
for (NSUInteger i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
int c = [str characterAtIndex:i];
|
||||||
|
int key = mapCharacterToKey(c);
|
||||||
|
if (key != -1)
|
||||||
|
io.KeysDown[key] = false;
|
||||||
|
}
|
||||||
return io.WantCaptureKeyboard;
|
return io.WantCaptureKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type == NSEventTypeFlagsChanged)
|
if (event.type == NSEventTypeFlagsChanged)
|
||||||
{
|
{
|
||||||
NSEventModifierFlags flags = event.modifierFlags;
|
unsigned int flags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
|
||||||
switch (event.keyCode)
|
|
||||||
{
|
bool oldKeyCtrl = io.KeyCtrl;
|
||||||
case kVK_Control:
|
bool oldKeyShift = io.KeyShift;
|
||||||
io.KeyCtrl = (flags & NSEventModifierFlagControl) != 0;
|
bool oldKeyAlt = io.KeyAlt;
|
||||||
break;
|
bool oldKeySuper = io.KeySuper;
|
||||||
case kVK_Shift:
|
io.KeyCtrl = flags & NSEventModifierFlagControl;
|
||||||
io.KeyShift = (flags & NSEventModifierFlagShift) != 0;
|
io.KeyShift = flags & NSEventModifierFlagShift;
|
||||||
break;
|
io.KeyAlt = flags & NSEventModifierFlagOption;
|
||||||
case kVK_Option:
|
io.KeySuper = flags & NSEventModifierFlagCommand;
|
||||||
io.KeyAlt = (flags & NSEventModifierFlagOption) != 0;
|
|
||||||
break;
|
// We must reset them as we will not receive any keyUp event if they where pressed with a modifier
|
||||||
case kVK_Command:
|
if ((oldKeyShift && !io.KeyShift) || (oldKeyCtrl && !io.KeyCtrl) || (oldKeyAlt && !io.KeyAlt) || (oldKeySuper && !io.KeySuper))
|
||||||
io.KeySuper = (flags & NSEventModifierFlagCommand) != 0;
|
resetKeys();
|
||||||
break;
|
|
||||||
}
|
|
||||||
return io.WantCaptureKeyboard;
|
return io.WantCaptureKeyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
#include <TargetConditionals.h>
|
#include "TargetConditionals.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,4) && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
#if SDL_VERSION_ATLEAST(2,0,4) && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
|
||||||
@ -278,16 +278,10 @@ bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window)
|
|||||||
return ImGui_ImplSDL2_Init(window);
|
return ImGui_ImplSDL2_Init(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window)
|
|
||||||
{
|
|
||||||
return ImGui_ImplSDL2_Init(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDL2_Shutdown()
|
void ImGui_ImplSDL2_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplSDL2_Data* bd = ImGui_ImplSDL2_GetBackendData();
|
||||||
|
|
||||||
if (bd->ClipboardTextData)
|
if (bd->ClipboardTextData)
|
||||||
SDL_free(bd->ClipboardTextData);
|
SDL_free(bd->ClipboardTextData);
|
||||||
|
@ -25,7 +25,6 @@ IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForOpenGL(SDL_Window* window, void* s
|
|||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForVulkan(SDL_Window* window);
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForD3D(SDL_Window* window);
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForMetal(SDL_Window* window);
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_InitForSDLRenderer(SDL_Window* window);
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplSDL2_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplSDL2_NewFrame();
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
IMGUI_IMPL_API bool ImGui_ImplSDL2_ProcessEvent(const SDL_Event* event);
|
||||||
|
@ -1,248 +0,0 @@
|
|||||||
// dear imgui: Renderer Backend for SDL_Renderer
|
|
||||||
// (Requires: SDL 2.0.17+)
|
|
||||||
|
|
||||||
// Important to understand: SDL_Renderer is an _optional_ component of SDL.
|
|
||||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
|
||||||
// If your application will want to render any non trivial amount of graphics other than UI,
|
|
||||||
// please be aware that SDL_Renderer offers a limited graphic API to the end-user and it might
|
|
||||||
// be difficult to step out of those boundaries.
|
|
||||||
// However, we understand it is a convenient choice to get an app started easily.
|
|
||||||
|
|
||||||
// Implemented features:
|
|
||||||
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
|
||||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
|
||||||
// Missing features:
|
|
||||||
|
|
||||||
// You can copy and use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
|
||||||
|
|
||||||
// CHANGELOG
|
|
||||||
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
|
|
||||||
// 2021-12-03: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
|
||||||
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
|
|
||||||
// 2021-09-21: Initial version.
|
|
||||||
|
|
||||||
#include "imgui.h"
|
|
||||||
#include "imgui_impl_sdlrenderer.h"
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier
|
|
||||||
#include <stddef.h> // intptr_t
|
|
||||||
#else
|
|
||||||
#include <stdint.h> // intptr_t
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SDL
|
|
||||||
#include <SDL.h>
|
|
||||||
#if !SDL_VERSION_ATLEAST(2,0,17)
|
|
||||||
#error This backend requires SDL 2.0.17+ because of SDL_RenderGeometry() function
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SDL_Renderer data
|
|
||||||
struct ImGui_ImplSDLRenderer_Data
|
|
||||||
{
|
|
||||||
SDL_Renderer* SDLRenderer;
|
|
||||||
SDL_Texture* FontTexture;
|
|
||||||
ImGui_ImplSDLRenderer_Data() { memset(this, 0, sizeof(*this)); }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Backend data stored in io.BackendRendererUserData to allow support for multiple Dear ImGui contexts
|
|
||||||
// It is STRONGLY preferred that you use docking branch with multi-viewports (== single Dear ImGui context + multiple windows) instead of multiple Dear ImGui contexts.
|
|
||||||
static ImGui_ImplSDLRenderer_Data* ImGui_ImplSDLRenderer_GetBackendData()
|
|
||||||
{
|
|
||||||
return ImGui::GetCurrentContext() ? (ImGui_ImplSDLRenderer_Data*)ImGui::GetIO().BackendRendererUserData : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Functions
|
|
||||||
bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer)
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
IM_ASSERT(io.BackendRendererUserData == NULL && "Already initialized a renderer backend!");
|
|
||||||
IM_ASSERT(renderer != NULL && "SDL_Renderer not initialized!");
|
|
||||||
|
|
||||||
// Setup backend capabilities flags
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = IM_NEW(ImGui_ImplSDLRenderer_Data)();
|
|
||||||
io.BackendRendererUserData = (void*)bd;
|
|
||||||
io.BackendRendererName = "imgui_impl_sdlrenderer";
|
|
||||||
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
|
|
||||||
|
|
||||||
bd->SDLRenderer = renderer;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer_Shutdown()
|
|
||||||
{
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
|
|
||||||
ImGui_ImplSDLRenderer_DestroyDeviceObjects();
|
|
||||||
|
|
||||||
io.BackendRendererName = NULL;
|
|
||||||
io.BackendRendererUserData = NULL;
|
|
||||||
IM_DELETE(bd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ImGui_ImplSDLRenderer_SetupRenderState()
|
|
||||||
{
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
|
||||||
|
|
||||||
// Clear out any viewports and cliprect set by the user
|
|
||||||
// FIXME: Technically speaking there are lots of other things we could backup/setup/restore during our render process.
|
|
||||||
SDL_RenderSetViewport(bd->SDLRenderer, NULL);
|
|
||||||
SDL_RenderSetClipRect(bd->SDLRenderer, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer_NewFrame()
|
|
||||||
{
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "Did you call ImGui_ImplSDLRenderer_Init()?");
|
|
||||||
|
|
||||||
if (!bd->FontTexture)
|
|
||||||
ImGui_ImplSDLRenderer_CreateDeviceObjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data)
|
|
||||||
{
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
|
||||||
|
|
||||||
// If there's a scale factor set by the user, use that instead
|
|
||||||
// If the user has specified a scale factor to SDL_Renderer already via SDL_RenderSetScale(), SDL will scale whatever we pass
|
|
||||||
// to SDL_RenderGeometryRaw() by that scale factor. In that case we don't want to be also scaling it ourselves here.
|
|
||||||
float rsx = 1.0f;
|
|
||||||
float rsy = 1.0f;
|
|
||||||
SDL_RenderGetScale(bd->SDLRenderer, &rsx, &rsy);
|
|
||||||
ImVec2 render_scale;
|
|
||||||
render_scale.x = (rsx == 1.0f) ? draw_data->FramebufferScale.x : 1.0f;
|
|
||||||
render_scale.y = (rsy == 1.0f) ? draw_data->FramebufferScale.y : 1.0f;
|
|
||||||
|
|
||||||
// Avoid rendering when minimized, scale coordinates for retina displays (screen coordinates != framebuffer coordinates)
|
|
||||||
int fb_width = (int)(draw_data->DisplaySize.x * render_scale.x);
|
|
||||||
int fb_height = (int)(draw_data->DisplaySize.y * render_scale.y);
|
|
||||||
if (fb_width == 0 || fb_height == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Backup SDL_Renderer state that will be modified to restore it afterwards
|
|
||||||
struct BackupSDLRendererState
|
|
||||||
{
|
|
||||||
SDL_Rect Viewport;
|
|
||||||
bool ClipEnabled;
|
|
||||||
SDL_Rect ClipRect;
|
|
||||||
};
|
|
||||||
BackupSDLRendererState old = {};
|
|
||||||
old.ClipEnabled = SDL_RenderIsClipEnabled(bd->SDLRenderer) == SDL_TRUE;
|
|
||||||
SDL_RenderGetViewport(bd->SDLRenderer, &old.Viewport);
|
|
||||||
SDL_RenderGetClipRect(bd->SDLRenderer, &old.ClipRect);
|
|
||||||
|
|
||||||
// Will project scissor/clipping rectangles into framebuffer space
|
|
||||||
ImVec2 clip_off = draw_data->DisplayPos; // (0,0) unless using multi-viewports
|
|
||||||
ImVec2 clip_scale = render_scale;
|
|
||||||
|
|
||||||
// Render command lists
|
|
||||||
ImGui_ImplSDLRenderer_SetupRenderState();
|
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
|
||||||
{
|
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
|
||||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
|
||||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
|
||||||
{
|
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
|
||||||
if (pcmd->UserCallback)
|
|
||||||
{
|
|
||||||
// User callback, registered via ImDrawList::AddCallback()
|
|
||||||
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
|
|
||||||
if (pcmd->UserCallback == ImDrawCallback_ResetRenderState)
|
|
||||||
ImGui_ImplSDLRenderer_SetupRenderState();
|
|
||||||
else
|
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
|
||||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
|
||||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
|
||||||
if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }
|
|
||||||
if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }
|
|
||||||
if (clip_max.x > fb_width) { clip_max.x = (float)fb_width; }
|
|
||||||
if (clip_max.y > fb_height) { clip_max.y = (float)fb_height; }
|
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SDL_Rect r = { (int)(clip_min.x), (int)(clip_min.y), (int)(clip_max.x - clip_min.x), (int)(clip_max.y - clip_min.y) };
|
|
||||||
SDL_RenderSetClipRect(bd->SDLRenderer, &r);
|
|
||||||
|
|
||||||
const float* xy = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, pos));
|
|
||||||
const float* uv = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, uv));
|
|
||||||
#if SDL_VERSION_ATLEAST(2,0,19)
|
|
||||||
const SDL_Color* color = (const SDL_Color*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.19+
|
|
||||||
#else
|
|
||||||
const int* color = (const int*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.17 and 2.0.18
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Bind texture, Draw
|
|
||||||
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
|
||||||
SDL_RenderGeometryRaw(bd->SDLRenderer, tex,
|
|
||||||
xy, (int)sizeof(ImDrawVert),
|
|
||||||
color, (int)sizeof(ImDrawVert),
|
|
||||||
uv, (int)sizeof(ImDrawVert),
|
|
||||||
cmd_list->VtxBuffer.Size - pcmd->VtxOffset,
|
|
||||||
idx_buffer + pcmd->IdxOffset, pcmd->ElemCount, sizeof(ImDrawIdx));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore modified SDL_Renderer state
|
|
||||||
SDL_RenderSetViewport(bd->SDLRenderer, &old.Viewport);
|
|
||||||
SDL_RenderSetClipRect(bd->SDLRenderer, old.ClipEnabled ? &old.ClipRect : NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
|
||||||
bool ImGui_ImplSDLRenderer_CreateFontsTexture()
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
|
||||||
|
|
||||||
// Build texture atlas
|
|
||||||
unsigned char* pixels;
|
|
||||||
int width, height;
|
|
||||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bit (75% of the memory is wasted, but default font is so small) because it is more likely to be compatible with user's existing shaders. If your ImTextureId represent a higher-level concept than just a GL texture id, consider calling GetTexDataAsAlpha8() instead to save on GPU memory.
|
|
||||||
|
|
||||||
// Upload texture to graphics system
|
|
||||||
bd->FontTexture = SDL_CreateTexture(bd->SDLRenderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_STATIC, width, height);
|
|
||||||
if (bd->FontTexture == NULL)
|
|
||||||
{
|
|
||||||
SDL_Log("error creating texture");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SDL_UpdateTexture(bd->FontTexture, NULL, pixels, 4 * width);
|
|
||||||
SDL_SetTextureBlendMode(bd->FontTexture, SDL_BLENDMODE_BLEND);
|
|
||||||
|
|
||||||
// Store our identifier
|
|
||||||
io.Fonts->SetTexID((ImTextureID)(intptr_t)bd->FontTexture);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer_DestroyFontsTexture()
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
ImGui_ImplSDLRenderer_Data* bd = ImGui_ImplSDLRenderer_GetBackendData();
|
|
||||||
if (bd->FontTexture)
|
|
||||||
{
|
|
||||||
io.Fonts->SetTexID(0);
|
|
||||||
SDL_DestroyTexture(bd->FontTexture);
|
|
||||||
bd->FontTexture = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui_ImplSDLRenderer_CreateDeviceObjects()
|
|
||||||
{
|
|
||||||
return ImGui_ImplSDLRenderer_CreateFontsTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLRenderer_DestroyDeviceObjects()
|
|
||||||
{
|
|
||||||
ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
// dear imgui: Renderer Backend for SDL_Renderer
|
|
||||||
// (Requires: SDL 2.0.17+)
|
|
||||||
|
|
||||||
// Important to understand: SDL_Renderer is an _optional_ component of SDL.
|
|
||||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
|
||||||
// If your application will want to render any non trivial amount of graphics other than UI,
|
|
||||||
// please be aware that SDL_Renderer offers a limited graphic API to the end-user and it might
|
|
||||||
// be difficult to step out of those boundaries.
|
|
||||||
// However, we understand it is a convenient choice to get an app started easily.
|
|
||||||
|
|
||||||
// Implemented features:
|
|
||||||
// [X] Renderer: User texture binding. Use 'SDL_Texture*' as ImTextureID. Read the FAQ about ImTextureID!
|
|
||||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "imgui.h" // IMGUI_IMPL_API
|
|
||||||
|
|
||||||
struct SDL_Renderer;
|
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_Init(SDL_Renderer* renderer);
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_Shutdown();
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_NewFrame();
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data);
|
|
||||||
|
|
||||||
// Called by Init/NewFrame/Shutdown
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_CreateFontsTexture();
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_DestroyFontsTexture();
|
|
||||||
IMGUI_IMPL_API bool ImGui_ImplSDLRenderer_CreateDeviceObjects();
|
|
||||||
IMGUI_IMPL_API void ImGui_ImplSDLRenderer_DestroyDeviceObjects();
|
|
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-10-15: Vulkan: Call vkCmdSetScissor() at the end of render a full-viewport to reduce likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling vkCmdSetScissor() explicitly every frame.
|
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-03-22: Vulkan: Fix mapped memory validation error when buffer sizes are not multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize.
|
// 2021-03-22: Vulkan: Fix mapped memory validation error when buffer sizes are not multiple of VkPhysicalDeviceLimits::nonCoherentAtomSize.
|
||||||
// 2021-02-18: Vulkan: Change blending equation to preserve alpha in output buffer.
|
// 2021-02-18: Vulkan: Change blending equation to preserve alpha in output buffer.
|
||||||
@ -512,42 +511,36 @@ void ImGui_ImplVulkan_RenderDrawData(ImDrawData* draw_data, VkCommandBuffer comm
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Project scissor/clipping rectangles into framebuffer space
|
||||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
ImVec4 clip_rect;
|
||||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
clip_rect.x = (pcmd->ClipRect.x - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.y = (pcmd->ClipRect.y - clip_off.y) * clip_scale.y;
|
||||||
|
clip_rect.z = (pcmd->ClipRect.z - clip_off.x) * clip_scale.x;
|
||||||
|
clip_rect.w = (pcmd->ClipRect.w - clip_off.y) * clip_scale.y;
|
||||||
|
|
||||||
// Clamp to viewport as vkCmdSetScissor() won't accept values that are off bounds
|
if (clip_rect.x < fb_width && clip_rect.y < fb_height && clip_rect.z >= 0.0f && clip_rect.w >= 0.0f)
|
||||||
if (clip_min.x < 0.0f) { clip_min.x = 0.0f; }
|
{
|
||||||
if (clip_min.y < 0.0f) { clip_min.y = 0.0f; }
|
// Negative offsets are illegal for vkCmdSetScissor
|
||||||
if (clip_max.x > fb_width) { clip_max.x = (float)fb_width; }
|
if (clip_rect.x < 0.0f)
|
||||||
if (clip_max.y > fb_height) { clip_max.y = (float)fb_height; }
|
clip_rect.x = 0.0f;
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
if (clip_rect.y < 0.0f)
|
||||||
continue;
|
clip_rect.y = 0.0f;
|
||||||
|
|
||||||
// Apply scissor/clipping rectangle
|
// Apply scissor/clipping rectangle
|
||||||
VkRect2D scissor;
|
VkRect2D scissor;
|
||||||
scissor.offset.x = (int32_t)(clip_min.x);
|
scissor.offset.x = (int32_t)(clip_rect.x);
|
||||||
scissor.offset.y = (int32_t)(clip_min.y);
|
scissor.offset.y = (int32_t)(clip_rect.y);
|
||||||
scissor.extent.width = (uint32_t)(clip_max.x - clip_min.x);
|
scissor.extent.width = (uint32_t)(clip_rect.z - clip_rect.x);
|
||||||
scissor.extent.height = (uint32_t)(clip_max.y - clip_min.y);
|
scissor.extent.height = (uint32_t)(clip_rect.w - clip_rect.y);
|
||||||
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
|
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
|
||||||
|
|
||||||
// Draw
|
// Draw
|
||||||
vkCmdDrawIndexed(command_buffer, pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
vkCmdDrawIndexed(command_buffer, pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
global_idx_offset += cmd_list->IdxBuffer.Size;
|
global_idx_offset += cmd_list->IdxBuffer.Size;
|
||||||
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
global_vtx_offset += cmd_list->VtxBuffer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: at this point both vkCmdSetViewport() and vkCmdSetScissor() have been called.
|
|
||||||
// Our last values will leak into user/application rendering IF:
|
|
||||||
// - Your app uses a pipeline with VK_DYNAMIC_STATE_VIEWPORT or VK_DYNAMIC_STATE_SCISSOR dynamic state
|
|
||||||
// - And you forgot to call vkCmdSetViewport() and vkCmdSetScissor() yourself to explicitely set that state.
|
|
||||||
// If you use VK_DYNAMIC_STATE_VIEWPORT or VK_DYNAMIC_STATE_SCISSOR you are responsible for setting the values before rendering.
|
|
||||||
// In theory we should aim to backup/restore those values but I am not sure this is possible.
|
|
||||||
// We perform a call to vkCmdSetScissor() to set back a full viewport which is likely to fix things for 99% users but technically this is not perfect. (See github #4644)
|
|
||||||
VkRect2D scissor = { { 0, 0 }, { (uint32_t)fb_width, (uint32_t)fb_height } };
|
|
||||||
vkCmdSetScissor(command_buffer, 0, 1, &scissor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)
|
bool ImGui_ImplVulkan_CreateFontsTexture(VkCommandBuffer command_buffer)
|
||||||
@ -707,7 +700,7 @@ static void ImGui_ImplVulkan_CreateShaderModules(VkDevice device, const VkAlloca
|
|||||||
{
|
{
|
||||||
// Create the shader modules
|
// Create the shader modules
|
||||||
ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData();
|
ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData();
|
||||||
if (bd->ShaderModuleVert == VK_NULL_HANDLE)
|
if (bd->ShaderModuleVert == NULL)
|
||||||
{
|
{
|
||||||
VkShaderModuleCreateInfo vert_info = {};
|
VkShaderModuleCreateInfo vert_info = {};
|
||||||
vert_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
vert_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||||
@ -716,7 +709,7 @@ static void ImGui_ImplVulkan_CreateShaderModules(VkDevice device, const VkAlloca
|
|||||||
VkResult err = vkCreateShaderModule(device, &vert_info, allocator, &bd->ShaderModuleVert);
|
VkResult err = vkCreateShaderModule(device, &vert_info, allocator, &bd->ShaderModuleVert);
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
}
|
}
|
||||||
if (bd->ShaderModuleFrag == VK_NULL_HANDLE)
|
if (bd->ShaderModuleFrag == NULL)
|
||||||
{
|
{
|
||||||
VkShaderModuleCreateInfo frag_info = {};
|
VkShaderModuleCreateInfo frag_info = {};
|
||||||
frag_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
frag_info.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||||
@ -1059,9 +1052,8 @@ bool ImGui_ImplVulkan_Init(ImGui_ImplVulkan_InitInfo* info, VkRenderPass rend
|
|||||||
|
|
||||||
void ImGui_ImplVulkan_Shutdown()
|
void ImGui_ImplVulkan_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No renderer backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplVulkan_Data* bd = ImGui_ImplVulkan_GetBackendData();
|
||||||
|
|
||||||
ImGui_ImplVulkan_DestroyDeviceObjects();
|
ImGui_ImplVulkan_DestroyDeviceObjects();
|
||||||
io.BackendRendererName = NULL;
|
io.BackendRendererName = NULL;
|
||||||
@ -1239,7 +1231,7 @@ void ImGui_ImplVulkanH_CreateWindowSwapChain(VkPhysicalDevice physical_device, V
|
|||||||
{
|
{
|
||||||
VkResult err;
|
VkResult err;
|
||||||
VkSwapchainKHR old_swapchain = wd->Swapchain;
|
VkSwapchainKHR old_swapchain = wd->Swapchain;
|
||||||
wd->Swapchain = VK_NULL_HANDLE;
|
wd->Swapchain = NULL;
|
||||||
err = vkDeviceWaitIdle(device);
|
err = vkDeviceWaitIdle(device);
|
||||||
check_vk_result(err);
|
check_vk_result(err);
|
||||||
|
|
||||||
|
@ -6,15 +6,13 @@
|
|||||||
// [X] Renderer: User texture binding. Use 'WGPUTextureView' as ImTextureID. Read the FAQ about ImTextureID!
|
// [X] Renderer: User texture binding. Use 'WGPUTextureView' as ImTextureID. Read the FAQ about ImTextureID!
|
||||||
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
// [X] Renderer: Support for large meshes (64k+ vertices) with 16-bit indices.
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-11-29: Passing explicit buffer sizes to wgpuRenderPassEncoderSetVertexBuffer()/wgpuRenderPassEncoderSetIndexBuffer().
|
|
||||||
// 2021-08-24: Fix for latest specs.
|
|
||||||
// 2021-05-24: Add support for draw_data->FramebufferScale.
|
// 2021-05-24: Add support for draw_data->FramebufferScale.
|
||||||
// 2021-05-19: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
// 2021-05-19: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
||||||
// 2021-05-16: Update to latest WebGPU specs (compatible with Emscripten 2.0.20 and Chrome Canary 92).
|
// 2021-05-16: Update to latest WebGPU specs (compatible with Emscripten 2.0.20 and Chrome Canary 92).
|
||||||
@ -271,7 +269,7 @@ static WGPUProgrammableStageDescriptor ImGui_ImplWGPU_CreateShaderModule(uint32_
|
|||||||
spirv_desc.codeSize = binary_data_size;
|
spirv_desc.codeSize = binary_data_size;
|
||||||
spirv_desc.code = binary_data;
|
spirv_desc.code = binary_data;
|
||||||
|
|
||||||
WGPUShaderModuleDescriptor desc = {};
|
WGPUShaderModuleDescriptor desc;
|
||||||
desc.nextInChain = reinterpret_cast<WGPUChainedStruct*>(&spirv_desc);
|
desc.nextInChain = reinterpret_cast<WGPUChainedStruct*>(&spirv_desc);
|
||||||
|
|
||||||
WGPUProgrammableStageDescriptor stage_desc = {};
|
WGPUProgrammableStageDescriptor stage_desc = {};
|
||||||
@ -282,7 +280,7 @@ static WGPUProgrammableStageDescriptor ImGui_ImplWGPU_CreateShaderModule(uint32_
|
|||||||
|
|
||||||
static WGPUBindGroup ImGui_ImplWGPU_CreateImageBindGroup(WGPUBindGroupLayout layout, WGPUTextureView texture)
|
static WGPUBindGroup ImGui_ImplWGPU_CreateImageBindGroup(WGPUBindGroupLayout layout, WGPUTextureView texture)
|
||||||
{
|
{
|
||||||
WGPUBindGroupEntry image_bg_entries[] = { { nullptr, 0, 0, 0, 0, 0, texture } };
|
WGPUBindGroupEntry image_bg_entries[] = { { 0, 0, 0, 0, 0, texture } };
|
||||||
|
|
||||||
WGPUBindGroupDescriptor image_bg_descriptor = {};
|
WGPUBindGroupDescriptor image_bg_descriptor = {};
|
||||||
image_bg_descriptor.layout = layout;
|
image_bg_descriptor.layout = layout;
|
||||||
@ -314,8 +312,8 @@ static void ImGui_ImplWGPU_SetupRenderState(ImDrawData* draw_data, WGPURenderPas
|
|||||||
wgpuRenderPassEncoderSetViewport(ctx, 0, 0, draw_data->FramebufferScale.x * draw_data->DisplaySize.x, draw_data->FramebufferScale.y * draw_data->DisplaySize.y, 0, 1);
|
wgpuRenderPassEncoderSetViewport(ctx, 0, 0, draw_data->FramebufferScale.x * draw_data->DisplaySize.x, draw_data->FramebufferScale.y * draw_data->DisplaySize.y, 0, 1);
|
||||||
|
|
||||||
// Bind shader and vertex buffers
|
// Bind shader and vertex buffers
|
||||||
wgpuRenderPassEncoderSetVertexBuffer(ctx, 0, fr->VertexBuffer, 0, fr->VertexBufferSize);
|
wgpuRenderPassEncoderSetVertexBuffer(ctx, 0, fr->VertexBuffer, 0, 0);
|
||||||
wgpuRenderPassEncoderSetIndexBuffer(ctx, fr->IndexBuffer, sizeof(ImDrawIdx) == 2 ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32, 0, fr->IndexBufferSize);
|
wgpuRenderPassEncoderSetIndexBuffer(ctx, fr->IndexBuffer, sizeof(ImDrawIdx) == 2 ? WGPUIndexFormat_Uint16 : WGPUIndexFormat_Uint32, 0, 0);
|
||||||
wgpuRenderPassEncoderSetPipeline(ctx, g_pipelineState);
|
wgpuRenderPassEncoderSetPipeline(ctx, g_pipelineState);
|
||||||
wgpuRenderPassEncoderSetBindGroup(ctx, 0, g_resources.CommonBindGroup, 0, NULL);
|
wgpuRenderPassEncoderSetBindGroup(ctx, 0, g_resources.CommonBindGroup, 0, NULL);
|
||||||
|
|
||||||
@ -444,14 +442,13 @@ void ImGui_ImplWGPU_RenderDrawData(ImDrawData* draw_data, WGPURenderPassEncoder
|
|||||||
wgpuRenderPassEncoderSetBindGroup(pass_encoder, 1, image_bind_group, 0, NULL);
|
wgpuRenderPassEncoderSetBindGroup(pass_encoder, 1, image_bind_group, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project scissor/clipping rectangles into framebuffer space
|
// Apply Scissor, Bind texture, Draw
|
||||||
ImVec2 clip_min((pcmd->ClipRect.x - clip_off.x) * clip_scale.x, (pcmd->ClipRect.y - clip_off.y) * clip_scale.y);
|
uint32_t clip_rect[4];
|
||||||
ImVec2 clip_max((pcmd->ClipRect.z - clip_off.x) * clip_scale.x, (pcmd->ClipRect.w - clip_off.y) * clip_scale.y);
|
clip_rect[0] = (uint32_t)(clip_scale.x * (pcmd->ClipRect.x - clip_off.x));
|
||||||
if (clip_max.x <= clip_min.x || clip_max.y <= clip_min.y)
|
clip_rect[1] = (uint32_t)(clip_scale.y * (pcmd->ClipRect.y - clip_off.y));
|
||||||
continue;
|
clip_rect[2] = (uint32_t)(clip_scale.x * (pcmd->ClipRect.z - clip_off.x));
|
||||||
|
clip_rect[3] = (uint32_t)(clip_scale.y * (pcmd->ClipRect.w - clip_off.y));
|
||||||
// Apply scissor/clipping rectangle, Draw
|
wgpuRenderPassEncoderSetScissorRect(pass_encoder, clip_rect[0], clip_rect[1], clip_rect[2] - clip_rect[0], clip_rect[3] - clip_rect[1]);
|
||||||
wgpuRenderPassEncoderSetScissorRect(pass_encoder, (uint32_t)clip_min.x, (uint32_t)clip_min.y, (uint32_t)(clip_max.x - clip_min.x), (uint32_t)(clip_max.y - clip_min.y));
|
|
||||||
wgpuRenderPassEncoderDrawIndexed(pass_encoder, pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
wgpuRenderPassEncoderDrawIndexed(pass_encoder, pcmd->ElemCount, 1, pcmd->IdxOffset + global_idx_offset, pcmd->VtxOffset + global_vtx_offset, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -479,7 +476,7 @@ static void ImGui_ImplWGPU_CreateFontsTexture()
|
|||||||
tex_desc.sampleCount = 1;
|
tex_desc.sampleCount = 1;
|
||||||
tex_desc.format = WGPUTextureFormat_RGBA8Unorm;
|
tex_desc.format = WGPUTextureFormat_RGBA8Unorm;
|
||||||
tex_desc.mipLevelCount = 1;
|
tex_desc.mipLevelCount = 1;
|
||||||
tex_desc.usage = WGPUTextureUsage_CopyDst | WGPUTextureUsage_TextureBinding;
|
tex_desc.usage = WGPUTextureUsage_CopyDst | WGPUTextureUsage_Sampled;
|
||||||
g_resources.FontTexture = wgpuDeviceCreateTexture(g_wgpuDevice, &tex_desc);
|
g_resources.FontTexture = wgpuDeviceCreateTexture(g_wgpuDevice, &tex_desc);
|
||||||
|
|
||||||
WGPUTextureViewDescriptor tex_view_desc = {};
|
WGPUTextureViewDescriptor tex_view_desc = {};
|
||||||
@ -547,7 +544,7 @@ bool ImGui_ImplWGPU_CreateDeviceObjects()
|
|||||||
ImGui_ImplWGPU_InvalidateDeviceObjects();
|
ImGui_ImplWGPU_InvalidateDeviceObjects();
|
||||||
|
|
||||||
// Create render pipeline
|
// Create render pipeline
|
||||||
WGPURenderPipelineDescriptor graphics_pipeline_desc = {};
|
WGPURenderPipelineDescriptor2 graphics_pipeline_desc = {};
|
||||||
graphics_pipeline_desc.primitive.topology = WGPUPrimitiveTopology_TriangleList;
|
graphics_pipeline_desc.primitive.topology = WGPUPrimitiveTopology_TriangleList;
|
||||||
graphics_pipeline_desc.primitive.stripIndexFormat = WGPUIndexFormat_Undefined;
|
graphics_pipeline_desc.primitive.stripIndexFormat = WGPUIndexFormat_Undefined;
|
||||||
graphics_pipeline_desc.primitive.frontFace = WGPUFrontFace_CW;
|
graphics_pipeline_desc.primitive.frontFace = WGPUFrontFace_CW;
|
||||||
@ -572,7 +569,7 @@ bool ImGui_ImplWGPU_CreateDeviceObjects()
|
|||||||
|
|
||||||
WGPUVertexBufferLayout buffer_layouts[1];
|
WGPUVertexBufferLayout buffer_layouts[1];
|
||||||
buffer_layouts[0].arrayStride = sizeof(ImDrawVert);
|
buffer_layouts[0].arrayStride = sizeof(ImDrawVert);
|
||||||
buffer_layouts[0].stepMode = WGPUVertexStepMode_Vertex;
|
buffer_layouts[0].stepMode = WGPUInputStepMode_Vertex;
|
||||||
buffer_layouts[0].attributeCount = 3;
|
buffer_layouts[0].attributeCount = 3;
|
||||||
buffer_layouts[0].attributes = attribute_desc;
|
buffer_layouts[0].attributes = attribute_desc;
|
||||||
|
|
||||||
@ -613,7 +610,7 @@ bool ImGui_ImplWGPU_CreateDeviceObjects()
|
|||||||
// Configure disabled depth-stencil state
|
// Configure disabled depth-stencil state
|
||||||
graphics_pipeline_desc.depthStencil = nullptr;
|
graphics_pipeline_desc.depthStencil = nullptr;
|
||||||
|
|
||||||
g_pipelineState = wgpuDeviceCreateRenderPipeline(g_wgpuDevice, &graphics_pipeline_desc);
|
g_pipelineState = wgpuDeviceCreateRenderPipeline2(g_wgpuDevice, &graphics_pipeline_desc);
|
||||||
|
|
||||||
ImGui_ImplWGPU_CreateFontsTexture();
|
ImGui_ImplWGPU_CreateFontsTexture();
|
||||||
ImGui_ImplWGPU_CreateUniformBuffer();
|
ImGui_ImplWGPU_CreateUniformBuffer();
|
||||||
@ -625,8 +622,8 @@ bool ImGui_ImplWGPU_CreateDeviceObjects()
|
|||||||
|
|
||||||
WGPUBindGroupEntry common_bg_entries[] =
|
WGPUBindGroupEntry common_bg_entries[] =
|
||||||
{
|
{
|
||||||
{ nullptr, 0, g_resources.Uniforms, 0, sizeof(Uniforms), 0, 0 },
|
{ 0, g_resources.Uniforms, 0, sizeof(Uniforms), 0, 0 },
|
||||||
{ nullptr, 1, 0, 0, 0, g_resources.Sampler, 0 },
|
{ 1, 0, 0, 0, g_resources.Sampler, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
WGPUBindGroupDescriptor common_bg_descriptor = {};
|
WGPUBindGroupDescriptor common_bg_descriptor = {};
|
||||||
|
@ -33,9 +33,8 @@ typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-12-16: Inputs: Fill VK_LCONTROL/VK_RCONTROL/VK_LSHIFT/VK_RSHIFT/VK_LMENU/VK_RMENU for completeness.
|
|
||||||
// 2021-08-17: Calling io.AddFocusEvent() on WM_SETFOCUS/WM_KILLFOCUS messages.
|
// 2021-08-17: Calling io.AddFocusEvent() on WM_SETFOCUS/WM_KILLFOCUS messages.
|
||||||
// 2021-08-02: Inputs: Fixed keyboard modifiers being reported when host window doesn't have focus.
|
// 2021-08-02: Inputs: Fixed keyboard modifiers being reported when host windo doesn't have focus.
|
||||||
// 2021-07-29: Inputs: MousePos is correctly reported when the host platform window is hovered but not focused (using TrackMouseEvent() to receive WM_MOUSELEAVE events).
|
// 2021-07-29: Inputs: MousePos is correctly reported when the host platform window is hovered but not focused (using TrackMouseEvent() to receive WM_MOUSELEAVE events).
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-06-08: Fixed ImGui_ImplWin32_EnableDpiAwareness() and ImGui_ImplWin32_GetDpiScaleForMonitor() to handle Windows 8.1/10 features without a manifest (per-monitor DPI, and properly calls SetProcessDpiAwareness() on 8.1).
|
// 2021-06-08: Fixed ImGui_ImplWin32_EnableDpiAwareness() and ImGui_ImplWin32_GetDpiScaleForMonitor() to handle Windows 8.1/10 features without a manifest (per-monitor DPI, and properly calls SetProcessDpiAwareness() on 8.1).
|
||||||
@ -173,9 +172,8 @@ bool ImGui_ImplWin32_Init(void* hwnd)
|
|||||||
|
|
||||||
void ImGui_ImplWin32_Shutdown()
|
void ImGui_ImplWin32_Shutdown()
|
||||||
{
|
{
|
||||||
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
|
||||||
IM_ASSERT(bd != NULL && "No platform backend to shutdown, or already shutdown?");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData();
|
||||||
|
|
||||||
// Unload XInput library
|
// Unload XInput library
|
||||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||||
@ -427,23 +425,11 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
|||||||
if (wParam < 256)
|
if (wParam < 256)
|
||||||
io.KeysDown[wParam] = down;
|
io.KeysDown[wParam] = down;
|
||||||
if (wParam == VK_CONTROL)
|
if (wParam == VK_CONTROL)
|
||||||
{
|
io.KeyCtrl = down;
|
||||||
io.KeysDown[VK_LCONTROL] = ((::GetKeyState(VK_LCONTROL) & 0x8000) != 0);
|
|
||||||
io.KeysDown[VK_RCONTROL] = ((::GetKeyState(VK_RCONTROL) & 0x8000) != 0);
|
|
||||||
io.KeyCtrl = io.KeysDown[VK_LCONTROL] || io.KeysDown[VK_RCONTROL];
|
|
||||||
}
|
|
||||||
if (wParam == VK_SHIFT)
|
if (wParam == VK_SHIFT)
|
||||||
{
|
io.KeyShift = down;
|
||||||
io.KeysDown[VK_LSHIFT] = ((::GetKeyState(VK_LSHIFT) & 0x8000) != 0);
|
|
||||||
io.KeysDown[VK_RSHIFT] = ((::GetKeyState(VK_RSHIFT) & 0x8000) != 0);
|
|
||||||
io.KeyShift = io.KeysDown[VK_LSHIFT] || io.KeysDown[VK_RSHIFT];
|
|
||||||
}
|
|
||||||
if (wParam == VK_MENU)
|
if (wParam == VK_MENU)
|
||||||
{
|
io.KeyAlt = down;
|
||||||
io.KeysDown[VK_LMENU] = ((::GetKeyState(VK_LMENU) & 0x8000) != 0);
|
|
||||||
io.KeysDown[VK_RMENU] = ((::GetKeyState(VK_RMENU) & 0x8000) != 0);
|
|
||||||
io.KeyAlt = io.KeysDown[VK_LMENU] || io.KeysDown[VK_RMENU];
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
|
@ -12,7 +12,7 @@ your application or engine to easily integrate Dear ImGui.** Each backend is typ
|
|||||||
e.g. DirectX11 ([imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)), OpenGL/WebGL ([imgui_impl_opengl3.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_opengl3.cpp), Vulkan ([imgui_impl_vulkan.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_vulkan.cpp), etc.
|
e.g. DirectX11 ([imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)), OpenGL/WebGL ([imgui_impl_opengl3.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_opengl3.cpp), Vulkan ([imgui_impl_vulkan.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_vulkan.cpp), etc.
|
||||||
|
|
||||||
- For some high-level frameworks, a single backend usually handle both 'Platform' and 'Renderer' parts.<BR>
|
- For some high-level frameworks, a single backend usually handle both 'Platform' and 'Renderer' parts.<BR>
|
||||||
e.g. Allegro 5 ([imgui_impl_allegro5.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_allegro5.cpp)). If you end up creating a custom backend for your engine, you may want to do the same.
|
e.g. Allegro 5 ([imgui_impl_allegro5.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_allegro5.cpp)), Marmalade ([imgui_impl_marmalade.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_marmalade.cpp)). If you end up creating a custom backend for your engine, you may want to do the same.
|
||||||
|
|
||||||
An application usually combines 1 Platform backend + 1 Renderer backend + main Dear ImGui sources.
|
An application usually combines 1 Platform backend + 1 Renderer backend + main Dear ImGui sources.
|
||||||
For example, the [example_win32_directx11](https://github.com/ocornut/imgui/tree/master/examples/example_win32_directx11) application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp. There are 20+ examples in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder. See [EXAMPLES.MD](https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md) for details.
|
For example, the [example_win32_directx11](https://github.com/ocornut/imgui/tree/master/examples/example_win32_directx11) application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp. There are 20+ examples in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder. See [EXAMPLES.MD](https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md) for details.
|
||||||
@ -75,20 +75,20 @@ List of Renderer Backends:
|
|||||||
imgui_impl_metal.mm ; Metal (with ObjC)
|
imgui_impl_metal.mm ; Metal (with ObjC)
|
||||||
imgui_impl_opengl2.cpp ; OpenGL 2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
imgui_impl_opengl2.cpp ; OpenGL 2 (legacy, fixed pipeline <- don't use with modern OpenGL context)
|
||||||
imgui_impl_opengl3.cpp ; OpenGL 3/4, OpenGL ES 2, OpenGL ES 3 (modern programmable pipeline)
|
imgui_impl_opengl3.cpp ; OpenGL 3/4, OpenGL ES 2, OpenGL ES 3 (modern programmable pipeline)
|
||||||
imgui_impl_sdlrenderer.cpp; SDL_Renderer (optional component of SDL2 available from SDL 2.0.18+)
|
|
||||||
imgui_impl_vulkan.cpp ; Vulkan
|
imgui_impl_vulkan.cpp ; Vulkan
|
||||||
imgui_impl_wgpu.cpp ; WebGPU
|
imgui_impl_wgpu.cpp ; WebGPU
|
||||||
|
|
||||||
List of high-level Frameworks Backends (combining Platform + Renderer):
|
List of high-level Frameworks Backends (combining Platform + Renderer):
|
||||||
|
|
||||||
imgui_impl_allegro5.cpp
|
imgui_impl_allegro5.cpp
|
||||||
|
imgui_impl_marmalade.cpp
|
||||||
|
|
||||||
Emscripten is also supported.
|
Emscripten is also supported.
|
||||||
The [example_emscripten_opengl3](https://github.com/ocornut/imgui/tree/master/examples/example_emscripten_opengl3) app uses imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp, but other combos are possible.
|
The [example_emscripten_opengl3](https://github.com/ocornut/imgui/tree/master/examples/example_emscripten_opengl3) app uses imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp, but other combos are possible.
|
||||||
|
|
||||||
### Backends for third-party frameworks, graphics API or other languages
|
### Backends for third-party frameworks, graphics API or other languages
|
||||||
|
|
||||||
See https://github.com/ocornut/imgui/wiki/Bindings for the full list (e.g. Adventure Game Studio, Cinder, Cocos2d-x, Game Maker Studio2, Godot, L<EFBFBD>VE+LUA, Magnum, Monogame, Ogre, openFrameworks, OpenSceneGraph, SFML, Sokol, Unity, Unreal Engine and many others).
|
See https://github.com/ocornut/imgui/wiki/Bindings for the full list.
|
||||||
|
|
||||||
### Recommended Backends
|
### Recommended Backends
|
||||||
|
|
||||||
@ -127,10 +127,7 @@ Once it works, if you really need it you can replace parts of backends with your
|
|||||||
and you have high-level systems everywhere.<BR>
|
and you have high-level systems everywhere.<BR>
|
||||||
Suggestion: try using a non-portable backend first (e.g. win32 + underlying graphics API) to get
|
Suggestion: try using a non-portable backend first (e.g. win32 + underlying graphics API) to get
|
||||||
your desktop builds working first. This will get you running faster and get your acquainted with
|
your desktop builds working first. This will get you running faster and get your acquainted with
|
||||||
how Dear ImGui works and is setup. You can then rewrite a custom backend using your own engine API...
|
how Dear ImGui works and is setup. You can then rewrite a custom backend using your own engine API.
|
||||||
|
|
||||||
Generally:
|
|
||||||
It is unlikely you will add value to your project by creating your own backend.
|
|
||||||
|
|
||||||
Also:
|
Also:
|
||||||
The [multi-viewports feature](https://github.com/ocornut/imgui/issues/1542) of the 'docking' branch allows
|
The [multi-viewports feature](https://github.com/ocornut/imgui/issues/1542) of the 'docking' branch allows
|
||||||
|
@ -30,209 +30,16 @@ HOW TO UPDATE?
|
|||||||
and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
|
and API updates have been a little more frequent lately. They are documented below and in imgui.cpp and should not affect all users.
|
||||||
- Please report any issue!
|
- Please report any issue!
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.86 (Released 2021-12-22)
|
VERSION 1.84b (Released 2021-08-20)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
Breaking Changes:
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84b
|
||||||
|
|
||||||
- Removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges.
|
|
||||||
Please open an issue if you think you really need this function. (#3841)
|
|
||||||
- Backends: OSX: Added NSView* parameter to ImGui_ImplOSX_Init(). (#4759) [@stuartcarnie]
|
|
||||||
- Backends: Marmalade: Removed obsolete Marmalade backend (imgui_impl_marmalade.cpp) + example app. (#368, #375)
|
|
||||||
Find last supported version at https://github.com/ocornut/imgui/wiki/Bindings
|
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
- Added an assertion for the common user mistake of using "" as an identifier at the root level of a window
|
- Fixed BeginDisabled(false) - BeginDisabled(true) was working. (#211, #4452, #4453)
|
||||||
instead of using "##something". Empty identifiers are valid and useful in a very small amount of cases,
|
|
||||||
but 99.9% of the time if you need an empty label you should use "##something". (#1414, #2562, #2807, #4008,
|
|
||||||
#4158, #4375, #4548, #4657, #4796). READ THE FAQ ABOUT HOW THE ID STACK WORKS -> https://dearimgui.org/faq
|
|
||||||
- Added GetMouseClickedCount() function, returning the number of successive clicks. (#3229) [@kudaba]
|
|
||||||
(so IsMouseDoubleClicked(ImGuiMouseButton_Left) is same as GetMouseClickedCount(ImGuiMouseButton_Left) == 2,
|
|
||||||
but it allows testing for triple clicks and more).
|
|
||||||
- Modals: fixed issue hovering popups inside a child windows inside a modal. (#4676, #4527)
|
|
||||||
- Modals, Popups, Windows: changes how appearing windows are interrupting popups and modals. (#4317) [@rokups]
|
|
||||||
- appearing windows created from within the begin stack of a popup/modal will no longer close it.
|
|
||||||
- appearing windows created not within the begin stack of a modal will no longer close the modal,
|
|
||||||
and automatically appear behind it.
|
|
||||||
- Fixed IsWindowFocused()/IsWindowHovered() issues with child windows inside popups. (#4676)
|
|
||||||
- Nav: Ctrl+tabbing to cycle through windows is now enabled regardless of using the _NavEnableKeyboard
|
|
||||||
configuration flag. This is part of an effort to generalize the use of keyboard inputs. (#4023, #787).
|
|
||||||
Note that while this is active you can also moving windows (with arrow) and resize (shift+arrows).
|
|
||||||
- Nav: tabbing now cycles through clipped items and scroll accordingly. (#4449)
|
|
||||||
- Nav: pressing PageUp/PageDown/Home/End when in Menu layer automatically moves back to Main layer.
|
|
||||||
- Nav: fixed resizing window from borders setting navigation to Menu layer.
|
|
||||||
- Nav: prevent child from clipping items when using _NavFlattened and parent has a pending request.
|
|
||||||
- Nav: pressing Esc to exit a child window reactivates the Nav highlight if it was disabled by mouse.
|
|
||||||
- Nav: with ImGuiConfigFlags_NavEnableSetMousePos enabled: Fixed absolute mouse position when using
|
|
||||||
Home/End leads to scrolling. Fixed not setting mouse position when a failed move request (e.g. when
|
|
||||||
already at edge) reactivates the navigation highlight.
|
|
||||||
- Menus: fixed closing a menu inside a popup/modal by clicking on the popup/modal. (#3496, #4797)
|
|
||||||
- Menus: fixed closing a menu by clicking on its menu-bar item when inside a popup. (#3496, #4797) [@xndcn]
|
|
||||||
- Menus: fixed menu inside a popup/modal not inhibiting hovering of items in the popup/modal. (#3496, #4797)
|
|
||||||
- Menus: fixed sub-menu items inside a popups from closing the popup.
|
|
||||||
- Menus: fixed top-level menu from not consistently using style.PopupRounding. (#4788)
|
|
||||||
- InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682)
|
|
||||||
- Inputtext, Nav: fixed using SetKeyboardFocusHere() on InputTextMultiline(). (#4761)
|
|
||||||
- InputText: made double-click select word, triple-line select line. Word delimitation logic differs
|
|
||||||
slightly from the one used by CTRL+arrows. (#2244)
|
|
||||||
- InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) [@actondev]
|
|
||||||
- InputText: fixed Shift+Delete from not cutting into clipboard. (#4818, #1541) [@corporateshark]
|
|
||||||
- InputTextMultiline: fixed incorrect padding when FrameBorder > 0. (#3781, #4794)
|
|
||||||
- InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (#3781, #4794)
|
|
||||||
- Separator: fixed cover all columns while called inside a table. (#4787)
|
|
||||||
- Clipper: currently focused item is automatically included in clipper range.
|
|
||||||
Fixes issue where e.g. drag and dropping an item and scrolling ensure the item source location is
|
|
||||||
still submitted. (#3841, #1725) [@GamingMinds-DanielC, @ocornut]
|
|
||||||
- Clipper: added ForceDisplayRangeByIndices() to force a given item (or several) to be stepped out
|
|
||||||
during a clipping operation. (#3841) [@@GamingMinds-DanielC]
|
|
||||||
- Clipper: rework so gamepad/keyboard navigation doesn't create spikes in number of items requested
|
|
||||||
by the clipper to display. (#3841)
|
|
||||||
- Clipper: fixed content height declaration slightly mismatching the value of when not using a clipper.
|
|
||||||
(an additional ItemSpacing.y was declared, affecting scrollbar range).
|
|
||||||
- Clipper: various and incomplete changes to tame down scrolling and precision issues on very large ranges.
|
|
||||||
Passing an explicit height to the clipper now allows larger ranges. (#3609, #3962).
|
|
||||||
- Clipper: fixed invalid state when number of frozen table row is smaller than ItemCount.
|
|
||||||
- Drag and Drop: BeginDragDropSource() with ImGuiDragDropFlags_SourceAllowNullID doesn't lose
|
|
||||||
tooltip when scrolling. (#143)
|
|
||||||
- Fonts: fixed infinite loop in ImFontGlyphRangesBuilder::AddRanges() when passing UINT16_MAX or UINT32_MAX
|
|
||||||
without the IMGUI_USE_WCHAR32 compile-time option. (#4802) [@SlavicPotato]
|
|
||||||
- Metrics: Added a node showing windows in submission order and showing the Begin() stack.
|
|
||||||
- Misc: Added missing ImGuiMouseCursor_NotAllowed cursor for software rendering (when the
|
|
||||||
io.MouseDrawCursor flag is enabled). (#4713) [@nobody-special666]
|
|
||||||
- Misc: Fixed software mouse cursor being rendered multiple times if Render() is called more than once.
|
|
||||||
- Misc: Fix MinGW DLL build issue (when IMGUI_API is defined). [@rokups]
|
|
||||||
- CI: Add MinGW DLL build to test suite. [@rokups]
|
|
||||||
- Backends: Vulkan: Call vkCmdSetScissor() at the end of render with a full-viewport to reduce
|
|
||||||
likehood of issues with people using VK_DYNAMIC_STATE_SCISSOR in their app without calling
|
|
||||||
vkCmdSetScissor() explicitly every frame. (#4644)
|
|
||||||
- Backends: OpenGL3: Using buffer orphaning + glBufferSubData(), seems to fix leaks with multi-viewports
|
|
||||||
with some Intel HD drivers, and perhaps improve performances. (#4468, #4504, #2981, #3381) [@parbo]
|
|
||||||
- Backends: OpenGL2, Allegro5, Marmalade: Fixed mishandling of the ImDrawCmd::IdxOffset field.
|
|
||||||
This is an old bug, but due to the way we created drawlists, it never had any visible side-effect before.
|
|
||||||
The new code for handling Modal and CTRL+Tab dimming/whitening recently made the bug surface. (#4790)
|
|
||||||
- Backends: Win32: Store left/right variants of Ctrl/Shift/Alt mods in KeysDown[] array. (#2625) [@thedmd]
|
|
||||||
- Backends: DX12: Fixed DRAW_EMPTY_SCISSOR_RECTANGLE warnings. (#4775)
|
|
||||||
- Backends: SDL_Renderer: Added support for large meshes (64k+ vertices) with 16-bit indices,
|
|
||||||
enabling 'ImGuiBackendFlags_RendererHasVtxOffset' in the backend. (#3926) [@rokups]
|
|
||||||
- Backends: SDL_Renderer: Fix for SDL 2.0.19+ RenderGeometryRaw() API signature change. (#4819) [@sridenour]
|
|
||||||
- Backends: OSX: Generally fix keyboard support. Keyboard arrays indexed using kVK_* codes, e.g.
|
|
||||||
ImGui::IsKeyPressed(kVK_Space). Don't set mouse cursor shape unconditionally. Handle two fingers scroll
|
|
||||||
cancel event. (#4759, #4253, #1873) [@stuartcarnie]
|
|
||||||
- Backends: OSX: Add Game Controller support (need linking GameController framework) (#4759) [@stuartcarnie]
|
|
||||||
- Backends: WebGPU: Passing explicit buffer sizes to wgpuRenderPassEncoderSetVertexBuffer() and
|
|
||||||
wgpuRenderPassEncoderSetIndexBuffer() functions as validation layers appears to not do what the
|
|
||||||
in-flux specs says. (#4766) [@meshula]
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
VERSION 1.85 (Released 2021-10-12)
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
This is the last release officially supporting C++03 and Visual Studio 2008/2010. (#4537)
|
|
||||||
We expect that the next release will require a subset of the C++11 language (VS 2012~, GCC 4.8.1, Clang 3.3).
|
|
||||||
We may use some C++11 language features but we will not use any C++ library headers.
|
|
||||||
If you are stuck on ancient compiler you may need to stay at this version onward.
|
|
||||||
|
|
||||||
Breaking Changes:
|
|
||||||
|
|
||||||
- Removed GetWindowContentRegionWidth() function. keep inline redirection helper.
|
|
||||||
Can use 'GetWindowContentRegionMax().x - GetWindowContentRegionMin().x' instead but it's not
|
|
||||||
very useful in practice, and the only use of it in the demo was illfit.
|
|
||||||
Using 'GetContentRegionAvail().x' is generally a better choice.
|
|
||||||
|
|
||||||
Other Changes:
|
|
||||||
|
|
||||||
- Debug: Stack Tool: Added "Stack Tool" available in "Demo->Tools->Stack Tool", "Metrics->Tools",
|
|
||||||
or by calling the ShowStackToolWindow() function. The tool run queries on hovered id to display
|
|
||||||
details about individual components that were hashed to create an ID. It helps understanding
|
|
||||||
the ID stack system and debugging potential ID collisions. (#4631) [@ocornut, @rokups]
|
|
||||||
- Windows: Fixed background order of overlapping childs submitted sequentially. (#4493)
|
|
||||||
- IsWindowFocused: Added ImGuiFocusedFlags_NoPopupHierarchy flag allowing to exclude child popups
|
|
||||||
from the tested windows when combined with _ChildWindows.
|
|
||||||
- IsWindowHovered: Added ImGuiHoveredFlags_NoPopupHierarchy flag allowing to exclude child popups
|
|
||||||
from the tested windows when combined with _ChildWindows.
|
|
||||||
- InputTextMultiline: Fixed label size not being included into window contents rect unless
|
|
||||||
the whole widget is clipped.
|
|
||||||
- InputText: Allow activating/cancelling/validating input with gamepad nav events. (#2321, #4552)
|
|
||||||
- InputText: Fixed selection rectangle appearing one frame late when selecting all.
|
|
||||||
- TextUnformatted: Accept null ranges including (NULL,NULL) without asserting, in order to conform
|
|
||||||
to common idioms (e.g. passing .data(), .data() + .size() from a null string). (#3615)
|
|
||||||
- Disabled: Added assert guard for mismatching BeginDisabled()/EndDisabled() blocks. (#211)
|
|
||||||
- Nav: Fixed using SetKeyboardFocusHere() on non-visible/clipped items. It now works and will scroll
|
|
||||||
toward the item. When called during a frame where the parent window is appearing, scrolling will
|
|
||||||
aim to center the item in the window. When calling during a frame where the parent window is already
|
|
||||||
visible, scrolling will aim to scroll as little as possible to make the item visible. We will later
|
|
||||||
expose scroll functions and flags in public API to select those behaviors. (#343, #4079, #2352)
|
|
||||||
- Nav: Fixed using SetKeyboardFocusHere() from activating a different item on the next frame if
|
|
||||||
submitted items have changed during that frame. (#432)
|
|
||||||
- Nav: Fixed toggling menu layer with Alt or exiting menu layer with Esc not moving mouse when
|
|
||||||
the ImGuiConfigFlags_NavEnableSetMousePos config flag is set.
|
|
||||||
- Nav: Fixed a few widgets from not setting reference keyboard/gamepad navigation ID when
|
|
||||||
activated with mouse. More specifically: BeginTabItem(), the scrolling arrows of BeginTabBar(),
|
|
||||||
the arrow section of TreeNode(), the +/- buttons of InputInt()/InputFloat(), Selectable() with
|
|
||||||
ImGuiSelectableFlags_SelectOnRelease. More generally: any direct use of ButtonBehavior() with
|
|
||||||
the PressedOnClick/PressedOnDoubleClick/PressedOnRelease button policy.
|
|
||||||
- Nav: Fixed an issue with losing focus on docked windows when pressing Alt while keyboard navigation
|
|
||||||
is disabled. (#4547, #4439) [@PathogenDavid]
|
|
||||||
- Nav: Fixed vertical scoring offset when wrapping on Y in a decorated window.
|
|
||||||
- Nav: Improve scrolling behavior when navigating to an item larger than view.
|
|
||||||
- TreePush(): removed unnecessary/inconsistent legacy behavior where passing a NULL value to
|
|
||||||
the TreePush(const char*) and TreePush(const void*) functions would use an hard-coded replacement.
|
|
||||||
The only situation where that change would make a meaningful difference is TreePush((const char*)NULL)
|
|
||||||
(_explicitly_ casting a null pointer to const char*), which is unlikely and will now crash.
|
|
||||||
You may replace it with anything else.
|
|
||||||
- ColorEdit4: Fixed not being able to change hue when saturation is 0. (#4014) [@rokups]
|
|
||||||
- ColorEdit4: Fixed hue resetting to 0 when it is set to 255. [@rokups]
|
|
||||||
- ColorEdit4: Fixed hue value jitter when source color is stored as RGB in 32-bit integer and perform
|
|
||||||
RGB<>HSV round trips every frames. [@rokups]
|
|
||||||
- ColorPicker4: Fixed picker being unable to select exact 1.0f color when dragging toward the edges
|
|
||||||
of the SV square (previously picked 0.999989986f). (#3517) [@rokups]
|
|
||||||
- Menus: Fixed vertical alignments of MenuItem() calls within a menu bar (broken in 1.84). (#4538)
|
|
||||||
- Menus: Improve closing logic when moving diagonally in empty between between parent and child menus to
|
|
||||||
accommodate for varying font size and dpi.
|
|
||||||
- Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510).
|
|
||||||
- Menus: Fixed an assertion happening in some situations when closing nested menus (broken in 1.83). (#4640)
|
|
||||||
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
|
|
||||||
- PlotHistogram: Fixed zero-line position when manually specifying min<0 and max>0. (#4349) [@filippocrocchini]
|
|
||||||
- Misc: Added asserts for missing PopItemFlag() calls.
|
|
||||||
- Misc: Fixed printf-style format checks on Clang+MinGW. (#4626, #4183, #3592) [@guusw]
|
|
||||||
- IO: Added 'io.WantCaptureMouseUnlessPopupClose' alternative to `io.WantCaptureMouse'. (#4480)
|
|
||||||
This allows apps to receive the click on void when that click is used to close popup (by default,
|
|
||||||
clicking on a void when a popup is open will close the popup but not release io.WantCaptureMouse).
|
|
||||||
- Fonts: imgui_freetype: Fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL
|
|
||||||
(which apparently happens with Freetype 2.11). (#4394, #4145?).
|
|
||||||
- Fonts: Fixed ImFontAtlas::ClearInputData() marking atlas as not built. (#4455, #3487)
|
|
||||||
- Backends: Added more implicit asserts to detect invalid/redundant calls to Shutdown functions. (#4562)
|
|
||||||
- Backends: OpenGL3: Fixed our custom GL loader conflicting with user using GL3W. (#4445) [@rokups]
|
|
||||||
- Backends: WebGPU: Fixed for latest specs. (#4472, #4512) [@Kangz, @bfierz]
|
|
||||||
- Backends: SDL_Renderer: Added SDL_Renderer backend compatible with upcoming SDL 2.0.18. (#3926) [@1bsyl]
|
|
||||||
- Backends: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted via
|
|
||||||
a direct unclipped PushClipRect() call. (#4464)
|
|
||||||
- Backends: OSX: Use mach_absolute_time as CFAbsoluteTimeGetCurrent can jump backwards. (#4557, #4563) [@lfnoise]
|
|
||||||
- Backends: All renderers: Normalize clipping rect handling across backends. (#4464)
|
|
||||||
- Examples: Added SDL + SDL_Renderer example in "examples/example_sdl_sdlrenderer/" folder. (#3926) [@1bsyl]
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
VERSION 1.84.2 (Released 2021-08-23)
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.2
|
|
||||||
|
|
||||||
- Disabled: Fixed nested BeginDisabled()/EndDisabled() calls. (#211, #4452, #4453, #4462) [@Legulysse]
|
|
||||||
- Backends: OpenGL3: OpenGL: Fixed ES 3.0 shader ("#version 300 es") to use normal precision
|
|
||||||
floats. Avoid wobbly rendering at HD resolutions. (#4463) [@nicolasnoble]
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
VERSION 1.84.1 (Released 2021-08-20)
|
|
||||||
-----------------------------------------------------------------------
|
|
||||||
|
|
||||||
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.84.1
|
|
||||||
|
|
||||||
- Disabled: Fixed BeginDisabled(false) - BeginDisabled(true) was working. (#211, #4452, #4453)
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
@ -141,6 +141,10 @@ GLUT (e.g., FreeGLUT on Linux/Windows, GLUT framework on OSX) + OpenGL2 example.
|
|||||||
= main.cpp + imgui_impl_glut.cpp + imgui_impl_opengl2.cpp <BR>
|
= main.cpp + imgui_impl_glut.cpp + imgui_impl_opengl2.cpp <BR>
|
||||||
Note that GLUT/FreeGLUT is largely obsolete software, prefer using GLFW or SDL.
|
Note that GLUT/FreeGLUT is largely obsolete software, prefer using GLFW or SDL.
|
||||||
|
|
||||||
|
[example_marmalade/](https://github.com/ocornut/imgui/blob/master/examples/example_marmalade/) <BR>
|
||||||
|
Marmalade example using IwGx. <BR>
|
||||||
|
= main.cpp + imgui_impl_marmalade.cpp
|
||||||
|
|
||||||
[example_null/](https://github.com/ocornut/imgui/blob/master/examples/example_null/) <BR>
|
[example_null/](https://github.com/ocornut/imgui/blob/master/examples/example_null/) <BR>
|
||||||
Null example, compile and link imgui, create context, run headless with no inputs and no graphics output. <BR>
|
Null example, compile and link imgui, create context, run headless with no inputs and no graphics output. <BR>
|
||||||
= main.cpp <BR>
|
= main.cpp <BR>
|
||||||
@ -171,12 +175,6 @@ SDL2 (Win32, Mac, Linux, etc.) + OpenGL3+/ES2/ES3 example. <BR>
|
|||||||
This uses more modern OpenGL calls and custom shaders. <BR>
|
This uses more modern OpenGL calls and custom shaders. <BR>
|
||||||
This may actually also work with OpenGL 2.x contexts! <BR>
|
This may actually also work with OpenGL 2.x contexts! <BR>
|
||||||
|
|
||||||
[example_sdl_sdlrenderer/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_sdlrenderer/) <BR>
|
|
||||||
SDL2 (Win32, Mac, Linux, etc.) + SDL_Renderer (most graphics backends are supported underneath) <BR>
|
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_sdlrenderer.cpp <BR>
|
|
||||||
This requires SDL 2.0.17+ (expected to release November 2021) <BR>
|
|
||||||
We do not really recommend using SDL_Renderer as it is a rather primitive API.
|
|
||||||
|
|
||||||
[example_sdl_vulkan/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_vulkan/) <BR>
|
[example_sdl_vulkan/](https://github.com/ocornut/imgui/blob/master/examples/example_sdl_vulkan/) <BR>
|
||||||
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example. <BR>
|
SDL2 (Win32, Mac, Linux, etc.) + Vulkan example. <BR>
|
||||||
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp <BR>
|
= main.cpp + imgui_impl_sdl.cpp + imgui_impl_vulkan.cpp <BR>
|
||||||
|
21
docs/FAQ.md
21
docs/FAQ.md
@ -23,7 +23,7 @@ or view this file with any Markdown viewer.
|
|||||||
| [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) |
|
| [I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-clipping-or-disappearing-when-i-move-windows-around) |
|
||||||
| [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) |
|
| [I integrated Dear ImGui in my engine and some elements are displaying outside their expected windows boundaries...](#q-i-integrated-dear-imgui-in-my-engine-and-some-elements-are-displaying-outside-their-expected-windows-boundaries) |
|
||||||
| **Q&A: Usage** |
|
| **Q&A: Usage** |
|
||||||
| **[About the ID Stack system..<br>Why is my widget not reacting when I click on it?<br>How can I have widgets with an empty label?<br>How can I have multiple widgets with the same label?<br>How can I have multiple windows with the same label?](#q-about-the-id-stack-system)** |
|
| **[Why is my widget not reacting when I click on it?<br>How can I have widgets with an empty label?<br>How can I have multiple widgets with the same label?](#q-why-is-my-widget-not-reacting-when-i-click-on-it)** |
|
||||||
| [How can I display an image? What is ImTextureID, how does it work?](#q-how-can-i-display-an-image-what-is-imtextureid-how-does-it-work)|
|
| [How can I display an image? What is ImTextureID, how does it work?](#q-how-can-i-display-an-image-what-is-imtextureid-how-does-it-work)|
|
||||||
| [How can I use my own math types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-math-types-instead-of-imvec2imvec4) |
|
| [How can I use my own math types instead of ImVec2/ImVec4?](#q-how-can-i-use-my-own-math-types-instead-of-imvec2imvec4) |
|
||||||
| [How can I interact with standard C++ types (such as std::string and std::vector)?](#q-how-can-i-interact-with-standard-c-types-such-as-stdstring-and-stdvector) |
|
| [How can I interact with standard C++ types (such as std::string and std::vector)?](#q-how-can-i-interact-with-standard-c-types-such-as-stdstring-and-stdvector) |
|
||||||
@ -94,8 +94,6 @@ Read [BACKENDS.md](https://github.com/ocornut/imgui/blob/master/docs/BACKENDS.md
|
|||||||
Read `PROGRAMMER GUIDE` section of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp). <BR>
|
Read `PROGRAMMER GUIDE` section of [imgui.cpp](https://github.com/ocornut/imgui/blob/master/imgui.cpp). <BR>
|
||||||
The [Wiki](https://github.com/ocornut/imgui/wiki) is a hub to many resources and links.
|
The [Wiki](https://github.com/ocornut/imgui/wiki) is a hub to many resources and links.
|
||||||
|
|
||||||
For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
|
|
||||||
|
|
||||||
##### [Return to Index](#index)
|
##### [Return to Index](#index)
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -162,7 +160,7 @@ Console SDK also sometimes provide equivalent tooling or wrapper for Synergy-lik
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...
|
### Q: I integrated Dear ImGui in my engine and little squares are showing instead of text...
|
||||||
Your renderer is not using the font texture correctly or it hasn't been uploaded to the GPU.
|
Your renderer is not using the font texture correctly or it hasn't be uploaded to GPU.
|
||||||
- If this happens using the standard backends: A) have you modified the font atlas after `ImGui_ImplXXX_NewFrame()`? B) maybe the texture failed to upload, which could happens if for some reason your texture is too big. Also see [docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md).
|
- If this happens using the standard backends: A) have you modified the font atlas after `ImGui_ImplXXX_NewFrame()`? B) maybe the texture failed to upload, which could happens if for some reason your texture is too big. Also see [docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md).
|
||||||
- If this happens with a custom backend: make sure you have uploaded the font texture to the GPU, that all shaders are rendering states are setup properly (e.g. texture is bound). Compare your code to existing backends and use a graphics debugger such as [RenderDoc](https://renderdoc.org) to debug your rendering states.
|
- If this happens with a custom backend: make sure you have uploaded the font texture to the GPU, that all shaders are rendering states are setup properly (e.g. texture is bound). Compare your code to existing backends and use a graphics debugger such as [RenderDoc](https://renderdoc.org) to debug your rendering states.
|
||||||
|
|
||||||
@ -186,24 +184,17 @@ Refer to rendering backends in the [examples/](https://github.com/ocornut/imgui/
|
|||||||
|
|
||||||
# Q&A: Usage
|
# Q&A: Usage
|
||||||
|
|
||||||
### Q: About the ID Stack system...
|
|
||||||
### Q: Why is my widget not reacting when I click on it?
|
### Q: Why is my widget not reacting when I click on it?
|
||||||
### Q: How can I have widgets with an empty label?
|
### Q: How can I have widgets with an empty label?
|
||||||
### Q: How can I have multiple widgets with the same label?
|
### Q: How can I have multiple widgets with the same label?
|
||||||
### Q: How can I have multiple windows with the same label?
|
|
||||||
|
|
||||||
A primer on labels and the ID Stack...
|
A primer on labels and the ID Stack...
|
||||||
|
|
||||||
Dear ImGui internally needs to uniquely identify UI elements.
|
Dear ImGui internally need to uniquely identify UI elements.
|
||||||
Elements that are typically not clickable (such as calls to the Text functions) don't need an ID.
|
Elements that are typically not clickable (such as calls to the Text functions) don't need an ID.
|
||||||
Interactive widgets (such as calls to Button buttons) need a unique ID.
|
Interactive widgets (such as calls to Button buttons) need a unique ID.
|
||||||
|
Unique ID are used internally to track active widgets and occasionally associate state to widgets.
|
||||||
**Unique ID are used internally to track active widgets and occasionally associate state to widgets.<BR>
|
Unique ID are implicitly built from the hash of multiple elements that identify the "path" to the UI element.
|
||||||
Unique ID are implicitly built from the hash of multiple elements that identify the "path" to the UI element.**
|
|
||||||
|
|
||||||
Since Dear ImGui 1.85 you can use `Demo>Tools>Stack Tool` or call `ImGui::ShowStackToolWindow()`. The tool display intermediate values leading to the creation of a unique ID, making things easier to debug and understand.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
- Unique ID are often derived from a string label and at minimum scoped within their host window:
|
- Unique ID are often derived from a string label and at minimum scoped within their host window:
|
||||||
```cpp
|
```cpp
|
||||||
@ -475,7 +466,7 @@ ImGui::End();
|
|||||||
- Math operators: if you have setup `IM_VEC2_CLASS_EXTRA` in `imconfig.h` to bind your own math types, you can use your own math types and their natural operators instead of ImVec2. ImVec2 by default doesn't export any math operators in the public API. You may use `#define IMGUI_DEFINE_MATH_OPERATORS` `#include "imgui_internal.h"` to use the internally defined math operators, but instead prefer using your own math library and set it up in `imconfig.h`.
|
- Math operators: if you have setup `IM_VEC2_CLASS_EXTRA` in `imconfig.h` to bind your own math types, you can use your own math types and their natural operators instead of ImVec2. ImVec2 by default doesn't export any math operators in the public API. You may use `#define IMGUI_DEFINE_MATH_OPERATORS` `#include "imgui_internal.h"` to use the internally defined math operators, but instead prefer using your own math library and set it up in `imconfig.h`.
|
||||||
- You can use `ImGui::GetBackgroundDrawList()` or `ImGui::GetForegroundDrawList()` to access draw lists which will be displayed behind and over every other dear imgui windows (one bg/fg drawlist per viewport). This is very convenient if you need to quickly display something on the screen that is not associated to a dear imgui window.
|
- You can use `ImGui::GetBackgroundDrawList()` or `ImGui::GetForegroundDrawList()` to access draw lists which will be displayed behind and over every other dear imgui windows (one bg/fg drawlist per viewport). This is very convenient if you need to quickly display something on the screen that is not associated to a dear imgui window.
|
||||||
- You can also create your own empty window and draw inside it. Call Begin() with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags (The `ImGuiWindowFlags_NoDecoration` flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse). Then you can retrieve the ImDrawList* via `GetWindowDrawList()` and draw to it in any way you like.
|
- You can also create your own empty window and draw inside it. Call Begin() with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags (The `ImGuiWindowFlags_NoDecoration` flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse). Then you can retrieve the ImDrawList* via `GetWindowDrawList()` and draw to it in any way you like.
|
||||||
- You can create your own ImDrawList instance. You'll need to initialize them with `ImGui::GetDrawListSharedData()`, or create your own instancing `ImDrawListSharedData`, and then call your renderer function with your own ImDrawList or ImDrawData data.
|
`- You can create your own ImDrawList instance. You'll need to initialize them with `ImGui::GetDrawListSharedData()`, or create your own instancing ImDrawListSharedData`, and then call your renderer function with your own ImDrawList or ImDrawData data.
|
||||||
- Looking for fun? The [ImDrawList coding party 2020](https://github.com/ocornut/imgui/issues/3606) thread is full of "don't do this at home" extreme uses of the ImDrawList API.
|
- Looking for fun? The [ImDrawList coding party 2020](https://github.com/ocornut/imgui/issues/3606) thread is full of "don't do this at home" extreme uses of the ImDrawList API.
|
||||||
|
|
||||||
##### [Return to Index](#index)
|
##### [Return to Index](#index)
|
||||||
|
@ -27,12 +27,12 @@ In the [misc/fonts/](https://github.com/ocornut/imgui/tree/master/misc/fonts) fo
|
|||||||
---------------------------------------
|
---------------------------------------
|
||||||
## Readme First
|
## Readme First
|
||||||
|
|
||||||
- You can use the `Metrics/Debugger` window (available in `Demo>Tools`) to browse your fonts and understand what's going on if you have an issue. You can also reach it in `Demo->Tools->Style Editor->Fonts`. The same information are also available in the Style Editor under Fonts.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
- All loaded fonts glyphs are rendered into a single texture atlas ahead of time. Calling either of `io.Fonts->GetTexDataAsAlpha8()`, `io.Fonts->GetTexDataAsRGBA32()` or `io.Fonts->Build()` will build the atlas.
|
- All loaded fonts glyphs are rendered into a single texture atlas ahead of time. Calling either of `io.Fonts->GetTexDataAsAlpha8()`, `io.Fonts->GetTexDataAsRGBA32()` or `io.Fonts->Build()` will build the atlas.
|
||||||
|
|
||||||
|
- You can use the style editor `ImGui::ShowStyleEditor()` in the "Fonts" section to browse your fonts and understand what's going on if you have an issue. You can also reach it in `Demo->Tools->Style Editor->Fonts`:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
- Make sure your font ranges data are persistent (available during the calls to `GetTexDataAsAlpha8()`/`GetTexDataAsRGBA32()/`Build()`.
|
- Make sure your font ranges data are persistent (available during the calls to `GetTexDataAsAlpha8()`/`GetTexDataAsRGBA32()/`Build()`.
|
||||||
|
|
||||||
- Use C++11 u8"my text" syntax to encode literal strings as UTF-8. e.g.:
|
- Use C++11 u8"my text" syntax to encode literal strings as UTF-8. e.g.:
|
||||||
|
@ -116,9 +116,9 @@ On most platforms and when using C++, **you should be able to use a combination
|
|||||||
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer at ease with those concepts, it should take you less than two hours to integrate Dear ImGui in your custom engine. **Make sure to spend time reading the [FAQ](https://www.dearimgui.org/faq), comments, and some of the examples/ application!**
|
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer at ease with those concepts, it should take you less than two hours to integrate Dear ImGui in your custom engine. **Make sure to spend time reading the [FAQ](https://www.dearimgui.org/faq), comments, and some of the examples/ application!**
|
||||||
|
|
||||||
Officially maintained backends/bindings (in repository):
|
Officially maintained backends/bindings (in repository):
|
||||||
- Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
|
- Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, Vulkan, WebGPU.
|
||||||
- Platforms: GLFW, SDL2, Win32, Glut, OSX, Android.
|
- Platforms: GLFW, SDL2, Win32, Glut, OSX, Android.
|
||||||
- Frameworks: Allegro5, Emscripten.
|
- Frameworks: Emscripten, Allegro5, Marmalade.
|
||||||
|
|
||||||
[Third-party backends/bindings](https://github.com/ocornut/imgui/wiki/Bindings) wiki page:
|
[Third-party backends/bindings](https://github.com/ocornut/imgui/wiki/Bindings) wiki page:
|
||||||
- Languages: C, C# and: Beef, ChaiScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift...
|
- Languages: C, C# and: Beef, ChaiScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift...
|
||||||
@ -162,9 +162,7 @@ See: [Wiki](https://github.com/ocornut/imgui/wiki) for many links, references, a
|
|||||||
|
|
||||||
See: [Articles about the IMGUI paradigm](https://github.com/ocornut/imgui/wiki#about-the-imgui-paradigm) to read/learn about the Immediate Mode GUI paradigm.
|
See: [Articles about the IMGUI paradigm](https://github.com/ocornut/imgui/wiki#about-the-imgui-paradigm) to read/learn about the Immediate Mode GUI paradigm.
|
||||||
|
|
||||||
Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions).
|
For questions, bug reports, requests, feedback, you may post on [GitHub Issues](https://github.com/ocornut/imgui/issues) or [GitHub Discussions](https://github.com/ocornut/imgui/discussions). Please read and fill the New Issue template carefully.
|
||||||
|
|
||||||
For other questions, bug reports, requests, feedback, you may post on [GitHub Issues](https://github.com/ocornut/imgui/issues). Please read and fill the New Issue template carefully.
|
|
||||||
|
|
||||||
Private support is available for paying business customers (E-mail: _contact @ dearimgui dot com_).
|
Private support is available for paying business customers (E-mail: _contact @ dearimgui dot com_).
|
||||||
|
|
||||||
@ -201,13 +199,13 @@ Ongoing Dear ImGui development is currently financially supported by users and p
|
|||||||
- [Blizzard](https://careers.blizzard.com/en-us/openings/engineering/all/all/all/1)
|
- [Blizzard](https://careers.blizzard.com/en-us/openings/engineering/all/all/all/1)
|
||||||
|
|
||||||
*Double-chocolate sponsors*
|
*Double-chocolate sponsors*
|
||||||
- [Ubisoft](https://montreal.ubisoft.com/en/ubisoft-sponsors-user-interface-library-for-c-dear-imgui), [Supercell](https://supercell.com)
|
- [Google](https://github.com/google/filament), [Nvidia](https://developer.nvidia.com/nvidia-omniverse), [Ubisoft](https://montreal.ubisoft.com/en/ubisoft-sponsors-user-interface-library-for-c-dear-imgui)
|
||||||
|
|
||||||
*Chocolate sponsors*
|
*Chocolate sponsors*
|
||||||
- [Activision](https://careers.activision.com/c/programmingsoftware-engineering-jobs), [Adobe](https://www.adobe.com/products/medium.html), [Aras Pranckevičius](https://aras-p.info), [Arkane Studios](https://www.arkane-studios.com), [Epic](https://www.unrealengine.com/en-US/megagrants), [Google](https://github.com/google/filament), [Nvidia](https://developer.nvidia.com/nvidia-omniverse), [RAD Game Tools](http://www.radgametools.com/)
|
- [Activision](https://careers.activision.com/c/programmingsoftware-engineering-jobs), [Adobe](https://www.adobe.com/products/medium.html), [Aras Pranckevičius](https://aras-p.info), [Arkane Studios](https://www.arkane-studios.com), [Epic](https://www.unrealengine.com/en-US/megagrants), [RAD Game Tools](http://www.radgametools.com/)
|
||||||
|
|
||||||
*Salty-caramel sponsors*
|
*Salty-caramel sponsors*
|
||||||
- [Framefield](http://framefield.com), [Grinding Gear Games](https://www.grindinggear.com), [Kylotonn](https://www.kylotonn.com), [Next Level Games](https://www.nextlevelgames.com), [O-Net Communications (USA)](http://en.o-netcom.com)
|
- [Framefield](http://framefield.com), [Grinding Gear Games](https://www.grindinggear.com), [Kylotonn](https://www.kylotonn.com), [Next Level Games](https://www.nextlevelgames.com), [O-Net Communications (USA)](http://en.o-netcom.com), [Supercell](https://supercell.com).
|
||||||
|
|
||||||
Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors) for past sponsors.
|
Please see [detailed list of Dear ImGui supporters](https://github.com/ocornut/imgui/wiki/Sponsors) for past sponsors.
|
||||||
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations.
|
From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations.
|
||||||
|
@ -142,6 +142,7 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- plot: option/feature: draw unit
|
- plot: option/feature: draw unit
|
||||||
- plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID)
|
- plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID)
|
||||||
|
|
||||||
|
- clipper: ability to force display 1 item in the list would be convenient (for patterns where we need to set active id etc.)
|
||||||
- clipper: ability to disable the clipping through a simple flag/bool.
|
- clipper: ability to disable the clipping through a simple flag/bool.
|
||||||
- clipper: ability to run without knowing full count in advance.
|
- clipper: ability to run without knowing full count in advance.
|
||||||
- clipper: horizontal clipping support. (#2580)
|
- clipper: horizontal clipping support. (#2580)
|
||||||
@ -325,7 +326,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- nav: some features such as PageUp/Down/Home/End should probably work without ImGuiConfigFlags_NavEnableKeyboard? (where do we draw the line?)
|
- nav: some features such as PageUp/Down/Home/End should probably work without ImGuiConfigFlags_NavEnableKeyboard? (where do we draw the line?)
|
||||||
- nav: configuration flag to disable global shortcuts (currently only CTRL-Tab) ?
|
- nav: configuration flag to disable global shortcuts (currently only CTRL-Tab) ?
|
||||||
! nav: never clear NavId on some setup (e.g. gamepad centric)
|
! nav: never clear NavId on some setup (e.g. gamepad centric)
|
||||||
- nav: scroll up/down if possible when move request fails
|
|
||||||
- nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.
|
- nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.
|
||||||
- nav: code to focus child-window on restoring NavId appears to have issue: e.g. when focus change is implicit because of window closure.
|
- nav: code to focus child-window on restoring NavId appears to have issue: e.g. when focus change is implicit because of window closure.
|
||||||
- nav: Home/End behavior when navigable item is not fully visible at the edge of scrolling? should be backtrack to keep item into view?
|
- nav: Home/End behavior when navigable item is not fully visible at the edge of scrolling? should be backtrack to keep item into view?
|
||||||
@ -334,12 +334,12 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- nav: patterns to make it possible for arrows key to update selection (see JustMovedTo in range_select branch)
|
- nav: patterns to make it possible for arrows key to update selection (see JustMovedTo in range_select branch)
|
||||||
- nav: restore/find nearest NavId when current one disappear (e.g. pressed a button that disappear, or perhaps auto restoring when current button change name)
|
- nav: restore/find nearest NavId when current one disappear (e.g. pressed a button that disappear, or perhaps auto restoring when current button change name)
|
||||||
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
||||||
- nav: NavFlattened: init requests don't work properly on flattened siblings.
|
|
||||||
- nav: NavFlattened: pageup/pagedown/home/end don't work properly on flattened siblings.
|
|
||||||
- nav: NavFlattened: ESC on a flattened child should select something.
|
- nav: NavFlattened: ESC on a flattened child should select something.
|
||||||
- nav: NavFlattened: broken: in typical usage scenario, the items of a fully clipped child are currently not considered to enter into a NavFlattened child.
|
- nav: NavFlattened: broken: in typical usage scenario, the items of a fully clipped child are currently not considered to enter into a NavFlattened child.
|
||||||
|
- nav: NavFlattened: init request doesn't select items that are part of a NavFlattened child
|
||||||
- nav: NavFlattened: cannot access menu-bar of a flattened child window with Alt/menu key (not a very common use case..).
|
- nav: NavFlattened: cannot access menu-bar of a flattened child window with Alt/menu key (not a very common use case..).
|
||||||
- nav: simulate right-click or context activation? (SHIFT+F10)
|
- nav: simulate right-click or context activation? (SHIFT+F10)
|
||||||
|
- nav/tabbing: refactor old tabbing system and turn into navigation, should pass through all widgets (in submission order?).
|
||||||
- nav/popup: esc/enter default behavior for popups, e.g. be able to mark an "ok" or "cancel" button that would get triggered by those keys, default validation button, etc.
|
- nav/popup: esc/enter default behavior for popups, e.g. be able to mark an "ok" or "cancel" button that would get triggered by those keys, default validation button, etc.
|
||||||
- nav/treenode: left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
|
- nav/treenode: left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
|
||||||
- nav/menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
|
- nav/menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
|
||||||
@ -352,6 +352,8 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
|
|||||||
- nav/windowing: when CTRL-Tab/windowing is active, the HoveredWindow detection doesn't take account of the window display re-ordering.
|
- nav/windowing: when CTRL-Tab/windowing is active, the HoveredWindow detection doesn't take account of the window display re-ordering.
|
||||||
- nav/windowing: Resizing window will currently fail with certain types of resizing constraints/callback applied
|
- nav/windowing: Resizing window will currently fail with certain types of resizing constraints/callback applied
|
||||||
- focus: preserve ActiveId/focus stack state, e.g. when opening a menu and close it, previously selected InputText() focus gets restored (#622)
|
- focus: preserve ActiveId/focus stack state, e.g. when opening a menu and close it, previously selected InputText() focus gets restored (#622)
|
||||||
|
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
|
||||||
|
- focus: unable to use SetKeyboardFocusHere() on clipped widgets. (#787, #343)
|
||||||
|
|
||||||
- inputs: we need an explicit flag about whether the imgui window is focused, to be able to distinguish focused key releases vs alt-tabbing all release behaviors.
|
- inputs: we need an explicit flag about whether the imgui window is focused, to be able to distinguish focused key releases vs alt-tabbing all release behaviors.
|
||||||
- inputs: rework IO system to be able to pass actual ordered/timestamped events. use an event queue? (~#335, #71)
|
- inputs: rework IO system to be able to pass actual ordered/timestamped events. use an event queue? (~#335, #71)
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
05318E0F274C397200A8DE2E /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05318E0E274C397200A8DE2E /* GameController.framework */; };
|
|
||||||
07A82ED82139413D0078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82ED72139413C0078D120 /* imgui_widgets.cpp */; };
|
07A82ED82139413D0078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82ED72139413C0078D120 /* imgui_widgets.cpp */; };
|
||||||
07A82ED92139418F0078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82ED72139413C0078D120 /* imgui_widgets.cpp */; };
|
07A82ED92139418F0078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82ED72139413C0078D120 /* imgui_widgets.cpp */; };
|
||||||
5079822E257677DB0038A28D /* imgui_tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5079822D257677DB0038A28D /* imgui_tables.cpp */; };
|
5079822E257677DB0038A28D /* imgui_tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5079822D257677DB0038A28D /* imgui_tables.cpp */; };
|
||||||
@ -33,7 +32,6 @@
|
|||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
05318E0E274C397200A8DE2E /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
|
|
||||||
07A82ED62139413C0078D120 /* imgui_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_internal.h; path = ../../imgui_internal.h; sourceTree = "<group>"; };
|
07A82ED62139413C0078D120 /* imgui_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imgui_internal.h; path = ../../imgui_internal.h; sourceTree = "<group>"; };
|
||||||
07A82ED72139413C0078D120 /* imgui_widgets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_widgets.cpp; path = ../../imgui_widgets.cpp; sourceTree = "<group>"; };
|
07A82ED72139413C0078D120 /* imgui_widgets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_widgets.cpp; path = ../../imgui_widgets.cpp; sourceTree = "<group>"; };
|
||||||
5079822D257677DB0038A28D /* imgui_tables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_tables.cpp; path = ../../imgui_tables.cpp; sourceTree = "<group>"; };
|
5079822D257677DB0038A28D /* imgui_tables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_tables.cpp; path = ../../imgui_tables.cpp; sourceTree = "<group>"; };
|
||||||
@ -78,7 +76,6 @@
|
|||||||
files = (
|
files = (
|
||||||
8309BDC6253CCCFE0045E2A1 /* AppKit.framework in Frameworks */,
|
8309BDC6253CCCFE0045E2A1 /* AppKit.framework in Frameworks */,
|
||||||
83BBE9EC20EB471700295997 /* MetalKit.framework in Frameworks */,
|
83BBE9EC20EB471700295997 /* MetalKit.framework in Frameworks */,
|
||||||
05318E0F274C397200A8DE2E /* GameController.framework in Frameworks */,
|
|
||||||
83BBE9ED20EB471700295997 /* Metal.framework in Frameworks */,
|
83BBE9ED20EB471700295997 /* Metal.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -136,7 +133,6 @@
|
|||||||
83BBE9E320EB46B800295997 /* Frameworks */ = {
|
83BBE9E320EB46B800295997 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
05318E0E274C397200A8DE2E /* GameController.framework */,
|
|
||||||
8309BDC5253CCCFE0045E2A1 /* AppKit.framework */,
|
8309BDC5253CCCFE0045E2A1 /* AppKit.framework */,
|
||||||
8309BD8E253CCAAA0045E2A1 /* UIKit.framework */,
|
8309BD8E253CCAAA0045E2A1 /* UIKit.framework */,
|
||||||
83BBE9EE20EB471C00295997 /* ModelIO.framework */,
|
83BBE9EE20EB471C00295997 /* ModelIO.framework */,
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
return event;
|
return event;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ImGui_ImplOSX_Init(self.view);
|
ImGui_ImplOSX_Init();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
05E31B59274EF0700083FCB6 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05E31B57274EF0360083FCB6 /* GameController.framework */; };
|
|
||||||
07A82EDB213941D00078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82EDA213941D00078D120 /* imgui_widgets.cpp */; };
|
07A82EDB213941D00078D120 /* imgui_widgets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07A82EDA213941D00078D120 /* imgui_widgets.cpp */; };
|
||||||
4080A99820B02D340036BA46 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4080A98A20B02CD90036BA46 /* main.mm */; };
|
4080A99820B02D340036BA46 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4080A98A20B02CD90036BA46 /* main.mm */; };
|
||||||
4080A9A220B034280036BA46 /* imgui_impl_opengl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */; };
|
4080A9A220B034280036BA46 /* imgui_impl_opengl2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4080A99E20B034280036BA46 /* imgui_impl_opengl2.cpp */; };
|
||||||
@ -33,7 +32,6 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
05E31B57274EF0360083FCB6 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
|
|
||||||
07A82EDA213941D00078D120 /* imgui_widgets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_widgets.cpp; path = ../../imgui_widgets.cpp; sourceTree = "<group>"; };
|
07A82EDA213941D00078D120 /* imgui_widgets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = imgui_widgets.cpp; path = ../../imgui_widgets.cpp; sourceTree = "<group>"; };
|
||||||
4080A96B20B029B00036BA46 /* example_osx_opengl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = example_osx_opengl2; sourceTree = BUILT_PRODUCTS_DIR; };
|
4080A96B20B029B00036BA46 /* example_osx_opengl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = example_osx_opengl2; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
4080A98A20B02CD90036BA46 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = SOURCE_ROOT; };
|
4080A98A20B02CD90036BA46 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = SOURCE_ROOT; };
|
||||||
@ -59,7 +57,6 @@
|
|||||||
files = (
|
files = (
|
||||||
4080A9B520B034EA0036BA46 /* OpenGL.framework in Frameworks */,
|
4080A9B520B034EA0036BA46 /* OpenGL.framework in Frameworks */,
|
||||||
4080A9B320B034E40036BA46 /* Cocoa.framework in Frameworks */,
|
4080A9B320B034E40036BA46 /* Cocoa.framework in Frameworks */,
|
||||||
05E31B59274EF0700083FCB6 /* GameController.framework in Frameworks */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -98,7 +95,6 @@
|
|||||||
4080A9B120B034E40036BA46 /* Frameworks */ = {
|
4080A9B120B034E40036BA46 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
05E31B57274EF0360083FCB6 /* GameController.framework */,
|
|
||||||
4080A9B420B034EA0036BA46 /* OpenGL.framework */,
|
4080A9B420B034EA0036BA46 /* OpenGL.framework */,
|
||||||
4080A9B220B034E40036BA46 /* Cocoa.framework */,
|
4080A9B220B034E40036BA46 /* Cocoa.framework */,
|
||||||
);
|
);
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
// Setup Platform/Renderer backends
|
// Setup Platform/Renderer backends
|
||||||
ImGui_ImplOSX_Init(self);
|
ImGui_ImplOSX_Init();
|
||||||
ImGui_ImplOpenGL2_Init();
|
ImGui_ImplOpenGL2_Init();
|
||||||
|
|
||||||
// Load Fonts
|
// Load Fonts
|
||||||
@ -146,9 +146,12 @@
|
|||||||
animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES];
|
animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)reshape { [super reshape]; [[self openGLContext] update]; [self updateAndDrawDemoView]; }
|
-(void)reshape { [[self openGLContext] update]; [self updateAndDrawDemoView]; }
|
||||||
-(void)drawRect:(NSRect)bounds { [self updateAndDrawDemoView]; }
|
-(void)drawRect:(NSRect)bounds { [self updateAndDrawDemoView]; }
|
||||||
-(void)animationTimerFired:(NSTimer*)timer { [self setNeedsDisplay:YES]; }
|
-(void)animationTimerFired:(NSTimer*)timer { [self setNeedsDisplay:YES]; }
|
||||||
|
-(BOOL)acceptsFirstResponder { return (YES); }
|
||||||
|
-(BOOL)becomeFirstResponder { return (YES); }
|
||||||
|
-(BOOL)resignFirstResponder { return (YES); }
|
||||||
-(void)dealloc { animationTimer = nil; }
|
-(void)dealloc { animationTimer = nil; }
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
## How to Build
|
## How to Build
|
||||||
|
|
||||||
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
|
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
|
||||||
|
|
||||||
- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
|
|
||||||
|
|
||||||
- You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
|
- You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
|
||||||
|
- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
|
||||||
- Then build using `make` while in the `example_emscripten_opengl3/` directory.
|
- Then build using `make` while in the `example_emscripten_opengl3/` directory.
|
||||||
|
|
||||||
## How to Run
|
## How to Run
|
||||||
@ -18,7 +15,6 @@ _"Unfortunately several browsers (including Chrome, Safari, and Internet Explore
|
|||||||
- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
|
- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
|
||||||
- You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
|
- You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
|
||||||
- You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
|
- You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
|
||||||
- If you are accessing the files over a network, certain browsers, such as Firefox, will restrict Gamepad API access to secure contexts only (e.g. https only).
|
|
||||||
|
|
||||||
## Obsolete features:
|
## Obsolete features:
|
||||||
|
|
||||||
|
@ -1,24 +1,10 @@
|
|||||||
## How to Build
|
|
||||||
|
# How to Build
|
||||||
|
|
||||||
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
|
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
|
||||||
|
|
||||||
- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
|
- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
|
||||||
|
|
||||||
- You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
|
|
||||||
|
|
||||||
- Then build using `make` while in the `example_emscripten_wgpu/` directory.
|
- Then build using `make` while in the `example_emscripten_wgpu/` directory.
|
||||||
|
|
||||||
- Requires recent Emscripten as WGPU is still a work-in-progress API.
|
- Requires Emscripten 2.0.10 (December 2020) due to GLFW adaptations
|
||||||
|
|
||||||
## How to Run
|
|
||||||
|
|
||||||
To run on a local machine:
|
|
||||||
- Make sure your browse supports WGPU and it is enabled. WGPU is still WIP not enabled by default in most browser.
|
|
||||||
- `make serve` will use Python3 to spawn a local webserver, you can then browse http://localhost:8000 to access your build.
|
|
||||||
- Otherwise, generally you will need a local webserver:
|
|
||||||
- Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):<br>
|
|
||||||
_"Unfortunately several browsers (including Chrome, Safari, and Internet Explorer) do not support file:// [XHR](https://emscripten.org/docs/site/glossary.html#term-xhr) requests, and can’t load extra files needed by the HTML (like a .wasm file, or packaged file data as mentioned lower down). For these browsers you’ll need to serve the files using a [local webserver](https://emscripten.org/docs/getting_started/FAQ.html#faq-local-webserver) and then open http://localhost:8000/hello.html."_
|
|
||||||
- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
|
|
||||||
- You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
|
|
||||||
- You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
|
|
||||||
- If you are accessing the files over a network, certain browsers, such as Firefox, will restrict Gamepad API access to secure contexts only (e.g. https only).
|
|
||||||
|
32
examples/example_marmalade/data/app.icf
Normal file
32
examples/example_marmalade/data/app.icf
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# This file is for configuration settings for your
|
||||||
|
# application.
|
||||||
|
#
|
||||||
|
# The syntax is similar to windows .ini files ie
|
||||||
|
#
|
||||||
|
# [GroupName]
|
||||||
|
# Setting = Value
|
||||||
|
#
|
||||||
|
# Which can be read by your application using
|
||||||
|
# e.g s3eConfigGetString("GroupName", "Setting", string)
|
||||||
|
#
|
||||||
|
# All settings must be documented in .config.txt files.
|
||||||
|
# New settings specific to this application should be
|
||||||
|
# documented in app.config.txt
|
||||||
|
#
|
||||||
|
# Some conditional operations are also permitted, see the
|
||||||
|
# S3E documentation for details.
|
||||||
|
|
||||||
|
[S3E]
|
||||||
|
MemSize=6000000
|
||||||
|
MemSizeDebug=6000000
|
||||||
|
DispFixRot=FixedLandscape
|
||||||
|
|
||||||
|
# emulate iphone 5 resolution, change these settings to emulate other display resolution
|
||||||
|
WinWidth=1136
|
||||||
|
WinHeight=640
|
||||||
|
|
||||||
|
[GX]
|
||||||
|
DataCacheSize=131070
|
||||||
|
|
||||||
|
[Util]
|
||||||
|
#MemoryBreakpoint=1282
|
@ -1,63 +1,34 @@
|
|||||||
// Dear ImGui: standalone example application for SDL2 + SDL_Renderer
|
// Dear ImGui: standalone example application for Marmalade
|
||||||
// (SDL is a cross-platform general purpose library for handling windows, inputs, OpenGL/Vulkan/Metal graphics context creation, etc.)
|
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
// Important to understand: SDL_Renderer is an _optional_ component of SDL. We do not recommend you use SDL_Renderer
|
// Copyright (C) 2015 by Giovanni Zito
|
||||||
// because it provide a rather limited API to the end-user. We provide this backend for the sake of completeness.
|
// This file is part of Dear ImGui
|
||||||
// For a multi-platform app consider using e.g. SDL+DirectX on Windows and SDL+OpenGL on Linux/OSX.
|
|
||||||
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
#include "imgui_impl_sdl.h"
|
#include "imgui_impl_marmalade.h"
|
||||||
#include "imgui_impl_sdlrenderer.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
#if !SDL_VERSION_ATLEAST(2,0,17)
|
#include <s3eKeyboard.h>
|
||||||
#error This backend requires SDL 2.0.17+ because of SDL_RenderGeometry() function
|
#include <s3ePointer.h>
|
||||||
#endif
|
#include <IwGx.h>
|
||||||
|
|
||||||
// Main code
|
|
||||||
int main(int, char**)
|
int main(int, char**)
|
||||||
{
|
{
|
||||||
// Setup SDL
|
IwGxInit();
|
||||||
// (Some versions of SDL before <2.0.10 appears to have performance/stalling issues on a minority of Windows systems,
|
|
||||||
// depending on whether SDL_INIT_GAMECONTROLLER is enabled or disabled.. updating to latest version of SDL is recommended!)
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
|
||||||
{
|
|
||||||
printf("Error: %s\n", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup window
|
|
||||||
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
|
|
||||||
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+SDL_Renderer example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
|
|
||||||
|
|
||||||
// Setup SDL_Renderer instance
|
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
|
|
||||||
if (renderer == NULL)
|
|
||||||
{
|
|
||||||
SDL_Log("Error creating SDL_Renderer!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//SDL_RendererInfo info;
|
|
||||||
//SDL_GetRendererInfo(renderer, &info);
|
|
||||||
//SDL_Log("Current SDL_Renderer: %s", info.name);
|
|
||||||
|
|
||||||
// Setup Dear ImGui context
|
// Setup Dear ImGui context
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
// Setup Dear ImGui style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsClassic();
|
//ImGui::StyleColorsClassic();
|
||||||
|
|
||||||
// Setup Platform/Renderer backends
|
// Setup Platform/Renderer backends
|
||||||
ImGui_ImplSDL2_InitForSDLRenderer(window);
|
ImGui_Marmalade_Init(true);
|
||||||
ImGui_ImplSDLRenderer_Init(renderer);
|
|
||||||
|
|
||||||
// Load Fonts
|
// Load Fonts
|
||||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
||||||
@ -80,27 +51,21 @@ int main(int, char**)
|
|||||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
bool done = false;
|
while (true)
|
||||||
while (!done)
|
|
||||||
{
|
{
|
||||||
// Poll and handle events (inputs, window resize, etc.)
|
if (s3eDeviceCheckQuitRequest())
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Poll and handle inputs
|
||||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
||||||
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
|
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
|
||||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
SDL_Event event;
|
s3eKeyboardUpdate();
|
||||||
while (SDL_PollEvent(&event))
|
s3ePointerUpdate();
|
||||||
{
|
|
||||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
|
||||||
if (event.type == SDL_QUIT)
|
|
||||||
done = true;
|
|
||||||
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the Dear ImGui frame
|
// Start the Dear ImGui frame
|
||||||
ImGui_ImplSDLRenderer_NewFrame();
|
ImGui_Marmalade_NewFrame();
|
||||||
ImGui_ImplSDL2_NewFrame(window);
|
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
|
|
||||||
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
||||||
@ -142,20 +107,18 @@ int main(int, char**)
|
|||||||
|
|
||||||
// Rendering
|
// Rendering
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
SDL_SetRenderDrawColor(renderer, (Uint8)(clear_color.x * 255), (Uint8)(clear_color.y * 255), (Uint8)(clear_color.z * 255), (Uint8)(clear_color.w * 255));
|
IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
|
||||||
SDL_RenderClear(renderer);
|
IwGxClear();
|
||||||
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
|
ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData());
|
||||||
SDL_RenderPresent(renderer);
|
IwGxSwapBuffers();
|
||||||
|
|
||||||
|
s3eDeviceYield(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
ImGui_ImplSDLRenderer_Shutdown();
|
ImGui_Marmalade_Shutdown();
|
||||||
ImGui_ImplSDL2_Shutdown();
|
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
|
IwGxTerminate();
|
||||||
SDL_DestroyRenderer(renderer);
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
SDL_Quit();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
47
examples/example_marmalade/marmalade_example.mkb
Normal file
47
examples/example_marmalade/marmalade_example.mkb
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env mkb
|
||||||
|
|
||||||
|
# ImGui - standalone example application for Marmalade
|
||||||
|
# Copyright (C) 2015 by Giovanni Zito
|
||||||
|
# This file is part of ImGui
|
||||||
|
# https://github.com/ocornut/imgui
|
||||||
|
|
||||||
|
define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
||||||
|
define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
|
||||||
|
define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
|
||||||
|
define _snprintf=snprintf
|
||||||
|
|
||||||
|
options
|
||||||
|
{
|
||||||
|
optimise-speed=1
|
||||||
|
}
|
||||||
|
|
||||||
|
includepaths
|
||||||
|
{
|
||||||
|
../..
|
||||||
|
../../backends
|
||||||
|
}
|
||||||
|
|
||||||
|
subprojects
|
||||||
|
{
|
||||||
|
iwgx
|
||||||
|
}
|
||||||
|
|
||||||
|
files
|
||||||
|
{
|
||||||
|
(.)
|
||||||
|
["imgui"]
|
||||||
|
../../imgui.cpp
|
||||||
|
../../imgui_demo.cpp
|
||||||
|
../../imgui_draw.cpp
|
||||||
|
../../imgui_tables.cpp
|
||||||
|
../../imgui_widgets.cpp
|
||||||
|
../../imconfig.h
|
||||||
|
../../imgui.h
|
||||||
|
../../imgui_internal.h
|
||||||
|
|
||||||
|
["imgui","Marmalade backend"]
|
||||||
|
../../backends/imgui_impl_marmalade.h
|
||||||
|
../../backends/imgui_impl_marmalade.cpp
|
||||||
|
main.cpp
|
||||||
|
|
||||||
|
}
|
@ -8,10 +8,9 @@
|
|||||||
#include "imgui_impl_opengl3.h"
|
#include "imgui_impl_opengl3.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
#include <SDL_opengl.h>
|
||||||
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
#if defined(IMGUI_IMPL_OPENGL_ES2)
|
||||||
#include <SDL_opengles2.h>
|
#include <SDL_opengles2.h>
|
||||||
#else
|
|
||||||
#include <SDL_opengl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Main code
|
// Main code
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
#
|
|
||||||
# Cross Platform Makefile
|
|
||||||
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
|
|
||||||
#
|
|
||||||
# You will need SDL2 (http://www.libsdl.org):
|
|
||||||
# Linux:
|
|
||||||
# apt-get install libsdl2-dev
|
|
||||||
# Mac OS X:
|
|
||||||
# brew install sdl2
|
|
||||||
# MSYS2:
|
|
||||||
# pacman -S mingw-w64-i686-SDL2
|
|
||||||
#
|
|
||||||
|
|
||||||
#CXX = g++
|
|
||||||
#CXX = clang++
|
|
||||||
|
|
||||||
EXE = example_sdl_sdlrenderer
|
|
||||||
IMGUI_DIR = ../..
|
|
||||||
SOURCES = main.cpp
|
|
||||||
SOURCES += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp
|
|
||||||
SOURCES += $(IMGUI_DIR)/backends/imgui_impl_sdl.cpp $(IMGUI_DIR)/backends/imgui_impl_sdlrenderer.cpp
|
|
||||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
|
||||||
UNAME_S := $(shell uname -s)
|
|
||||||
|
|
||||||
CXXFLAGS = -I$(IMGUI_DIR) -I$(IMGUI_DIR)/backends
|
|
||||||
CXXFLAGS += -g -Wall -Wformat
|
|
||||||
LIBS =
|
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
|
||||||
## BUILD FLAGS PER PLATFORM
|
|
||||||
##---------------------------------------------------------------------
|
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Linux) #LINUX
|
|
||||||
ECHO_MESSAGE = "Linux"
|
|
||||||
LIBS += -lGL -ldl `sdl2-config --libs`
|
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags`
|
|
||||||
CFLAGS = $(CXXFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
|
||||||
ECHO_MESSAGE = "Mac OS X"
|
|
||||||
LIBS += -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo `sdl2-config --libs`
|
|
||||||
LIBS += -L/usr/local/lib -L/opt/local/lib
|
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags`
|
|
||||||
CXXFLAGS += -I/usr/local/include -I/opt/local/include
|
|
||||||
CFLAGS = $(CXXFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS), Windows_NT)
|
|
||||||
ECHO_MESSAGE = "MinGW"
|
|
||||||
LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2`
|
|
||||||
|
|
||||||
CXXFLAGS += `pkg-config --cflags sdl2`
|
|
||||||
CFLAGS = $(CXXFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
##---------------------------------------------------------------------
|
|
||||||
## BUILD RULES
|
|
||||||
##---------------------------------------------------------------------
|
|
||||||
|
|
||||||
%.o:%.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
%.o:$(IMGUI_DIR)/%.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
%.o:$(IMGUI_DIR)/backends/%.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
all: $(EXE)
|
|
||||||
@echo Build complete for $(ECHO_MESSAGE)
|
|
||||||
|
|
||||||
$(EXE): $(OBJS)
|
|
||||||
$(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(EXE) $(OBJS)
|
|
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
# How to Build
|
|
||||||
|
|
||||||
- On Windows with Visual Studio's CLI
|
|
||||||
|
|
||||||
```
|
|
||||||
set SDL2_DIR=path_to_your_sdl2_folder
|
|
||||||
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib /subsystem:console
|
|
||||||
# ^^ include paths ^^ source files ^^ output exe ^^ output dir ^^ libraries
|
|
||||||
# or for 64-bit:
|
|
||||||
cl /Zi /MD /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp /FeDebug/example_sdl_sdlrenderer.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib /subsystem:console
|
|
||||||
```
|
|
||||||
|
|
||||||
- On Linux and similar Unixes
|
|
||||||
|
|
||||||
```
|
|
||||||
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_sdlrenderer.cpp ../../imgui*.cpp `sdl2-config --libs` -lGL
|
|
||||||
```
|
|
||||||
|
|
||||||
- On Mac OS X
|
|
||||||
|
|
||||||
```
|
|
||||||
brew install sdl2
|
|
||||||
c++ `sdl2-config --cflags` -I .. -I ../.. main.cpp ../../backends/imgui_impl_sdl.cpp ../../backends/imgui_impl_sdlrenderer.cpp ../../imgui*.cpp `sdl2-config --libs` -framework OpenGl
|
|
||||||
```
|
|
@ -1,8 +0,0 @@
|
|||||||
@REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler.
|
|
||||||
@set OUT_DIR=Debug
|
|
||||||
@set OUT_EXE=example_sdl_sdlrenderer_
|
|
||||||
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
|
|
||||||
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl.cpp ..\..\backends\imgui_impl_sdlrenderer.cpp ..\..\imgui*.cpp
|
|
||||||
@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib
|
|
||||||
mkdir %OUT_DIR%
|
|
||||||
cl /nologo /Zi /MD %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
|
|
@ -1,181 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{2AE17FDE-F7F3-4CAC-ADAB-0710EDA4F741}</ProjectGuid>
|
|
||||||
<RootNamespace>example_sdl_sdlrenderer</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
|
||||||
<IncludePath>$(IncludePath)</IncludePath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
|
||||||
<IncludePath>$(IncludePath)</IncludePath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
|
||||||
<IncludePath>$(IncludePath)</IncludePath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<OutDir>$(ProjectDir)$(Configuration)\</OutDir>
|
|
||||||
<IntDir>$(ProjectDir)$(Configuration)\</IntDir>
|
|
||||||
<IncludePath>$(IncludePath)</IncludePath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalLibraryDirectories>%SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalLibraryDirectories>%SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<AdditionalLibraryDirectories>%SDL2_DIR%\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<IgnoreSpecificDefaultLibraries>
|
|
||||||
</IgnoreSpecificDefaultLibraries>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<AdditionalIncludeDirectories>..\..;..\..\backends;%SDL2_DIR%\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<AdditionalLibraryDirectories>%SDL2_DIR%\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<AdditionalDependencies>SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<IgnoreSpecificDefaultLibraries>
|
|
||||||
</IgnoreSpecificDefaultLibraries>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\..\imgui.cpp" />
|
|
||||||
<ClCompile Include="..\..\imgui_demo.cpp" />
|
|
||||||
<ClCompile Include="..\..\imgui_draw.cpp" />
|
|
||||||
<ClCompile Include="..\..\imgui_tables.cpp" />
|
|
||||||
<ClCompile Include="..\..\imgui_widgets.cpp" />
|
|
||||||
<ClCompile Include="..\..\backends\imgui_impl_sdlrenderer.cpp" />
|
|
||||||
<ClCompile Include="..\..\backends\imgui_impl_sdl.cpp" />
|
|
||||||
<ClCompile Include="main.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\imconfig.h" />
|
|
||||||
<ClInclude Include="..\..\imgui.h" />
|
|
||||||
<ClInclude Include="..\..\imgui_internal.h" />
|
|
||||||
<ClInclude Include="..\..\backends\imgui_impl_sdlrenderer.h" />
|
|
||||||
<ClInclude Include="..\..\backends\imgui_impl_sdl.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\misc\debuggers\imgui.natvis" />
|
|
||||||
<None Include="..\README.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
@ -1,61 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="imgui">
|
|
||||||
<UniqueIdentifier>{20b90ce4-7fcb-4731-b9a0-075f875de82d}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="sources">
|
|
||||||
<UniqueIdentifier>{f18ab499-84e1-499f-8eff-9754361e0e52}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\..\imgui.cpp">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\imgui_demo.cpp">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\imgui_draw.cpp">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="main.cpp">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\imgui_tables.cpp">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\imgui_widgets.cpp">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\backends\imgui_impl_sdl.cpp">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\backends\imgui_impl_sdlrenderer.cpp">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\..\imconfig.h">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\imgui.h">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\imgui_internal.h">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\backends\imgui_impl_sdlrenderer.h">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\backends\imgui_impl_sdl.h">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\README.txt" />
|
|
||||||
<None Include="..\..\misc\debuggers\imgui.natvis">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -9,13 +9,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx10", "
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx11", "example_win32_directx11\example_win32_directx11.vcxproj", "{9F316E83-5AE5-4939-A723-305A94F48005}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx11", "example_win32_directx11\example_win32_directx11.vcxproj", "{9F316E83-5AE5-4939-A723-305A94F48005}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx12", "example_win32_directx12\example_win32_directx12.vcxproj", "{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl2", "example_glfw_opengl2\example_glfw_opengl2.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl2", "example_glfw_opengl2\example_glfw_opengl2.vcxproj", "{9CDA7840-B7A5-496D-A527-E95571496D18}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl3", "example_glfw_opengl3\example_glfw_opengl3.vcxproj", "{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_opengl3", "example_glfw_opengl3\example_glfw_opengl3.vcxproj", "{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_glfw_vulkan", "example_glfw_vulkan\example_glfw_vulkan.vcxproj", "{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_directx12", "example_win32_directx12\example_win32_directx12.vcxproj", "{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -49,14 +47,6 @@ Global
|
|||||||
{9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.Build.0 = Release|Win32
|
{9F316E83-5AE5-4939-A723-305A94F48005}.Release|Win32.Build.0 = Release|Win32
|
||||||
{9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.ActiveCfg = Release|x64
|
{9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.ActiveCfg = Release|x64
|
||||||
{9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.Build.0 = Release|x64
|
{9F316E83-5AE5-4939-A723-305A94F48005}.Release|x64.Build.0 = Release|x64
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|x64.Build.0 = Release|x64
|
|
||||||
{9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.ActiveCfg = Debug|Win32
|
{9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.Build.0 = Debug|Win32
|
{9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.ActiveCfg = Debug|x64
|
{9CDA7840-B7A5-496D-A527-E95571496D18}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
@ -73,14 +63,14 @@ Global
|
|||||||
{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.Build.0 = Release|Win32
|
{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|Win32.Build.0 = Release|Win32
|
||||||
{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.ActiveCfg = Release|x64
|
{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.ActiveCfg = Release|x64
|
||||||
{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.Build.0 = Release|x64
|
{4A1FB5EA-22F5-42A8-AB92-1D2DF5D47FB9}.Release|x64.Build.0 = Release|x64
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Debug|Win32.ActiveCfg = Debug|Win32
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Debug|Win32.Build.0 = Debug|Win32
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Debug|x64.ActiveCfg = Debug|x64
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Debug|x64.Build.0 = Debug|x64
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Debug|x64.Build.0 = Debug|x64
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Release|Win32.ActiveCfg = Release|Win32
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Release|Win32.Build.0 = Release|Win32
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|Win32.Build.0 = Release|Win32
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Release|x64.ActiveCfg = Release|x64
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|x64.ActiveCfg = Release|x64
|
||||||
{57E2DF5A-6FC8-45BB-99DD-91A18C646E80}.Release|x64.Build.0 = Release|x64
|
{B4CF9797-519D-4AFE-A8F4-5141A6B521D3}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
|
// It is very strongly recommended to NOT disable the demo windows during development. Please read comments in imgui_demo.cpp.
|
||||||
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
//#define IMGUI_DISABLE // Disable everything: all headers and source files will be empty.
|
||||||
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
|
//#define IMGUI_DISABLE_DEMO_WINDOWS // Disable demo windows: ShowDemoWindow()/ShowStyleEditor() will be empty. Not recommended.
|
||||||
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger and other debug tools: ShowMetricsWindow() and ShowStackToolWindow() will be empty.
|
//#define IMGUI_DISABLE_METRICS_WINDOW // Disable metrics/debugger window: ShowMetricsWindow() will be empty.
|
||||||
|
|
||||||
//---- Don't implement some functions to reduce linkage requirements.
|
//---- Don't implement some functions to reduce linkage requirements.
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc. (user32.lib/.a, kernel32.lib/.a)
|
||||||
|
184
imgui.h
184
imgui.h
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86
|
// dear imgui, v1.84b
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@ -15,10 +15,7 @@
|
|||||||
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
// - Wiki https://github.com/ocornut/imgui/wiki (lots of good stuff there)
|
||||||
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
// - Glossary https://github.com/ocornut/imgui/wiki/Glossary
|
||||||
// - Issues & support https://github.com/ocornut/imgui/issues
|
// - Issues & support https://github.com/ocornut/imgui/issues
|
||||||
|
// - Discussions https://github.com/ocornut/imgui/discussions
|
||||||
// Getting Started?
|
|
||||||
// - For first-time users having issues compiling/linking/running or issues loading fonts:
|
|
||||||
// please post in https://github.com/ocornut/imgui/discussions if you cannot find a solution in resources above.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ -63,8 +60,8 @@ Index of this file:
|
|||||||
|
|
||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.86"
|
#define IMGUI_VERSION "1.84b"
|
||||||
#define IMGUI_VERSION_NUM 18600
|
#define IMGUI_VERSION_NUM 18402
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
@ -92,7 +89,7 @@ Index of this file:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
// Helper Macros - IM_FMTARGS, IM_FMTLIST: Apply printf-style warnings to our formatting functions.
|
||||||
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
|
#if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__)
|
||||||
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
#define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
|
||||||
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
#define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
|
||||||
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
|
#elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
|
||||||
@ -152,7 +149,7 @@ struct ImGuiContext; // Dear ImGui context (opaque structure, unl
|
|||||||
struct ImGuiIO; // Main configuration and I/O between your application and ImGui
|
struct ImGuiIO; // Main configuration and I/O between your application and ImGui
|
||||||
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use)
|
struct ImGuiInputTextCallbackData; // Shared state of InputText() when using custom ImGuiInputTextCallback (rare/advanced use)
|
||||||
struct ImGuiListClipper; // Helper to manually clip large list of items
|
struct ImGuiListClipper; // Helper to manually clip large list of items
|
||||||
struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame
|
struct ImGuiOnceUponAFrame; // Helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro
|
||||||
struct ImGuiPayload; // User data payload for drag and drop operations
|
struct ImGuiPayload; // User data payload for drag and drop operations
|
||||||
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
|
struct ImGuiSizeCallbackData; // Callback data when using SetNextWindowSizeConstraints() (rare/advanced use)
|
||||||
struct ImGuiStorage; // Helper for key->value storage
|
struct ImGuiStorage; // Helper for key->value storage
|
||||||
@ -163,7 +160,7 @@ struct ImGuiTextBuffer; // Helper to hold and append into a text buf
|
|||||||
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
|
struct ImGuiTextFilter; // Helper to parse and apply text filters (e.g. "aaaaa[,bbbbb][,ccccc]")
|
||||||
struct ImGuiViewport; // A Platform Window (always only one in 'master' branch), in the future may represent Platform Monitor
|
struct ImGuiViewport; // A Platform Window (always only one in 'master' branch), in the future may represent Platform Monitor
|
||||||
|
|
||||||
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags without overhead, and to not pollute the top of this file)
|
// Enums/Flags (declared as int for compatibility with old C++, to allow using as flags and to not pollute the top of this file)
|
||||||
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
// - Tip: Use your programming IDE navigation facilities on the names in the _central column_ below to find the actual flags/enum lists!
|
||||||
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
// In Visual Studio IDE: CTRL+comma ("Edit.NavigateTo") can follow symbols in comments, whereas CTRL+F12 ("Edit.GoToImplementation") cannot.
|
||||||
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
// With Visual Assist installed: ALT+G ("VAssistX.GoToImplementation") can also follow symbols in comments.
|
||||||
@ -203,22 +200,27 @@ typedef int ImGuiTreeNodeFlags; // -> enum ImGuiTreeNodeFlags_ // Flags: f
|
|||||||
typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport
|
typedef int ImGuiViewportFlags; // -> enum ImGuiViewportFlags_ // Flags: for ImGuiViewport
|
||||||
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
|
typedef int ImGuiWindowFlags; // -> enum ImGuiWindowFlags_ // Flags: for Begin(), BeginChild()
|
||||||
|
|
||||||
// ImTexture: user data for renderer backend to identify a texture [Compile-time configurable type]
|
// Other types
|
||||||
// - To use something else than an opaque void* pointer: override with e.g. '#define ImTextureID MyTextureType*' in your imconfig.h file.
|
#ifndef ImTextureID // ImTextureID [configurable type: override in imconfig.h with '#define ImTextureID xxx']
|
||||||
// - This can be whatever to you want it to be! read the FAQ about ImTextureID for details.
|
typedef void* ImTextureID; // User data for rendering backend to identify a texture. This is whatever to you want it to be! read the FAQ about ImTextureID for details.
|
||||||
#ifndef ImTextureID
|
#endif
|
||||||
typedef void* ImTextureID; // Default: store a pointer or an integer fitting in a pointer (most renderer backends are ok with that)
|
typedef unsigned int ImGuiID; // A unique ID used by widgets, typically hashed from a stack of string.
|
||||||
|
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
||||||
|
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
||||||
|
typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
||||||
|
typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
||||||
|
|
||||||
|
// Character types
|
||||||
|
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
||||||
|
typedef unsigned short ImWchar16; // A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
||||||
|
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
||||||
|
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
|
||||||
|
typedef ImWchar32 ImWchar;
|
||||||
|
#else
|
||||||
|
typedef ImWchar16 ImWchar;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ImDrawIdx: vertex index. [Compile-time configurable type]
|
// Basic scalar data types
|
||||||
// - To use 16-bit indices + allow large meshes: backend need to set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset (recommended).
|
|
||||||
// - To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in your imconfig.h file.
|
|
||||||
#ifndef ImDrawIdx
|
|
||||||
typedef unsigned short ImDrawIdx; // Default: 16-bit (for maximum compatibility with renderer backends)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Scalar data types
|
|
||||||
typedef unsigned int ImGuiID;// A unique ID used by widgets (typically the result of hashing a stack of string)
|
|
||||||
typedef signed char ImS8; // 8-bit signed integer
|
typedef signed char ImS8; // 8-bit signed integer
|
||||||
typedef unsigned char ImU8; // 8-bit unsigned integer
|
typedef unsigned char ImU8; // 8-bit unsigned integer
|
||||||
typedef signed short ImS16; // 16-bit signed integer
|
typedef signed short ImS16; // 16-bit signed integer
|
||||||
@ -237,24 +239,7 @@ typedef signed long long ImS64; // 64-bit signed integer (post C++11)
|
|||||||
typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11)
|
typedef unsigned long long ImU64; // 64-bit unsigned integer (post C++11)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Character types
|
// 2D vector (often used to store positions or sizes)
|
||||||
// (we generally use UTF-8 encoded string in the API. This is storage specifically for a decoded character used for keyboard input and display)
|
|
||||||
typedef unsigned short ImWchar16; // A single decoded U16 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
|
||||||
typedef unsigned int ImWchar32; // A single decoded U32 character/code point. We encode them as multi bytes UTF-8 when used in strings.
|
|
||||||
#ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
|
|
||||||
typedef ImWchar32 ImWchar;
|
|
||||||
#else
|
|
||||||
typedef ImWchar16 ImWchar;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Callback and functions types
|
|
||||||
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData* data); // Callback function for ImGui::InputText()
|
|
||||||
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data); // Callback function for ImGui::SetNextWindowSizeConstraints()
|
|
||||||
typedef void* (*ImGuiMemAllocFunc)(size_t sz, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
|
||||||
typedef void (*ImGuiMemFreeFunc)(void* ptr, void* user_data); // Function signature for ImGui::SetAllocatorFunctions()
|
|
||||||
|
|
||||||
// ImVec2: 2D vector used to store positions, sizes etc. [Compile-time configurable type]
|
|
||||||
// This is a frequently used type in the API. Consider using IM_VEC2_CLASS_EXTRA to create implicit cast from/to our preferred type.
|
|
||||||
IM_MSVC_RUNTIME_CHECKS_OFF
|
IM_MSVC_RUNTIME_CHECKS_OFF
|
||||||
struct ImVec2
|
struct ImVec2
|
||||||
{
|
{
|
||||||
@ -268,7 +253,7 @@ struct ImVec2
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// ImVec4: 4D vector used to store clipping rectangles, colors etc. [Compile-time configurable type]
|
// 4D vector (often used to store floating-point colors)
|
||||||
struct ImVec4
|
struct ImVec4
|
||||||
{
|
{
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
@ -307,7 +292,6 @@ namespace ImGui
|
|||||||
// Demo, Debug, Information
|
// Demo, Debug, Information
|
||||||
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
|
||||||
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
IMGUI_API void ShowMetricsWindow(bool* p_open = NULL); // create Metrics/Debugger window. display Dear ImGui internals: windows, draw commands, various internal state, etc.
|
||||||
IMGUI_API void ShowStackToolWindow(bool* p_open = NULL); // create Stack Tool window. hover items with mouse to query information about the source of their unique ID.
|
|
||||||
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
IMGUI_API void ShowAboutWindow(bool* p_open = NULL); // create About window. display Dear ImGui version, credits and build/system information.
|
||||||
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)
|
||||||
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
IMGUI_API bool ShowStyleSelector(const char* label); // add style selector block (not a window), essentially a combo listing the default styles.
|
||||||
@ -383,8 +367,9 @@ namespace ImGui
|
|||||||
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
// - Those functions are bound to be redesigned (they are confusing, incomplete and the Min/Max return values are in local window coordinates which increases confusion)
|
||||||
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
IMGUI_API ImVec2 GetContentRegionAvail(); // == GetContentRegionMax() - GetCursorPos()
|
||||||
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
IMGUI_API ImVec2 GetContentRegionMax(); // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min for the full window (roughly (0,0)-Scroll), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // content boundaries min (roughly (0,0)-Scroll), in window coordinates
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max for the full window (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
IMGUI_API ImVec2 GetWindowContentRegionMax(); // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates
|
||||||
|
IMGUI_API float GetWindowContentRegionWidth(); //
|
||||||
|
|
||||||
// Windows Scrolling
|
// Windows Scrolling
|
||||||
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
IMGUI_API float GetScrollX(); // get scrolling amount [0 .. GetScrollMaxX()]
|
||||||
@ -523,12 +508,12 @@ namespace ImGui
|
|||||||
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
IMGUI_API bool Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);
|
||||||
|
|
||||||
// Widgets: Drag Sliders
|
// Widgets: Drag Sliders
|
||||||
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
||||||
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||||
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits if ImGuiSliderFlags_AlwaysClamp is not used.
|
// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
|
||||||
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
|
||||||
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
|
||||||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
@ -547,7 +532,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragScalarN(const char* label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Regular Sliders
|
// Widgets: Regular Sliders
|
||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
|
||||||
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
|
||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
@ -633,7 +618,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
||||||
|
|
||||||
// Widgets: Data Plotting
|
// Widgets: Data Plotting
|
||||||
// - Consider using ImPlot (https://github.com/epezent/implot) which is much better!
|
// - Consider using ImPlot (https://github.com/epezent/implot)
|
||||||
IMGUI_API void PlotLines(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), int stride = sizeof(float));
|
IMGUI_API void PlotLines(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), int stride = sizeof(float));
|
||||||
IMGUI_API void PlotLines(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 PlotLines(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, 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), int 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), int stride = sizeof(float));
|
||||||
@ -816,7 +801,6 @@ namespace ImGui
|
|||||||
|
|
||||||
// Disabling [BETA API]
|
// Disabling [BETA API]
|
||||||
// - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
|
// - Disable all user interactions and dim items visuals (applying style.DisabledAlpha over current colors)
|
||||||
// - Those can be nested but it cannot be used to enable an already disabled section (a single BeginDisabled(true) in the stack is enough to keep everything disabled)
|
|
||||||
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
|
// - BeginDisabled(false) essentially does nothing useful but is provided to facilitate use of boolean expressions. If you can avoid calling BeginDisabled(False)/EndDisabled() best to avoid it.
|
||||||
IMGUI_API void BeginDisabled(bool disabled = true);
|
IMGUI_API void BeginDisabled(bool disabled = true);
|
||||||
IMGUI_API void EndDisabled();
|
IMGUI_API void EndDisabled();
|
||||||
@ -869,6 +853,7 @@ namespace ImGui
|
|||||||
IMGUI_API const char* GetStyleColorName(ImGuiCol idx); // get a string corresponding to the enum value (for display, saving, etc.).
|
IMGUI_API const char* GetStyleColorName(ImGuiCol idx); // get a string corresponding to the enum value (for display, saving, etc.).
|
||||||
IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
IMGUI_API void SetStateStorage(ImGuiStorage* storage); // replace current window storage with our own (if you want to manipulate it yourself, typically clear subsection of it)
|
||||||
IMGUI_API ImGuiStorage* GetStateStorage();
|
IMGUI_API ImGuiStorage* GetStateStorage();
|
||||||
|
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 bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame
|
IMGUI_API bool BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame
|
||||||
IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
|
IMGUI_API void EndChildFrame(); // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)
|
||||||
|
|
||||||
@ -896,10 +881,9 @@ namespace ImGui
|
|||||||
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
// - You can also use regular integer: it is forever guaranteed that 0=Left, 1=Right, 2=Middle.
|
||||||
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
// - Dragging operations are only reported after mouse has moved a certain distance away from the initial clicking position (see 'lock_threshold' and 'io.MouseDraggingThreshold')
|
||||||
IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held?
|
IMGUI_API bool IsMouseDown(ImGuiMouseButton button); // is mouse button held?
|
||||||
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down). Same as GetMouseClickedCount() == 1.
|
IMGUI_API bool IsMouseClicked(ImGuiMouseButton button, bool repeat = false); // did mouse button clicked? (went from !Down to Down)
|
||||||
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down)
|
IMGUI_API bool IsMouseReleased(ImGuiMouseButton button); // did mouse button released? (went from Down to !Down)
|
||||||
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? Same as GetMouseClickedCount() == 2. (note that a double-click will also report IsMouseClicked() == true)
|
IMGUI_API bool IsMouseDoubleClicked(ImGuiMouseButton button); // did mouse button double-clicked? (note that a double-click will also report IsMouseClicked() == true)
|
||||||
IMGUI_API int GetMouseClickedCount(ImGuiMouseButton button); // return the number of successive mouse-clicks at the time where a click happen (otherwise 0).
|
|
||||||
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
|
IMGUI_API bool IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);// is mouse hovering given bounding rect (in screen space). clipped by current clipping settings, but disregarding of other consideration of focus/window ordering/popup-block.
|
||||||
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
|
IMGUI_API bool IsMousePosValid(const ImVec2* mouse_pos = NULL); // by convention we use (-FLT_MAX,-FLT_MAX) to denote that there is no mouse available
|
||||||
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held?
|
IMGUI_API bool IsAnyMouseDown(); // is any mouse button held?
|
||||||
@ -954,7 +938,7 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window
|
ImGuiWindowFlags_NoMove = 1 << 2, // Disable user moving the window
|
||||||
ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programmatically)
|
ImGuiWindowFlags_NoScrollbar = 1 << 3, // Disable scrollbars (window can still scroll with mouse or programmatically)
|
||||||
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
ImGuiWindowFlags_NoScrollWithMouse = 1 << 4, // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.
|
||||||
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it. Also referred to as Window Menu Button (e.g. within a docking node).
|
ImGuiWindowFlags_NoCollapse = 1 << 5, // Disable user collapsing window by double-clicking on it
|
||||||
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_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
|
ImGuiWindowFlags_NoBackground = 1 << 7, // Disable drawing background color (WindowBg, etc.) and outside border. Similar as using SetNextWindowBgAlpha(0.0f).
|
||||||
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
ImGuiWindowFlags_NoSavedSettings = 1 << 8, // Never load/save settings in .ini file
|
||||||
@ -974,7 +958,7 @@ enum ImGuiWindowFlags_
|
|||||||
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,
|
||||||
|
|
||||||
// [Internal]
|
// [Internal]
|
||||||
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] On child window: allow gamepad/keyboard navigation to cross over parent border to this child or between sibling child windows.
|
ImGuiWindowFlags_NavFlattened = 1 << 23, // [BETA] Allow gamepad/keyboard navigation to cross over parent border to this child (only use on child that have no scrolling!)
|
||||||
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()
|
ImGuiWindowFlags_ChildWindow = 1 << 24, // Don't use! For internal use by BeginChild()
|
||||||
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()
|
ImGuiWindowFlags_Tooltip = 1 << 25, // Don't use! For internal use by BeginTooltip()
|
||||||
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
ImGuiWindowFlags_Popup = 1 << 26, // Don't use! For internal use by BeginPopup()
|
||||||
@ -1265,11 +1249,9 @@ enum ImGuiTableBgTarget_
|
|||||||
enum ImGuiFocusedFlags_
|
enum ImGuiFocusedFlags_
|
||||||
{
|
{
|
||||||
ImGuiFocusedFlags_None = 0,
|
ImGuiFocusedFlags_None = 0,
|
||||||
ImGuiFocusedFlags_ChildWindows = 1 << 0, // Return true if any children of the window is focused
|
ImGuiFocusedFlags_ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
|
||||||
ImGuiFocusedFlags_RootWindow = 1 << 1, // Test from root window (top most parent of the current hierarchy)
|
ImGuiFocusedFlags_RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiFocusedFlags_AnyWindow = 1 << 2, // Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
ImGuiFocusedFlags_AnyWindow = 1 << 2, // IsWindowFocused(): Return true if any window is focused. Important: If you are trying to tell how to dispatch your low-level inputs, do NOT use this. Use 'io.WantCaptureMouse' instead! Please read the FAQ!
|
||||||
ImGuiFocusedFlags_NoPopupHierarchy = 1 << 3, // Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
|
||||||
//ImGuiFocusedFlags_DockHierarchy = 1 << 4, // Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
|
||||||
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
ImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1282,13 +1264,11 @@ enum ImGuiHoveredFlags_
|
|||||||
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
ImGuiHoveredFlags_ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
|
||||||
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
ImGuiHoveredFlags_RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
|
||||||
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
ImGuiHoveredFlags_AnyWindow = 1 << 2, // IsWindowHovered() only: Return true if any window is hovered
|
||||||
ImGuiHoveredFlags_NoPopupHierarchy = 1 << 3, // IsWindowHovered() only: Do not consider popup hierarchy (do not treat popup emitter as parent of popup) (when used with _ChildWindows or _RootWindow)
|
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3, // Return true even if a popup window is normally blocking access to this item/window
|
||||||
//ImGuiHoveredFlags_DockHierarchy = 1 << 4, // IsWindowHovered() only: Consider docking hierarchy (treat dockspace host as parent of docked window) (when used with _ChildWindows or _RootWindow)
|
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 4, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 5, // Return true even if a popup window is normally blocking access to this item/window
|
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
||||||
//ImGuiHoveredFlags_AllowWhenBlockedByModal = 1 << 6, // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.
|
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6, // Return true even if the position is obstructed or overlapped by another window
|
||||||
ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 7, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
|
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 7, // Return true even if the item is disabled
|
||||||
ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 8, // IsItemHovered() only: Return true even if the position is obstructed or overlapped by another window
|
|
||||||
ImGuiHoveredFlags_AllowWhenDisabled = 1 << 9, // IsItemHovered() only: Return true even if the item is disabled
|
|
||||||
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,
|
||||||
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows
|
||||||
};
|
};
|
||||||
@ -1742,7 +1722,7 @@ struct ImVector
|
|||||||
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
||||||
inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); }
|
inline void push_front(const T& v) { if (Size == 0) push_back(v); else insert(Data, v); }
|
||||||
inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }
|
inline T* erase(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(T)); Size--; return Data + off; }
|
||||||
inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - (size_t)count) * sizeof(T)); Size -= (int)count; return Data + off; }
|
inline T* erase(const T* it, const T* it_last){ IM_ASSERT(it >= Data && it < Data + Size && it_last > it && it_last <= Data + Size); const ptrdiff_t count = it_last - it; const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + count, ((size_t)Size - (size_t)off - count) * sizeof(T)); Size -= (int)count; return Data + off; }
|
||||||
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
inline T* erase_unsorted(const T* it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; if (it < Data + Size - 1) memcpy(Data + off, Data + Size - 1, sizeof(T)); Size--; return Data + off; }
|
||||||
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
inline T* insert(const T* it, const T& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(T)); memcpy(&Data[off], &v, sizeof(v)); Size++; return Data + off; }
|
||||||
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
inline bool contains(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }
|
||||||
@ -1895,9 +1875,8 @@ struct ImGuiIO
|
|||||||
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
IMGUI_API void AddInputCharacter(unsigned int c); // Queue new character input
|
||||||
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
IMGUI_API void AddInputCharacterUTF16(ImWchar16 c); // Queue new character input from an UTF-16 character, it can be a surrogate
|
||||||
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
IMGUI_API void AddInputCharactersUTF8(const char* str); // Queue new characters input from an UTF-8 string
|
||||||
|
IMGUI_API void ClearInputCharacters(); // Clear the text input buffer manually
|
||||||
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
IMGUI_API void AddFocusEvent(bool focused); // Notifies Dear ImGui when hosting platform windows lose or gain input focus
|
||||||
IMGUI_API void ClearInputCharacters(); // [Internal] Clear the text input buffer manually
|
|
||||||
IMGUI_API void ClearInputKeys(); // [Internal] Release all keys
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Output - Updated by NewFrame() or EndFrame()/Render()
|
// Output - Updated by NewFrame() or EndFrame()/Render()
|
||||||
@ -1924,19 +1903,16 @@ struct ImGuiIO
|
|||||||
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
// [Internal] Dear ImGui will maintain those fields. Forward compatibility not guaranteed!
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
bool WantCaptureMouseUnlessPopupClose;// Alternative to WantCaptureMouse: (WantCaptureMouse == true && WantCaptureMouseUnlessPopupClose == false) when a click over void is expected to close a popup.
|
|
||||||
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
ImGuiKeyModFlags KeyMods; // Key mods flags (same as io.KeyCtrl/KeyShift/KeyAlt/KeySuper but merged into flags), updated by NewFrame()
|
||||||
ImGuiKeyModFlags KeyModsPrev; // Previous key mods
|
ImGuiKeyModFlags KeyModsPrev; // Previous key mods
|
||||||
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
ImVec2 MousePosPrev; // Previous mouse position (note that MouseDelta is not necessary == MousePos-MousePosPrev, in case either position is invalid)
|
||||||
ImVec2 MouseClickedPos[5]; // Position at time of clicking
|
ImVec2 MouseClickedPos[5]; // Position at time of clicking
|
||||||
double MouseClickedTime[5]; // Time of last click (used to figure out double-click)
|
double MouseClickedTime[5]; // Time of last click (used to figure out double-click)
|
||||||
bool MouseClicked[5]; // Mouse button went from !Down to Down (same as MouseClickedCount[x] != 0)
|
bool MouseClicked[5]; // Mouse button went from !Down to Down
|
||||||
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked? (same as MouseClickedCount[x] == 2)
|
bool MouseDoubleClicked[5]; // Has mouse button been double-clicked?
|
||||||
ImU16 MouseClickedCount[5]; // == 0 (not clicked), == 1 (same as MouseClicked[]), == 2 (double-clicked), == 3 (triple-clicked) etc. when going from !Down to Down
|
|
||||||
ImU16 MouseClickedLastCount[5]; // Count successive number of clicks. Stays valid after mouse release. Reset after another click is done.
|
|
||||||
bool MouseReleased[5]; // Mouse button went from Down to !Down
|
bool MouseReleased[5]; // Mouse button went from Down to !Down
|
||||||
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window or over void blocked by a popup. We don't request mouse capture from the application if click started outside ImGui bounds.
|
bool MouseDownOwned[5]; // Track if button was clicked inside a dear imgui window. We don't request mouse capture from the application if click started outside ImGui bounds.
|
||||||
bool MouseDownOwnedUnlessPopupClose[5];//Track if button was clicked inside a dear imgui window.
|
bool MouseDownWasDoubleClick[5]; // Track if button down was a double-click
|
||||||
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
float MouseDownDuration[5]; // Duration the mouse button has been down (0.0f == just clicked)
|
||||||
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
float MouseDownDurationPrev[5]; // Previous time the mouse button has been down
|
||||||
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
ImVec2 MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
|
||||||
@ -1946,7 +1922,6 @@ struct ImGuiIO
|
|||||||
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
float NavInputsDownDuration[ImGuiNavInput_COUNT];
|
||||||
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
float NavInputsDownDurationPrev[ImGuiNavInput_COUNT];
|
||||||
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
float PenPressure; // Touch/Pen pressure (0.0f to 1.0f, should be >0.0f only when MouseDown[0] == true). Helper storage currently unused by Dear ImGui.
|
||||||
bool AppFocusLost;
|
|
||||||
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
ImWchar16 InputQueueSurrogate; // For AddInputCharacterUTF16
|
||||||
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
ImVector<ImWchar> InputQueueCharacters; // Queue of _characters_ input (obtained by platform backend). Fill using AddInputCharacter() helper.
|
||||||
|
|
||||||
@ -2171,12 +2146,10 @@ struct ImGuiStorage
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Helper: Manually clip large list of items.
|
// Helper: Manually clip large list of items.
|
||||||
// If you have lots evenly spaced items and you have a random access to the list, you can perform coarse
|
// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse
|
||||||
// clipping based on visibility to only submit items that are in view.
|
// clipping based on visibility to save yourself from processing those items at all.
|
||||||
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
|
// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped.
|
||||||
// (Dear ImGui already clip items based on their bounds but: it needs to first layout the item to do so, and generally
|
// (Dear ImGui already clip items based on their bounds but it needs to measure text size to do so, whereas manual coarse clipping before submission makes this cost and your own data fetching/submission cost almost null)
|
||||||
// fetching/submitting your own data incurs additional cost. Coarse clipping using ImGuiListClipper allows you to easily
|
|
||||||
// scale using lists with tens of thousands of items without a problem)
|
|
||||||
// Usage:
|
// Usage:
|
||||||
// ImGuiListClipper clipper;
|
// ImGuiListClipper clipper;
|
||||||
// clipper.Begin(1000); // We have 1000 elements, evenly spaced.
|
// clipper.Begin(1000); // We have 1000 elements, evenly spaced.
|
||||||
@ -2185,30 +2158,30 @@ struct ImGuiStorage
|
|||||||
// ImGui::Text("line number %d", i);
|
// ImGui::Text("line number %d", i);
|
||||||
// Generally what happens is:
|
// Generally what happens is:
|
||||||
// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.
|
// - Clipper lets you process the first element (DisplayStart = 0, DisplayEnd = 1) regardless of it being visible or not.
|
||||||
// - User code submit that one element.
|
// - User code submit one element.
|
||||||
// - Clipper can measure the height of the first element
|
// - Clipper can measure the height of the first element
|
||||||
// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.
|
// - Clipper calculate the actual range of elements to display based on the current clipping rectangle, position the cursor before the first visible element.
|
||||||
// - User code submit visible elements.
|
// - User code submit visible elements.
|
||||||
// - The clipper also handles various subtleties related to keyboard/gamepad navigation, wrapping etc.
|
|
||||||
struct ImGuiListClipper
|
struct ImGuiListClipper
|
||||||
{
|
{
|
||||||
int DisplayStart; // First item to display, updated by each call to Step()
|
int DisplayStart;
|
||||||
int DisplayEnd; // End of items to display (exclusive)
|
int DisplayEnd;
|
||||||
int ItemsCount; // [Internal] Number of items
|
|
||||||
float ItemsHeight; // [Internal] Height of item after a first step and item submission can calculate it
|
// [Internal]
|
||||||
float StartPosY; // [Internal] Cursor position at the time of Begin() or after table frozen rows are all processed
|
int ItemsCount;
|
||||||
void* TempData; // [Internal] Internal data
|
int StepNo;
|
||||||
|
int ItemsFrozen;
|
||||||
|
float ItemsHeight;
|
||||||
|
float StartPosY;
|
||||||
|
|
||||||
|
IMGUI_API ImGuiListClipper();
|
||||||
|
IMGUI_API ~ImGuiListClipper();
|
||||||
|
|
||||||
// items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step)
|
// items_count: Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step)
|
||||||
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
|
// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().
|
||||||
IMGUI_API ImGuiListClipper();
|
IMGUI_API void Begin(int items_count, float items_height = -1.0f); // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1.
|
||||||
IMGUI_API ~ImGuiListClipper();
|
IMGUI_API void End(); // Automatically called on the last call of Step() that returns false.
|
||||||
IMGUI_API void Begin(int items_count, float items_height = -1.0f);
|
IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
|
||||||
IMGUI_API void End(); // Automatically called on the last call of Step() that returns false.
|
|
||||||
IMGUI_API bool Step(); // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.
|
|
||||||
|
|
||||||
// Call ForceDisplayRangeByIndices() before first call to Step() if you need a range of items to be displayed regardless of visibility.
|
|
||||||
IMGUI_API void ForceDisplayRangeByIndices(int item_min, int item_max); // item_max is exclusive e.g. use (42, 42+1) to make item 42 always visible BUT due to alignment/padding of certain items it is likely that an extra item may be included on either end of the display range.
|
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]
|
inline ImGuiListClipper(int items_count, float items_height = -1.0f) { memset(this, 0, sizeof(*this)); ItemsCount = -1; Begin(items_count, items_height); } // [removed in 1.79]
|
||||||
@ -2303,6 +2276,13 @@ struct ImDrawCmd
|
|||||||
inline ImTextureID GetTexID() const { return TextureId; }
|
inline ImTextureID GetTexID() const { return TextureId; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Vertex index, default to 16-bit
|
||||||
|
// To allow large meshes with 16-bit indices: set 'io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset' and handle ImDrawCmd::VtxOffset in the renderer backend (recommended).
|
||||||
|
// To use 32-bit indices: override with '#define ImDrawIdx unsigned int' in imconfig.h.
|
||||||
|
#ifndef ImDrawIdx
|
||||||
|
typedef unsigned short ImDrawIdx;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Vertex layout
|
// Vertex layout
|
||||||
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
|
#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
|
||||||
struct ImDrawVert
|
struct ImDrawVert
|
||||||
@ -2831,10 +2811,6 @@ struct ImGuiViewport
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
// OBSOLETED in 1.86 (from November 2021)
|
|
||||||
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 ImGuiListClipper.
|
|
||||||
// OBSOLETED in 1.85 (from August 2021)
|
|
||||||
static inline float GetWindowContentRegionWidth() { return GetWindowContentRegionMax().x - GetWindowContentRegionMin().x; }
|
|
||||||
// OBSOLETED in 1.81 (from February 2021)
|
// OBSOLETED in 1.81 (from February 2021)
|
||||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // Helper to calculate size from items_count and height_in_items
|
||||||
static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }
|
static inline bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0)) { return BeginListBox(label, size); }
|
||||||
|
287
imgui_demo.cpp
287
imgui_demo.cpp
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86
|
// dear imgui, v1.84b
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -473,7 +473,6 @@ void ImDrawList::_PopUnusedDrawCmd()
|
|||||||
|
|
||||||
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
||||||
{
|
{
|
||||||
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
IM_ASSERT(curr_cmd->UserCallback == NULL);
|
IM_ASSERT(curr_cmd->UserCallback == NULL);
|
||||||
if (curr_cmd->ElemCount != 0)
|
if (curr_cmd->ElemCount != 0)
|
||||||
@ -495,7 +494,6 @@ void ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)
|
|||||||
// Try to merge two last draw commands
|
// Try to merge two last draw commands
|
||||||
void ImDrawList::_TryMergeDrawCmds()
|
void ImDrawList::_TryMergeDrawCmds()
|
||||||
{
|
{
|
||||||
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
ImDrawCmd* prev_cmd = curr_cmd - 1;
|
||||||
if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL)
|
if (ImDrawCmd_HeaderCompare(curr_cmd, prev_cmd) == 0 && curr_cmd->UserCallback == NULL && prev_cmd->UserCallback == NULL)
|
||||||
@ -510,7 +508,6 @@ void ImDrawList::_TryMergeDrawCmds()
|
|||||||
void ImDrawList::_OnChangedClipRect()
|
void ImDrawList::_OnChangedClipRect()
|
||||||
{
|
{
|
||||||
// If current command is used with different settings we need to add a new command
|
// If current command is used with different settings we need to add a new command
|
||||||
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0)
|
if (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &_CmdHeader.ClipRect, sizeof(ImVec4)) != 0)
|
||||||
{
|
{
|
||||||
@ -533,7 +530,6 @@ void ImDrawList::_OnChangedClipRect()
|
|||||||
void ImDrawList::_OnChangedTextureID()
|
void ImDrawList::_OnChangedTextureID()
|
||||||
{
|
{
|
||||||
// If current command is used with different settings we need to add a new command
|
// If current command is used with different settings we need to add a new command
|
||||||
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
if (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != _CmdHeader.TextureId)
|
if (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != _CmdHeader.TextureId)
|
||||||
{
|
{
|
||||||
@ -557,7 +553,6 @@ void ImDrawList::_OnChangedVtxOffset()
|
|||||||
{
|
{
|
||||||
// We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.
|
// We don't need to compare curr_cmd->VtxOffset != _CmdHeader.VtxOffset because we know it'll be different at the time we call this.
|
||||||
_VtxCurrentIdx = 0;
|
_VtxCurrentIdx = 0;
|
||||||
IM_ASSERT_PARANOID(CmdBuffer.Size > 0);
|
|
||||||
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
ImDrawCmd* curr_cmd = &CmdBuffer.Data[CmdBuffer.Size - 1];
|
||||||
//IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349
|
//IM_ASSERT(curr_cmd->VtxOffset != _CmdHeader.VtxOffset); // See #3349
|
||||||
if (curr_cmd->ElemCount != 0)
|
if (curr_cmd->ElemCount != 0)
|
||||||
@ -1924,38 +1919,37 @@ ImFontConfig::ImFontConfig()
|
|||||||
|
|
||||||
// A work of art lies ahead! (. = white layer, X = black layer, others are blank)
|
// A work of art lies ahead! (. = white layer, X = black layer, others are blank)
|
||||||
// The 2x2 white texels on the top left are the ones we'll use everywhere in Dear ImGui to render filled shapes.
|
// The 2x2 white texels on the top left are the ones we'll use everywhere in Dear ImGui to render filled shapes.
|
||||||
// (This is used when io.MouseDrawCursor = true)
|
const int FONT_ATLAS_DEFAULT_TEX_DATA_W = 108; // Actual texture will be 2 times that + 1 spacing.
|
||||||
const int FONT_ATLAS_DEFAULT_TEX_DATA_W = 122; // Actual texture will be 2 times that + 1 spacing.
|
|
||||||
const int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27;
|
const int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27;
|
||||||
static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] =
|
static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] =
|
||||||
{
|
{
|
||||||
"..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX- XX - XX XX "
|
"..- -XXXXXXX- X - X -XXXXXXX - XXXXXXX- XX "
|
||||||
"..- -X.....X- X.X - X.X -X.....X - X.....X- X..X -X..X X..X"
|
"..- -X.....X- X.X - X.X -X.....X - X.....X- X..X "
|
||||||
"--- -XXX.XXX- X...X - X...X -X....X - X....X- X..X -X...X X...X"
|
"--- -XXX.XXX- X...X - X...X -X....X - X....X- X..X "
|
||||||
"X - X.X - X.....X - X.....X -X...X - X...X- X..X - X...X X...X "
|
"X - X.X - X.....X - X.....X -X...X - X...X- X..X "
|
||||||
"XX - X.X -X.......X- X.......X -X..X.X - X.X..X- X..X - X...X...X "
|
"XX - X.X -X.......X- X.......X -X..X.X - X.X..X- X..X "
|
||||||
"X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X- X..XXX - X.....X "
|
"X.X - X.X -XXXX.XXXX- XXXX.XXXX -X.X X.X - X.X X.X- X..XXX "
|
||||||
"X..X - X.X - X.X - X.X -XX X.X - X.X XX- X..X..XXX - X...X "
|
"X..X - X.X - X.X - X.X -XX X.X - X.X XX- X..X..XXX "
|
||||||
"X...X - X.X - X.X - XX X.X XX - X.X - X.X - X..X..X..XX - X.X "
|
"X...X - X.X - X.X - XX X.X XX - X.X - X.X - X..X..X..XX "
|
||||||
"X....X - X.X - X.X - X.X X.X X.X - X.X - X.X - X..X..X..X.X - X...X "
|
"X....X - X.X - X.X - X.X X.X X.X - X.X - X.X - X..X..X..X.X "
|
||||||
"X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X -XXX X..X..X..X..X- X.....X "
|
"X.....X - X.X - X.X - X..X X.X X..X - X.X - X.X -XXX X..X..X..X..X"
|
||||||
"X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X -X..XX........X..X- X...X...X "
|
"X......X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X XX-XX X.X -X..XX........X..X"
|
||||||
"X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X -X...X...........X- X...X X...X "
|
"X.......X - X.X - X.X -X.....................X- X.X X.X-X.X X.X -X...X...........X"
|
||||||
"X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X - X..............X-X...X X...X"
|
"X........X - X.X - X.X - X...XXXXXX.XXXXXX...X - X.X..X-X..X.X - X..............X"
|
||||||
"X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X - X.............X-X..X X..X"
|
"X.........X -XXX.XXX- X.X - X..X X.X X..X - X...X-X...X - X.............X"
|
||||||
"X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X - X.............X- XX XX "
|
"X..........X-X.....X- X.X - X.X X.X X.X - X....X-X....X - X.............X"
|
||||||
"X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X - X............X--------------"
|
"X......XXXXX-XXXXXXX- X.X - XX X.X XX - X.....X-X.....X - X............X"
|
||||||
"X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX - X...........X - "
|
"X...X..X --------- X.X - X.X - XXXXXXX-XXXXXXX - X...........X "
|
||||||
"X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------- X..........X - "
|
"X..X X..X - -XXXX.XXXX- XXXX.XXXX ------------------------------------- X..........X "
|
||||||
"X.X X..X - -X.......X- X.......X - XX XX - - X..........X - "
|
"X.X X..X - -X.......X- X.......X - XX XX - - X..........X "
|
||||||
"XX X..X - - X.....X - X.....X - X.X X.X - - X........X - "
|
"XX X..X - - X.....X - X.....X - X.X X.X - - X........X "
|
||||||
" X..X - - X...X - X...X - X..X X..X - - X........X - "
|
" X..X - X...X - X...X - X..X X..X - - X........X "
|
||||||
" XX - - X.X - X.X - X...XXXXXXXXXXXXX...X - - XXXXXXXXXX - "
|
" XX - X.X - X.X - X...XXXXXXXXXXXXX...X - - XXXXXXXXXX "
|
||||||
"------------- - X - X -X.....................X- ------------------- "
|
"------------ - X - X -X.....................X- ------------------"
|
||||||
" ----------------------------------- X...XXXXXXXXXXXXX...X - "
|
" ----------------------------------- X...XXXXXXXXXXXXX...X - "
|
||||||
" - X..X X..X - "
|
" - X..X X..X - "
|
||||||
" - X.X X.X - "
|
" - X.X X.X - "
|
||||||
" - XX XX - "
|
" - XX XX - "
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3] =
|
static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3] =
|
||||||
@ -1969,7 +1963,6 @@ static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3
|
|||||||
{ ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNESW
|
{ ImVec2(73,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNESW
|
||||||
{ ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNWSE
|
{ ImVec2(55,0), ImVec2(17,17), ImVec2( 8, 8) }, // ImGuiMouseCursor_ResizeNWSE
|
||||||
{ ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, // ImGuiMouseCursor_Hand
|
{ ImVec2(91,0), ImVec2(17,22), ImVec2( 5, 0) }, // ImGuiMouseCursor_Hand
|
||||||
{ ImVec2(109,0),ImVec2(13,15), ImVec2( 6, 7) }, // ImGuiMouseCursor_NotAllowed
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ImFontAtlas::ImFontAtlas()
|
ImFontAtlas::ImFontAtlas()
|
||||||
@ -2005,7 +1998,7 @@ void ImFontAtlas::ClearInputData()
|
|||||||
ConfigData.clear();
|
ConfigData.clear();
|
||||||
CustomRects.clear();
|
CustomRects.clear();
|
||||||
PackIdMouseCursors = PackIdLines = -1;
|
PackIdMouseCursors = PackIdLines = -1;
|
||||||
// Important: we leave TexReady untouched
|
TexReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlas::ClearTexData()
|
void ImFontAtlas::ClearTexData()
|
||||||
@ -3080,8 +3073,8 @@ void ImFontGlyphRangesBuilder::AddText(const char* text, const char* text_end)
|
|||||||
void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges)
|
void ImFontGlyphRangesBuilder::AddRanges(const ImWchar* ranges)
|
||||||
{
|
{
|
||||||
for (; ranges[0]; ranges += 2)
|
for (; ranges[0]; ranges += 2)
|
||||||
for (unsigned int c = ranges[0]; c <= ranges[1] && c <= IM_UNICODE_CODEPOINT_MAX; c++) //-V560
|
for (ImWchar c = ranges[0]; c <= ranges[1]; c++)
|
||||||
AddChar((ImWchar)c);
|
AddChar(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
void ImFontGlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)
|
||||||
@ -3906,10 +3899,10 @@ void ImGui::RenderRectFilledWithHole(ImDrawList* draw_list, ImRect outer, ImRect
|
|||||||
const bool fill_R = (inner.Max.x < outer.Max.x);
|
const bool fill_R = (inner.Max.x < outer.Max.x);
|
||||||
const bool fill_U = (inner.Min.y > outer.Min.y);
|
const bool fill_U = (inner.Min.y > outer.Min.y);
|
||||||
const bool fill_D = (inner.Max.y < outer.Max.y);
|
const bool fill_D = (inner.Max.y < outer.Max.y);
|
||||||
if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft));
|
if (fill_L) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Min.y), ImVec2(inner.Min.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomLeft));
|
||||||
if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
if (fill_R) draw_list->AddRectFilled(ImVec2(inner.Max.x, inner.Min.y), ImVec2(outer.Max.x, inner.Max.y), col, rounding, (fill_U ? 0 : ImDrawFlags_RoundCornersTopRight) | (fill_D ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
||||||
if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight));
|
if (fill_U) draw_list->AddRectFilled(ImVec2(inner.Min.x, outer.Min.y), ImVec2(inner.Max.x, inner.Min.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersTopLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersTopRight));
|
||||||
if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersNone | (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
if (fill_D) draw_list->AddRectFilled(ImVec2(inner.Min.x, inner.Max.y), ImVec2(inner.Max.x, outer.Max.y), col, rounding, (fill_L ? 0 : ImDrawFlags_RoundCornersBottomLeft) | (fill_R ? 0 : ImDrawFlags_RoundCornersBottomRight));
|
||||||
if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft);
|
if (fill_L && fill_U) draw_list->AddRectFilled(ImVec2(outer.Min.x, outer.Min.y), ImVec2(inner.Min.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopLeft);
|
||||||
if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight);
|
if (fill_R && fill_U) draw_list->AddRectFilled(ImVec2(inner.Max.x, outer.Min.y), ImVec2(outer.Max.x, inner.Min.y), col, rounding, ImDrawFlags_RoundCornersTopRight);
|
||||||
if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft);
|
if (fill_L && fill_D) draw_list->AddRectFilled(ImVec2(outer.Min.x, inner.Max.y), ImVec2(inner.Min.x, outer.Max.y), col, rounding, ImDrawFlags_RoundCornersBottomLeft);
|
||||||
|
480
imgui_internal.h
480
imgui_internal.h
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86
|
// dear imgui, v1.84b
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
@ -18,14 +18,12 @@ Index of this file:
|
|||||||
// [SECTION] Generic helpers
|
// [SECTION] Generic helpers
|
||||||
// [SECTION] ImDrawList support
|
// [SECTION] ImDrawList support
|
||||||
// [SECTION] Widgets support: flags, enums, data structures
|
// [SECTION] Widgets support: flags, enums, data structures
|
||||||
// [SECTION] Clipper support
|
|
||||||
// [SECTION] Navigation support
|
|
||||||
// [SECTION] Columns support
|
// [SECTION] Columns support
|
||||||
// [SECTION] Multi-select support
|
// [SECTION] Multi-select support
|
||||||
// [SECTION] Docking support
|
// [SECTION] Docking support
|
||||||
// [SECTION] Viewport support
|
// [SECTION] Viewport support
|
||||||
// [SECTION] Settings support
|
// [SECTION] Settings support
|
||||||
// [SECTION] Metrics, Debug tools
|
// [SECTION] Metrics, Debug
|
||||||
// [SECTION] Generic context hooks
|
// [SECTION] Generic context hooks
|
||||||
// [SECTION] ImGuiContext (main imgui context)
|
// [SECTION] ImGuiContext (main imgui context)
|
||||||
// [SECTION] ImGuiWindowTempData, ImGuiWindow
|
// [SECTION] ImGuiWindowTempData, ImGuiWindow
|
||||||
@ -84,13 +82,19 @@ Index of this file:
|
|||||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
|
||||||
#pragma clang diagnostic ignored "-Wdouble-promotion"
|
#pragma clang diagnostic ignored "-Wdouble-promotion"
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
|
#pragma clang diagnostic ignored "-Wimplicit-int-float-conversion" // warning: implicit conversion from 'xxx' to 'float' may lose precision
|
||||||
#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning: function 'xxx' could be declared with attribute 'noreturn'
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
#pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
|
||||||
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
#pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Helper macros
|
||||||
|
#if defined(__clang__)
|
||||||
|
#define IM_NORETURN __attribute__((noreturn))
|
||||||
|
#else
|
||||||
|
#define IM_NORETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
// Legacy defines
|
// Legacy defines
|
||||||
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74
|
#ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS // Renamed in 1.74
|
||||||
#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
#error Use IMGUI_DISABLE_DEFAULT_FORMAT_FUNCTIONS
|
||||||
@ -144,8 +148,8 @@ struct ImGuiWindowSettings; // Storage for a window .ini settings (we ke
|
|||||||
|
|
||||||
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
|
// Use your programming IDE "Go to definition" facility on the names of the center columns to find the actual flags/enum lists.
|
||||||
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
typedef int ImGuiLayoutType; // -> enum ImGuiLayoutType_ // Enum: Horizontal or vertical
|
||||||
typedef int ImGuiActivateFlags; // -> enum ImGuiActivateFlags_ // Flags: for navigation/focus function (will be for ActivateItem() later)
|
|
||||||
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
typedef int ImGuiItemFlags; // -> enum ImGuiItemFlags_ // Flags: for PushItemFlag()
|
||||||
|
typedef int ImGuiItemAddFlags; // -> enum ImGuiItemAddFlags_ // Flags: for ItemAdd()
|
||||||
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
typedef int ImGuiItemStatusFlags; // -> enum ImGuiItemStatusFlags_ // Flags: for DC.LastItemStatusFlags
|
||||||
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
typedef int ImGuiOldColumnFlags; // -> enum ImGuiOldColumnFlags_ // Flags: for BeginColumns()
|
||||||
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
typedef int ImGuiNavHighlightFlags; // -> enum ImGuiNavHighlightFlags_ // Flags: for RenderNavHighlight()
|
||||||
@ -153,7 +157,6 @@ typedef int ImGuiNavDirSourceFlags; // -> enum ImGuiNavDirSourceFlags_ // F
|
|||||||
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
typedef int ImGuiNavMoveFlags; // -> enum ImGuiNavMoveFlags_ // Flags: for navigation requests
|
||||||
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
typedef int ImGuiNextItemDataFlags; // -> enum ImGuiNextItemDataFlags_ // Flags: for SetNextItemXXX() functions
|
||||||
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
typedef int ImGuiNextWindowDataFlags; // -> enum ImGuiNextWindowDataFlags_// Flags: for SetNextWindowXXX() functions
|
||||||
typedef int ImGuiScrollFlags; // -> enum ImGuiScrollFlags_ // Flags: for ScrollToItem() and navigation requests
|
|
||||||
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
|
typedef int ImGuiSeparatorFlags; // -> enum ImGuiSeparatorFlags_ // Flags: for SeparatorEx()
|
||||||
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
typedef int ImGuiTextFlags; // -> enum ImGuiTextFlags_ // Flags: for TextEx()
|
||||||
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
typedef int ImGuiTooltipFlags; // -> enum ImGuiTooltipFlags_ // Flags: for BeginTooltipEx()
|
||||||
@ -253,19 +256,12 @@ namespace ImStb
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
// Use 'Metrics/Debugger->Tools->Item Picker' to break into the call-stack of a specific item.
|
// Use 'Metrics->Tools->Item Picker' to break into the call-stack of a specific item.
|
||||||
// This will call IM_DEBUG_BREAK() which you may redefine yourself. See https://github.com/scottt/debugbreak for more reference.
|
|
||||||
#ifndef IM_DEBUG_BREAK
|
#ifndef IM_DEBUG_BREAK
|
||||||
#if defined (_MSC_VER)
|
#if defined(__clang__)
|
||||||
#define IM_DEBUG_BREAK() __debugbreak()
|
|
||||||
#elif defined(__clang__)
|
|
||||||
#define IM_DEBUG_BREAK() __builtin_debugtrap()
|
#define IM_DEBUG_BREAK() __builtin_debugtrap()
|
||||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
#elif defined (_MSC_VER)
|
||||||
#define IM_DEBUG_BREAK() __asm__ volatile("int $0x03")
|
#define IM_DEBUG_BREAK() __debugbreak()
|
||||||
#elif defined(__GNUC__) && defined(__thumb__)
|
|
||||||
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xde01")
|
|
||||||
#elif defined(__GNUC__) && defined(__arm__) && !defined(__thumb__)
|
|
||||||
#define IM_DEBUG_BREAK() __asm__ volatile(".inst 0xe7f001f0");
|
|
||||||
#else
|
#else
|
||||||
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
|
#define IM_DEBUG_BREAK() IM_ASSERT(0) // It is expected that you define IM_DEBUG_BREAK() into something that will break nicely in a debugger!
|
||||||
#endif
|
#endif
|
||||||
@ -302,9 +298,7 @@ static inline ImGuiID ImHash(const void* data, int size, ImU32 seed = 0) { ret
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Helpers: Sorting
|
// Helpers: Sorting
|
||||||
#ifndef ImQsort
|
#define ImQsort qsort
|
||||||
static inline void ImQsort(void* base, size_t count, size_t size_of_element, int(IMGUI_CDECL *compare_func)(void const*, void const*)) { if (count > 1) qsort(base, count, size_of_element, compare_func); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Helpers: Color Blending
|
// Helpers: Color Blending
|
||||||
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
IMGUI_API ImU32 ImAlphaBlendColors(ImU32 col_a, ImU32 col_b);
|
||||||
@ -411,8 +405,8 @@ static inline double ImLog(double x) { return log(x); }
|
|||||||
static inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
static inline int ImAbs(int x) { return x < 0 ? -x : x; }
|
||||||
static inline float ImAbs(float x) { return fabsf(x); }
|
static inline float ImAbs(float x) { return fabsf(x); }
|
||||||
static inline double ImAbs(double x) { return fabs(x); }
|
static inline double ImAbs(double x) { return fabs(x); }
|
||||||
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : (x > 0.0f) ? 1.0f : 0.0f; } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
static inline float ImSign(float x) { return (x < 0.0f) ? -1.0f : ((x > 0.0f) ? 1.0f : 0.0f); } // Sign operator - returns -1, 0 or 1 based on sign of argument
|
||||||
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : (x > 0.0) ? 1.0 : 0.0; }
|
static inline double ImSign(double x) { return (x < 0.0) ? -1.0 : ((x > 0.0) ? 1.0 : 0.0); }
|
||||||
#ifdef IMGUI_ENABLE_SSE
|
#ifdef IMGUI_ENABLE_SSE
|
||||||
static inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
static inline float ImRsqrt(float x) { return _mm_cvtss_f32(_mm_rsqrt_ss(_mm_set_ss(x))); }
|
||||||
#else
|
#else
|
||||||
@ -448,7 +442,6 @@ static inline float ImDot(const ImVec2& a, const ImVec2& b)
|
|||||||
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }
|
||||||
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||||||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||||
static inline bool ImIsFloatAboveGuaranteedIntegerPrecision(float f) { return f <= -16777216 || f >= 16777216; }
|
|
||||||
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
IM_MSVC_RUNTIME_CHECKS_RESTORE
|
||||||
|
|
||||||
// Helpers: Geometry
|
// Helpers: Geometry
|
||||||
@ -754,8 +747,15 @@ enum ImGuiItemFlags_
|
|||||||
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false // Disable item being a candidate for default focus (e.g. used by title bar items)
|
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false // Disable item being a candidate for default focus (e.g. used by title bar items)
|
||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // Disable MenuItem/Selectable() automatically closing their popup window
|
||||||
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
ImGuiItemFlags_MixedValue = 1 << 6, // false // [BETA] Represent a mixed/indeterminate value, generally multi-selection where values differ. Currently only supported by Checkbox() (later should support all sorts of widgets)
|
||||||
ImGuiItemFlags_ReadOnly = 1 << 7, // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
|
ImGuiItemFlags_ReadOnly = 1 << 7 // false // [ALPHA] Allow hovering interactions but underlying value is not changed.
|
||||||
ImGuiItemFlags_Inputable = 1 << 8 // false // [WIP] Auto-activate input mode when tab focused. Currently only used and supported by a few items before it becomes a generic feature.
|
};
|
||||||
|
|
||||||
|
// Flags for ItemAdd()
|
||||||
|
// FIXME-NAV: _Focusable is _ALMOST_ what you would expect to be called '_TabStop' but because SetKeyboardFocusHere() works on items with no TabStop we distinguish Focusable from TabStop.
|
||||||
|
enum ImGuiItemAddFlags_
|
||||||
|
{
|
||||||
|
ImGuiItemAddFlags_None = 0,
|
||||||
|
ImGuiItemAddFlags_Focusable = 1 << 0 // FIXME-NAV: In current/legacy scheme, Focusable+TabStop support are opt-in by widgets. We will transition it toward being opt-out, so this flag is expected to eventually disappear.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for LastItem data
|
// Storage for LastItem data
|
||||||
@ -763,14 +763,16 @@ enum ImGuiItemStatusFlags_
|
|||||||
{
|
{
|
||||||
ImGuiItemStatusFlags_None = 0,
|
ImGuiItemStatusFlags_None = 0,
|
||||||
ImGuiItemStatusFlags_HoveredRect = 1 << 0, // Mouse position is within item rectangle (does NOT mean that the window is in correct z-order and can be hovered!, this is only one part of the most-common IsItemHovered test)
|
ImGuiItemStatusFlags_HoveredRect = 1 << 0, // Mouse position is within item rectangle (does NOT mean that the window is in correct z-order and can be hovered!, this is only one part of the most-common IsItemHovered test)
|
||||||
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1, // g.LastItemData.DisplayRect is valid
|
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1, // window->DC.LastItemDisplayRect is valid
|
||||||
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
ImGuiItemStatusFlags_Edited = 1 << 2, // Value exposed by item was edited in the current frame (should match the bool return value of most widgets)
|
||||||
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected", only state changes, in order to easily handle clipping with less issues.
|
ImGuiItemStatusFlags_ToggledSelection = 1 << 3, // Set when Selectable(), TreeNode() reports toggling a selection. We can't report "Selected", only state changes, in order to easily handle clipping with less issues.
|
||||||
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
ImGuiItemStatusFlags_ToggledOpen = 1 << 4, // Set when TreeNode() reports toggling their open state.
|
||||||
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
ImGuiItemStatusFlags_HasDeactivated = 1 << 5, // Set if the widget/group is able to provide data for the ImGuiItemStatusFlags_Deactivated flag.
|
||||||
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
ImGuiItemStatusFlags_Deactivated = 1 << 6, // Only valid if ImGuiItemStatusFlags_HasDeactivated is set.
|
||||||
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
ImGuiItemStatusFlags_HoveredWindow = 1 << 7, // Override the HoveredWindow test to allow cross-window hover testing.
|
||||||
ImGuiItemStatusFlags_FocusedByTabbing = 1 << 8 // Set when the Focusable item just got focused by Tabbing (FIXME: to be removed soon)
|
ImGuiItemStatusFlags_FocusedByCode = 1 << 8, // Set when the Focusable item just got focused from code.
|
||||||
|
ImGuiItemStatusFlags_FocusedByTabbing = 1 << 9, // Set when the Focusable item just got focused by Tabbing.
|
||||||
|
ImGuiItemStatusFlags_Focused = ImGuiItemStatusFlags_FocusedByCode | ImGuiItemStatusFlags_FocusedByTabbing
|
||||||
|
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
, // [imgui_tests only]
|
, // [imgui_tests only]
|
||||||
@ -919,6 +921,49 @@ enum ImGuiInputReadMode
|
|||||||
ImGuiInputReadMode_RepeatFast
|
ImGuiInputReadMode_RepeatFast
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavHighlightFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavHighlightFlags_None = 0,
|
||||||
|
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
||||||
|
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
||||||
|
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
|
||||||
|
ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavDirSourceFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavDirSourceFlags_None = 0,
|
||||||
|
ImGuiNavDirSourceFlags_Keyboard = 1 << 0,
|
||||||
|
ImGuiNavDirSourceFlags_PadDPad = 1 << 1,
|
||||||
|
ImGuiNavDirSourceFlags_PadLStick = 1 << 2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavMoveFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavMoveFlags_None = 0,
|
||||||
|
ImGuiNavMoveFlags_LoopX = 1 << 0, // On failed request, restart from opposite side
|
||||||
|
ImGuiNavMoveFlags_LoopY = 1 << 1,
|
||||||
|
ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
|
||||||
|
ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful for provided for completeness
|
||||||
|
ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
|
||||||
|
ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisibleSet that only comprise elements that are already fully visible.
|
||||||
|
ImGuiNavMoveFlags_ScrollToEdge = 1 << 6
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavForward
|
||||||
|
{
|
||||||
|
ImGuiNavForward_None,
|
||||||
|
ImGuiNavForward_ForwardQueued,
|
||||||
|
ImGuiNavForward_ForwardActive
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavLayer
|
||||||
|
{
|
||||||
|
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
||||||
|
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu)
|
||||||
|
ImGuiNavLayer_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
enum ImGuiPopupPositionPolicy
|
enum ImGuiPopupPositionPolicy
|
||||||
{
|
{
|
||||||
ImGuiPopupPositionPolicy_Default,
|
ImGuiPopupPositionPolicy_Default,
|
||||||
@ -1030,6 +1075,8 @@ struct IMGUI_API ImGuiInputTextState
|
|||||||
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
bool SelectedAllMouseLock; // after a double-click to select all, we ignore further mouse drags to update selection
|
||||||
bool Edited; // edited this frame
|
bool Edited; // edited this frame
|
||||||
ImGuiInputTextFlags Flags; // copy of InputText() flags
|
ImGuiInputTextFlags Flags; // copy of InputText() flags
|
||||||
|
ImGuiInputTextCallback UserCallback; // "
|
||||||
|
void* UserCallbackData; // "
|
||||||
|
|
||||||
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
ImGuiInputTextState() { memset(this, 0, sizeof(*this)); }
|
||||||
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
void ClearText() { CurLenW = CurLenA = 0; TextW[0] = 0; TextA[0] = 0; CursorClamp(); }
|
||||||
@ -1063,6 +1110,20 @@ struct ImGuiPopupData
|
|||||||
ImGuiPopupData() { memset(this, 0, sizeof(*this)); OpenFrameCount = -1; }
|
ImGuiPopupData() { memset(this, 0, sizeof(*this)); OpenFrameCount = -1; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ImGuiNavItemData
|
||||||
|
{
|
||||||
|
ImGuiWindow* Window; // Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
|
||||||
|
ImGuiID ID; // Init,Move // Best candidate item ID
|
||||||
|
ImGuiID FocusScopeId; // Init,Move // Best candidate focus scope ID
|
||||||
|
ImRect RectRel; // Init,Move // Best candidate bounding box in window relative space
|
||||||
|
float DistBox; // Move // Best candidate box distance to current NavId
|
||||||
|
float DistCenter; // Move // Best candidate center distance to current NavId
|
||||||
|
float DistAxial; // Move // Best candidate axial distance to current NavId
|
||||||
|
|
||||||
|
ImGuiNavItemData() { Clear(); }
|
||||||
|
void Clear() { Window = NULL; ID = FocusScopeId = 0; RectRel = ImRect(); DistBox = DistCenter = DistAxial = FLT_MAX; }
|
||||||
|
};
|
||||||
|
|
||||||
enum ImGuiNextWindowDataFlags_
|
enum ImGuiNextWindowDataFlags_
|
||||||
{
|
{
|
||||||
ImGuiNextWindowDataFlags_None = 0,
|
ImGuiNextWindowDataFlags_None = 0,
|
||||||
@ -1124,36 +1185,17 @@ struct ImGuiLastItemData
|
|||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
ImGuiItemFlags InFlags; // See ImGuiItemFlags_
|
ImGuiItemFlags InFlags; // See ImGuiItemFlags_
|
||||||
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
ImGuiItemStatusFlags StatusFlags; // See ImGuiItemStatusFlags_
|
||||||
ImRect Rect; // Full rectangle
|
ImRect Rect;
|
||||||
ImRect NavRect; // Navigation scoring rectangle (not displayed)
|
ImRect DisplayRect;
|
||||||
ImRect DisplayRect; // Display rectangle (only if ImGuiItemStatusFlags_HasDisplayRect is set)
|
|
||||||
|
|
||||||
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
ImGuiLastItemData() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IMGUI_API ImGuiStackSizes
|
|
||||||
{
|
|
||||||
short SizeOfIDStack;
|
|
||||||
short SizeOfColorStack;
|
|
||||||
short SizeOfStyleVarStack;
|
|
||||||
short SizeOfFontStack;
|
|
||||||
short SizeOfFocusScopeStack;
|
|
||||||
short SizeOfGroupStack;
|
|
||||||
short SizeOfItemFlagsStack;
|
|
||||||
short SizeOfBeginPopupStack;
|
|
||||||
short SizeOfDisabledStack;
|
|
||||||
|
|
||||||
ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }
|
|
||||||
void SetToCurrentState();
|
|
||||||
void CompareWithCurrentState();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Data saved for each window pushed into the stack
|
// Data saved for each window pushed into the stack
|
||||||
struct ImGuiWindowStackData
|
struct ImGuiWindowStackData
|
||||||
{
|
{
|
||||||
ImGuiWindow* Window;
|
ImGuiWindow* Window;
|
||||||
ImGuiLastItemData ParentLastItemDataBackup;
|
ImGuiLastItemData ParentLastItemDataBackup;
|
||||||
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiShrinkWidthItem
|
struct ImGuiShrinkWidthItem
|
||||||
@ -1171,120 +1213,6 @@ struct ImGuiPtrOrIndex
|
|||||||
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
ImGuiPtrOrIndex(int index) { Ptr = NULL; Index = index; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// [SECTION] Clipper support
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
struct ImGuiListClipperRange
|
|
||||||
{
|
|
||||||
int Min;
|
|
||||||
int Max;
|
|
||||||
bool PosToIndexConvert; // Begin/End are absolute position (will be converted to indices later)
|
|
||||||
ImS8 PosToIndexOffsetMin; // Add to Min after converting to indices
|
|
||||||
ImS8 PosToIndexOffsetMax; // Add to Min after converting to indices
|
|
||||||
|
|
||||||
static ImGuiListClipperRange FromIndices(int min, int max) { ImGuiListClipperRange r = { min, max, false, 0, 0 }; return r; }
|
|
||||||
static ImGuiListClipperRange FromPositions(float y1, float y2, int off_min, int off_max) { ImGuiListClipperRange r = { (int)y1, (int)y2, true, (ImS8)off_min, (ImS8)off_max }; return r; }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Temporary clipper data, buffers shared/reused between instances
|
|
||||||
struct ImGuiListClipperData
|
|
||||||
{
|
|
||||||
ImGuiListClipper* ListClipper;
|
|
||||||
float LossynessOffset;
|
|
||||||
int StepNo;
|
|
||||||
int ItemsFrozen;
|
|
||||||
ImVector<ImGuiListClipperRange> Ranges;
|
|
||||||
|
|
||||||
ImGuiListClipperData() { memset(this, 0, sizeof(*this)); }
|
|
||||||
void Reset(ImGuiListClipper* clipper) { ListClipper = clipper; StepNo = ItemsFrozen = 0; Ranges.resize(0); }
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// [SECTION] Navigation support
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
enum ImGuiActivateFlags_
|
|
||||||
{
|
|
||||||
ImGuiActivateFlags_None = 0,
|
|
||||||
ImGuiActivateFlags_PreferInput = 1 << 0, // Favor activation that requires keyboard text input (e.g. for Slider/Drag). Default if keyboard is available.
|
|
||||||
ImGuiActivateFlags_PreferTweak = 1 << 1, // Favor activation for tweaking with arrows or gamepad (e.g. for Slider/Drag). Default if keyboard is not available.
|
|
||||||
ImGuiActivateFlags_TryToPreserveState = 1 << 2 // Request widget to preserve state if it can (e.g. InputText will try to preserve cursor/selection)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Early work-in-progress API for ScrollToItem()
|
|
||||||
enum ImGuiScrollFlags_
|
|
||||||
{
|
|
||||||
ImGuiScrollFlags_None = 0,
|
|
||||||
ImGuiScrollFlags_KeepVisibleEdgeX = 1 << 0, // If item is not visible: scroll as little as possible on X axis to bring item back into view [default for X axis]
|
|
||||||
ImGuiScrollFlags_KeepVisibleEdgeY = 1 << 1, // If item is not visible: scroll as little as possible on Y axis to bring item back into view [default for Y axis for windows that are already visible]
|
|
||||||
ImGuiScrollFlags_KeepVisibleCenterX = 1 << 2, // If item is not visible: scroll to make the item centered on X axis [rarely used]
|
|
||||||
ImGuiScrollFlags_KeepVisibleCenterY = 1 << 3, // If item is not visible: scroll to make the item centered on Y axis
|
|
||||||
ImGuiScrollFlags_AlwaysCenterX = 1 << 4, // Always center the result item on X axis [rarely used]
|
|
||||||
ImGuiScrollFlags_AlwaysCenterY = 1 << 5, // Always center the result item on Y axis [default for Y axis for appearing window)
|
|
||||||
ImGuiScrollFlags_NoScrollParent = 1 << 6, // Disable forwarding scrolling to parent window if required to keep item/rect visible (only scroll window the function was applied to).
|
|
||||||
ImGuiScrollFlags_MaskX_ = ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleCenterX | ImGuiScrollFlags_AlwaysCenterX,
|
|
||||||
ImGuiScrollFlags_MaskY_ = ImGuiScrollFlags_KeepVisibleEdgeY | ImGuiScrollFlags_KeepVisibleCenterY | ImGuiScrollFlags_AlwaysCenterY
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavHighlightFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavHighlightFlags_None = 0,
|
|
||||||
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
|
||||||
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
|
||||||
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2, // Draw rectangular highlight if (g.NavId == id) _even_ when using the mouse.
|
|
||||||
ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavDirSourceFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavDirSourceFlags_None = 0,
|
|
||||||
ImGuiNavDirSourceFlags_RawKeyboard = 1 << 0, // Raw keyboard (not pulled from nav), faciliate use of some functions before we can unify nav and keys
|
|
||||||
ImGuiNavDirSourceFlags_Keyboard = 1 << 1,
|
|
||||||
ImGuiNavDirSourceFlags_PadDPad = 1 << 2,
|
|
||||||
ImGuiNavDirSourceFlags_PadLStick = 1 << 3
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavMoveFlags_
|
|
||||||
{
|
|
||||||
ImGuiNavMoveFlags_None = 0,
|
|
||||||
ImGuiNavMoveFlags_LoopX = 1 << 0, // On failed request, restart from opposite side
|
|
||||||
ImGuiNavMoveFlags_LoopY = 1 << 1,
|
|
||||||
ImGuiNavMoveFlags_WrapX = 1 << 2, // On failed request, request from opposite side one line down (when NavDir==right) or one line up (when NavDir==left)
|
|
||||||
ImGuiNavMoveFlags_WrapY = 1 << 3, // This is not super useful but provided for completeness
|
|
||||||
ImGuiNavMoveFlags_AllowCurrentNavId = 1 << 4, // Allow scoring and considering the current NavId as a move target candidate. This is used when the move source is offset (e.g. pressing PageDown actually needs to send a Up move request, if we are pressing PageDown from the bottom-most item we need to stay in place)
|
|
||||||
ImGuiNavMoveFlags_AlsoScoreVisibleSet = 1 << 5, // Store alternate result in NavMoveResultLocalVisible that only comprise elements that are already fully visible (used by PageUp/PageDown)
|
|
||||||
ImGuiNavMoveFlags_ScrollToEdgeY = 1 << 6, // Force scrolling to min/max (used by Home/End) // FIXME-NAV: Aim to remove or reword, probably unnecessary
|
|
||||||
ImGuiNavMoveFlags_Forwarded = 1 << 7,
|
|
||||||
ImGuiNavMoveFlags_DebugNoResult = 1 << 8, // Dummy scoring for debug purpose, don't apply result
|
|
||||||
ImGuiNavMoveFlags_FocusApi = 1 << 9,
|
|
||||||
ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight
|
|
||||||
ImGuiNavMoveFlags_Activate = 1 << 11,
|
|
||||||
ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12 // Do not alter the visible state of keyboard vs mouse nav highlight
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImGuiNavLayer
|
|
||||||
{
|
|
||||||
ImGuiNavLayer_Main = 0, // Main scrolling layer
|
|
||||||
ImGuiNavLayer_Menu = 1, // Menu layer (access with Alt/ImGuiNavInput_Menu)
|
|
||||||
ImGuiNavLayer_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ImGuiNavItemData
|
|
||||||
{
|
|
||||||
ImGuiWindow* Window; // Init,Move // Best candidate window (result->ItemWindow->RootWindowForNav == request->Window)
|
|
||||||
ImGuiID ID; // Init,Move // Best candidate item ID
|
|
||||||
ImGuiID FocusScopeId; // Init,Move // Best candidate focus scope ID
|
|
||||||
ImRect RectRel; // Init,Move // Best candidate bounding box in window relative space
|
|
||||||
ImGuiItemFlags InFlags; // ????,Move // Best candidate item flags
|
|
||||||
float DistBox; // Move // Best candidate box distance to current NavId
|
|
||||||
float DistCenter; // Move // Best candidate center distance to current NavId
|
|
||||||
float DistAxial; // Move // Best candidate axial distance to current NavId
|
|
||||||
|
|
||||||
ImGuiNavItemData() { Clear(); }
|
|
||||||
void Clear() { Window = NULL; ID = FocusScopeId = 0; InFlags = 0; DistBox = DistCenter = DistAxial = FLT_MAX; }
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Columns support
|
// [SECTION] Columns support
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1424,12 +1352,11 @@ struct ImGuiSettingsHandler
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// [SECTION] Metrics, Debug Tools
|
// [SECTION] Metrics, Debug
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct ImGuiMetricsConfig
|
struct ImGuiMetricsConfig
|
||||||
{
|
{
|
||||||
bool ShowStackTool;
|
|
||||||
bool ShowWindowsRects;
|
bool ShowWindowsRects;
|
||||||
bool ShowWindowsBeginOrder;
|
bool ShowWindowsBeginOrder;
|
||||||
bool ShowTablesRects;
|
bool ShowTablesRects;
|
||||||
@ -1440,7 +1367,6 @@ struct ImGuiMetricsConfig
|
|||||||
|
|
||||||
ImGuiMetricsConfig()
|
ImGuiMetricsConfig()
|
||||||
{
|
{
|
||||||
ShowStackTool = false;
|
|
||||||
ShowWindowsRects = false;
|
ShowWindowsRects = false;
|
||||||
ShowWindowsBeginOrder = false;
|
ShowWindowsBeginOrder = false;
|
||||||
ShowTablesRects = false;
|
ShowTablesRects = false;
|
||||||
@ -1451,25 +1377,19 @@ struct ImGuiMetricsConfig
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiStackLevelInfo
|
struct IMGUI_API ImGuiStackSizes
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
short SizeOfIDStack;
|
||||||
ImS8 QueryFrameCount; // >= 1: Query in progress
|
short SizeOfColorStack;
|
||||||
bool QuerySuccess; // Obtained result from DebugHookIdInfo()
|
short SizeOfStyleVarStack;
|
||||||
char Desc[58]; // Arbitrarily sized buffer to hold a result (FIXME: could replace Results[] with a chunk stream?)
|
short SizeOfFontStack;
|
||||||
|
short SizeOfFocusScopeStack;
|
||||||
|
short SizeOfGroupStack;
|
||||||
|
short SizeOfBeginPopupStack;
|
||||||
|
|
||||||
ImGuiStackLevelInfo() { memset(this, 0, sizeof(*this)); }
|
ImGuiStackSizes() { memset(this, 0, sizeof(*this)); }
|
||||||
};
|
void SetToCurrentState();
|
||||||
|
void CompareWithCurrentState();
|
||||||
// State for Stack tool queries
|
|
||||||
struct ImGuiStackTool
|
|
||||||
{
|
|
||||||
int LastActiveFrame;
|
|
||||||
int StackLevel; // -1: query stack and resize Results, >= 0: individual stack level
|
|
||||||
ImGuiID QueryId; // ID to query details for
|
|
||||||
ImVector<ImGuiStackLevelInfo> Results;
|
|
||||||
|
|
||||||
ImGuiStackTool() { memset(this, 0, sizeof(*this)); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1513,6 +1433,7 @@ struct ImGuiContext
|
|||||||
bool WithinEndChild; // Set within EndChild()
|
bool WithinEndChild; // Set within EndChild()
|
||||||
bool GcCompactAll; // Request full GC
|
bool GcCompactAll; // Request full GC
|
||||||
bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
|
bool TestEngineHookItems; // Will call test engine hooks: ImGuiTestEngineHook_ItemAdd(), ImGuiTestEngineHook_ItemInfo(), ImGuiTestEngineHook_Log()
|
||||||
|
ImGuiID TestEngineHookIdInfo; // Will call test engine hooks: ImGuiTestEngineHook_IdInfo() from GetID()
|
||||||
void* TestEngine; // Test engine user data
|
void* TestEngine; // Test engine user data
|
||||||
|
|
||||||
// Windows state
|
// Windows state
|
||||||
@ -1532,7 +1453,6 @@ struct ImGuiContext
|
|||||||
float WheelingWindowTimer;
|
float WheelingWindowTimer;
|
||||||
|
|
||||||
// Item/widgets state and tracking information
|
// Item/widgets state and tracking information
|
||||||
ImGuiID DebugHookIdInfo; // Will call core hooks: DebugHookIdInfo() from GetID functions, used by Stack Tool [next HoveredId/ActiveId to not pull in an extra cache-line]
|
|
||||||
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
ImGuiID HoveredId; // Hovered widget, filled during the frame
|
||||||
ImGuiID HoveredIdPreviousFrame;
|
ImGuiID HoveredIdPreviousFrame;
|
||||||
bool HoveredIdAllowOverlap;
|
bool HoveredIdAllowOverlap;
|
||||||
@ -1580,7 +1500,6 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiGroupData>GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
ImVector<ImGuiGroupData>GroupStack; // Stack for BeginGroup()/EndGroup() - not inherited by Begin()
|
||||||
ImVector<ImGuiPopupData>OpenPopupStack; // Which popups are open (persistent)
|
ImVector<ImGuiPopupData>OpenPopupStack; // Which popups are open (persistent)
|
||||||
ImVector<ImGuiPopupData>BeginPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
ImVector<ImGuiPopupData>BeginPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
||||||
int BeginMenuCount;
|
|
||||||
|
|
||||||
// Viewports
|
// Viewports
|
||||||
ImVector<ImGuiViewportP*> Viewports; // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData.
|
ImVector<ImGuiViewportP*> Viewports; // Active viewports (Size==1 in 'master' branch). Each viewports hold their copy of ImDrawData.
|
||||||
@ -1592,44 +1511,37 @@ struct ImGuiContext
|
|||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiID NavActivateInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0; ImGuiActivateFlags_PreferInput will be set and NavActivateId will be 0.
|
ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0
|
||||||
ImGuiActivateFlags NavActivateFlags;
|
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
||||||
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest).
|
||||||
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
ImGuiID NavJustMovedToFocusScopeId; // Just navigated to this focus scope id (result of a successfully MoveRequest).
|
||||||
ImGuiKeyModFlags NavJustMovedToKeyMods;
|
ImGuiKeyModFlags NavJustMovedToKeyMods;
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame.
|
||||||
ImGuiActivateFlags NavNextActivateFlags;
|
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS WILL ONLY BE None or NavGamepad or NavKeyboard.
|
||||||
|
ImRect NavScoringRect; // Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.
|
||||||
|
int NavScoringCount; // Metrics for debugging
|
||||||
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
ImGuiNavLayer NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
||||||
|
int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
||||||
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid
|
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRectRel is valid
|
||||||
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
||||||
bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
||||||
bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
||||||
|
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
||||||
// Navigation: Init & Move Requests
|
|
||||||
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest this is to perform early out in ItemAdd()
|
|
||||||
bool NavInitRequest; // Init request for appearing window to select first item
|
bool NavInitRequest; // Init request for appearing window to select first item
|
||||||
bool NavInitRequestFromMove;
|
bool NavInitRequestFromMove;
|
||||||
ImGuiID NavInitResultId; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
|
ImGuiID NavInitResultId; // Init request result (first item of the window, or one for which SetItemDefaultFocus() was called)
|
||||||
ImRect NavInitResultRectRel; // Init request result rectangle (relative to parent window)
|
ImRect NavInitResultRectRel; // Init request result rectangle (relative to parent window)
|
||||||
bool NavMoveSubmitted; // Move request submitted, will process result on next NewFrame()
|
bool NavMoveRequest; // Move request for this frame
|
||||||
bool NavMoveScoringItems; // Move request submitted, still scoring incoming items
|
ImGuiNavMoveFlags NavMoveRequestFlags;
|
||||||
bool NavMoveForwardToNextFrame;
|
ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
|
||||||
ImGuiNavMoveFlags NavMoveFlags;
|
ImGuiKeyModFlags NavMoveRequestKeyMods;
|
||||||
ImGuiScrollFlags NavMoveScrollFlags;
|
ImGuiDir NavMoveDir, NavMoveDirLast; // Direction of the move request (left/right/up/down), direction of the previous move request
|
||||||
ImGuiKeyModFlags NavMoveKeyMods;
|
|
||||||
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
|
|
||||||
ImGuiDir NavMoveDirForDebug;
|
|
||||||
ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename?
|
ImGuiDir NavMoveClipDir; // FIXME-NAV: Describe the purpose of this better. Might want to rename?
|
||||||
ImRect NavScoringRect; // Rectangle used for scoring, in screen space. Based of window->NavRectRel[], modified for directional navigation scoring.
|
|
||||||
ImRect NavScoringNoClipRect; // Some nav operations (such as PageUp/PageDown) enforce a region which clipper will attempt to always keep submitted
|
|
||||||
int NavScoringDebugCount; // Metrics for debugging
|
|
||||||
int NavTabbingDir; // Generally -1 or +1, 0 when tabbing without a nav id
|
|
||||||
int NavTabbingCounter; // >0 when counting items for tabbing
|
|
||||||
ImGuiNavItemData NavMoveResultLocal; // Best move request candidate within NavWindow
|
ImGuiNavItemData NavMoveResultLocal; // Best move request candidate within NavWindow
|
||||||
ImGuiNavItemData NavMoveResultLocalVisible; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
|
ImGuiNavItemData NavMoveResultLocalVisibleSet; // Best move request candidate within NavWindow that are mostly visible (when using ImGuiNavMoveFlags_AlsoScoreVisibleSet flag)
|
||||||
ImGuiNavItemData NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
ImGuiNavItemData NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using ImGuiWindowFlags_NavFlattened flag)
|
||||||
ImGuiNavItemData NavTabbingResultFirst; // First tabbing request candidate within NavWindow and flattened hierarchy
|
ImGuiWindow* NavWrapRequestWindow; // Window which requested trying nav wrap-around.
|
||||||
|
ImGuiNavMoveFlags NavWrapRequestFlags; // Wrap-around operation flags.
|
||||||
|
|
||||||
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
// Navigation: Windowing (CTRL+TAB for list, or Menu button + keys or directional pads to move/resize)
|
||||||
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
ImGuiWindow* NavWindowingTarget; // Target window when doing CTRL+Tab (or Pad Menu + FocusPrev/Next), this window is temporarily displayed top-most!
|
||||||
@ -1639,6 +1551,15 @@ struct ImGuiContext
|
|||||||
float NavWindowingHighlightAlpha;
|
float NavWindowingHighlightAlpha;
|
||||||
bool NavWindowingToggleLayer;
|
bool NavWindowingToggleLayer;
|
||||||
|
|
||||||
|
// Legacy Focus/Tabbing system (older than Nav, active even if Nav is disabled, misnamed. FIXME-NAV: This needs a redesign!)
|
||||||
|
ImGuiWindow* TabFocusRequestCurrWindow; //
|
||||||
|
ImGuiWindow* TabFocusRequestNextWindow; //
|
||||||
|
int TabFocusRequestCurrCounterRegular; // Any item being requested for focus, stored as an index (we on layout to be stable between the frame pressing TAB and the next frame, semi-ouch)
|
||||||
|
int TabFocusRequestCurrCounterTabStop; // Tab item being requested for focus, stored as an index
|
||||||
|
int TabFocusRequestNextCounterRegular; // Stored for next frame
|
||||||
|
int TabFocusRequestNextCounterTabStop; // "
|
||||||
|
bool TabFocusPressed; // Set in NewFrame() when user pressed Tab
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
float DimBgRatio; // 0.0..1.0 animation when fading in a dimming background (for modal window and CTRL+TAB list)
|
||||||
ImGuiMouseCursor MouseCursor;
|
ImGuiMouseCursor MouseCursor;
|
||||||
@ -1662,15 +1583,11 @@ struct ImGuiContext
|
|||||||
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size
|
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly, ImGuiPayload only holds pointer+size
|
||||||
unsigned char DragDropPayloadBufLocal[16]; // Local buffer for small payloads
|
unsigned char DragDropPayloadBufLocal[16]; // Local buffer for small payloads
|
||||||
|
|
||||||
// Clipper
|
|
||||||
int ClipperTempDataStacked;
|
|
||||||
ImVector<ImGuiListClipperData> ClipperTempData;
|
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
ImGuiTable* CurrentTable;
|
ImGuiTable* CurrentTable;
|
||||||
int TablesTempDataStacked; // Temporary table data size (because we leave previous instances undestructed, we generally don't use TablesTempData.Size)
|
int CurrentTableStackIdx;
|
||||||
ImVector<ImGuiTableTempData> TablesTempData; // Temporary table data (buffers reused/shared across instances, support nesting)
|
ImPool<ImGuiTable> Tables;
|
||||||
ImPool<ImGuiTable> Tables; // Persistent table data
|
ImVector<ImGuiTableTempData> TablesTempDataStack;
|
||||||
ImVector<float> TablesLastTimeActive; // Last used timestamp of each tables (SOA, for efficient GC)
|
ImVector<float> TablesLastTimeActive; // Last used timestamp of each tables (SOA, for efficient GC)
|
||||||
ImVector<ImDrawChannel> DrawChannelsTempMergeBuffer;
|
ImVector<ImDrawChannel> DrawChannelsTempMergeBuffer;
|
||||||
|
|
||||||
@ -1681,14 +1598,14 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiShrinkWidthItem> ShrinkWidthBuffer;
|
ImVector<ImGuiShrinkWidthItem> ShrinkWidthBuffer;
|
||||||
|
|
||||||
// Widget state
|
// Widget state
|
||||||
ImVec2 MouseLastValidPos;
|
ImVec2 LastValidMousePos;
|
||||||
ImGuiInputTextState InputTextState;
|
ImGuiInputTextState InputTextState;
|
||||||
ImFont InputTextPasswordFont;
|
ImFont InputTextPasswordFont;
|
||||||
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
ImGuiID TempInputId; // Temporary text input when CTRL+clicking on a slider, etc.
|
||||||
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
ImGuiColorEditFlags ColorEditOptions; // Store user options for color edit widgets
|
||||||
float ColorEditLastHue; // Backup of last Hue associated to LastColor, so we can restore Hue in lossy RGB<>HSV round trips
|
float ColorEditLastHue; // Backup of last Hue associated to LastColor[3], so we can restore Hue in lossy RGB<>HSV round trips
|
||||||
float ColorEditLastSat; // Backup of last Saturation associated to LastColor, so we can restore Saturation in lossy RGB<>HSV round trips
|
float ColorEditLastSat; // Backup of last Saturation associated to LastColor[3], so we can restore Saturation in lossy RGB<>HSV round trips
|
||||||
ImU32 ColorEditLastColor; // RGB value with alpha set to 0.
|
float ColorEditLastColor[3];
|
||||||
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
ImVec4 ColorPickerRef; // Initial/reference color at the time of opening the color picker.
|
||||||
ImGuiComboPreviewData ComboPreviewData;
|
ImGuiComboPreviewData ComboPreviewData;
|
||||||
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
float SliderCurrentAccum; // Accumulated slider delta when using navigation controls.
|
||||||
@ -1696,10 +1613,9 @@ struct ImGuiContext
|
|||||||
bool DragCurrentAccumDirty;
|
bool DragCurrentAccumDirty;
|
||||||
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
float DragCurrentAccum; // Accumulator for dragging modification. Always high-precision, not rounded by end-user precision settings
|
||||||
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
float DragSpeedDefaultRatio; // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio
|
||||||
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
|
||||||
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
float DisabledAlphaBackup; // Backup for style.Alpha for BeginDisabled()
|
||||||
short DisabledStackSize;
|
float ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||||
short TooltipOverrideCount;
|
int TooltipOverrideCount;
|
||||||
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
float TooltipSlowDelay; // Time before slow tooltips appears (FIXME: This is temporary until we merge in tooltip timer+priority work)
|
||||||
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
ImVector<char> ClipboardHandlerData; // If no custom clipboard handler is defined
|
||||||
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
ImVector<ImGuiID> MenusIdSubmittedThisFrame; // A list of menu IDs that were rendered at least once
|
||||||
@ -1734,9 +1650,8 @@ struct ImGuiContext
|
|||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
bool DebugItemPickerActive; // Item picker is active (started with DebugStartItemPicker())
|
||||||
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this ID
|
ImGuiID DebugItemPickerBreakId; // Will call IM_DEBUG_BREAK() when encountering this id
|
||||||
ImGuiMetricsConfig DebugMetricsConfig;
|
ImGuiMetricsConfig DebugMetricsConfig;
|
||||||
ImGuiStackTool DebugStackTool;
|
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
||||||
@ -1761,6 +1676,7 @@ struct ImGuiContext
|
|||||||
WithinFrameScope = WithinFrameScopeWithImplicitWindow = WithinEndChild = false;
|
WithinFrameScope = WithinFrameScopeWithImplicitWindow = WithinEndChild = false;
|
||||||
GcCompactAll = false;
|
GcCompactAll = false;
|
||||||
TestEngineHookItems = false;
|
TestEngineHookItems = false;
|
||||||
|
TestEngineHookIdInfo = 0;
|
||||||
TestEngine = NULL;
|
TestEngine = NULL;
|
||||||
|
|
||||||
WindowsActiveCount = 0;
|
WindowsActiveCount = 0;
|
||||||
@ -1771,7 +1687,6 @@ struct ImGuiContext
|
|||||||
WheelingWindow = NULL;
|
WheelingWindow = NULL;
|
||||||
WheelingWindowTimer = 0.0f;
|
WheelingWindowTimer = 0.0f;
|
||||||
|
|
||||||
DebugHookIdInfo = 0;
|
|
||||||
HoveredId = HoveredIdPreviousFrame = 0;
|
HoveredId = HoveredIdPreviousFrame = 0;
|
||||||
HoveredIdAllowOverlap = false;
|
HoveredIdAllowOverlap = false;
|
||||||
HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false;
|
HoveredIdUsingMouseWheel = HoveredIdPreviousFrameUsingMouseWheel = false;
|
||||||
@ -1802,15 +1717,16 @@ struct ImGuiContext
|
|||||||
LastActiveIdTimer = 0.0f;
|
LastActiveIdTimer = 0.0f;
|
||||||
|
|
||||||
CurrentItemFlags = ImGuiItemFlags_None;
|
CurrentItemFlags = ImGuiItemFlags_None;
|
||||||
BeginMenuCount = 0;
|
|
||||||
|
|
||||||
NavWindow = NULL;
|
NavWindow = NULL;
|
||||||
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavActivateInputId = 0;
|
NavId = NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
||||||
NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
NavJustTabbedId = NavJustMovedToId = NavJustMovedToFocusScopeId = NavNextActivateId = 0;
|
||||||
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
|
||||||
NavJustMovedToKeyMods = ImGuiKeyModFlags_None;
|
NavJustMovedToKeyMods = ImGuiKeyModFlags_None;
|
||||||
NavInputSource = ImGuiInputSource_None;
|
NavInputSource = ImGuiInputSource_None;
|
||||||
|
NavScoringRect = ImRect();
|
||||||
|
NavScoringCount = 0;
|
||||||
NavLayer = ImGuiNavLayer_Main;
|
NavLayer = ImGuiNavLayer_Main;
|
||||||
|
NavIdTabCounter = INT_MAX;
|
||||||
NavIdIsAlive = false;
|
NavIdIsAlive = false;
|
||||||
NavMousePosDirty = false;
|
NavMousePosDirty = false;
|
||||||
NavDisableHighlight = true;
|
NavDisableHighlight = true;
|
||||||
@ -1819,21 +1735,23 @@ struct ImGuiContext
|
|||||||
NavInitRequest = false;
|
NavInitRequest = false;
|
||||||
NavInitRequestFromMove = false;
|
NavInitRequestFromMove = false;
|
||||||
NavInitResultId = 0;
|
NavInitResultId = 0;
|
||||||
NavMoveSubmitted = false;
|
NavMoveRequest = false;
|
||||||
NavMoveScoringItems = false;
|
NavMoveRequestFlags = ImGuiNavMoveFlags_None;
|
||||||
NavMoveForwardToNextFrame = false;
|
NavMoveRequestForward = ImGuiNavForward_None;
|
||||||
NavMoveFlags = ImGuiNavMoveFlags_None;
|
NavMoveRequestKeyMods = ImGuiKeyModFlags_None;
|
||||||
NavMoveScrollFlags = ImGuiScrollFlags_None;
|
NavMoveDir = NavMoveDirLast = NavMoveClipDir = ImGuiDir_None;
|
||||||
NavMoveKeyMods = ImGuiKeyModFlags_None;
|
NavWrapRequestWindow = NULL;
|
||||||
NavMoveDir = NavMoveDirForDebug = NavMoveClipDir = ImGuiDir_None;
|
NavWrapRequestFlags = ImGuiNavMoveFlags_None;
|
||||||
NavScoringDebugCount = 0;
|
|
||||||
NavTabbingDir = 0;
|
|
||||||
NavTabbingCounter = 0;
|
|
||||||
|
|
||||||
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
NavWindowingTarget = NavWindowingTargetAnim = NavWindowingListWindow = NULL;
|
||||||
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
NavWindowingTimer = NavWindowingHighlightAlpha = 0.0f;
|
||||||
NavWindowingToggleLayer = false;
|
NavWindowingToggleLayer = false;
|
||||||
|
|
||||||
|
TabFocusRequestCurrWindow = TabFocusRequestNextWindow = NULL;
|
||||||
|
TabFocusRequestCurrCounterRegular = TabFocusRequestCurrCounterTabStop = INT_MAX;
|
||||||
|
TabFocusRequestNextCounterRegular = TabFocusRequestNextCounterTabStop = INT_MAX;
|
||||||
|
TabFocusPressed = false;
|
||||||
|
|
||||||
DimBgRatio = 0.0f;
|
DimBgRatio = 0.0f;
|
||||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||||
|
|
||||||
@ -1849,23 +1767,21 @@ struct ImGuiContext
|
|||||||
DragDropHoldJustPressedId = 0;
|
DragDropHoldJustPressedId = 0;
|
||||||
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
|
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
|
||||||
|
|
||||||
ClipperTempDataStacked = 0;
|
|
||||||
|
|
||||||
CurrentTable = NULL;
|
CurrentTable = NULL;
|
||||||
TablesTempDataStacked = 0;
|
CurrentTableStackIdx = -1;
|
||||||
CurrentTabBar = NULL;
|
CurrentTabBar = NULL;
|
||||||
|
|
||||||
|
LastValidMousePos = ImVec2(0.0f, 0.0f);
|
||||||
TempInputId = 0;
|
TempInputId = 0;
|
||||||
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
ColorEditOptions = ImGuiColorEditFlags_DefaultOptions_;
|
||||||
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
ColorEditLastHue = ColorEditLastSat = 0.0f;
|
||||||
ColorEditLastColor = 0;
|
ColorEditLastColor[0] = ColorEditLastColor[1] = ColorEditLastColor[2] = FLT_MAX;
|
||||||
SliderCurrentAccum = 0.0f;
|
SliderCurrentAccum = 0.0f;
|
||||||
SliderCurrentAccumDirty = false;
|
SliderCurrentAccumDirty = false;
|
||||||
DragCurrentAccumDirty = false;
|
DragCurrentAccumDirty = false;
|
||||||
DragCurrentAccum = 0.0f;
|
DragCurrentAccum = 0.0f;
|
||||||
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
DragSpeedDefaultRatio = 1.0f / 100.0f;
|
||||||
DisabledAlphaBackup = 0.0f;
|
DisabledAlphaBackup = 0.0f;
|
||||||
DisabledStackSize = 0;
|
|
||||||
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
ScrollbarClickDeltaToGrabCenter = 0.0f;
|
||||||
TooltipOverrideCount = 0;
|
TooltipOverrideCount = 0;
|
||||||
TooltipSlowDelay = 0.50f;
|
TooltipSlowDelay = 0.50f;
|
||||||
@ -1919,7 +1835,6 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
|
ImVec1 Indent; // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)
|
||||||
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
ImVec1 ColumnsOffset; // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.
|
||||||
ImVec1 GroupOffset;
|
ImVec1 GroupOffset;
|
||||||
ImVec2 CursorStartPosLossyness;// Record the loss of precision of CursorStartPos due to really large scrolling amount. This is used by clipper to compensentate and fix the most common use case of large scroll area.
|
|
||||||
|
|
||||||
// Keyboard/Gamepad navigation
|
// Keyboard/Gamepad navigation
|
||||||
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
ImGuiNavLayer NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
||||||
@ -1941,6 +1856,8 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
int CurrentTableIdx; // Current table index (into g.Tables)
|
int CurrentTableIdx; // Current table index (into g.Tables)
|
||||||
ImGuiLayoutType LayoutType;
|
ImGuiLayoutType LayoutType;
|
||||||
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||||||
|
int FocusCounterRegular; // (Legacy Focus/Tabbing system) Sequential counter, start at -1 and increase as assigned via FocusableItemRegister() (FIXME-NAV: Needs redesign)
|
||||||
|
int FocusCounterTabStop; // (Legacy Focus/Tabbing system) Same, but only count widgets which you can Tab through.
|
||||||
|
|
||||||
// Local parameters stacks
|
// Local parameters stacks
|
||||||
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
||||||
@ -1948,6 +1865,7 @@ struct IMGUI_API ImGuiWindowTempData
|
|||||||
float TextWrapPos; // Current text wrap pos.
|
float TextWrapPos; // Current text wrap pos.
|
||||||
ImVector<float> ItemWidthStack; // Store item widths to restore (attention: .back() is not == ItemWidth)
|
ImVector<float> ItemWidthStack; // Store item widths to restore (attention: .back() is not == ItemWidth)
|
||||||
ImVector<float> TextWrapPosStack; // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
|
ImVector<float> TextWrapPosStack; // Store text wrap pos to restore (attention: .back() is not == TextWrapPos)
|
||||||
|
ImGuiStackSizes StackSizesOnBegin; // Store size of various stacks for asserting
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for one window
|
// Storage for one window
|
||||||
@ -1984,7 +1902,6 @@ struct IMGUI_API ImGuiWindow
|
|||||||
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
||||||
bool Hidden; // Do not display (== HiddenFrames*** > 0)
|
bool Hidden; // Do not display (== HiddenFrames*** > 0)
|
||||||
bool IsFallbackWindow; // Set on the "Debug##Default" window.
|
bool IsFallbackWindow; // Set on the "Debug##Default" window.
|
||||||
bool IsExplicitChild; // Set when passed _ChildWindow, left to false by BeginDocked()
|
|
||||||
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
|
bool HasCloseButton; // Set when the window has a close button (p_open != NULL)
|
||||||
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
|
signed char ResizeBorderHeld; // Current border being held for resize (-1: none, otherwise 0-3)
|
||||||
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
|
short BeginCount; // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)
|
||||||
@ -2031,10 +1948,8 @@ struct IMGUI_API ImGuiWindow
|
|||||||
|
|
||||||
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
||||||
ImDrawList DrawListInst;
|
ImDrawList DrawListInst;
|
||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup _or_ docked window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* ParentWindowInBeginStack;
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window == Top-level window.
|
||||||
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window. Doesn't cross through popups/dock nodes.
|
|
||||||
ImGuiWindow* RootWindowPopupTree; // Point to ourself or first ancestor that is not a child window. Cross through popups parent<>child.
|
|
||||||
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
|
|
||||||
@ -2106,7 +2021,7 @@ struct ImGuiTabItem
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Storage for a tab bar (sizeof() 152 bytes)
|
// Storage for a tab bar (sizeof() 152 bytes)
|
||||||
struct IMGUI_API ImGuiTabBar
|
struct ImGuiTabBar
|
||||||
{
|
{
|
||||||
ImVector<ImGuiTabItem> Tabs;
|
ImVector<ImGuiTabItem> Tabs;
|
||||||
ImGuiTabBarFlags Flags;
|
ImGuiTabBarFlags Flags;
|
||||||
@ -2231,7 +2146,7 @@ struct ImGuiTableCellData
|
|||||||
};
|
};
|
||||||
|
|
||||||
// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
|
// FIXME-TABLE: more transient data could be stored in a per-stacked table structure: DrawSplitter, SortSpecs, incoming RowData
|
||||||
struct IMGUI_API ImGuiTable
|
struct ImGuiTable
|
||||||
{
|
{
|
||||||
ImGuiID ID;
|
ImGuiID ID;
|
||||||
ImGuiTableFlags Flags;
|
ImGuiTableFlags Flags;
|
||||||
@ -2337,14 +2252,14 @@ struct IMGUI_API ImGuiTable
|
|||||||
bool MemoryCompacted;
|
bool MemoryCompacted;
|
||||||
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
bool HostSkipItems; // Backup of InnerWindow->SkipItem at the end of BeginTable(), because we will overwrite InnerWindow->SkipItem on a per-column basis
|
||||||
|
|
||||||
ImGuiTable() { memset(this, 0, sizeof(*this)); LastFrameActive = -1; }
|
IMGUI_API ImGuiTable() { memset(this, 0, sizeof(*this)); LastFrameActive = -1; }
|
||||||
~ImGuiTable() { IM_FREE(RawData); }
|
IMGUI_API ~ImGuiTable() { IM_FREE(RawData); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
|
// Transient data that are only needed between BeginTable() and EndTable(), those buffers are shared (1 per level of stacked table).
|
||||||
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
|
// - Accessing those requires chasing an extra pointer so for very frequently used data we leave them in the main table structure.
|
||||||
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
|
// - We also leave out of this structure data that tend to be particularly useful for debugging/metrics.
|
||||||
struct IMGUI_API ImGuiTableTempData
|
struct ImGuiTableTempData
|
||||||
{
|
{
|
||||||
int TableIndex; // Index in g.Tables.Buf[] pool
|
int TableIndex; // Index in g.Tables.Buf[] pool
|
||||||
float LastTimeActive; // Last timestamp this structure was used
|
float LastTimeActive; // Last timestamp this structure was used
|
||||||
@ -2361,7 +2276,7 @@ struct IMGUI_API ImGuiTableTempData
|
|||||||
float HostBackupItemWidth; // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
|
float HostBackupItemWidth; // Backup of OuterWindow->DC.ItemWidth at the end of BeginTable()
|
||||||
int HostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()
|
int HostBackupItemWidthStackSize;//Backup of OuterWindow->DC.ItemWidthStack.Size at the end of BeginTable()
|
||||||
|
|
||||||
ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }
|
IMGUI_API ImGuiTableTempData() { memset(this, 0, sizeof(*this)); LastTimeActive = -1.0f; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// sizeof() ~ 12
|
// sizeof() ~ 12
|
||||||
@ -2420,16 +2335,13 @@ namespace ImGui
|
|||||||
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
|
||||||
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
|
||||||
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
|
||||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent, bool popup_hierarchy);
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||||||
IMGUI_API bool IsWindowWithinBeginStackOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
|
||||||
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
|
||||||
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||||
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
|
||||||
IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);
|
||||||
IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);
|
IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);
|
||||||
IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size);
|
IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size);
|
||||||
inline ImRect WindowRectAbsToRel(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x - off.x, r.Min.y - off.y, r.Max.x - off.x, r.Max.y - off.y); }
|
|
||||||
inline ImRect WindowRectRelToAbs(ImGuiWindow* window, const ImRect& r) { ImVec2 off = window->DC.CursorStartPos; return ImRect(r.Min.x + off.x, r.Min.y + off.y, r.Max.x + off.x, r.Max.y + off.y); }
|
|
||||||
|
|
||||||
// Windows: Display Order and Focus Order
|
// Windows: Display Order and Focus Order
|
||||||
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
IMGUI_API void FocusWindow(ImGuiWindow* window);
|
||||||
@ -2437,9 +2349,6 @@ namespace ImGui
|
|||||||
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToFocusFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
IMGUI_API void BringWindowToDisplayBack(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToDisplayBehind(ImGuiWindow* window, ImGuiWindow* above_window);
|
|
||||||
IMGUI_API int FindWindowDisplayIndex(ImGuiWindow* window);
|
|
||||||
IMGUI_API ImGuiWindow* FindBottomMostVisibleWindowWithinBeginStack(ImGuiWindow* window);
|
|
||||||
|
|
||||||
// Fonts, drawing
|
// Fonts, drawing
|
||||||
IMGUI_API void SetCurrentFont(ImFont* font);
|
IMGUI_API void SetCurrentFont(ImFont* font);
|
||||||
@ -2478,14 +2387,7 @@ namespace ImGui
|
|||||||
IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y);
|
IMGUI_API void SetScrollY(ImGuiWindow* window, float scroll_y);
|
||||||
IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio);
|
IMGUI_API void SetScrollFromPosX(ImGuiWindow* window, float local_x, float center_x_ratio);
|
||||||
IMGUI_API void SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio);
|
IMGUI_API void SetScrollFromPosY(ImGuiWindow* window, float local_y, float center_y_ratio);
|
||||||
|
IMGUI_API ImVec2 ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& item_rect);
|
||||||
// Early work-in-progress API (ScrollToItem() will become public)
|
|
||||||
IMGUI_API void ScrollToItem(ImGuiScrollFlags flags = 0);
|
|
||||||
IMGUI_API void ScrollToRect(ImGuiWindow* window, const ImRect& rect, ImGuiScrollFlags flags = 0);
|
|
||||||
IMGUI_API ImVec2 ScrollToRectEx(ImGuiWindow* window, const ImRect& rect, ImGuiScrollFlags flags = 0);
|
|
||||||
//#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
|
||||||
inline void ScrollToBringRectIntoView(ImGuiWindow* window, const ImRect& rect) { ScrollToRect(window, rect, ImGuiScrollFlags_KeepVisibleEdgeY); }
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
// Basic Accessors
|
// Basic Accessors
|
||||||
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
inline ImGuiID GetItemID() { ImGuiContext& g = *GImGui; return g.LastItemData.ID; } // Get ID of last item (~~ often same ImGui::GetID(label) beforehand)
|
||||||
@ -2506,10 +2408,10 @@ namespace ImGui
|
|||||||
// Basic Helpers for widget code
|
// Basic Helpers for widget code
|
||||||
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);
|
IMGUI_API void ItemSize(const ImVec2& size, float text_baseline_y = -1.0f);
|
||||||
IMGUI_API void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f);
|
IMGUI_API void ItemSize(const ImRect& bb, float text_baseline_y = -1.0f);
|
||||||
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemFlags extra_flags = 0);
|
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL, ImGuiItemAddFlags flags = 0);
|
||||||
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id);
|
IMGUI_API void ItemFocusable(ImGuiWindow* window, ImGuiID id);
|
||||||
IMGUI_API void SetLastItemData(ImGuiID item_id, ImGuiItemFlags in_flags, ImGuiItemStatusFlags status_flags, const ImRect& item_rect);
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
||||||
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
IMGUI_API ImVec2 CalcItemSize(ImVec2 size, float default_w, float default_h);
|
||||||
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
IMGUI_API float CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);
|
||||||
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
IMGUI_API void PushMultiItemsWidths(int components, float width_full);
|
||||||
@ -2522,14 +2424,12 @@ namespace ImGui
|
|||||||
IMGUI_API void PopItemFlag();
|
IMGUI_API void PopItemFlag();
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
// Currently refactoring focus/nav/tabbing system
|
|
||||||
// If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
|
// If you have old/custom copy-and-pasted widgets that used FocusableItemRegister():
|
||||||
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool tab_focused = FocusableItemRegister(...)'
|
// (Old) IMGUI_VERSION_NUM < 18209: using 'ItemAdd(....)' and 'bool focused = FocusableItemRegister(...)'
|
||||||
// (Old) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
|
// (New) IMGUI_VERSION_NUM >= 18209: using 'ItemAdd(..., ImGuiItemAddFlags_Focusable)' and 'bool focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_Focused) != 0'
|
||||||
// (New) IMGUI_VERSION_NUM >= 18413: using 'ItemAdd(..., ImGuiItemFlags_Inputable)' and 'bool tab_focused = (GetItemStatusFlags() & ImGuiItemStatusFlags_FocusedTabbing) != 0 || g.NavActivateInputId == id' (WIP)
|
|
||||||
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
|
// Widget code are simplified as there's no need to call FocusableItemUnregister() while managing the transition from regular widget to TempInputText()
|
||||||
inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Inputable flag to ItemAdd()
|
inline bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id) { IM_ASSERT(0); IM_UNUSED(window); IM_UNUSED(id); return false; } // -> pass ImGuiItemAddFlags_Focusable flag to ItemAdd()
|
||||||
inline void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
inline IM_NORETURN void FocusableItemUnregister(ImGuiWindow* window) { IM_ASSERT(0); IM_UNUSED(window); } // -> unnecessary: TempInputText() uses ImGuiInputTextFlags_MergedItem
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Logging/Capture
|
// Logging/Capture
|
||||||
@ -2543,19 +2443,16 @@ namespace ImGui
|
|||||||
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
IMGUI_API void OpenPopupEx(ImGuiID id, ImGuiPopupFlags popup_flags = ImGuiPopupFlags_None);
|
||||||
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
IMGUI_API void ClosePopupToLevel(int remaining, bool restore_focus_to_window_under_popup);
|
||||||
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window, bool restore_focus_to_window_under_popup);
|
||||||
IMGUI_API void ClosePopupsExceptModals();
|
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);
|
IMGUI_API bool IsPopupOpen(ImGuiID id, ImGuiPopupFlags popup_flags);
|
||||||
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
||||||
IMGUI_API void BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags);
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, ImGuiTooltipFlags tooltip_flags);
|
||||||
IMGUI_API ImRect GetPopupAllowedExtentRect(ImGuiWindow* window);
|
IMGUI_API ImRect GetPopupAllowedExtentRect(ImGuiWindow* window);
|
||||||
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
IMGUI_API ImGuiWindow* GetTopMostPopupModal();
|
||||||
IMGUI_API ImGuiWindow* GetTopMostAndVisiblePopupModal();
|
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
IMGUI_API ImVec2 FindBestWindowPosForPopup(ImGuiWindow* window);
|
||||||
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);
|
IMGUI_API ImVec2 FindBestWindowPosForPopupEx(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_outer, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy);
|
||||||
|
IMGUI_API bool BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
IMGUI_API bool BeginViewportSideBar(const char* name, ImGuiViewport* viewport, ImGuiDir dir, float size, ImGuiWindowFlags window_flags);
|
|
||||||
IMGUI_API bool BeginMenuEx(const char* label, const char* icon, bool enabled = true);
|
|
||||||
IMGUI_API bool MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);
|
IMGUI_API bool MenuItemEx(const char* label, const char* icon, const char* shortcut = NULL, bool selected = false, bool enabled = true);
|
||||||
|
|
||||||
// Combos
|
// Combos
|
||||||
@ -2565,13 +2462,9 @@ namespace ImGui
|
|||||||
|
|
||||||
// Gamepad/Keyboard Navigation
|
// Gamepad/Keyboard Navigation
|
||||||
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
||||||
IMGUI_API void NavInitRequestApplyResult();
|
|
||||||
IMGUI_API bool NavMoveRequestButNoResultYet();
|
IMGUI_API bool NavMoveRequestButNoResultYet();
|
||||||
IMGUI_API void NavMoveRequestSubmit(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
|
|
||||||
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, ImGuiNavMoveFlags move_flags, ImGuiScrollFlags scroll_flags);
|
|
||||||
IMGUI_API void NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result);
|
|
||||||
IMGUI_API void NavMoveRequestCancel();
|
IMGUI_API void NavMoveRequestCancel();
|
||||||
IMGUI_API void NavMoveRequestApplyResult();
|
IMGUI_API void NavMoveRequestForward(ImGuiDir move_dir, ImGuiDir clip_dir, const ImRect& bb_rel, ImGuiNavMoveFlags move_flags);
|
||||||
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
IMGUI_API void NavMoveRequestTryWrapping(ImGuiWindow* window, ImGuiNavMoveFlags move_flags);
|
||||||
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
||||||
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
||||||
@ -2717,7 +2610,7 @@ namespace ImGui
|
|||||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
||||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||||
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, ImS64* p_scroll_v, ImS64 avail_v, ImS64 contents_v, ImDrawFlags flags);
|
IMGUI_API bool ScrollbarEx(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float* p_scroll_v, float avail_v, float contents_v, ImDrawFlags flags);
|
||||||
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
IMGUI_API bool ImageButtonEx(ImGuiID id, ImTextureID texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec2& padding, const ImVec4& bg_col, const ImVec4& tint_col);
|
||||||
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImRect GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
IMGUI_API ImGuiID GetWindowScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||||
@ -2780,12 +2673,10 @@ namespace ImGui
|
|||||||
|
|
||||||
// Debug Tools
|
// Debug Tools
|
||||||
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
IMGUI_API void ErrorCheckEndFrameRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
||||||
IMGUI_API void ErrorCheckEndWindowRecover(ImGuiErrorLogCallback log_callback, void* user_data = NULL);
|
|
||||||
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
inline void DebugDrawItemRect(ImU32 col = IM_COL32(255,0,0,255)) { ImGuiContext& g = *GImGui; ImGuiWindow* window = g.CurrentWindow; GetForegroundDrawList(window)->AddRect(g.LastItemData.Rect.Min, g.LastItemData.Rect.Max, col); }
|
||||||
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
inline void DebugStartItemPicker() { ImGuiContext& g = *GImGui; g.DebugItemPickerActive = true; }
|
||||||
|
|
||||||
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
IMGUI_API void ShowFontAtlas(ImFontAtlas* atlas);
|
||||||
IMGUI_API void DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* data_id, const void* data_id_end);
|
|
||||||
IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns);
|
IMGUI_API void DebugNodeColumns(ImGuiOldColumns* columns);
|
||||||
IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label);
|
IMGUI_API void DebugNodeDrawList(ImGuiWindow* window, const ImDrawList* draw_list, const char* label);
|
||||||
IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb);
|
IMGUI_API void DebugNodeDrawCmdShowMeshAndBoundingBox(ImDrawList* out_draw_list, const ImDrawList* draw_list, const ImDrawCmd* draw_cmd, bool show_mesh, bool show_aabb);
|
||||||
@ -2797,7 +2688,6 @@ namespace ImGui
|
|||||||
IMGUI_API void DebugNodeWindow(ImGuiWindow* window, const char* label);
|
IMGUI_API void DebugNodeWindow(ImGuiWindow* window, const char* label);
|
||||||
IMGUI_API void DebugNodeWindowSettings(ImGuiWindowSettings* settings);
|
IMGUI_API void DebugNodeWindowSettings(ImGuiWindowSettings* settings);
|
||||||
IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);
|
IMGUI_API void DebugNodeWindowsList(ImVector<ImGuiWindow*>* windows, const char* label);
|
||||||
IMGUI_API void DebugNodeWindowsListByBeginStackParent(ImGuiWindow** windows, int windows_size, ImGuiWindow* parent_in_begin_stack);
|
|
||||||
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
IMGUI_API void DebugNodeViewport(ImGuiViewportP* viewport);
|
||||||
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
IMGUI_API void DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP* viewport, const ImRect& bb);
|
||||||
|
|
||||||
@ -2832,12 +2722,14 @@ IMGUI_API void ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table
|
|||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id);
|
extern void ImGuiTestEngineHook_ItemAdd(ImGuiContext* ctx, const ImRect& bb, ImGuiID id);
|
||||||
extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags);
|
extern void ImGuiTestEngineHook_ItemInfo(ImGuiContext* ctx, ImGuiID id, const char* label, ImGuiItemStatusFlags flags);
|
||||||
|
extern void ImGuiTestEngineHook_IdInfo(ImGuiContext* ctx, ImGuiDataType data_type, ImGuiID id, const void* data_id);
|
||||||
|
extern void ImGuiTestEngineHook_IdInfo(ImGuiContext* ctx, ImGuiDataType data_type, ImGuiID id, const void* data_id, const void* data_id_end);
|
||||||
extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...);
|
extern void ImGuiTestEngineHook_Log(ImGuiContext* ctx, const char* fmt, ...);
|
||||||
extern const char* ImGuiTestEngine_FindItemDebugLabel(ImGuiContext* ctx, ImGuiID id);
|
|
||||||
|
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box
|
#define IMGUI_TEST_ENGINE_ITEM_ADD(_BB,_ID) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemAdd(&g, _BB, _ID) // Register item bounding box
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) if (g.TestEngineHookItems) ImGuiTestEngineHook_ItemInfo(&g, _ID, _LABEL, _FLAGS) // Register item label and status flags (optional)
|
||||||
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log
|
#define IMGUI_TEST_ENGINE_LOG(_FMT,...) if (g.TestEngineHookItems) ImGuiTestEngineHook_Log(&g, _FMT, __VA_ARGS__) // Custom log entry from user land into test log
|
||||||
|
#define IMGUI_TEST_ENGINE_ID_INFO(_ID,_TYPE,_DATA) if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA));
|
||||||
|
#define IMGUI_TEST_ENGINE_ID_INFO2(_ID,_TYPE,_DATA,_DATA2) if (g.TestEngineHookIdInfo == _ID) ImGuiTestEngineHook_IdInfo(&g, _TYPE, _ID, (const void*)(_DATA), (const void*)(_DATA2));
|
||||||
#else
|
#else
|
||||||
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0)
|
#define IMGUI_TEST_ENGINE_ITEM_INFO(_ID,_LABEL,_FLAGS) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86
|
// dear imgui, v1.84b
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -324,7 +324,7 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
const ImVec2 avail_size = GetContentRegionAvail();
|
const ImVec2 avail_size = GetContentRegionAvail();
|
||||||
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
ImVec2 actual_outer_size = CalcItemSize(outer_size, ImMax(avail_size.x, 1.0f), use_child_window ? ImMax(avail_size.y, 1.0f) : 0.0f);
|
||||||
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
ImRect outer_rect(outer_window->DC.CursorPos, outer_window->DC.CursorPos + actual_outer_size);
|
||||||
if (use_child_window && IsClippedEx(outer_rect, 0))
|
if (use_child_window && IsClippedEx(outer_rect, 0, false))
|
||||||
{
|
{
|
||||||
ItemSize(outer_rect);
|
ItemSize(outer_rect);
|
||||||
return false;
|
return false;
|
||||||
@ -340,9 +340,10 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
|
|
||||||
// Acquire temporary buffers
|
// Acquire temporary buffers
|
||||||
const int table_idx = g.Tables.GetIndex(table);
|
const int table_idx = g.Tables.GetIndex(table);
|
||||||
if (++g.TablesTempDataStacked > g.TablesTempData.Size)
|
g.CurrentTableStackIdx++;
|
||||||
g.TablesTempData.resize(g.TablesTempDataStacked, ImGuiTableTempData());
|
if (g.CurrentTableStackIdx + 1 > g.TablesTempDataStack.Size)
|
||||||
ImGuiTableTempData* temp_data = table->TempData = &g.TablesTempData[g.TablesTempDataStacked - 1];
|
g.TablesTempDataStack.resize(g.CurrentTableStackIdx + 1, ImGuiTableTempData());
|
||||||
|
ImGuiTableTempData* temp_data = table->TempData = &g.TablesTempDataStack[g.CurrentTableStackIdx];
|
||||||
temp_data->TableIndex = table_idx;
|
temp_data->TableIndex = table_idx;
|
||||||
table->DrawSplitter = &table->TempData->DrawSplitter;
|
table->DrawSplitter = &table->TempData->DrawSplitter;
|
||||||
table->DrawSplitter->Clear();
|
table->DrawSplitter->Clear();
|
||||||
@ -563,7 +564,6 @@ bool ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG
|
|||||||
// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)
|
// + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables)
|
||||||
// + 1 (for table->RawData allocated below)
|
// + 1 (for table->RawData allocated below)
|
||||||
// + 1 (for table->ColumnsNames, if names are used)
|
// + 1 (for table->ColumnsNames, if names are used)
|
||||||
// Shared allocations per number of nested tables
|
|
||||||
// + 1 (for table->Splitter._Channels)
|
// + 1 (for table->Splitter._Channels)
|
||||||
// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)
|
// + 2 * active_channels_count (for ImDrawCmd and ImDrawIdx buffers inside channels)
|
||||||
// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.
|
// Where active_channels_count is variable but often == columns_count or columns_count + 1, see TableSetupDrawChannels() for details.
|
||||||
@ -1170,7 +1170,7 @@ void ImGui::TableUpdateBorders(ImGuiTable* table)
|
|||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick | ImGuiButtonFlags_NoNavFocus);
|
bool pressed = ButtonBehavior(hit_rect, column_id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnDoubleClick);
|
||||||
if (pressed && IsMouseDoubleClicked(0))
|
if (pressed && IsMouseDoubleClicked(0))
|
||||||
{
|
{
|
||||||
TableSetColumnWidthAutoSingle(table, column_n);
|
TableSetColumnWidthAutoSingle(table, column_n);
|
||||||
@ -1381,8 +1381,9 @@ void ImGui::EndTable()
|
|||||||
|
|
||||||
// Clear or restore current table, if any
|
// Clear or restore current table, if any
|
||||||
IM_ASSERT(g.CurrentWindow == outer_window && g.CurrentTable == table);
|
IM_ASSERT(g.CurrentWindow == outer_window && g.CurrentTable == table);
|
||||||
IM_ASSERT(g.TablesTempDataStacked > 0);
|
IM_ASSERT(g.CurrentTableStackIdx >= 0);
|
||||||
temp_data = (--g.TablesTempDataStacked > 0) ? &g.TablesTempData[g.TablesTempDataStacked - 1] : NULL;
|
g.CurrentTableStackIdx--;
|
||||||
|
temp_data = g.CurrentTableStackIdx >= 0 ? &g.TablesTempDataStack[g.CurrentTableStackIdx] : NULL;
|
||||||
g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;
|
g.CurrentTable = temp_data ? g.Tables.GetByIndex(temp_data->TableIndex) : NULL;
|
||||||
if (g.CurrentTable)
|
if (g.CurrentTable)
|
||||||
{
|
{
|
||||||
@ -1478,7 +1479,6 @@ void ImGui::TableSetupScrollFreeze(int columns, int rows)
|
|||||||
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
|
table->IsUnfrozenRows = (table->FreezeRowsCount == 0); // Make sure this is set before TableUpdateLayout() so ImGuiListClipper can benefit from it.b
|
||||||
|
|
||||||
// Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.
|
// Ensure frozen columns are ordered in their section. We still allow multiple frozen columns to be reordered.
|
||||||
// FIXME-TABLE: This work for preserving 2143 into 21|43. How about 4321 turning into 21|43? (preserve relative order in each section)
|
|
||||||
for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)
|
for (int column_n = 0; column_n < table->FreezeColumnsRequest; column_n++)
|
||||||
{
|
{
|
||||||
int order_n = table->DisplayOrderToIndex[column_n];
|
int order_n = table->DisplayOrderToIndex[column_n];
|
||||||
@ -3987,7 +3987,7 @@ void ImGui::EndColumns()
|
|||||||
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
const float column_hit_hw = COLUMNS_HIT_RECT_HALF_WIDTH;
|
||||||
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
const ImRect column_hit_rect(ImVec2(x - column_hit_hw, y1), ImVec2(x + column_hit_hw, y2));
|
||||||
KeepAliveID(column_id);
|
KeepAliveID(column_id);
|
||||||
if (IsClippedEx(column_hit_rect, column_id)) // FIXME: Can be removed or replaced with a lower-level test
|
if (IsClippedEx(column_hit_rect, column_id, false))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool hovered = false, held = false;
|
bool hovered = false, held = false;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021/08/23: fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL.
|
|
||||||
// 2021/03/05: added ImGuiFreeTypeBuilderFlags_Bitmap to load bitmap glyphs.
|
// 2021/03/05: added ImGuiFreeTypeBuilderFlags_Bitmap to load bitmap glyphs.
|
||||||
// 2021/03/02: set 'atlas->TexPixelsUseColors = true' to help some backends with deciding of a prefered texture format.
|
// 2021/03/02: set 'atlas->TexPixelsUseColors = true' to help some backends with deciding of a prefered texture format.
|
||||||
// 2021/01/28: added support for color-layered glyphs via ImGuiFreeTypeBuilderFlags_LoadColor (require Freetype 2.10+).
|
// 2021/01/28: added support for color-layered glyphs via ImGuiFreeTypeBuilderFlags_LoadColor (require Freetype 2.10+).
|
||||||
@ -226,12 +225,6 @@ namespace
|
|||||||
uint32_t glyph_index = FT_Get_Char_Index(Face, codepoint);
|
uint32_t glyph_index = FT_Get_Char_Index(Face, codepoint);
|
||||||
if (glyph_index == 0)
|
if (glyph_index == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// If this crash for you: FreeType 2.11.0 has a crash bug on some bitmap/colored fonts.
|
|
||||||
// - https://gitlab.freedesktop.org/freetype/freetype/-/issues/1076
|
|
||||||
// - https://github.com/ocornut/imgui/issues/4567
|
|
||||||
// - https://github.com/ocornut/imgui/issues/4566
|
|
||||||
// You can use FreeType 2.10, or the patched version of 2.11.0 in VcPkg, or probably any upcoming FreeType version.
|
|
||||||
FT_Error error = FT_Load_Glyph(Face, glyph_index, LoadFlags);
|
FT_Error error = FT_Load_Glyph(Face, glyph_index, LoadFlags);
|
||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -546,8 +539,7 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u
|
|||||||
|
|
||||||
// Render glyph into a bitmap (currently held by FreeType)
|
// Render glyph into a bitmap (currently held by FreeType)
|
||||||
const FT_Bitmap* ft_bitmap = src_tmp.Font.RenderGlyphAndGetInfo(&src_glyph.Info);
|
const FT_Bitmap* ft_bitmap = src_tmp.Font.RenderGlyphAndGetInfo(&src_glyph.Info);
|
||||||
if (ft_bitmap == NULL)
|
IM_ASSERT(ft_bitmap);
|
||||||
continue;
|
|
||||||
|
|
||||||
// Allocate new temporary chunk if needed
|
// Allocate new temporary chunk if needed
|
||||||
const int bitmap_size_in_bytes = src_glyph.Info.Width * src_glyph.Info.Height * 4;
|
const int bitmap_size_in_bytes = src_glyph.Info.Width * src_glyph.Info.Height * 4;
|
||||||
|
Reference in New Issue
Block a user