Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d02c645e38 | ||
|
|
49ee151ed6 | ||
|
|
b76ab6232d | ||
|
|
6dbda97fee | ||
|
|
90743d3112 | ||
|
|
14a500a476 | ||
|
|
6cc99a6e2b | ||
|
|
a103826154 | ||
|
|
0db591935f | ||
|
|
1fbab15c0a | ||
|
|
7546f1eb16 | ||
|
|
5220c14f4b | ||
|
|
378cb85bf0 | ||
|
|
5aa7d61139 | ||
|
|
03a9946a14 |
@@ -274,7 +274,7 @@ void ImGui_ImplOpenGL2_UpdateTexture(ImTextureData* tex)
|
|||||||
{
|
{
|
||||||
// Create and upload new texture to graphics system
|
// Create and upload new texture to graphics system
|
||||||
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
|
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
|
||||||
IM_ASSERT(tex->TexID == 0 && tex->BackendUserData == nullptr);
|
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
|
||||||
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
|
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
|
||||||
const void* pixels = tex->GetPixels();
|
const void* pixels = tex->GetPixels();
|
||||||
GLuint gl_texture_id = 0;
|
GLuint gl_texture_id = 0;
|
||||||
|
|||||||
@@ -744,7 +744,7 @@ void ImGui_ImplOpenGL3_UpdateTexture(ImTextureData* tex)
|
|||||||
{
|
{
|
||||||
// Create and upload new texture to graphics system
|
// Create and upload new texture to graphics system
|
||||||
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
|
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
|
||||||
IM_ASSERT(tex->TexID == 0 && tex->BackendUserData == nullptr);
|
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
|
||||||
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
|
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
|
||||||
const void* pixels = tex->GetPixels();
|
const void* pixels = tex->GetPixels();
|
||||||
GLuint gl_texture_id = 0;
|
GLuint gl_texture_id = 0;
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ void ImGui_ImplSDLRenderer3_UpdateTexture(ImTextureData* tex)
|
|||||||
{
|
{
|
||||||
// Create and upload new texture to graphics system
|
// Create and upload new texture to graphics system
|
||||||
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
|
//IMGUI_DEBUG_LOG("UpdateTexture #%03d: WantCreate %dx%d\n", tex->UniqueID, tex->Width, tex->Height);
|
||||||
IM_ASSERT(tex->TexID == 0 && tex->BackendUserData == nullptr);
|
IM_ASSERT(tex->TexID == ImTextureID_Invalid && tex->BackendUserData == nullptr);
|
||||||
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
|
IM_ASSERT(tex->Format == ImTextureFormat_RGBA32);
|
||||||
|
|
||||||
// Create texture
|
// Create texture
|
||||||
|
|||||||
@@ -1,324 +0,0 @@
|
|||||||
// imgui_impl_sdlsurface2.cpp
|
|
||||||
// CPU-only SDL_Surface backend for Dear ImGui
|
|
||||||
|
|
||||||
#include "imgui_impl_sdlsurface2.h"
|
|
||||||
#include "imgui.h"
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <cstring>
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
// No clamp in C++11
|
|
||||||
template<typename T>
|
|
||||||
static inline T ImClamp(T v, T lo, T hi)
|
|
||||||
{
|
|
||||||
if (v < lo) return lo;
|
|
||||||
if (v > hi) return hi;
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static SDL_Surface* g_TargetSurface = nullptr;
|
|
||||||
static SDL_Surface* g_FontSurface = nullptr;
|
|
||||||
|
|
||||||
static inline Uint32 GetPixel(SDL_Surface* s, int x, int y)
|
|
||||||
{
|
|
||||||
Uint8* p = (Uint8*)s->pixels + y * s->pitch + x * s->format->BytesPerPixel;
|
|
||||||
switch (s->format->BytesPerPixel)
|
|
||||||
{
|
|
||||||
case 1: return *p;
|
|
||||||
case 2: return *(Uint16*)p;
|
|
||||||
case 3:
|
|
||||||
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
|
||||||
return (p[0] << 16) | (p[1] << 8) | p[2];
|
|
||||||
else
|
|
||||||
return p[0] | (p[1] << 8) | (p[2] << 16);
|
|
||||||
case 4: return *(Uint32*)p;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void BlendPixel(SDL_Surface* s, int x, int y,
|
|
||||||
Uint8 sr, Uint8 sg, Uint8 sb, Uint8 sa)
|
|
||||||
{
|
|
||||||
if (!s || sa == 0) return;
|
|
||||||
if (x < 0 || y < 0 || x >= s->w || y >= s->h) return;
|
|
||||||
|
|
||||||
if (sa == 255)
|
|
||||||
{
|
|
||||||
Uint32 out_pix = SDL_MapRGBA(s->format, sr, sg, sb, sa);
|
|
||||||
Uint8* p = (Uint8*)s->pixels + y * s->pitch + x * s->format->BytesPerPixel;
|
|
||||||
switch (s->format->BytesPerPixel)
|
|
||||||
{
|
|
||||||
case 1: *p = (Uint8)out_pix; break;
|
|
||||||
case 2: *(Uint16*)p = (Uint16)out_pix; break;
|
|
||||||
case 3:
|
|
||||||
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
|
||||||
{
|
|
||||||
p[0] = (out_pix >> 16) & 0xFF;
|
|
||||||
p[1] = (out_pix >> 8) & 0xFF;
|
|
||||||
p[2] = out_pix & 0xFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p[0] = out_pix & 0xFF;
|
|
||||||
p[1] = (out_pix >> 8) & 0xFF;
|
|
||||||
p[2] = (out_pix >> 16) & 0xFF;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4: *(Uint32*)p = out_pix; break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint32 dst_pix = GetPixel(s, x, y);
|
|
||||||
Uint8 dr, dg, db, da;
|
|
||||||
SDL_GetRGBA(dst_pix, s->format, &dr, &dg, &db, &da);
|
|
||||||
|
|
||||||
Uint8 out_r = (Uint8)((sr * sa + dr * (255 - sa)) / 255);
|
|
||||||
Uint8 out_g = (Uint8)((sg * sa + dg * (255 - sa)) / 255);
|
|
||||||
Uint8 out_b = (Uint8)((sb * sa + db * (255 - sa)) / 255);
|
|
||||||
Uint8 out_a = (Uint8)((sa + (da * (255 - sa)) / 255));
|
|
||||||
|
|
||||||
Uint32 out_pix = SDL_MapRGBA(s->format, out_r, out_g, out_b, out_a);
|
|
||||||
Uint8* p = (Uint8*)s->pixels + y * s->pitch + x * s->format->BytesPerPixel;
|
|
||||||
switch (s->format->BytesPerPixel)
|
|
||||||
{
|
|
||||||
case 1: *p = (Uint8)out_pix; break;
|
|
||||||
case 2: *(Uint16*)p = (Uint16)out_pix; break;
|
|
||||||
case 3:
|
|
||||||
if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
|
|
||||||
{
|
|
||||||
p[0] = (out_pix >> 16) & 0xFF;
|
|
||||||
p[1] = (out_pix >> 8) & 0xFF;
|
|
||||||
p[2] = out_pix & 0xFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p[0] = out_pix & 0xFF;
|
|
||||||
p[1] = (out_pix >> 8) & 0xFF;
|
|
||||||
p[2] = (out_pix >> 16) & 0xFF;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4: *(Uint32*)p = out_pix; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline float Edge(const ImVec2& a, const ImVec2& b, float x, float y)
|
|
||||||
{
|
|
||||||
return (b.x - a.x) * (y - a.y) - (b.y - a.y) * (x - a.x);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* ImGui_ImplSDLSurface2_CreateFontAtlasSurface()
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
unsigned char* pixels = nullptr;
|
|
||||||
int width = 0, height = 0;
|
|
||||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
|
||||||
if (!pixels || width <= 0 || height <= 0) return nullptr;
|
|
||||||
|
|
||||||
SDL_Surface* surf = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGBA32);
|
|
||||||
if (!surf) return nullptr;
|
|
||||||
|
|
||||||
SDL_LockSurface(surf);
|
|
||||||
std::memcpy(surf->pixels, pixels, width * height * 4);
|
|
||||||
SDL_UnlockSurface(surf);
|
|
||||||
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
|
|
||||||
return surf;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui_ImplSDLSurface2_Init(SDL_Surface* surface)
|
|
||||||
{
|
|
||||||
if (!surface) return false;
|
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
IM_ASSERT(io.BackendRendererName == nullptr && "Already initialized a renderer backend!");
|
|
||||||
io.BackendRendererName = "imgui_impl_sdlsurface2";
|
|
||||||
|
|
||||||
g_TargetSurface = surface;
|
|
||||||
g_FontSurface = ImGui_ImplSDLSurface2_CreateFontAtlasSurface();
|
|
||||||
if (g_FontSurface)
|
|
||||||
{
|
|
||||||
if (g_TargetSurface && g_FontSurface->format->format != g_TargetSurface->format->format)
|
|
||||||
{
|
|
||||||
SDL_Surface* converted = SDL_ConvertSurfaceFormat(g_FontSurface, g_TargetSurface->format->format, 0);
|
|
||||||
if (converted)
|
|
||||||
{
|
|
||||||
SDL_FreeSurface(g_FontSurface);
|
|
||||||
g_FontSurface = converted;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::GetIO().Fonts->TexID = (ImTextureID)g_FontSurface;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLSurface2_Shutdown()
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
io.BackendRendererName = nullptr;
|
|
||||||
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasTextures;
|
|
||||||
|
|
||||||
ImGui::GetIO().Fonts->TexID = nullptr;
|
|
||||||
if (g_FontSurface)
|
|
||||||
{
|
|
||||||
SDL_FreeSurface(g_FontSurface);
|
|
||||||
g_FontSurface = nullptr;
|
|
||||||
}
|
|
||||||
g_TargetSurface = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLSurface2_NewFrame()
|
|
||||||
{
|
|
||||||
// noop
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_ImplSDLSurface2_RenderDrawData(ImDrawData* draw_data)
|
|
||||||
{
|
|
||||||
if (!draw_data || !g_TargetSurface) return;
|
|
||||||
|
|
||||||
if (SDL_MUSTLOCK(g_TargetSurface)) SDL_LockSurface(g_TargetSurface);
|
|
||||||
|
|
||||||
const ImVec2 display_pos = draw_data->DisplayPos;
|
|
||||||
const ImVec2 fb_scale = draw_data->FramebufferScale;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
int idx_offset = 0;
|
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
|
||||||
{
|
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
|
||||||
if (pcmd->ElemCount == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ImVec2 clip_min = ImVec2(
|
|
||||||
(pcmd->ClipRect.x - display_pos.x) * fb_scale.x,
|
|
||||||
(pcmd->ClipRect.y - display_pos.y) * fb_scale.y);
|
|
||||||
ImVec2 clip_max = ImVec2(
|
|
||||||
(pcmd->ClipRect.z - display_pos.x) * fb_scale.x,
|
|
||||||
(pcmd->ClipRect.w - display_pos.y) * fb_scale.y);
|
|
||||||
|
|
||||||
int cx0 = (int)std::floor(clip_min.x);
|
|
||||||
int cy0 = (int)std::floor(clip_min.y);
|
|
||||||
int cx1 = (int)std::ceil (clip_max.x);
|
|
||||||
int cy1 = (int)std::ceil (clip_max.y);
|
|
||||||
|
|
||||||
cx0 = std::max(cx0, 0);
|
|
||||||
cy0 = std::max(cy0, 0);
|
|
||||||
cx1 = std::min(cx1, g_TargetSurface->w);
|
|
||||||
cy1 = std::min(cy1, g_TargetSurface->h);
|
|
||||||
|
|
||||||
if (cx0 >= cx1 || cy0 >= cy1)
|
|
||||||
{
|
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Rect srect{ cx0, cy0, cx1 - cx0, cy1 - cy0 };
|
|
||||||
SDL_SetClipRect(g_TargetSurface, &srect);
|
|
||||||
|
|
||||||
SDL_Surface* tex = (SDL_Surface*)pcmd->GetTexID();
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i + 2 < (unsigned int)pcmd->ElemCount; i += 3)
|
|
||||||
{
|
|
||||||
ImDrawIdx i0 = idx_buffer[idx_offset + i + 0];
|
|
||||||
ImDrawIdx i1 = idx_buffer[idx_offset + i + 1];
|
|
||||||
ImDrawIdx i2 = idx_buffer[idx_offset + i + 2];
|
|
||||||
|
|
||||||
const ImDrawVert& v0 = vtx_buffer[i0];
|
|
||||||
const ImDrawVert& v1 = vtx_buffer[i1];
|
|
||||||
const ImDrawVert& v2 = vtx_buffer[i2];
|
|
||||||
|
|
||||||
ImVec2 p0 = ImVec2((v0.pos.x - display_pos.x) * fb_scale.x, (v0.pos.y - display_pos.y) * fb_scale.y);
|
|
||||||
ImVec2 p1 = ImVec2((v1.pos.x - display_pos.x) * fb_scale.x, (v1.pos.y - display_pos.y) * fb_scale.y);
|
|
||||||
ImVec2 p2 = ImVec2((v2.pos.x - display_pos.x) * fb_scale.x, (v2.pos.y - display_pos.y) * fb_scale.y);
|
|
||||||
|
|
||||||
int minx = (int)std::floor(std::min({ p0.x, p1.x, p2.x }));
|
|
||||||
int miny = (int)std::floor(std::min({ p0.y, p1.y, p2.y }));
|
|
||||||
int maxx = (int)std::ceil (std::max({ p0.x, p1.x, p2.x }));
|
|
||||||
int maxy = (int)std::ceil (std::max({ p0.y, p1.y, p2.y }));
|
|
||||||
|
|
||||||
minx = std::max(minx, cx0);
|
|
||||||
miny = std::max(miny, cy0);
|
|
||||||
maxx = std::min(maxx, cx1 - 1);
|
|
||||||
maxy = std::min(maxy, cy1 - 1);
|
|
||||||
|
|
||||||
if (minx > maxx || miny > maxy) continue;
|
|
||||||
|
|
||||||
float area = Edge(p0, p1, p2.x, p2.y);
|
|
||||||
if (area == 0.0f) continue;
|
|
||||||
|
|
||||||
auto unpack_col = [](ImU32 c, float out[4]) {
|
|
||||||
out[0] = (float)((c >> IM_COL32_R_SHIFT) & 0xFF) / 255.0f;
|
|
||||||
out[1] = (float)((c >> IM_COL32_G_SHIFT) & 0xFF) / 255.0f;
|
|
||||||
out[2] = (float)((c >> IM_COL32_B_SHIFT) & 0xFF) / 255.0f;
|
|
||||||
out[3] = (float)((c >> IM_COL32_A_SHIFT) & 0xFF) / 255.0f;
|
|
||||||
};
|
|
||||||
|
|
||||||
float c0[4], c1[4], c2[4];
|
|
||||||
unpack_col(v0.col, c0); unpack_col(v1.col, c1); unpack_col(v2.col, c2);
|
|
||||||
|
|
||||||
for (int y = miny; y <= maxy; y++)
|
|
||||||
{
|
|
||||||
for (int x = minx; x <= maxx; x++)
|
|
||||||
{
|
|
||||||
float px = (float)x + 0.5f;
|
|
||||||
float py = (float)y + 0.5f;
|
|
||||||
|
|
||||||
float w0 = Edge(p1, p2, px, py) / area;
|
|
||||||
float w1 = Edge(p2, p0, px, py) / area;
|
|
||||||
float w2 = Edge(p0, p1, px, py) / area;
|
|
||||||
|
|
||||||
if (w0 < 0.0f || w1 < 0.0f || w2 < 0.0f) continue;
|
|
||||||
|
|
||||||
float r = w0 * c0[0] + w1 * c1[0] + w2 * c2[0];
|
|
||||||
float g = w0 * c0[1] + w1 * c1[1] + w2 * c2[1];
|
|
||||||
float b = w0 * c0[2] + w1 * c1[2] + w2 * c2[2];
|
|
||||||
float a = w0 * c0[3] + w1 * c1[3] + w2 * c2[3];
|
|
||||||
|
|
||||||
Uint8 out_r = (Uint8)(ImClamp(r, 0.0f, 1.0f) * 255.0f);
|
|
||||||
Uint8 out_g = (Uint8)(ImClamp(g, 0.0f, 1.0f) * 255.0f);
|
|
||||||
Uint8 out_b = (Uint8)(ImClamp(b, 0.0f, 1.0f) * 255.0f);
|
|
||||||
Uint8 out_a = (Uint8)(ImClamp(a, 0.0f, 1.0f) * 255.0f);
|
|
||||||
|
|
||||||
if (tex)
|
|
||||||
{
|
|
||||||
ImVec2 uv0 = v0.uv, uv1 = v1.uv, uv2 = v2.uv;
|
|
||||||
float u = w0 * uv0.x + w1 * uv1.x + w2 * uv2.x;
|
|
||||||
float v = w0 * uv0.y + w1 * uv1.y + w2 * uv2.y;
|
|
||||||
|
|
||||||
int tx = (int)(u * (tex->w - 1) + 0.5f);
|
|
||||||
int ty = (int)(v * (tex->h - 1) + 0.5f);
|
|
||||||
tx = ImClamp(tx, 0, tex->w - 1);
|
|
||||||
ty = ImClamp(ty, 0, tex->h - 1);
|
|
||||||
|
|
||||||
Uint32 tpx = GetPixel(tex, tx, ty);
|
|
||||||
Uint8 tr, tg, tb, ta;
|
|
||||||
SDL_GetRGBA(tpx, tex->format, &tr, &tg, &tb, &ta);
|
|
||||||
|
|
||||||
Uint8 final_r = (Uint8)((tr * out_r) / 255);
|
|
||||||
Uint8 final_g = (Uint8)((tg * out_g) / 255);
|
|
||||||
Uint8 final_b = (Uint8)((tb * out_b) / 255);
|
|
||||||
Uint8 final_a = (Uint8)((ta * out_a) / 255);
|
|
||||||
|
|
||||||
BlendPixel(g_TargetSurface, x, y, final_r, final_g, final_b, final_a);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BlendPixel(g_TargetSurface, x, y, out_r, out_g, out_b, out_a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
idx_offset += pcmd->ElemCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_SetClipRect(g_TargetSurface, nullptr);
|
|
||||||
if (SDL_MUSTLOCK(g_TargetSurface)) SDL_UnlockSurface(g_TargetSurface);
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// imgui_impl_sdlsurface2.h
|
|
||||||
// CPU-only SDL_Surface backend for Dear ImGui
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "imgui.h"
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
// Initialize with target SDL_Surface (32-bit RGBA)
|
|
||||||
IMGUI_API bool ImGui_ImplSDLSurface2_Init(SDL_Surface* surface);
|
|
||||||
IMGUI_API void ImGui_ImplSDLSurface2_Shutdown();
|
|
||||||
IMGUI_API void ImGui_ImplSDLSurface2_NewFrame();
|
|
||||||
IMGUI_API void ImGui_ImplSDLSurface2_RenderDrawData(ImDrawData* draw_data);
|
|
||||||
|
|
||||||
IMGUI_API SDL_Surface* ImGui_ImplSDLSurface2_CreateFontAtlasSurface();
|
|
||||||
@@ -1376,6 +1376,7 @@ VkDescriptorSet ImGui_ImplVulkan_AddTexture(VkSampler sampler, VkImageView image
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the Descriptor Set:
|
// Update the Descriptor Set:
|
||||||
|
if (descriptor_set != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
VkDescriptorImageInfo desc_image[1] = {};
|
VkDescriptorImageInfo desc_image[1] = {};
|
||||||
desc_image[0].sampler = sampler;
|
desc_image[0].sampler = sampler;
|
||||||
|
|||||||
@@ -41,6 +41,16 @@ HOW TO UPDATE?
|
|||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Changed default ImTextureID_Invalid value to -1 instead of 0 if not #define-d.
|
||||||
|
(#9293, #8745, #8465, #7090)
|
||||||
|
- It seems like a better default since it will work with backends storing
|
||||||
|
indices or memory offsets inside ImTextureID, where 0 might be a valid value.
|
||||||
|
- If this is causing problem with e.g your custom ImTextureID definition, you can
|
||||||
|
add '#define ImTextureID_Invalid 0' to your imconfig.h + PLEASE report this to GitHub.
|
||||||
|
- If you have hardcoded e.g. 'if (tex_id == 0)' checks they should be updated.
|
||||||
|
e.g. OpenGL2, OpenGL3 and SDLRenderer3 backends incorrectly had 'IM_ASSERT(tex->TexID == 0)'
|
||||||
|
lines which were replaced with 'IM_ASSERT(tex->TexID == ImTextureID_Invalid)'.
|
||||||
|
If you have copied or forked backends consider fixing locally. (#9295)
|
||||||
- Separator(): fixed a legacy quirk where Separator() was submitting a zero-height
|
- Separator(): fixed a legacy quirk where Separator() was submitting a zero-height
|
||||||
item for layout purpose, even though it draws a 1-pixel separator.
|
item for layout purpose, even though it draws a 1-pixel separator.
|
||||||
The fix could affect code e.g. computing height from multiple widgets in order to
|
The fix could affect code e.g. computing height from multiple widgets in order to
|
||||||
@@ -72,6 +82,9 @@ Other Changes:
|
|||||||
- InputText:
|
- InputText:
|
||||||
- Shift+Enter in multi-line editor always adds a new line, regardless of
|
- Shift+Enter in multi-line editor always adds a new line, regardless of
|
||||||
ImGuiInputTextFlags_CtrlEnterForNewLine being set or not. (#9239)
|
ImGuiInputTextFlags_CtrlEnterForNewLine being set or not. (#9239)
|
||||||
|
- Reworked io.ConfigInputTextEnterKeepActive mode so that pressing Enter will
|
||||||
|
deactivate/reactivate the item in order for e.g. IsItemDeactivatedAfterEdit()
|
||||||
|
signals to be emitted the same way regardless of that setting. (#9001, #9115)
|
||||||
- Style:
|
- Style:
|
||||||
- Border sizes are now scaled (and rounded) by ScaleAllSizes().
|
- Border sizes are now scaled (and rounded) by ScaleAllSizes().
|
||||||
- When using large values with ScallAllSizes(), the following items thickness
|
- When using large values with ScallAllSizes(), the following items thickness
|
||||||
@@ -81,6 +94,17 @@ Other Changes:
|
|||||||
- TextLink() underline thickness.
|
- TextLink() underline thickness.
|
||||||
- ColorButton() border thickness.
|
- ColorButton() border thickness.
|
||||||
- Separator() thickness, via scaling newly added style.SeparatorSize. (#2657, #9263)
|
- Separator() thickness, via scaling newly added style.SeparatorSize. (#2657, #9263)
|
||||||
|
- Nav:
|
||||||
|
- Changed Gamepad mapping for "Activate with Text Input" action: (#8803, #787)
|
||||||
|
- Previously: press North button (PS4/PS5 triangle, Switch X, Xbox Y).
|
||||||
|
- Now: long press (hold) Activate button (PS4/PS5 cross, Switch B, Xbox A) for ~0.60 secs.
|
||||||
|
This is rarely used, somehow easier to discover, and frees a button for other uses.
|
||||||
|
See updated Gamepad Control Sheets: https://www.dearimgui.com/controls_sheets
|
||||||
|
- Short Gamepad Activation press on InputText() always activate with Text Input mode.
|
||||||
|
- Popups: Shift+F10 or Menu key can now open popups menus when using
|
||||||
|
BeginPopupContextItem(), BeginPopupContextWindow() or OpenPopupOnItemClick().
|
||||||
|
(#8803, #9270) [@exelix11, @ocornut]
|
||||||
|
- Popups: pressing North button (PS4/PS5 triangle, SwitchX, Xbox Y) also open popups menus.
|
||||||
- Clipper:
|
- Clipper:
|
||||||
- Clear `DisplayStart`/`DisplayEnd` fields when `Step()` returns false.
|
- Clear `DisplayStart`/`DisplayEnd` fields when `Step()` returns false.
|
||||||
- Added `UserIndex` helper storage. This is solely a convenience for cases where
|
- Added `UserIndex` helper storage. This is solely a convenience for cases where
|
||||||
@@ -89,6 +113,8 @@ Other Changes:
|
|||||||
- Implemented a custom tweak to extend hit-testing bounding box when window is sitting
|
- Implemented a custom tweak to extend hit-testing bounding box when window is sitting
|
||||||
at the edge of a viewport (e.g. fullscreen or docked window), so that e.g. mouse the
|
at the edge of a viewport (e.g. fullscreen or docked window), so that e.g. mouse the
|
||||||
mouse at the extreme of the screen will reach the scrollbar. (#9276)
|
mouse at the extreme of the screen will reach the scrollbar. (#9276)
|
||||||
|
- Focus: fixed fallback "Debug" window temporarily taking focus and setting io.WantCaptureKeyboard
|
||||||
|
for one frame on e.g. application boot if no other windows are submitted. (#9243)
|
||||||
- Demo: fixed IMGUI_DEMO_MARKER locations for examples applets. (#9261, #3689) [@pthom]
|
- Demo: fixed IMGUI_DEMO_MARKER locations for examples applets. (#9261, #3689) [@pthom]
|
||||||
- Backends:
|
- Backends:
|
||||||
- SDLGPU3: removed unnecessary call to SDL_WaitForGPUIdle when releasing
|
- SDLGPU3: removed unnecessary call to SDL_WaitForGPUIdle when releasing
|
||||||
@@ -104,6 +130,8 @@ Other Changes:
|
|||||||
- hidden scrollbar in Firefox.
|
- hidden scrollbar in Firefox.
|
||||||
- Vulkan: added ImGui_ImplVulkan_PipelineInfo::ExtraDynamicStates[] to allow specifying
|
- Vulkan: added ImGui_ImplVulkan_PipelineInfo::ExtraDynamicStates[] to allow specifying
|
||||||
extra dynamic states to add when creating the VkPipeline. (#9211) [@DziubanMaciej]
|
extra dynamic states to add when creating the VkPipeline. (#9211) [@DziubanMaciej]
|
||||||
|
- Vulkan: ImGui_ImplVulkan_AddTexture() skips updating descriptor_set if failing
|
||||||
|
to allocate one. (#8677) [@micb25]
|
||||||
- WebGPU: fixed undefined behaviors in example code for requesting adapter
|
- WebGPU: fixed undefined behaviors in example code for requesting adapter
|
||||||
and device. (#9246, #9256) [@r-lyeh]
|
and device. (#9246, #9256) [@r-lyeh]
|
||||||
- GLFW/SDL2/SDL3+WebGPU: removed suport for Emscripten <4.0.10. (#9281) [@ypujante]
|
- GLFW/SDL2/SDL3+WebGPU: removed suport for Emscripten <4.0.10. (#9281) [@ypujante]
|
||||||
|
|||||||
+5
-5
@@ -55,8 +55,8 @@ if (ImGui::Button("Save"))
|
|||||||
ImGui::InputText("string", buf, IM_COUNTOF(buf));
|
ImGui::InputText("string", buf, IM_COUNTOF(buf));
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||||
```
|
```
|
||||||
<img width="412" height="236" alt="sample code output (dark)" src="https://github.com/user-attachments/assets/f075e2b0-98de-4be8-acb4-99ba0c9966cd" />
|
<img width="412" height="236" alt="sample code output (dark)" src="https://github.com/user-attachments/assets/32b838df-6378-498b-84a8-9a79ee6264a7" />
|
||||||
<img width="412" height="236" alt="sample code output (light)" src="https://github.com/user-attachments/assets/32b838df-6378-498b-84a8-9a79ee6264a7" />
|
<img width="412" height="236" alt="sample code output (light)" src="https://github.com/user-attachments/assets/f075e2b0-98de-4be8-acb4-99ba0c9966cd" />
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
// Create a window called "My First Tool", with a menu bar.
|
// Create a window called "My First Tool", with a menu bar.
|
||||||
@@ -150,10 +150,10 @@ Officially maintained backends (in repository):
|
|||||||
- Frameworks: AGS/Adventure Game Studio, Amethyst, Blender, bsf, Cinder, Cocos2d-x, Defold, Diligent Engine, Ebiten, Flexium, GML/Game Maker Studio, GLEQ, Godot, GTK3, Irrlicht Engine, JUCE, LÖVE+LUA, Mach Engine, Magnum, Marmalade, Monogame, NanoRT, nCine, Nim Game Lib, Nintendo 3DS/Switch/WiiU (homebrew), Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, raylib, SFML, Sokol, Unity, Unreal Engine 4/5, UWP, vtk, VulkanHpp, VulkanSceneGraph, Win32 GDI, WxWidgets.
|
- Frameworks: AGS/Adventure Game Studio, Amethyst, Blender, bsf, Cinder, Cocos2d-x, Defold, Diligent Engine, Ebiten, Flexium, GML/Game Maker Studio, GLEQ, Godot, GTK3, Irrlicht Engine, JUCE, LÖVE+LUA, Mach Engine, Magnum, Marmalade, Monogame, NanoRT, nCine, Nim Game Lib, Nintendo 3DS/Switch/WiiU (homebrew), Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, raylib, SFML, Sokol, Unity, Unreal Engine 4/5, UWP, vtk, VulkanHpp, VulkanSceneGraph, Win32 GDI, WxWidgets.
|
||||||
- Many bindings are auto-generated (by good old [cimgui](https://github.com/cimgui/cimgui) or our newer [dear_bindings](https://github.com/dearimgui/dear_bindings)), you can use their metadata output to generate bindings for other languages.
|
- Many bindings are auto-generated (by good old [cimgui](https://github.com/cimgui/cimgui) or our newer [dear_bindings](https://github.com/dearimgui/dear_bindings)), you can use their metadata output to generate bindings for other languages.
|
||||||
|
|
||||||
<img width="878" height="220" alt="Useful extensions" src="https://github.com/user-attachments/assets/e6b0aa7c-bf53-41c5-ac69-bea3098b1dee" />
|
|
||||||
|
|
||||||
[Useful Extensions/Widgets](https://github.com/ocornut/imgui/wiki/Useful-Extensions) wiki page:
|
[Useful Extensions/Widgets](https://github.com/ocornut/imgui/wiki/Useful-Extensions) wiki page:
|
||||||
- Automation/testing, Text editors, node editors, timeline editors, plotting, software renderers, remote network access, memory editors, gizmos, etc. Notable and well supported extensions include [ImPlot](https://github.com/epezent/implot) and [Dear ImGui Test Engine](https://github.com/ocornut/imgui_test_engine).
|
|
||||||
|
[](https://github.com/ocornut/imgui/wiki/Useful-Extensions)
|
||||||
|
- Automation/testing, Text editors, node editors, timeline editors, plotting, software renderers, remote network access, memory editors, gizmos, etc. Notable and well supported extensions include [ImPlot](https://github.com/epezent/implot), [ImPlot3d](https://github.com/brenocq/implot3d) and [Dear ImGui Test Engine](https://github.com/ocornut/imgui_test_engine).
|
||||||
|
|
||||||
Also see [Wiki](https://github.com/ocornut/imgui/wiki) for more links and ideas.
|
Also see [Wiki](https://github.com/ocornut/imgui/wiki) for more links and ideas.
|
||||||
|
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
#
|
|
||||||
# Cross Platform Makefile (example_sdl2_surface)
|
|
||||||
# Compatible with MSYS2/MINGW, Linux and macOS
|
|
||||||
#
|
|
||||||
# You will need SDL2 (http://www.libsdl.org):
|
|
||||||
# Linux: apt-get install libsdl2-dev
|
|
||||||
# macOS: brew install sdl2
|
|
||||||
# MSYS2: pacman -S mingw-w64-i686-SDL2
|
|
||||||
#
|
|
||||||
|
|
||||||
EXE = example_sdl2_surface
|
|
||||||
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_sdl2.cpp $(IMGUI_DIR)/backends/imgui_impl_sdlsurface2.cpp
|
|
||||||
OBJS = $(addsuffix .o, $(basename $(notdir $(SOURCES))))
|
|
||||||
UNAME_S := $(shell uname -s)
|
|
||||||
|
|
||||||
CXXFLAGS = -std=c++11 -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 += `sdl2-config --libs`
|
|
||||||
|
|
||||||
CXXFLAGS += `sdl2-config --cflags`
|
|
||||||
CFLAGS = $(CXXFLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Darwin) #APPLE
|
|
||||||
ECHO_MESSAGE = "Mac OS X"
|
|
||||||
LIBS += `sdl2-config --libs`
|
|
||||||
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 `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,35 +0,0 @@
|
|||||||
# How to Build
|
|
||||||
|
|
||||||
## Windows with Visual Studio's IDE
|
|
||||||
|
|
||||||
Use the provided project file (`example_sdl2_surface.vcxproj`) or open `imgui_examples.sln`.
|
|
||||||
|
|
||||||
## Windows with Visual Studio's CLI
|
|
||||||
|
|
||||||
Use `build_win32.bat` or directly:
|
|
||||||
```
|
|
||||||
set SDL2_DIR=path_to_your_sdl2_folder
|
|
||||||
cl /Zi /MD /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlsurface2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_surface.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 /utf-8 /I.. /I..\.. /I%SDL2_DIR%\include main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlsurface2.cpp ..\..\imgui*.cpp /FeDebug/example_sdl2_surface.exe /FoDebug/ /link /libpath:%SDL2_DIR%\lib\x64 SDL2.lib SDL2main.lib /subsystem:console
|
|
||||||
```
|
|
||||||
|
|
||||||
## Linux and similar Unixes
|
|
||||||
|
|
||||||
Use the provided `Makefile` or directly:
|
|
||||||
```
|
|
||||||
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends \
|
|
||||||
main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_sdlsurface2.cpp ../../imgui*.cpp \
|
|
||||||
`sdl2-config --libs`
|
|
||||||
```
|
|
||||||
|
|
||||||
## macOS
|
|
||||||
|
|
||||||
Use the provided `Makefile` or directly:
|
|
||||||
```
|
|
||||||
brew install sdl2
|
|
||||||
c++ `sdl2-config --cflags` -I .. -I ../.. -I ../../backends \
|
|
||||||
main.cpp ../../backends/imgui_impl_sdl2.cpp ../../backends/imgui_impl_sdlsurface2.cpp ../../imgui*.cpp \
|
|
||||||
`sdl2-config --libs`
|
|
||||||
```
|
|
||||||
@@ -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_sdl2_surface
|
|
||||||
@set INCLUDES=/I..\.. /I..\..\backends /I%SDL2_DIR%\include
|
|
||||||
@set SOURCES=main.cpp ..\..\backends\imgui_impl_sdl2.cpp ..\..\backends\imgui_impl_sdlsurface2.cpp ..\..\imgui*.cpp
|
|
||||||
@set LIBS=/LIBPATH:%SDL2_DIR%\lib\x86 SDL2.lib SDL2main.lib
|
|
||||||
mkdir %OUT_DIR%
|
|
||||||
cl /nologo /Zi /MD /utf-8 %INCLUDES% %SOURCES% /Fe%OUT_DIR%/%OUT_EXE%.exe /Fo%OUT_DIR%/ /link %LIBS% /subsystem:console
|
|
||||||
@@ -1,187 +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>{47525E56-7D05-474E-A455-64C5BBFFC029}</ProjectGuid>
|
|
||||||
<RootNamespace>example_sdl2_surface</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
|
||||||
<ProjectName>example_sdl2_surface</ProjectName>
|
|
||||||
</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>
|
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</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>
|
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</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>
|
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</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>
|
|
||||||
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
</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_sdl2.cpp" />
|
|
||||||
<ClCompile Include="..\..\backends\imgui_impl_sdlsurface2.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_sdl2.h" />
|
|
||||||
<ClInclude Include="..\..\backends\imgui_impl_sdlsurface2.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\..\misc\debuggers\imgui.natstepfilter" />
|
|
||||||
<None Include="..\..\misc\debuggers\imgui.natvis" />
|
|
||||||
<None Include="..\README.txt" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,64 +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_sdl2.cpp">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\backends\imgui_impl_sdlsurface2.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_sdlsurface2.h">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\..\backends\imgui_impl_sdl2.h">
|
|
||||||
<Filter>sources</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="..\README.txt" />
|
|
||||||
<None Include="..\..\misc\debuggers\imgui.natvis">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</None>
|
|
||||||
<None Include="..\..\misc\debuggers\imgui.natstepfilter">
|
|
||||||
<Filter>imgui</Filter>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
@@ -1,187 +0,0 @@
|
|||||||
// main.cpp
|
|
||||||
// Example program using imgui_impl_sdlsurface2 backend
|
|
||||||
|
|
||||||
#include "imgui.h"
|
|
||||||
#include "imgui_impl_sdl2.h"
|
|
||||||
#include "imgui_impl_sdlsurface2.h"
|
|
||||||
#include <SDL.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int, char**)
|
|
||||||
{
|
|
||||||
// Setup SDL
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
|
|
||||||
{
|
|
||||||
printf("Error: %s\n", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// From 2.0.18: Enable native IME.
|
|
||||||
#ifdef SDL_HINT_IME_SHOW_UI
|
|
||||||
SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Create window
|
|
||||||
float main_scale = ImGui_ImplSDL2_GetContentScaleForDisplay(0);
|
|
||||||
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_SHOWN);
|
|
||||||
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+Surface Example",
|
|
||||||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
|
||||||
(int)(1280 * main_scale), (int)(720 * main_scale), window_flags);
|
|
||||||
if (!window)
|
|
||||||
{
|
|
||||||
printf("Error creating window: %s\n", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Surface* window_surface = SDL_GetWindowSurface(window);
|
|
||||||
if (!window_surface)
|
|
||||||
{
|
|
||||||
printf("Error getting window surface: %s\n", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int win_w = window_surface->w;
|
|
||||||
int win_h = window_surface->h;
|
|
||||||
SDL_Surface* framebuffer = SDL_CreateRGBSurfaceWithFormat(0, win_w, win_h, 32, SDL_PIXELFORMAT_RGBA32);
|
|
||||||
if (!framebuffer)
|
|
||||||
{
|
|
||||||
printf("Error creating framebuffer: %s\n", SDL_GetError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup Dear ImGui context
|
|
||||||
IMGUI_CHECKVERSION();
|
|
||||||
ImGui::CreateContext();
|
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
|
||||||
ImGui::StyleColorsDark();
|
|
||||||
|
|
||||||
// Setup scaling
|
|
||||||
ImGuiStyle& style = ImGui::GetStyle();
|
|
||||||
style.ScaleAllSizes(main_scale); // Bake a fixed style scale.
|
|
||||||
style.FontScaleDpi = main_scale;
|
|
||||||
|
|
||||||
// Setup Platform/Renderer backends
|
|
||||||
ImGui_ImplSDL2_InitForOther(window);
|
|
||||||
ImGui_ImplSDL2_SetGamepadMode(ImGui_ImplSDL2_GamepadMode_AutoFirst, nullptr, 0);
|
|
||||||
ImGui_ImplSDLSurface2_Init(framebuffer);
|
|
||||||
|
|
||||||
// Our state
|
|
||||||
bool show_demo_window = true;
|
|
||||||
bool show_another_window = false;
|
|
||||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
|
||||||
|
|
||||||
// Main loop
|
|
||||||
bool done = false;
|
|
||||||
while (!done)
|
|
||||||
{
|
|
||||||
// Poll and handle events (inputs, window resize, etc.)
|
|
||||||
SDL_Event event;
|
|
||||||
while (SDL_PollEvent(&event))
|
|
||||||
{
|
|
||||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
|
||||||
if (event.type == SDL_QUIT)
|
|
||||||
done = true;
|
|
||||||
|
|
||||||
if (event.type == SDL_WINDOWEVENT)
|
|
||||||
{
|
|
||||||
if (event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
|
|
||||||
done = true;
|
|
||||||
|
|
||||||
if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED || event.window.event == SDL_WINDOWEVENT_RESIZED)
|
|
||||||
{
|
|
||||||
// Recreate framebuffer at new size
|
|
||||||
window_surface = SDL_GetWindowSurface(window);
|
|
||||||
int new_w = window_surface->w;
|
|
||||||
int new_h = window_surface->h;
|
|
||||||
if (new_w != win_w || new_h != win_h)
|
|
||||||
{
|
|
||||||
SDL_FreeSurface(framebuffer);
|
|
||||||
framebuffer = SDL_CreateRGBSurfaceWithFormat(0, new_w, new_h, 32, SDL_PIXELFORMAT_RGBA32);
|
|
||||||
if (!framebuffer) { printf("Error creating framebuffer after resize: %s\n", SDL_GetError()); return -1; }
|
|
||||||
win_w = new_w; win_h = new_h;
|
|
||||||
// Re-init the backend with the new framebuffer
|
|
||||||
ImGui_ImplSDLSurface2_Shutdown();
|
|
||||||
ImGui_ImplSDLSurface2_Init(framebuffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip rendering when minimized to avoid busy-looping
|
|
||||||
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)
|
|
||||||
{
|
|
||||||
SDL_Delay(10);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the Dear ImGui frame
|
|
||||||
ImGui_ImplSDLSurface2_NewFrame();
|
|
||||||
ImGui_ImplSDL2_NewFrame();
|
|
||||||
ImGui::NewFrame();
|
|
||||||
|
|
||||||
// 1. Show the big demo window
|
|
||||||
if (show_demo_window)
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. Mirror the SDL_Renderer example.
|
|
||||||
{
|
|
||||||
static float f = 0.0f;
|
|
||||||
static int counter = 0;
|
|
||||||
|
|
||||||
ImGui::Begin("Hello, world!"); // Create a window called "Hello, world!" and append into it.
|
|
||||||
|
|
||||||
ImGui::Text("This is some useful text."); // Display some text
|
|
||||||
ImGui::Checkbox("Demo Window", &show_demo_window); // Edit bools storing our window open/close state
|
|
||||||
ImGui::Checkbox("Another Window", &show_another_window);
|
|
||||||
|
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
|
||||||
|
|
||||||
if (ImGui::Button("Button")) // Buttons return true when clicked
|
|
||||||
counter++;
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Text("counter = %d", counter);
|
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Show another simple window.
|
|
||||||
if (show_another_window)
|
|
||||||
{
|
|
||||||
ImGui::Begin("Another Window", &show_another_window); // Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
|
|
||||||
ImGui::Text("Hello from another window!");
|
|
||||||
if (ImGui::Button("Close Me"))
|
|
||||||
show_another_window = false;
|
|
||||||
ImGui::End();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rendering
|
|
||||||
ImGui::Render();
|
|
||||||
|
|
||||||
SDL_FillRect(framebuffer, nullptr, SDL_MapRGBA(framebuffer->format,
|
|
||||||
(Uint8)(clear_color.x * 255),
|
|
||||||
(Uint8)(clear_color.y * 255),
|
|
||||||
(Uint8)(clear_color.z * 255),
|
|
||||||
(Uint8)(clear_color.w * 255)));
|
|
||||||
|
|
||||||
ImGui_ImplSDLSurface2_RenderDrawData(ImGui::GetDrawData());
|
|
||||||
|
|
||||||
SDL_BlitSurface(framebuffer, nullptr, window_surface, nullptr);
|
|
||||||
SDL_UpdateWindowSurface(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui_ImplSDLSurface2_Shutdown();
|
|
||||||
ImGui_ImplSDL2_Shutdown();
|
|
||||||
ImGui::DestroyContext();
|
|
||||||
|
|
||||||
SDL_FreeSurface(framebuffer);
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
SDL_Quit();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -29,8 +29,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_win32_opengl3", "ex
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_sdlrenderer2", "example_sdl2_sdlrenderer2\example_sdl2_sdlrenderer2.vcxproj", "{0C0B2BEA-311F-473C-9652-87923EF639E3}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_sdlrenderer2", "example_sdl2_sdlrenderer2\example_sdl2_sdlrenderer2.vcxproj", "{0C0B2BEA-311F-473C-9652-87923EF639E3}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl2_surface", "example_sdl2_surface\example_sdl2_surface.vcxproj", "{47525E56-7D05-474E-A455-64C5BBFFC029}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl3_opengl3", "example_sdl3_opengl3\example_sdl3_opengl3.vcxproj", "{84AAA301-84FE-428B-9E3E-817BC8123C0C}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl3_opengl3", "example_sdl3_opengl3\example_sdl3_opengl3.vcxproj", "{84AAA301-84FE-428B-9E3E-817BC8123C0C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl3_sdlrenderer3", "example_sdl3_sdlrenderer3\example_sdl3_sdlrenderer3.vcxproj", "{C0290D21-3AD2-4A35-ABBC-A2F5F48326DA}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_sdl3_sdlrenderer3", "example_sdl3_sdlrenderer3\example_sdl3_sdlrenderer3.vcxproj", "{C0290D21-3AD2-4A35-ABBC-A2F5F48326DA}"
|
||||||
@@ -157,14 +155,6 @@ Global
|
|||||||
{0C0B2BEA-311F-473C-9652-87923EF639E3}.Release|Win32.Build.0 = Release|Win32
|
{0C0B2BEA-311F-473C-9652-87923EF639E3}.Release|Win32.Build.0 = Release|Win32
|
||||||
{0C0B2BEA-311F-473C-9652-87923EF639E3}.Release|x64.ActiveCfg = Release|x64
|
{0C0B2BEA-311F-473C-9652-87923EF639E3}.Release|x64.ActiveCfg = Release|x64
|
||||||
{0C0B2BEA-311F-473C-9652-87923EF639E3}.Release|x64.Build.0 = Release|x64
|
{0C0B2BEA-311F-473C-9652-87923EF639E3}.Release|x64.Build.0 = Release|x64
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{47525E56-7D05-474E-A455-64C5BBFFC029}.Release|x64.Build.0 = Release|x64
|
|
||||||
{84AAA301-84FE-428B-9E3E-817BC8123C0C}.Debug|Win32.ActiveCfg = Debug|Win32
|
{84AAA301-84FE-428B-9E3E-817BC8123C0C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{84AAA301-84FE-428B-9E3E-817BC8123C0C}.Debug|Win32.Build.0 = Debug|Win32
|
{84AAA301-84FE-428B-9E3E-817BC8123C0C}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{84AAA301-84FE-428B-9E3E-817BC8123C0C}.Debug|x64.ActiveCfg = Debug|x64
|
{84AAA301-84FE-428B-9E3E-817BC8123C0C}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ CODE
|
|||||||
- Home, End Scroll to top, scroll to bottom.
|
- Home, End Scroll to top, scroll to bottom.
|
||||||
- Alt Toggle between scrolling layer and menu layer.
|
- Alt Toggle between scrolling layer and menu layer.
|
||||||
- Ctrl+Tab then Ctrl+Arrows Move window. Hold Shift to resize instead of moving.
|
- Ctrl+Tab then Ctrl+Arrows Move window. Hold Shift to resize instead of moving.
|
||||||
|
- Menu or Shift+F10 Open context menu.
|
||||||
- Output when ImGuiConfigFlags_NavEnableKeyboard set,
|
- Output when ImGuiConfigFlags_NavEnableKeyboard set,
|
||||||
- io.WantCaptureKeyboard flag is set when keyboard is claimed.
|
- io.WantCaptureKeyboard flag is set when keyboard is claimed.
|
||||||
- io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
|
- io.NavActive: true when a window is focused and it doesn't have the ImGuiWindowFlags_NoNavInputs flag set.
|
||||||
@@ -394,6 +395,10 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
|||||||
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
When you are not sure about an old symbol or function name, try using the Search/Find function of your IDE to look for comments or references in all imgui files.
|
||||||
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
You can read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
|
- 2026/03/12 (1.92.7) - Changed default ImTextureID_Invalid to -1 instead of 0 if not #define-d. (#9293, #8745, #8465, #7090)
|
||||||
|
It seems like a better default since it will work with backends storing indices or memory offsets inside ImTextureID, where 0 might be a valid value.
|
||||||
|
If this is causing problem with e.g. your custom ImTextureID definition, you can add '#define ImTextureID_Invalid 0' to your imconfig.h + PLEASE report this to GitHub.
|
||||||
|
If you have hard-coded e.g. 'if (tex_id == 0)' checks they should be updated. e.g. OpenGL2, OpenGL3 and SDLRenderer3 backends incorrectly had 'IM_ASSERT(tex->TexID == 0)' lines which were replaced with 'IM_ASSERT(tex->TexID == ImTextureID_Invalid)'. (#9295)
|
||||||
- 2026/02/26 (1.92.7) - Separator: fixed a legacy quirk where Separator() was submitting a zero-height item for layout purpose, even though it draws a 1-pixel separator.
|
- 2026/02/26 (1.92.7) - Separator: fixed a legacy quirk where Separator() was submitting a zero-height item for layout purpose, even though it draws a 1-pixel separator.
|
||||||
The fix could affect code e.g. computing height from multiple widgets in order to allocate vertical space for a footer or multi-line status bar. (#2657, #9263)
|
The fix could affect code e.g. computing height from multiple widgets in order to allocate vertical space for a footer or multi-line status bar. (#2657, #9263)
|
||||||
The "Console" example had such a bug:
|
The "Console" example had such a bug:
|
||||||
@@ -402,8 +407,7 @@ IMPLEMENTING SUPPORT for ImGuiBackendFlags_RendererHasTextures:
|
|||||||
Should be:
|
Should be:
|
||||||
float footer_height = style.ItemSpacing.y + style.SeparatorSize + ImGui::GetFrameHeightWithSpacing();
|
float footer_height = style.ItemSpacing.y + style.SeparatorSize + ImGui::GetFrameHeightWithSpacing();
|
||||||
BeginChild("ScrollingRegion", { 0, -footer_height });
|
BeginChild("ScrollingRegion", { 0, -footer_height });
|
||||||
When such idiom was used and assuming zero-height Separator, it is likely that
|
When such idiom was used and assuming zero-height Separator, it is likely that in 1.92.7 the resulting window will have unexpected 1 pixel scrolling range.
|
||||||
in 1.92.7 the resulting window will have unexpected 1 pixel scrolling range.
|
|
||||||
- 2026/02/23 (1.92.7) - Commented out legacy signature for Combo(), ListBox(), signatures which were obsoleted in 1.90 (Nov 2023), when the getter callback type was changed.
|
- 2026/02/23 (1.92.7) - Commented out legacy signature for Combo(), ListBox(), signatures which were obsoleted in 1.90 (Nov 2023), when the getter callback type was changed.
|
||||||
- Old getter type: bool (*getter)(void* user_data, int idx, const char** out_text) // Set label + return bool. False replaced label with placeholder.
|
- Old getter type: bool (*getter)(void* user_data, int idx, const char** out_text) // Set label + return bool. False replaced label with placeholder.
|
||||||
- New getter type: const char* (*getter)(void* user_data, int idx) // Return label or NULL/empty label if missing
|
- New getter type: const char* (*getter)(void* user_data, int idx) // Return label or NULL/empty label if missing
|
||||||
@@ -1309,6 +1313,7 @@ static const float FONT_DEFAULT_SIZE_BASE = 20.0f;
|
|||||||
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
|
static const float NAV_WINDOWING_HIGHLIGHT_DELAY = 0.20f; // Time before the highlight and screen dimming starts fading in
|
||||||
static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time before the window list starts to appear
|
static const float NAV_WINDOWING_LIST_APPEAR_DELAY = 0.15f; // Time before the window list starts to appear
|
||||||
static const float NAV_ACTIVATE_HIGHLIGHT_TIMER = 0.10f; // Time to highlight an item activated by a shortcut.
|
static const float NAV_ACTIVATE_HIGHLIGHT_TIMER = 0.10f; // Time to highlight an item activated by a shortcut.
|
||||||
|
static const float NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY = 0.60f; // Time to hold activation button (e.g. FaceDown) to turn the activation into a text input.
|
||||||
static const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER = 0.04f; // Reduce visual noise by only highlighting the border after a certain time.
|
static const float WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER = 0.04f; // Reduce visual noise by only highlighting the border after a certain time.
|
||||||
static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.70f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved.
|
static const float WINDOWS_MOUSE_WHEEL_SCROLL_LOCK_TIMER = 0.70f; // Lock scrolled window (so it doesn't pick child windows that are scrolling through) for a certain time, unless mouse moved.
|
||||||
|
|
||||||
@@ -1355,6 +1360,7 @@ static void NavUpdateWindowing();
|
|||||||
static void NavUpdateWindowingApplyFocus(ImGuiWindow* window);
|
static void NavUpdateWindowingApplyFocus(ImGuiWindow* window);
|
||||||
static void NavUpdateWindowingOverlay();
|
static void NavUpdateWindowingOverlay();
|
||||||
static void NavUpdateCancelRequest();
|
static void NavUpdateCancelRequest();
|
||||||
|
static void NavUpdateContextMenuRequest();
|
||||||
static void NavUpdateCreateMoveRequest();
|
static void NavUpdateCreateMoveRequest();
|
||||||
static void NavUpdateCreateTabbingRequest();
|
static void NavUpdateCreateTabbingRequest();
|
||||||
static float NavUpdatePageUpPageDown();
|
static float NavUpdatePageUpPageDown();
|
||||||
@@ -4212,6 +4218,8 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|||||||
NavWindow = NULL;
|
NavWindow = NULL;
|
||||||
NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0;
|
NavFocusScopeId = NavActivateId = NavActivateDownId = NavActivatePressedId = 0;
|
||||||
NavLayer = ImGuiNavLayer_Main;
|
NavLayer = ImGuiNavLayer_Main;
|
||||||
|
NavIdItemFlags = ImGuiItemFlags_None;
|
||||||
|
NavOpenContextMenuItemId = NavOpenContextMenuWindowId = 0;
|
||||||
NavNextActivateId = 0;
|
NavNextActivateId = 0;
|
||||||
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
NavActivateFlags = NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||||
NavHighlightActivatedId = 0;
|
NavHighlightActivatedId = 0;
|
||||||
@@ -4281,6 +4289,7 @@ ImGuiContext::ImGuiContext(ImFontAtlas* shared_font_atlas)
|
|||||||
MouseStationaryTimer = 0.0f;
|
MouseStationaryTimer = 0.0f;
|
||||||
|
|
||||||
InputTextPasswordFontBackupFlags = ImFontFlags_None;
|
InputTextPasswordFontBackupFlags = ImFontFlags_None;
|
||||||
|
InputTextReactivateId = 0;
|
||||||
TempInputId = 0;
|
TempInputId = 0;
|
||||||
memset(&DataTypeZeroValue, 0, sizeof(DataTypeZeroValue));
|
memset(&DataTypeZeroValue, 0, sizeof(DataTypeZeroValue));
|
||||||
BeginMenuDepth = BeginComboDepth = 0;
|
BeginMenuDepth = BeginComboDepth = 0;
|
||||||
@@ -5572,6 +5581,8 @@ void ImGui::NewFrame()
|
|||||||
g.ActiveIdIsJustActivated = false;
|
g.ActiveIdIsJustActivated = false;
|
||||||
if (g.TempInputId != 0 && g.ActiveId != g.TempInputId)
|
if (g.TempInputId != 0 && g.ActiveId != g.TempInputId)
|
||||||
g.TempInputId = 0;
|
g.TempInputId = 0;
|
||||||
|
if (g.InputTextReactivateId != 0 && g.InputTextReactivateId != g.DeactivatedItemData.ID)
|
||||||
|
g.InputTextReactivateId = 0;
|
||||||
if (g.ActiveId == 0)
|
if (g.ActiveId == 0)
|
||||||
{
|
{
|
||||||
g.ActiveIdUsingNavDirMask = 0x00;
|
g.ActiveIdUsingNavDirMask = 0x00;
|
||||||
@@ -5982,10 +5993,14 @@ void ImGui::EndFrame()
|
|||||||
}
|
}
|
||||||
g.WantTextInputNextFrame = ime_data->WantTextInput ? 1 : 0;
|
g.WantTextInputNextFrame = ime_data->WantTextInput ? 1 : 0;
|
||||||
|
|
||||||
// Hide implicit/fallback "Debug" window if it hasn't been used
|
// Hide and unfocus implicit/fallback "Debug" window if it hasn't been used
|
||||||
g.WithinFrameScopeWithImplicitWindow = false;
|
g.WithinFrameScopeWithImplicitWindow = false;
|
||||||
if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)
|
if (g.CurrentWindow && g.CurrentWindow->IsFallbackWindow && g.CurrentWindow->WriteAccessed == false)
|
||||||
|
{
|
||||||
g.CurrentWindow->Active = false;
|
g.CurrentWindow->Active = false;
|
||||||
|
if (g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow)
|
||||||
|
FocusWindow(NULL);
|
||||||
|
}
|
||||||
End();
|
End();
|
||||||
|
|
||||||
// Update navigation: Ctrl+Tab, wrap-around requests
|
// Update navigation: Ctrl+Tab, wrap-around requests
|
||||||
@@ -12489,14 +12504,37 @@ ImGuiMouseButton ImGui::GetMouseButtonFromPopupFlags(ImGuiPopupFlags flags)
|
|||||||
return ImGuiMouseButton_Right; // Default == 1
|
return ImGuiMouseButton_Right; // Default == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ImGui::IsPopupOpenRequestForItem(ImGuiPopupFlags popup_flags, ImGuiID id)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
||||||
|
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||||
|
return true;
|
||||||
|
if (g.NavOpenContextMenuItemId == id && (IsItemFocused() || id == g.CurrentWindow->MoveId))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImGui::IsPopupOpenRequestForWindow(ImGuiPopupFlags popup_flags)
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
||||||
|
if (IsMouseReleased(mouse_button) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||||
|
if (!(popup_flags & ImGuiPopupFlags_NoOpenOverItems) || !IsAnyItemHovered())
|
||||||
|
return true;
|
||||||
|
if (g.NavOpenContextMenuWindowId && g.CurrentWindow->ID)
|
||||||
|
if (IsWindowChildOf(g.NavWindow, g.CurrentWindow, false)) // This enable ordering to be used to disambiguate item vs window (#8803)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Helper to open a popup if mouse button is released over the item
|
// Helper to open a popup if mouse button is released over the item
|
||||||
// - This is essentially the same as BeginPopupContextItem() but without the trailing BeginPopup()
|
// - This is essentially the same as BeginPopupContextItem() but without the trailing BeginPopup()
|
||||||
void ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiPopupFlags popup_flags)
|
void ImGui::OpenPopupOnItemClick(const char* str_id, ImGuiPopupFlags popup_flags)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
if (IsPopupOpenRequestForItem(popup_flags, g.LastItemData.ID))
|
||||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
||||||
{
|
{
|
||||||
ImGuiID id = str_id ? window->GetID(str_id) : g.LastItemData.ID; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
ImGuiID id = str_id ? window->GetID(str_id) : g.LastItemData.ID; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
||||||
IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
||||||
@@ -12526,10 +12564,9 @@ bool ImGui::BeginPopupContextItem(const char* str_id, ImGuiPopupFlags popup_flag
|
|||||||
ImGuiWindow* window = g.CurrentWindow;
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
return false;
|
return false;
|
||||||
ImGuiID id = str_id ? window->GetID(str_id) : g.LastItemData.ID; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!
|
ImGuiID id = str_id ? window->GetID(str_id) : g.LastItemData.ID; // If user hasn't passed an ID, we can use the LastItem ID. Using LastItem ID as a Popup ID won't conflict!
|
||||||
IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
IM_ASSERT(id != 0); // You cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)
|
||||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
if (IsPopupOpenRequestForItem(popup_flags, g.LastItemData.ID))
|
||||||
if (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
||||||
OpenPopupEx(id, popup_flags);
|
OpenPopupEx(id, popup_flags);
|
||||||
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);
|
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);
|
||||||
}
|
}
|
||||||
@@ -12541,9 +12578,7 @@ bool ImGui::BeginPopupContextWindow(const char* str_id, ImGuiPopupFlags popup_fl
|
|||||||
if (!str_id)
|
if (!str_id)
|
||||||
str_id = "window_context";
|
str_id = "window_context";
|
||||||
ImGuiID id = window->GetID(str_id);
|
ImGuiID id = window->GetID(str_id);
|
||||||
ImGuiMouseButton mouse_button = GetMouseButtonFromPopupFlags(popup_flags);
|
if (IsPopupOpenRequestForWindow(popup_flags))
|
||||||
if (IsMouseReleased(mouse_button) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
|
||||||
if (!(popup_flags & ImGuiPopupFlags_NoOpenOverItems) || !IsAnyItemHovered())
|
|
||||||
OpenPopupEx(id, popup_flags);
|
OpenPopupEx(id, popup_flags);
|
||||||
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);
|
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);
|
||||||
}
|
}
|
||||||
@@ -13068,6 +13103,7 @@ void ImGui::SetFocusID(ImGuiID id, ImGuiWindow* window)
|
|||||||
window->NavLastIds[nav_layer] = id;
|
window->NavLastIds[nav_layer] = id;
|
||||||
if (g.LastItemData.ID == id)
|
if (g.LastItemData.ID == id)
|
||||||
window->NavRectRel[nav_layer] = WindowRectAbsToRel(window, g.LastItemData.NavRect);
|
window->NavRectRel[nav_layer] = WindowRectAbsToRel(window, g.LastItemData.NavRect);
|
||||||
|
g.NavIdItemFlags = (g.LastItemData.ID == id) ? g.LastItemData.ItemFlags : ImGuiItemFlags_None;
|
||||||
if (id == g.ActiveIdIsAlive)
|
if (id == g.ActiveIdIsAlive)
|
||||||
g.NavIdIsAlive = true;
|
g.NavIdIsAlive = true;
|
||||||
|
|
||||||
@@ -13337,6 +13373,7 @@ static void ImGui::NavProcessItem()
|
|||||||
SetNavFocusScope(g.CurrentFocusScopeId); // Will set g.NavFocusScopeId AND store g.NavFocusScopePath
|
SetNavFocusScope(g.CurrentFocusScopeId); // Will set g.NavFocusScopeId AND store g.NavFocusScopePath
|
||||||
g.NavFocusScopeId = g.CurrentFocusScopeId;
|
g.NavFocusScopeId = g.CurrentFocusScopeId;
|
||||||
g.NavIdIsAlive = true;
|
g.NavIdIsAlive = true;
|
||||||
|
g.NavIdItemFlags = item_flags;
|
||||||
if (g.LastItemData.ItemFlags & ImGuiItemFlags_HasSelectionUserData)
|
if (g.LastItemData.ItemFlags & ImGuiItemFlags_HasSelectionUserData)
|
||||||
{
|
{
|
||||||
IM_ASSERT(g.NextItemData.SelectionUserData != ImGuiSelectionUserData_Invalid);
|
IM_ASSERT(g.NextItemData.SelectionUserData != ImGuiSelectionUserData_Invalid);
|
||||||
@@ -13721,6 +13758,7 @@ static void ImGui::NavUpdate()
|
|||||||
|
|
||||||
// Process NavCancel input (to close a popup, get back to parent, clear focus)
|
// Process NavCancel input (to close a popup, get back to parent, clear focus)
|
||||||
NavUpdateCancelRequest();
|
NavUpdateCancelRequest();
|
||||||
|
NavUpdateContextMenuRequest();
|
||||||
|
|
||||||
// Process manual activation request
|
// Process manual activation request
|
||||||
g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = 0;
|
g.NavActivateId = g.NavActivateDownId = g.NavActivatePressedId = 0;
|
||||||
@@ -13729,21 +13767,25 @@ static void ImGui::NavUpdate()
|
|||||||
{
|
{
|
||||||
const bool activate_down = (nav_keyboard_active && IsKeyDown(ImGuiKey_Space, ImGuiKeyOwner_NoOwner)) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadActivate, ImGuiKeyOwner_NoOwner));
|
const bool activate_down = (nav_keyboard_active && IsKeyDown(ImGuiKey_Space, ImGuiKeyOwner_NoOwner)) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadActivate, ImGuiKeyOwner_NoOwner));
|
||||||
const bool activate_pressed = activate_down && ((nav_keyboard_active && IsKeyPressed(ImGuiKey_Space, 0, ImGuiKeyOwner_NoOwner)) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadActivate, 0, ImGuiKeyOwner_NoOwner)));
|
const bool activate_pressed = activate_down && ((nav_keyboard_active && IsKeyPressed(ImGuiKey_Space, 0, ImGuiKeyOwner_NoOwner)) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadActivate, 0, ImGuiKeyOwner_NoOwner)));
|
||||||
const bool input_down = (nav_keyboard_active && (IsKeyDown(ImGuiKey_Enter, ImGuiKeyOwner_NoOwner) || IsKeyDown(ImGuiKey_KeypadEnter, ImGuiKeyOwner_NoOwner))) || (nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadInput, ImGuiKeyOwner_NoOwner));
|
const bool input_pressed_keyboard = nav_keyboard_active && (IsKeyPressed(ImGuiKey_Enter, 0, ImGuiKeyOwner_NoOwner) || IsKeyPressed(ImGuiKey_KeypadEnter, 0, ImGuiKeyOwner_NoOwner));
|
||||||
const bool input_pressed = input_down && ((nav_keyboard_active && (IsKeyPressed(ImGuiKey_Enter, 0, ImGuiKeyOwner_NoOwner) || IsKeyPressed(ImGuiKey_KeypadEnter, 0, ImGuiKeyOwner_NoOwner))) || (nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadInput, 0, ImGuiKeyOwner_NoOwner)));
|
bool input_pressed_gamepad = false;
|
||||||
|
if (activate_down && nav_gamepad_active && IsKeyDown(ImGuiKey_NavGamepadActivate, ImGuiKeyOwner_NoOwner) && (g.NavIdItemFlags & ImGuiItemFlags_Inputable)) // requires ImGuiItemFlags_Inputable to avoid retriggering regular buttons.
|
||||||
|
if (GetKeyData(ImGuiKey_NavGamepadActivate)->DownDurationPrev < NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY && GetKeyData(ImGuiKey_NavGamepadActivate)->DownDuration >= NAV_ACTIVATE_INPUT_WITH_GAMEPAD_DELAY)
|
||||||
|
input_pressed_gamepad = true;
|
||||||
|
|
||||||
if (g.ActiveId == 0 && activate_pressed)
|
if (g.ActiveId == 0 && activate_pressed)
|
||||||
{
|
{
|
||||||
g.NavActivateId = g.NavId;
|
g.NavActivateId = g.NavId;
|
||||||
g.NavActivateFlags = ImGuiActivateFlags_PreferTweak;
|
g.NavActivateFlags = ImGuiActivateFlags_PreferTweak;
|
||||||
}
|
}
|
||||||
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && input_pressed)
|
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (input_pressed_keyboard || input_pressed_gamepad))
|
||||||
{
|
{
|
||||||
g.NavActivateId = g.NavId;
|
g.NavActivateId = g.NavId;
|
||||||
g.NavActivateFlags = ImGuiActivateFlags_PreferInput;
|
g.NavActivateFlags = ImGuiActivateFlags_PreferInput;
|
||||||
}
|
}
|
||||||
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_down || input_down))
|
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_down || input_pressed_keyboard || input_pressed_gamepad)) // FIXME-NAV: Unsure why input_pressed_xxx (migrated from input_down which was already dubious)
|
||||||
g.NavActivateDownId = g.NavId;
|
g.NavActivateDownId = g.NavId;
|
||||||
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_pressed || input_pressed))
|
if ((g.ActiveId == 0 || g.ActiveId == g.NavId) && (activate_pressed || input_pressed_keyboard || input_pressed_gamepad))
|
||||||
{
|
{
|
||||||
g.NavActivatePressedId = g.NavId;
|
g.NavActivatePressedId = g.NavId;
|
||||||
NavHighlightActivated(g.NavId);
|
NavHighlightActivated(g.NavId);
|
||||||
@@ -14205,6 +14247,31 @@ static void ImGui::NavUpdateCancelRequest()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ImGui::NavUpdateContextMenuRequest()
|
||||||
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
g.NavOpenContextMenuItemId = g.NavOpenContextMenuWindowId = 0;
|
||||||
|
const bool nav_keyboard_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
|
const bool nav_gamepad_active = (g.IO.ConfigFlags & ImGuiConfigFlags_NavEnableKeyboard) != 0;
|
||||||
|
if ((!nav_keyboard_active && !nav_gamepad_active) || g.NavWindow == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool request = false;
|
||||||
|
request |= nav_keyboard_active && (IsKeyReleased(ImGuiKey_Menu, ImGuiKeyOwner_NoOwner) || (IsKeyPressed(ImGuiKey_F10, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner) && g.IO.KeyMods == ImGuiMod_Shift));
|
||||||
|
request |= nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadContextMenu, ImGuiInputFlags_None, ImGuiKeyOwner_NoOwner);
|
||||||
|
if (!request)
|
||||||
|
return;
|
||||||
|
g.NavOpenContextMenuItemId = g.NavId;
|
||||||
|
g.NavOpenContextMenuWindowId = g.NavWindow->ID;
|
||||||
|
|
||||||
|
// Allow triggering for Begin()..BeginPopupContextItem(). A possible alternative would be to use g.NavLayer == ImGuiNavLayer_Menu.
|
||||||
|
if (g.NavId == g.NavWindow->GetID("#CLOSE") || g.NavId == g.NavWindow->GetID("#COLLAPSE"))
|
||||||
|
g.NavOpenContextMenuItemId = g.NavWindow->MoveId;
|
||||||
|
|
||||||
|
g.NavInputSource = ImGuiInputSource_Keyboard;
|
||||||
|
SetNavCursorVisibleAfterMove();
|
||||||
|
}
|
||||||
|
|
||||||
// Handle PageUp/PageDown/Home/End keys
|
// Handle PageUp/PageDown/Home/End keys
|
||||||
// Called from NavUpdateCreateMoveRequest() which will use our output to create a move request
|
// Called from NavUpdateCreateMoveRequest() which will use our output to create a move request
|
||||||
// FIXME-NAV: This doesn't work properly with NavFlattened siblings as we use NavWindow rectangle for reference
|
// FIXME-NAV: This doesn't work properly with NavFlattened siblings as we use NavWindow rectangle for reference
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
// Library Version
|
// Library Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
|
||||||
#define IMGUI_VERSION "1.92.7 WIP"
|
#define IMGUI_VERSION "1.92.7 WIP"
|
||||||
#define IMGUI_VERSION_NUM 19264
|
#define IMGUI_VERSION_NUM 19265
|
||||||
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
|
#define IMGUI_HAS_TABLE // Added BeginTable() - from IMGUI_VERSION_NUM >= 18000
|
||||||
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
|
#define IMGUI_HAS_TEXTURES // Added ImGuiBackendFlags_RendererHasTextures - from IMGUI_VERSION_NUM >= 19198
|
||||||
|
|
||||||
@@ -340,9 +340,11 @@ IM_MSVC_RUNTIME_CHECKS_RESTORE
|
|||||||
typedef ImU64 ImTextureID; // Default: store up to 64-bits (any pointer or integer). A majority of backends are ok with that.
|
typedef ImU64 ImTextureID; // Default: store up to 64-bits (any pointer or integer). A majority of backends are ok with that.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define this if you need 0 to be a valid ImTextureID for your backend.
|
// Define this if you need to change the invalid value for your backend.
|
||||||
|
// - in v1.92.7 (2025/03/12): we changed default value from 0 to -1 as it is a better default, which supports storing offsets/indices.
|
||||||
|
// - If this is causing problem with your custom ImTextureID definition, you can add '#define ImTextureID_Invalid' to your imconfig + please report this to GitHub.
|
||||||
#ifndef ImTextureID_Invalid
|
#ifndef ImTextureID_Invalid
|
||||||
#define ImTextureID_Invalid ((ImTextureID)0)
|
#define ImTextureID_Invalid ((ImTextureID)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ImTextureRef = higher-level identifier for a texture. Store a ImTextureID _or_ a ImTextureData*.
|
// ImTextureRef = higher-level identifier for a texture. Store a ImTextureID _or_ a ImTextureData*.
|
||||||
@@ -1616,10 +1618,10 @@ enum ImGuiKey : int
|
|||||||
// // XBOX | SWITCH | PLAYSTA. | -> ACTION
|
// // XBOX | SWITCH | PLAYSTA. | -> ACTION
|
||||||
ImGuiKey_GamepadStart, // Menu | + | Options |
|
ImGuiKey_GamepadStart, // Menu | + | Options |
|
||||||
ImGuiKey_GamepadBack, // View | - | Share |
|
ImGuiKey_GamepadBack, // View | - | Share |
|
||||||
ImGuiKey_GamepadFaceLeft, // X | Y | Square | Tap: Toggle Menu. Hold: Windowing mode (Focus/Move/Resize windows)
|
ImGuiKey_GamepadFaceLeft, // X | Y | Square | Toggle Menu. Hold for Windowing mode (Focus/Move/Resize windows)
|
||||||
ImGuiKey_GamepadFaceRight, // B | A | Circle | Cancel / Close / Exit
|
ImGuiKey_GamepadFaceRight, // B | A | Circle | Cancel / Close / Exit
|
||||||
ImGuiKey_GamepadFaceUp, // Y | X | Triangle | Text Input / On-screen Keyboard
|
ImGuiKey_GamepadFaceUp, // Y | X | Triangle | Open Context Menu
|
||||||
ImGuiKey_GamepadFaceDown, // A | B | Cross | Activate / Open / Toggle / Tweak
|
ImGuiKey_GamepadFaceDown, // A | B | Cross | Activate / Open / Toggle. Hold for 0.60f to Activate in Text Input mode (e.g. wired to an on-screen keyboard).
|
||||||
ImGuiKey_GamepadDpadLeft, // D-pad Left | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
ImGuiKey_GamepadDpadLeft, // D-pad Left | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadDpadRight, // D-pad Right | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
ImGuiKey_GamepadDpadRight, // D-pad Right | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
||||||
ImGuiKey_GamepadDpadUp, // D-pad Up | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
ImGuiKey_GamepadDpadUp, // D-pad Up | " | " | Move / Tweak / Resize Window (in Windowing mode)
|
||||||
@@ -2428,7 +2430,7 @@ struct ImGuiIO
|
|||||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // Swap Cmd<>Ctrl keys + OS X style text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
|
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // Swap Cmd<>Ctrl keys + OS X style text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
|
||||||
bool ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
|
bool ConfigInputTrickleEventQueue; // = true // Enable input queue trickling: some types of events submitted during the same frame (e.g. button down + up) will be spread over multiple frames, improving interactions with low framerates.
|
||||||
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
bool ConfigInputTextCursorBlink; // = true // Enable blinking cursor (optional as some users consider it to be distracting).
|
||||||
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will keep item active and select contents (single-line only).
|
bool ConfigInputTextEnterKeepActive; // = false // [BETA] Pressing Enter will reactivate item and select all text (single-line only).
|
||||||
bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.
|
bool ConfigDragClickToInputText; // = false // [BETA] Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving). Not desirable on devices without a keyboard.
|
||||||
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires ImGuiBackendFlags_HasMouseCursors for better mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
bool ConfigWindowsResizeFromEdges; // = true // Enable resizing of windows from their edges and from the lower-left corner. This requires ImGuiBackendFlags_HasMouseCursors for better mouse cursor feedback. (This used to be a per-window ImGuiWindowFlags_ResizeFromAnySide flag)
|
||||||
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
|
bool ConfigWindowsMoveFromTitleBarOnly; // = false // Enable allowing to move windows only when clicking on their title bar. Does not apply to windows without a title bar.
|
||||||
@@ -3906,8 +3908,10 @@ inline ImTextureID ImTextureRef::GetTexID() const
|
|||||||
// Using an indirection to avoid patching ImDrawCmd after a SetTexID() call (but this could be an alternative solution too)
|
// Using an indirection to avoid patching ImDrawCmd after a SetTexID() call (but this could be an alternative solution too)
|
||||||
inline ImTextureID ImDrawCmd::GetTexID() const
|
inline ImTextureID ImDrawCmd::GetTexID() const
|
||||||
{
|
{
|
||||||
// If you are getting this assert: A renderer backend with support for ImGuiBackendFlags_RendererHasTextures (1.92)
|
// If you are getting this assert with ImTextureID_Invalid == 0 and your ImTextureID is used to store an index:
|
||||||
// must iterate and handle ImTextureData requests stored in ImDrawData::Textures[].
|
// - You can add '#define ImTextureID_Invalid ((ImTextureID)-1)' in your imconfig file.
|
||||||
|
// If you are getting this assert with a renderer backend with support for ImGuiBackendFlags_RendererHasTextures (1.92+):
|
||||||
|
// - You must correctly iterate and handle ImTextureData requests stored in ImDrawData::Textures[]. See docs/BACKENDS.md.
|
||||||
ImTextureID tex_id = TexRef._TexData ? TexRef._TexData->TexID : TexRef._TexID; // == TexRef.GetTexID() above.
|
ImTextureID tex_id = TexRef._TexData ? TexRef._TexData->TexID : TexRef._TexID; // == TexRef.GetTexID() above.
|
||||||
if (TexRef._TexData != NULL)
|
if (TexRef._TexData != NULL)
|
||||||
IM_ASSERT(tex_id != ImTextureID_Invalid && "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!");
|
IM_ASSERT(tex_id != ImTextureID_Invalid && "ImDrawCmd is referring to ImTextureData that wasn't uploaded to graphics system. Backend must call ImTextureData::SetTexID() after handling ImTextureStatus_WantCreate request!");
|
||||||
|
|||||||
+12
-2
@@ -526,7 +526,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink);
|
ImGui::Checkbox("io.ConfigInputTextCursorBlink", &io.ConfigInputTextCursorBlink);
|
||||||
ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting).");
|
ImGui::SameLine(); HelpMarker("Enable blinking cursor (optional as some users consider it to be distracting).");
|
||||||
ImGui::Checkbox("io.ConfigInputTextEnterKeepActive", &io.ConfigInputTextEnterKeepActive);
|
ImGui::Checkbox("io.ConfigInputTextEnterKeepActive", &io.ConfigInputTextEnterKeepActive);
|
||||||
ImGui::SameLine(); HelpMarker("Pressing Enter will keep item active and select contents (single-line only).");
|
ImGui::SameLine(); HelpMarker("Pressing Enter will reactivate item and select all text (single-line only).");
|
||||||
ImGui::Checkbox("io.ConfigDragClickToInputText", &io.ConfigDragClickToInputText);
|
ImGui::Checkbox("io.ConfigDragClickToInputText", &io.ConfigDragClickToInputText);
|
||||||
ImGui::SameLine(); HelpMarker("Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving).");
|
ImGui::SameLine(); HelpMarker("Enable turning DragXXX widgets into text input with a simple mouse click-release (without moving).");
|
||||||
ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors);
|
ImGui::Checkbox("io.ConfigMacOSXBehaviors", &io.ConfigMacOSXBehaviors);
|
||||||
@@ -8731,13 +8731,23 @@ void ImGui::ShowUserGuide()
|
|||||||
BulletText("Ctrl+Z to undo, Ctrl+Y/Ctrl+Shift+Z to redo.");
|
BulletText("Ctrl+Z to undo, Ctrl+Y/Ctrl+Shift+Z to redo.");
|
||||||
BulletText("Escape to revert.");
|
BulletText("Escape to revert.");
|
||||||
Unindent();
|
Unindent();
|
||||||
BulletText("With keyboard navigation enabled:");
|
BulletText("With Keyboard controls enabled:");
|
||||||
Indent();
|
Indent();
|
||||||
BulletText("Arrow keys or Home/End/PageUp/PageDown to navigate.");
|
BulletText("Arrow keys or Home/End/PageUp/PageDown to navigate.");
|
||||||
BulletText("Space to activate a widget.");
|
BulletText("Space to activate a widget.");
|
||||||
BulletText("Return to input text into a widget.");
|
BulletText("Return to input text into a widget.");
|
||||||
BulletText("Escape to deactivate a widget, close popup,\nexit a child window or the menu layer, clear focus.");
|
BulletText("Escape to deactivate a widget, close popup,\nexit a child window or the menu layer, clear focus.");
|
||||||
BulletText("Alt to jump to the menu layer of a window.");
|
BulletText("Alt to jump to the menu layer of a window.");
|
||||||
|
BulletText("Menu or Shift+F10 to open a context menu.");
|
||||||
|
Unindent();
|
||||||
|
BulletText("With Gamepad controls enabled:");
|
||||||
|
Indent();
|
||||||
|
BulletText("D-Pad: Navigate / Tweak / Resize (in Windowing mode).");
|
||||||
|
BulletText("%s Face button: Activate / Open / Toggle. Hold: activate with text input.", io.ConfigNavSwapGamepadButtons ? "East" : "South");
|
||||||
|
BulletText("%s Face button: Cancel / Close / Exit.", io.ConfigNavSwapGamepadButtons ? "South" : "East");
|
||||||
|
BulletText("West Face button: Toggle Menu. Hold for Windowing mode (Focus/Move/Resize windows).");
|
||||||
|
BulletText("North Face button: Open Context Menu.");
|
||||||
|
BulletText("L1/R1: Tweak Slower/Faster, Focus Previous/Next (in Windowing Mode).");
|
||||||
Unindent();
|
Unindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-2
@@ -1508,8 +1508,8 @@ typedef ImBitArray<ImGuiKey_NamedKey_COUNT, -ImGuiKey_NamedKey_BEGIN> ImBitAr
|
|||||||
#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1
|
#define ImGuiKey_NavGamepadTweakFast ImGuiKey_GamepadR1
|
||||||
#define ImGuiKey_NavGamepadActivate (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceRight : ImGuiKey_GamepadFaceDown)
|
#define ImGuiKey_NavGamepadActivate (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceRight : ImGuiKey_GamepadFaceDown)
|
||||||
#define ImGuiKey_NavGamepadCancel (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceDown : ImGuiKey_GamepadFaceRight)
|
#define ImGuiKey_NavGamepadCancel (g.IO.ConfigNavSwapGamepadButtons ? ImGuiKey_GamepadFaceDown : ImGuiKey_GamepadFaceRight)
|
||||||
#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft
|
#define ImGuiKey_NavGamepadMenu ImGuiKey_GamepadFaceLeft // Toggle menu layer. Hold to enable Windowing.
|
||||||
#define ImGuiKey_NavGamepadInput ImGuiKey_GamepadFaceUp
|
#define ImGuiKey_NavGamepadContextMenu ImGuiKey_GamepadFaceUp // Open context menu (same as Shift+F10)
|
||||||
|
|
||||||
enum ImGuiInputEventType
|
enum ImGuiInputEventType
|
||||||
{
|
{
|
||||||
@@ -2325,6 +2325,7 @@ struct ImGuiContext
|
|||||||
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusedWindow'
|
||||||
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
ImGuiID NavFocusScopeId; // Focused focus scope (e.g. selection code often wants to "clear other items" when landing on an item of the same scope)
|
||||||
ImGuiNavLayer NavLayer; // Focused layer (main scrolling layer, or menu/title bar layer)
|
ImGuiNavLayer NavLayer; // Focused layer (main scrolling layer, or menu/title bar layer)
|
||||||
|
ImGuiItemFlags NavIdItemFlags;
|
||||||
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItemByID()
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && (IsKeyPressed(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate)) ? NavId : 0, also set when calling ActivateItemByID()
|
||||||
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
ImGuiID NavActivateDownId; // ~~ IsKeyDown(ImGuiKey_Space) || IsKeyDown(ImGuiKey_Enter) || IsKeyDown(ImGuiKey_NavGamepadActivate) ? NavId : 0
|
||||||
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
ImGuiID NavActivatePressedId; // ~~ IsKeyPressed(ImGuiKey_Space) || IsKeyPressed(ImGuiKey_Enter) || IsKeyPressed(ImGuiKey_NavGamepadActivate) ? NavId : 0 (no repeat)
|
||||||
@@ -2332,6 +2333,8 @@ struct ImGuiContext
|
|||||||
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
ImVector<ImGuiFocusScopeData> NavFocusRoute; // Reversed copy focus scope stack for NavId (should contains NavFocusScopeId). This essentially follow the window->ParentWindowForFocusRoute chain.
|
||||||
ImGuiID NavHighlightActivatedId;
|
ImGuiID NavHighlightActivatedId;
|
||||||
float NavHighlightActivatedTimer;
|
float NavHighlightActivatedTimer;
|
||||||
|
ImGuiID NavOpenContextMenuItemId;
|
||||||
|
ImGuiID NavOpenContextMenuWindowId;
|
||||||
ImGuiID NavNextActivateId; // Set by ActivateItemByID(), queued until next frame.
|
ImGuiID NavNextActivateId; // Set by ActivateItemByID(), queued until next frame.
|
||||||
ImGuiActivateFlags NavNextActivateFlags;
|
ImGuiActivateFlags NavNextActivateFlags;
|
||||||
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Gamepad
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode? THIS CAN ONLY BE ImGuiInputSource_Keyboard or ImGuiInputSource_Gamepad
|
||||||
@@ -2461,6 +2464,7 @@ struct ImGuiContext
|
|||||||
ImGuiInputTextDeactivatedState InputTextDeactivatedState;
|
ImGuiInputTextDeactivatedState InputTextDeactivatedState;
|
||||||
ImFontBaked InputTextPasswordFontBackupBaked;
|
ImFontBaked InputTextPasswordFontBackupBaked;
|
||||||
ImFontFlags InputTextPasswordFontBackupFlags;
|
ImFontFlags InputTextPasswordFontBackupFlags;
|
||||||
|
ImGuiID InputTextReactivateId; // ID of InputText to reactivate on next frame (for io.ConfigInputTextEnterKeepActive behavior)
|
||||||
ImGuiID TempInputId; // Temporary text input when using Ctrl+Click on a slider, etc.
|
ImGuiID TempInputId; // Temporary text input when using Ctrl+Click on a slider, etc.
|
||||||
ImGuiDataTypeStorage DataTypeZeroValue; // 0 for all data types
|
ImGuiDataTypeStorage DataTypeZeroValue; // 0 for all data types
|
||||||
int BeginMenuDepth;
|
int BeginMenuDepth;
|
||||||
@@ -3330,6 +3334,8 @@ namespace ImGui
|
|||||||
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 ImGuiMouseButton GetMouseButtonFromPopupFlags(ImGuiPopupFlags flags);
|
IMGUI_API ImGuiMouseButton GetMouseButtonFromPopupFlags(ImGuiPopupFlags flags);
|
||||||
|
IMGUI_API bool IsPopupOpenRequestForItem(ImGuiPopupFlags flags, ImGuiID id);
|
||||||
|
IMGUI_API bool IsPopupOpenRequestForWindow(ImGuiPopupFlags flags);
|
||||||
|
|
||||||
// Tooltips
|
// Tooltips
|
||||||
IMGUI_API bool BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags);
|
IMGUI_API bool BeginTooltipEx(ImGuiTooltipFlags tooltip_flags, ImGuiWindowFlags extra_window_flags);
|
||||||
|
|||||||
+9
-7
@@ -4760,8 +4760,8 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
if (is_wordwrap)
|
if (is_wordwrap)
|
||||||
wrap_width = ImMax(1.0f, GetContentRegionAvail().x + (draw_window->ScrollbarY ? 0.0f : -g.Style.ScrollbarSize));
|
wrap_width = ImMax(1.0f, GetContentRegionAvail().x + (draw_window->ScrollbarY ? 0.0f : -g.Style.ScrollbarSize));
|
||||||
|
|
||||||
const bool input_requested_by_nav = (g.ActiveId != id) && ((g.NavActivateId == id) && ((g.NavActivateFlags & ImGuiActivateFlags_PreferInput) || (g.NavInputSource == ImGuiInputSource_Keyboard)));
|
const bool input_requested_by_nav = (g.ActiveId != id) && (g.NavActivateId == id);
|
||||||
|
const bool input_requested_by_reactivate = (g.InputTextReactivateId == id); // for io.ConfigInputTextEnterKeepActive
|
||||||
const bool user_clicked = hovered && io.MouseClicked[0];
|
const bool user_clicked = hovered && io.MouseClicked[0];
|
||||||
const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
const bool user_scroll_finish = is_multiline && state != NULL && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
||||||
const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
const bool user_scroll_active = is_multiline && state != NULL && g.ActiveId == GetWindowScrollbarID(draw_window, ImGuiAxis_Y);
|
||||||
@@ -4772,7 +4772,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
|
|
||||||
const bool init_reload_from_user_buf = (state != NULL && state->WantReloadUserBuf);
|
const bool init_reload_from_user_buf = (state != NULL && state->WantReloadUserBuf);
|
||||||
const bool init_changed_specs = (state != NULL && state->Stb->single_line != !is_multiline); // state != NULL means its our state.
|
const bool init_changed_specs = (state != NULL && state->Stb->single_line != !is_multiline); // state != NULL means its our state.
|
||||||
const bool init_make_active = (user_clicked || user_scroll_finish || input_requested_by_nav);
|
const bool init_make_active = (user_clicked || user_scroll_finish || input_requested_by_nav || input_requested_by_reactivate);
|
||||||
const bool init_state = (init_make_active || user_scroll_active);
|
const bool init_state = (init_make_active || user_scroll_active);
|
||||||
if (init_reload_from_user_buf)
|
if (init_reload_from_user_buf)
|
||||||
{
|
{
|
||||||
@@ -5068,7 +5068,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
const bool is_enter = Shortcut(ImGuiKey_Enter, f_repeat, id) || Shortcut(ImGuiKey_KeypadEnter, f_repeat, id);
|
const bool is_enter = Shortcut(ImGuiKey_Enter, f_repeat, id) || Shortcut(ImGuiKey_KeypadEnter, f_repeat, id);
|
||||||
const bool is_ctrl_enter = Shortcut(ImGuiMod_Ctrl | ImGuiKey_Enter, f_repeat, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_KeypadEnter, f_repeat, id);
|
const bool is_ctrl_enter = Shortcut(ImGuiMod_Ctrl | ImGuiKey_Enter, f_repeat, id) || Shortcut(ImGuiMod_Ctrl | ImGuiKey_KeypadEnter, f_repeat, id);
|
||||||
const bool is_shift_enter = Shortcut(ImGuiMod_Shift | ImGuiKey_Enter, f_repeat, id) || Shortcut(ImGuiMod_Shift | ImGuiKey_KeypadEnter, f_repeat, id);
|
const bool is_shift_enter = Shortcut(ImGuiMod_Shift | ImGuiKey_Enter, f_repeat, id) || Shortcut(ImGuiMod_Shift | ImGuiKey_KeypadEnter, f_repeat, id);
|
||||||
const bool is_gamepad_validate = nav_gamepad_active && (IsKeyPressed(ImGuiKey_NavGamepadActivate, false) || IsKeyPressed(ImGuiKey_NavGamepadInput, false));
|
const bool is_gamepad_validate = nav_gamepad_active && IsKeyPressed(ImGuiKey_NavGamepadActivate, false);
|
||||||
const bool is_cancel = Shortcut(ImGuiKey_Escape, f_repeat, id) || (nav_gamepad_active && Shortcut(ImGuiKey_NavGamepadCancel, f_repeat, id));
|
const bool is_cancel = Shortcut(ImGuiKey_Escape, f_repeat, id) || (nav_gamepad_active && Shortcut(ImGuiKey_NavGamepadCancel, f_repeat, id));
|
||||||
|
|
||||||
// FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of.
|
// FIXME: Should use more Shortcut() and reduce IsKeyPressed()+SetKeyOwner(), but requires modifiers combination to be taken account of.
|
||||||
@@ -5109,11 +5109,13 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
bool is_new_line = is_multiline && !is_gamepad_validate && (is_shift_enter || (is_enter && !ctrl_enter_for_new_line) || (is_ctrl_enter && ctrl_enter_for_new_line));
|
bool is_new_line = is_multiline && !is_gamepad_validate && (is_shift_enter || (is_enter && !ctrl_enter_for_new_line) || (is_ctrl_enter && ctrl_enter_for_new_line));
|
||||||
if (!is_new_line)
|
if (!is_new_line)
|
||||||
{
|
{
|
||||||
validated = true;
|
validated = clear_active_id = true;
|
||||||
if (io.ConfigInputTextEnterKeepActive && !is_multiline)
|
if (io.ConfigInputTextEnterKeepActive && !is_multiline)
|
||||||
|
{
|
||||||
|
// Queue reactivation, so that e.g. IsItemDeactivatedAfterEdit() will work. (#9001)
|
||||||
state->SelectAll(); // No need to scroll
|
state->SelectAll(); // No need to scroll
|
||||||
else
|
g.InputTextReactivateId = id; // Mark for reactivation on next frame
|
||||||
clear_active_id = true;
|
}
|
||||||
}
|
}
|
||||||
else if (!is_readonly)
|
else if (!is_readonly)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user