mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-29 14:56:36 +00:00
Merge branch 'master' into navigation
# Conflicts: # imgui.cpp
This commit is contained in:
commit
66b2ee6ea2
@ -28,8 +28,6 @@ static double g_Time = 0.0;
|
|||||||
static ALLEGRO_MOUSE_CURSOR* g_MouseCursorInvisible = NULL;
|
static ALLEGRO_MOUSE_CURSOR* g_MouseCursorInvisible = NULL;
|
||||||
static ALLEGRO_VERTEX_DECL* g_VertexDecl = NULL;
|
static ALLEGRO_VERTEX_DECL* g_VertexDecl = NULL;
|
||||||
|
|
||||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
|
||||||
|
|
||||||
struct ImDrawVertAllegro
|
struct ImDrawVertAllegro
|
||||||
{
|
{
|
||||||
ImVec2 pos;
|
ImVec2 pos;
|
||||||
@ -162,9 +160,9 @@ bool ImGui_ImplA5_Init(ALLEGRO_DISPLAY* display)
|
|||||||
// We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
|
// We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
|
||||||
ALLEGRO_VERTEX_ELEMENT elems[] =
|
ALLEGRO_VERTEX_ELEMENT elems[] =
|
||||||
{
|
{
|
||||||
{ ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, OFFSETOF(ImDrawVertAllegro, pos) },
|
{ ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, IM_OFFSETOF(ImDrawVertAllegro, pos) },
|
||||||
{ ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, OFFSETOF(ImDrawVertAllegro, uv) },
|
{ ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, IM_OFFSETOF(ImDrawVertAllegro, uv) },
|
||||||
{ ALLEGRO_PRIM_COLOR_ATTR, 0, OFFSETOF(ImDrawVertAllegro, col) },
|
{ ALLEGRO_PRIM_COLOR_ATTR, 0, IM_OFFSETOF(ImDrawVertAllegro, col) },
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
|
g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));
|
||||||
|
@ -793,11 +793,10 @@ bool ImGui_ImplIOS_CreateDeviceObjects()
|
|||||||
glEnableVertexAttribArray(g_AttribLocationUV);
|
glEnableVertexAttribArray(g_AttribLocationUV);
|
||||||
glEnableVertexAttribArray(g_AttribLocationColor);
|
glEnableVertexAttribArray(g_AttribLocationColor);
|
||||||
|
|
||||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
||||||
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, pos));
|
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
||||||
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, uv));
|
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
||||||
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, col));
|
|
||||||
#undef OFFSETOF
|
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -127,6 +128,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -240,19 +240,20 @@ static bool IsAnyMouseButtonDown()
|
|||||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.
|
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.
|
||||||
|
// PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.
|
||||||
IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
int button = 0;
|
int button = 0;
|
||||||
if (msg == WM_LBUTTONDOWN) button = 0;
|
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
|
||||||
if (msg == WM_RBUTTONDOWN) button = 1;
|
if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
|
||||||
if (msg == WM_MBUTTONDOWN) button = 2;
|
if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
|
||||||
if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
|
if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
io.MouseDown[button] = true;
|
io.MouseDown[button] = true;
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -127,6 +128,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -247,19 +247,20 @@ static bool IsAnyMouseButtonDown()
|
|||||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.
|
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.
|
||||||
|
// PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.
|
||||||
IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
int button = 0;
|
int button = 0;
|
||||||
if (msg == WM_LBUTTONDOWN) button = 0;
|
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
|
||||||
if (msg == WM_RBUTTONDOWN) button = 1;
|
if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
|
||||||
if (msg == WM_MBUTTONDOWN) button = 2;
|
if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
|
||||||
if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
|
if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
io.MouseDown[button] = true;
|
io.MouseDown[button] = true;
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -127,6 +128,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..;%(AdditionalIncludeDirectories);$(DXSDK_DIR)Include;</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -186,19 +186,20 @@ static bool IsAnyMouseButtonDown()
|
|||||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
||||||
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.
|
// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.
|
||||||
|
// PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.
|
||||||
IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:
|
||||||
{
|
{
|
||||||
int button = 0;
|
int button = 0;
|
||||||
if (msg == WM_LBUTTONDOWN) button = 0;
|
if (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;
|
||||||
if (msg == WM_RBUTTONDOWN) button = 1;
|
if (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;
|
||||||
if (msg == WM_MBUTTONDOWN) button = 2;
|
if (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;
|
||||||
if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
|
if (!IsAnyMouseButtonDown() && GetCapture() == NULL)
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
io.MouseDown[button] = true;
|
io.MouseDown[button] = true;
|
||||||
|
@ -77,15 +77,14 @@ void ImGui_ImplGlfwGL2_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + OFFSETOF(ImDrawVert, pos)));
|
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + OFFSETOF(ImDrawVert, uv)));
|
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + OFFSETOF(ImDrawVert, col)));
|
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
@ -103,7 +102,6 @@ void ImGui_ImplGlfwGL2_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
idx_buffer += pcmd->ElemCount;
|
idx_buffer += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef OFFSETOF
|
|
||||||
|
|
||||||
// Restore modified state
|
// Restore modified state
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
@ -116,6 +116,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -135,6 +136,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -269,11 +269,9 @@ bool ImGui_ImplGlfwGL3_CreateDeviceObjects()
|
|||||||
glEnableVertexAttribArray(g_AttribLocationUV);
|
glEnableVertexAttribArray(g_AttribLocationUV);
|
||||||
glEnableVertexAttribArray(g_AttribLocationColor);
|
glEnableVertexAttribArray(g_AttribLocationColor);
|
||||||
|
|
||||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
||||||
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, pos));
|
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
||||||
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, uv));
|
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
||||||
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, col));
|
|
||||||
#undef OFFSETOF
|
|
||||||
|
|
||||||
ImGui_ImplGlfwGL3_CreateFontsTexture();
|
ImGui_ImplGlfwGL3_CreateFontsTexture();
|
||||||
|
|
||||||
|
@ -116,6 +116,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;$(SolutionDir)\libs\gl3w;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;$(SolutionDir)\libs\gl3w;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -135,6 +136,7 @@
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;$(SolutionDir)\libs\gl3w;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\libs\glfw\include;$(SolutionDir)\libs\gl3w;..\..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -70,15 +70,14 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
||||||
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
const ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;
|
||||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
||||||
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + OFFSETOF(ImDrawVert, pos)));
|
glVertexPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, pos)));
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + OFFSETOF(ImDrawVert, uv)));
|
glTexCoordPointer(2, GL_FLOAT, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, uv)));
|
||||||
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + OFFSETOF(ImDrawVert, col)));
|
glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(ImDrawVert), (const GLvoid*)((const char*)vtx_buffer + IM_OFFSETOF(ImDrawVert, col)));
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
||||||
{
|
{
|
||||||
@ -96,7 +95,6 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
|||||||
idx_buffer += pcmd->ElemCount;
|
idx_buffer += pcmd->ElemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef OFFSETOF
|
|
||||||
|
|
||||||
// Restore modified state
|
// Restore modified state
|
||||||
glDisableClientState(GL_COLOR_ARRAY);
|
glDisableClientState(GL_COLOR_ARRAY);
|
||||||
|
@ -273,11 +273,9 @@ bool ImGui_ImplSdlGL3_CreateDeviceObjects()
|
|||||||
glEnableVertexAttribArray(g_AttribLocationUV);
|
glEnableVertexAttribArray(g_AttribLocationUV);
|
||||||
glEnableVertexAttribArray(g_AttribLocationColor);
|
glEnableVertexAttribArray(g_AttribLocationColor);
|
||||||
|
|
||||||
#define OFFSETOF(TYPE, ELEMENT) ((size_t)&(((TYPE *)0)->ELEMENT))
|
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, pos));
|
||||||
glVertexAttribPointer(g_AttribLocationPosition, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, pos));
|
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, uv));
|
||||||
glVertexAttribPointer(g_AttribLocationUV, 2, GL_FLOAT, GL_FALSE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, uv));
|
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)IM_OFFSETOF(ImDrawVert, col));
|
||||||
glVertexAttribPointer(g_AttribLocationColor, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(ImDrawVert), (GLvoid*)OFFSETOF(ImDrawVert, col));
|
|
||||||
#undef OFFSETOF
|
|
||||||
|
|
||||||
ImGui_ImplSdlGL3_CreateFontsTexture();
|
ImGui_ImplSdlGL3_CreateFontsTexture();
|
||||||
|
|
||||||
|
10
imgui.cpp
10
imgui.cpp
@ -716,7 +716,7 @@ namespace ImGui
|
|||||||
static void NavUpdate();
|
static void NavUpdate();
|
||||||
static void NavUpdateWindowing();
|
static void NavUpdateWindowing();
|
||||||
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id);
|
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id);
|
||||||
static void FocusPreviousWindow();
|
static void FocusFrontMostActiveWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -3318,7 +3318,7 @@ void ImGui::NewFrame()
|
|||||||
|
|
||||||
// Closing the focused window restore focus to the first active root window in descending z-order
|
// Closing the focused window restore focus to the first active root window in descending z-order
|
||||||
if (g.NavWindow && !g.NavWindow->WasActive)
|
if (g.NavWindow && !g.NavWindow->WasActive)
|
||||||
FocusPreviousWindow();
|
FocusFrontMostActiveWindow();
|
||||||
|
|
||||||
// No window should be open at the beginning of the frame.
|
// No window should be open at the beginning of the frame.
|
||||||
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
|
||||||
@ -6079,10 +6079,10 @@ void ImGui::BringWindowToFront(ImGuiWindow* window)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
if (g.Windows.back() == window)
|
if (g.Windows.back() == window)
|
||||||
return;
|
return;
|
||||||
for (int i = 0; i < g.Windows.Size; i++)
|
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window
|
||||||
if (g.Windows[i] == window)
|
if (g.Windows[i] == window)
|
||||||
{
|
{
|
||||||
g.Windows.erase(g.Windows.begin() + i);
|
g.Windows.erase(g.Windows.Data + i);
|
||||||
g.Windows.push_back(window);
|
g.Windows.push_back(window);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -6137,7 +6137,7 @@ void ImGui::FocusWindow(ImGuiWindow* window)
|
|||||||
BringWindowToFront(window);
|
BringWindowToFront(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::FocusPreviousWindow()
|
void ImGui::FocusFrontMostActiveWindow()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
for (int i = g.Windows.Size - 1; i >= 0; i--)
|
for (int i = g.Windows.Size - 1; i >= 0; i--)
|
||||||
|
2
imgui.h
2
imgui.h
@ -40,7 +40,7 @@
|
|||||||
#define IM_FMTLIST(FMT)
|
#define IM_FMTLIST(FMT)
|
||||||
#endif
|
#endif
|
||||||
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
|
#define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR)/sizeof(*_ARR)))
|
||||||
#define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM))
|
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in modern C++.
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
|
@ -1445,7 +1445,7 @@ void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_wid
|
|||||||
// Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp
|
// Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp
|
||||||
if (!TexPixelsRGBA32)
|
if (!TexPixelsRGBA32)
|
||||||
{
|
{
|
||||||
unsigned char* pixels;
|
unsigned char* pixels = NULL;
|
||||||
GetTexDataAsAlpha8(&pixels, NULL, NULL);
|
GetTexDataAsAlpha8(&pixels, NULL, NULL);
|
||||||
if (pixels)
|
if (pixels)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user