mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Merge branch 'master' into docking
# Conflicts: # backends/imgui_impl_win32.cpp # examples/example_marmalade/main.cpp # imgui.cpp # imgui.h
This commit is contained in:
commit
15b4a064f9
@ -300,6 +300,7 @@ static bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks, Glfw
|
|||||||
|
|
||||||
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
// Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any.
|
||||||
bd->PrevUserCallbackWindowFocus = NULL;
|
bd->PrevUserCallbackWindowFocus = NULL;
|
||||||
|
bd->PrevUserCallbackCursorEnter = NULL;
|
||||||
bd->PrevUserCallbackMousebutton = NULL;
|
bd->PrevUserCallbackMousebutton = NULL;
|
||||||
bd->PrevUserCallbackScroll = NULL;
|
bd->PrevUserCallbackScroll = NULL;
|
||||||
bd->PrevUserCallbackKey = NULL;
|
bd->PrevUserCallbackKey = NULL;
|
||||||
|
@ -1,318 +0,0 @@
|
|||||||
// dear imgui: Renderer + Platform Backend for Marmalade + IwGx
|
|
||||||
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
|
|
||||||
|
|
||||||
// Implemented features:
|
|
||||||
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID!
|
|
||||||
// Missing features:
|
|
||||||
// [ ] Renderer: Clipping rectangles are not honored.
|
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
|
||||||
|
|
||||||
// CHANGELOG
|
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
|
||||||
// 2021-12-08: Renderer: Fixed mishandling of the the ImDrawCmd::IdxOffset field! This is an old bug but it never had an effect until some internal rendering changes in 1.86.
|
|
||||||
// 2021-05-19: Renderer: Replaced direct access to ImDrawCmd::TextureId with a call to ImDrawCmd::GetTexID(). (will become a requirement)
|
|
||||||
// 2019-07-21: Inputs: Added mapping for ImGuiKey_KeyPadEnter.
|
|
||||||
// 2019-05-11: Inputs: Don't filter value from character callback before calling AddInputCharacter().
|
|
||||||
// 2018-11-30: Misc: Setting up io.BackendPlatformName/io.BackendRendererName so they can be displayed in the About Window.
|
|
||||||
// 2018-02-16: Misc: Obsoleted the io.RenderDrawListsFn callback and exposed ImGui_Marmalade_RenderDrawData() in the .h file so you can call it yourself.
|
|
||||||
// 2018-02-06: Misc: Removed call to ImGui::Shutdown() which is not available from 1.60 WIP, user needs to call CreateContext/DestroyContext themselves.
|
|
||||||
// 2018-02-06: Inputs: Added mapping for ImGuiKey_Space.
|
|
||||||
|
|
||||||
#include "imgui.h"
|
|
||||||
#include "imgui_impl_marmalade.h"
|
|
||||||
|
|
||||||
#include <s3eClipboard.h>
|
|
||||||
#include <s3ePointer.h>
|
|
||||||
#include <s3eKeyboard.h>
|
|
||||||
#include <IwTexture.h>
|
|
||||||
#include <IwGx.h>
|
|
||||||
|
|
||||||
// Data
|
|
||||||
static double g_Time = 0.0f;
|
|
||||||
static bool g_MousePressed[3] = { false, false, false };
|
|
||||||
static CIwTexture* g_FontTexture = NULL;
|
|
||||||
static char* g_ClipboardText = NULL;
|
|
||||||
static bool g_osdKeyboardEnabled = false;
|
|
||||||
|
|
||||||
// use this setting to scale the interface - e.g. on device you could use 2 or 3 scale factor
|
|
||||||
static ImVec2 g_RenderScale = ImVec2(1.0f, 1.0f);
|
|
||||||
|
|
||||||
// Render function.
|
|
||||||
void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data)
|
|
||||||
{
|
|
||||||
// Avoid rendering when minimized
|
|
||||||
if (draw_data->DisplaySize.x <= 0.0f || draw_data->DisplaySize.y <= 0.0f)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Render command lists
|
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
|
||||||
{
|
|
||||||
const ImDrawList* cmd_list = draw_data->CmdLists[n];
|
|
||||||
const ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;
|
|
||||||
const int nVert = cmd_list->VtxBuffer.Size;
|
|
||||||
CIwFVec2* pVertStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
|
||||||
CIwFVec2* pUVStream = IW_GX_ALLOC(CIwFVec2, nVert);
|
|
||||||
CIwColour* pColStream = IW_GX_ALLOC(CIwColour, nVert);
|
|
||||||
|
|
||||||
for (int i = 0; i < nVert; i++)
|
|
||||||
{
|
|
||||||
// FIXME-OPT: optimize multiplication on GPU using vertex shader/projection matrix.
|
|
||||||
pVertStream[i].x = cmd_list->VtxBuffer[i].pos.x * g_RenderScale.x;
|
|
||||||
pVertStream[i].y = cmd_list->VtxBuffer[i].pos.y * g_RenderScale.y;
|
|
||||||
pUVStream[i].x = cmd_list->VtxBuffer[i].uv.x;
|
|
||||||
pUVStream[i].y = cmd_list->VtxBuffer[i].uv.y;
|
|
||||||
pColStream[i] = cmd_list->VtxBuffer[i].col;
|
|
||||||
}
|
|
||||||
|
|
||||||
IwGxSetVertStreamScreenSpace(pVertStream, nVert);
|
|
||||||
IwGxSetUVStream(pUVStream);
|
|
||||||
IwGxSetColStream(pColStream, nVert);
|
|
||||||
IwGxSetNormStream(0);
|
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
|
||||||
{
|
|
||||||
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
|
|
||||||
if (pcmd->UserCallback)
|
|
||||||
{
|
|
||||||
pcmd->UserCallback(cmd_list, pcmd);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// FIXME: Not honoring ClipRect fields.
|
|
||||||
CIwMaterial* pCurrentMaterial = IW_GX_ALLOC_MATERIAL();
|
|
||||||
pCurrentMaterial->SetShadeMode(CIwMaterial::SHADE_FLAT);
|
|
||||||
pCurrentMaterial->SetCullMode(CIwMaterial::CULL_NONE);
|
|
||||||
pCurrentMaterial->SetFiltering(false);
|
|
||||||
pCurrentMaterial->SetAlphaMode(CIwMaterial::ALPHA_BLEND);
|
|
||||||
pCurrentMaterial->SetDepthWriteMode(CIwMaterial::DEPTH_WRITE_NORMAL);
|
|
||||||
pCurrentMaterial->SetAlphaTestMode(CIwMaterial::ALPHATEST_DISABLED);
|
|
||||||
pCurrentMaterial->SetTexture((CIwTexture*)pcmd->GetTexID());
|
|
||||||
IwGxSetMaterial(pCurrentMaterial);
|
|
||||||
IwGxDrawPrims(IW_GX_TRI_LIST, (uint16*)(idx_buffer + pcmd->IdxOffset), pcmd->ElemCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IwGxFlush();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: restore modified state (i.e. mvp matrix)
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char* ImGui_Marmalade_GetClipboardText(void* /*user_data*/)
|
|
||||||
{
|
|
||||||
if (!s3eClipboardAvailable())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (int size = s3eClipboardGetText(NULL, 0))
|
|
||||||
{
|
|
||||||
if (g_ClipboardText)
|
|
||||||
delete[] g_ClipboardText;
|
|
||||||
g_ClipboardText = new char[size];
|
|
||||||
g_ClipboardText[0] = '\0';
|
|
||||||
s3eClipboardGetText(g_ClipboardText, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_ClipboardText;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ImGui_Marmalade_SetClipboardText(void* /*user_data*/, const char* text)
|
|
||||||
{
|
|
||||||
if (s3eClipboardAvailable())
|
|
||||||
s3eClipboardSetText(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data)
|
|
||||||
{
|
|
||||||
// pEvent->m_Button is of type s3ePointerButton and indicates which mouse
|
|
||||||
// button was pressed. For touchscreen this should always have the value
|
|
||||||
// S3E_POINTER_BUTTON_SELECT
|
|
||||||
s3ePointerEvent* pEvent = (s3ePointerEvent*)system_data;
|
|
||||||
|
|
||||||
if (pEvent->m_Pressed == 1)
|
|
||||||
{
|
|
||||||
if (pEvent->m_Button == S3E_POINTER_BUTTON_LEFTMOUSE)
|
|
||||||
g_MousePressed[0] = true;
|
|
||||||
if (pEvent->m_Button == S3E_POINTER_BUTTON_RIGHTMOUSE)
|
|
||||||
g_MousePressed[1] = true;
|
|
||||||
if (pEvent->m_Button == S3E_POINTER_BUTTON_MIDDLEMOUSE)
|
|
||||||
g_MousePressed[2] = true;
|
|
||||||
if (pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELUP)
|
|
||||||
io.MouseWheel += pEvent->m_y;
|
|
||||||
if (pEvent->m_Button == S3E_POINTER_BUTTON_MOUSEWHEELDOWN)
|
|
||||||
io.MouseWheel += pEvent->m_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data)
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
s3eKeyboardEvent* e = (s3eKeyboardEvent*)system_data;
|
|
||||||
if (e->m_Pressed == 1)
|
|
||||||
io.KeysDown[e->m_Key] = true;
|
|
||||||
if (e->m_Pressed == 0)
|
|
||||||
io.KeysDown[e->m_Key] = false;
|
|
||||||
|
|
||||||
io.KeyCtrl = s3eKeyboardGetState(s3eKeyLeftControl) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightControl) == S3E_KEY_STATE_DOWN;
|
|
||||||
io.KeyShift = s3eKeyboardGetState(s3eKeyLeftShift) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightShift) == S3E_KEY_STATE_DOWN;
|
|
||||||
io.KeyAlt = s3eKeyboardGetState(s3eKeyLeftAlt) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightAlt) == S3E_KEY_STATE_DOWN;
|
|
||||||
io.KeySuper = s3eKeyboardGetState(s3eKeyLeftWindows) == S3E_KEY_STATE_DOWN || s3eKeyboardGetState(s3eKeyRightWindows) == S3E_KEY_STATE_DOWN;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data)
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
s3eKeyboardCharEvent* e = (s3eKeyboardCharEvent*)system_data;
|
|
||||||
io.AddInputCharacter((unsigned int)e->m_Char);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui_Marmalade_CreateDeviceObjects()
|
|
||||||
{
|
|
||||||
// Build texture atlas
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
unsigned char* pixels;
|
|
||||||
int width, height;
|
|
||||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
|
||||||
|
|
||||||
// Upload texture to graphics system
|
|
||||||
g_FontTexture = new CIwTexture();
|
|
||||||
g_FontTexture->SetModifiable(true);
|
|
||||||
CIwImage& image = g_FontTexture->GetImage();
|
|
||||||
image.SetFormat(CIwImage::ARGB_8888);
|
|
||||||
image.SetWidth(width);
|
|
||||||
image.SetHeight(height);
|
|
||||||
image.SetBuffers(); // allocates and own buffers
|
|
||||||
image.ReadTexels(pixels);
|
|
||||||
g_FontTexture->SetMipMapping(false);
|
|
||||||
g_FontTexture->SetFiltering(false);
|
|
||||||
g_FontTexture->Upload();
|
|
||||||
|
|
||||||
// Store our identifier
|
|
||||||
io.Fonts->SetTexID((ImTextureID)g_FontTexture);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_Marmalade_InvalidateDeviceObjects()
|
|
||||||
{
|
|
||||||
if (g_ClipboardText)
|
|
||||||
{
|
|
||||||
delete[] g_ClipboardText;
|
|
||||||
g_ClipboardText = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_FontTexture)
|
|
||||||
{
|
|
||||||
ImGui::GetIO().Fonts->SetTexID(0);
|
|
||||||
delete g_FontTexture;
|
|
||||||
g_FontTexture = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ImGui_Marmalade_Init(bool install_callbacks)
|
|
||||||
{
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
io.BackendPlatformName = io.BackendRendererName = "imgui_impl_marmalade";
|
|
||||||
|
|
||||||
// Keyboard mapping. Dear ImGui will use those indices to peek into the io.KeysDown[] array.
|
|
||||||
io.KeyMap[ImGuiKey_Tab] = s3eKeyTab
|
|
||||||
io.KeyMap[ImGuiKey_LeftArrow] = s3eKeyLeft;
|
|
||||||
io.KeyMap[ImGuiKey_RightArrow] = s3eKeyRight;
|
|
||||||
io.KeyMap[ImGuiKey_UpArrow] = s3eKeyUp;
|
|
||||||
io.KeyMap[ImGuiKey_DownArrow] = s3eKeyDown;
|
|
||||||
io.KeyMap[ImGuiKey_PageUp] = s3eKeyPageUp;
|
|
||||||
io.KeyMap[ImGuiKey_PageDown] = s3eKeyPageDown;
|
|
||||||
io.KeyMap[ImGuiKey_Home] = s3eKeyHome;
|
|
||||||
io.KeyMap[ImGuiKey_End] = s3eKeyEnd;
|
|
||||||
io.KeyMap[ImGuiKey_Insert] = s3eKeyInsert;
|
|
||||||
io.KeyMap[ImGuiKey_Delete] = s3eKeyDelete;
|
|
||||||
io.KeyMap[ImGuiKey_Backspace] = s3eKeyBackspace;
|
|
||||||
io.KeyMap[ImGuiKey_Space] = s3eKeySpace;
|
|
||||||
io.KeyMap[ImGuiKey_Enter] = s3eKeyEnter;
|
|
||||||
io.KeyMap[ImGuiKey_Escape] = s3eKeyEsc;
|
|
||||||
io.KeyMap[ImGuiKey_KeyPadEnter] = s3eKeyNumPadEnter;
|
|
||||||
io.KeyMap[ImGuiKey_A] = s3eKeyA;
|
|
||||||
io.KeyMap[ImGuiKey_C] = s3eKeyC;
|
|
||||||
io.KeyMap[ImGuiKey_V] = s3eKeyV;
|
|
||||||
io.KeyMap[ImGuiKey_X] = s3eKeyX;
|
|
||||||
io.KeyMap[ImGuiKey_Y] = s3eKeyY;
|
|
||||||
io.KeyMap[ImGuiKey_Z] = s3eKeyZ;
|
|
||||||
|
|
||||||
io.SetClipboardTextFn = ImGui_Marmalade_SetClipboardText;
|
|
||||||
io.GetClipboardTextFn = ImGui_Marmalade_GetClipboardText;
|
|
||||||
|
|
||||||
if (install_callbacks)
|
|
||||||
{
|
|
||||||
s3ePointerRegister(S3E_POINTER_BUTTON_EVENT, ImGui_Marmalade_PointerButtonEventCallback, 0);
|
|
||||||
s3eKeyboardRegister(S3E_KEYBOARD_KEY_EVENT, ImGui_Marmalade_KeyCallback, 0);
|
|
||||||
s3eKeyboardRegister(S3E_KEYBOARD_CHAR_EVENT, ImGui_Marmalade_CharCallback, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_Marmalade_Shutdown()
|
|
||||||
{
|
|
||||||
ImGui_Marmalade_InvalidateDeviceObjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui_Marmalade_NewFrame()
|
|
||||||
{
|
|
||||||
if (!g_FontTexture)
|
|
||||||
ImGui_Marmalade_CreateDeviceObjects();
|
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
|
|
||||||
// Setup display size (every frame to accommodate for window resizing)
|
|
||||||
int w = IwGxGetScreenWidth(), h = IwGxGetScreenHeight();
|
|
||||||
io.DisplaySize = ImVec2((float)w, (float)h);
|
|
||||||
// For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.
|
|
||||||
io.DisplayFramebufferScale = g_scale;
|
|
||||||
|
|
||||||
// Setup time step
|
|
||||||
double current_time = s3eTimerGetUST() / 1000.0f;
|
|
||||||
io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f / 60.0f);
|
|
||||||
g_Time = current_time;
|
|
||||||
|
|
||||||
double mouse_x, mouse_y;
|
|
||||||
mouse_x = s3ePointerGetX();
|
|
||||||
mouse_y = s3ePointerGetY();
|
|
||||||
io.MousePos = ImVec2((float)mouse_x / g_scale.x, (float)mouse_y / g_scale.y); // Mouse position (set to -FLT_MAX,-FLT_MAX if no mouse / on another screen, etc.)
|
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
io.MouseDown[i] = g_MousePressed[i] || s3ePointerGetState((s3ePointerButton)i) != S3E_POINTER_STATE_UP; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
|
|
||||||
g_MousePressed[i] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Hide OS mouse cursor if ImGui is drawing it
|
|
||||||
// s3ePointerSetInt(S3E_POINTER_HIDE_CURSOR,(io.MouseDrawCursor ? 0 : 1));
|
|
||||||
|
|
||||||
// Show/hide OSD keyboard
|
|
||||||
if (io.WantTextInput)
|
|
||||||
{
|
|
||||||
// Some text input widget is active?
|
|
||||||
if (!g_osdKeyboardEnabled)
|
|
||||||
{
|
|
||||||
g_osdKeyboardEnabled = true;
|
|
||||||
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 1); // show OSD keyboard
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No text input widget is active
|
|
||||||
if (g_osdKeyboardEnabled)
|
|
||||||
{
|
|
||||||
g_osdKeyboardEnabled = false;
|
|
||||||
s3eKeyboardSetInt(S3E_KEYBOARD_GET_CHAR, 0); // hide OSD keyboard
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
// dear imgui: Renderer + Platform Backend for Marmalade + IwGx
|
|
||||||
// Marmalade code: Copyright (C) 2015 by Giovanni Zito (this file is part of Dear ImGui)
|
|
||||||
|
|
||||||
// Implemented features:
|
|
||||||
// [X] Renderer: User texture binding. Use 'CIwTexture*' as ImTextureID. Read the FAQ about ImTextureID!
|
|
||||||
|
|
||||||
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
|
|
||||||
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
|
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "imgui.h" // IMGUI_IMPL_API
|
|
||||||
|
|
||||||
IMGUI_IMPL_API bool ImGui_Marmalade_Init(bool install_callbacks);
|
|
||||||
IMGUI_IMPL_API void ImGui_Marmalade_Shutdown();
|
|
||||||
IMGUI_IMPL_API void ImGui_Marmalade_NewFrame();
|
|
||||||
IMGUI_IMPL_API void ImGui_Marmalade_RenderDrawData(ImDrawData* draw_data);
|
|
||||||
|
|
||||||
// Use if you want to reset your rendering device without losing Dear ImGui state.
|
|
||||||
IMGUI_IMPL_API void ImGui_Marmalade_InvalidateDeviceObjects();
|
|
||||||
IMGUI_IMPL_API bool ImGui_Marmalade_CreateDeviceObjects();
|
|
||||||
|
|
||||||
// Callbacks (installed by default if you enable 'install_callbacks' during initialization)
|
|
||||||
// You can also handle inputs yourself and use those as a reference.
|
|
||||||
IMGUI_IMPL_API int32 ImGui_Marmalade_PointerButtonEventCallback(void* system_data, void* user_data);
|
|
||||||
IMGUI_IMPL_API int32 ImGui_Marmalade_KeyCallback(void* system_data, void* user_data);
|
|
||||||
IMGUI_IMPL_API int32 ImGui_Marmalade_CharCallback(void* system_data, void* user_data);
|
|
@ -19,6 +19,7 @@
|
|||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
|
// 2021-12-21: Update SDL_RenderGeometryRaw() format to work with SDL 2.0.19.
|
||||||
// 2021-12-03: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
// 2021-12-03: Added support for large mesh (64K+ vertices), enable ImGuiBackendFlags_RendererHasVtxOffset flag.
|
||||||
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
|
// 2021-10-06: Backup and restore modified ClipRect/Viewport.
|
||||||
// 2021-09-21: Initial version.
|
// 2021-09-21: Initial version.
|
||||||
@ -175,7 +176,11 @@ void ImGui_ImplSDLRenderer_RenderDrawData(ImDrawData* draw_data)
|
|||||||
|
|
||||||
const float* xy = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, pos));
|
const float* xy = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, pos));
|
||||||
const float* uv = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, uv));
|
const float* uv = (const float*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, uv));
|
||||||
const int* color = (const int*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col));
|
#if SDL_VERSION_ATLEAST(2,0,19)
|
||||||
|
const SDL_Color* color = (const SDL_Color*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.19+
|
||||||
|
#else
|
||||||
|
const int* color = (const int*)((const char*)(vtx_buffer + pcmd->VtxOffset) + IM_OFFSETOF(ImDrawVert, col)); // SDL 2.0.17 and 2.0.18
|
||||||
|
#endif
|
||||||
|
|
||||||
// Bind texture, Draw
|
// Bind texture, Draw
|
||||||
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
SDL_Texture* tex = (SDL_Texture*)pcmd->GetTexID();
|
||||||
|
@ -35,8 +35,9 @@ typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);
|
|||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
// 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
// 2021-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
|
||||||
|
// 2021-12-16: Inputs: Fill VK_LCONTROL/VK_RCONTROL/VK_LSHIFT/VK_RSHIFT/VK_LMENU/VK_RMENU for completeness.
|
||||||
// 2021-08-17: Calling io.AddFocusEvent() on WM_SETFOCUS/WM_KILLFOCUS messages.
|
// 2021-08-17: Calling io.AddFocusEvent() on WM_SETFOCUS/WM_KILLFOCUS messages.
|
||||||
// 2021-08-02: Inputs: Fixed keyboard modifiers being reported when host windo doesn't have focus.
|
// 2021-08-02: Inputs: Fixed keyboard modifiers being reported when host window doesn't have focus.
|
||||||
// 2021-07-29: Inputs: MousePos is correctly reported when the host platform window is hovered but not focused (using TrackMouseEvent() to receive WM_MOUSELEAVE events).
|
// 2021-07-29: Inputs: MousePos is correctly reported when the host platform window is hovered but not focused (using TrackMouseEvent() to receive WM_MOUSELEAVE events).
|
||||||
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
// 2021-06-29: Reorganized backend to pull data from a single structure to facilitate usage with multiple-contexts (all g_XXXX access changed to bd->XXXX).
|
||||||
// 2021-06-08: Fixed ImGui_ImplWin32_EnableDpiAwareness() and ImGui_ImplWin32_GetDpiScaleForMonitor() to handle Windows 8.1/10 features without a manifest (per-monitor DPI, and properly calls SetProcessDpiAwareness() on 8.1).
|
// 2021-06-08: Fixed ImGui_ImplWin32_EnableDpiAwareness() and ImGui_ImplWin32_GetDpiScaleForMonitor() to handle Windows 8.1/10 features without a manifest (per-monitor DPI, and properly calls SetProcessDpiAwareness() on 8.1).
|
||||||
@ -503,11 +504,23 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA
|
|||||||
if (wParam < 256)
|
if (wParam < 256)
|
||||||
io.KeysDown[wParam] = down;
|
io.KeysDown[wParam] = down;
|
||||||
if (wParam == VK_CONTROL)
|
if (wParam == VK_CONTROL)
|
||||||
io.KeyCtrl = down;
|
{
|
||||||
|
io.KeysDown[VK_LCONTROL] = ((::GetKeyState(VK_LCONTROL) & 0x8000) != 0);
|
||||||
|
io.KeysDown[VK_RCONTROL] = ((::GetKeyState(VK_RCONTROL) & 0x8000) != 0);
|
||||||
|
io.KeyCtrl = io.KeysDown[VK_LCONTROL] || io.KeysDown[VK_RCONTROL];
|
||||||
|
}
|
||||||
if (wParam == VK_SHIFT)
|
if (wParam == VK_SHIFT)
|
||||||
io.KeyShift = down;
|
{
|
||||||
|
io.KeysDown[VK_LSHIFT] = ((::GetKeyState(VK_LSHIFT) & 0x8000) != 0);
|
||||||
|
io.KeysDown[VK_RSHIFT] = ((::GetKeyState(VK_RSHIFT) & 0x8000) != 0);
|
||||||
|
io.KeyShift = io.KeysDown[VK_LSHIFT] || io.KeysDown[VK_RSHIFT];
|
||||||
|
}
|
||||||
if (wParam == VK_MENU)
|
if (wParam == VK_MENU)
|
||||||
io.KeyAlt = down;
|
{
|
||||||
|
io.KeysDown[VK_LMENU] = ((::GetKeyState(VK_LMENU) & 0x8000) != 0);
|
||||||
|
io.KeysDown[VK_RMENU] = ((::GetKeyState(VK_RMENU) & 0x8000) != 0);
|
||||||
|
io.KeyAlt = io.KeysDown[VK_LMENU] || io.KeysDown[VK_RMENU];
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case WM_SETFOCUS:
|
case WM_SETFOCUS:
|
||||||
|
@ -12,7 +12,7 @@ your application or engine to easily integrate Dear ImGui.** Each backend is typ
|
|||||||
e.g. DirectX11 ([imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)), OpenGL/WebGL ([imgui_impl_opengl3.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_opengl3.cpp), Vulkan ([imgui_impl_vulkan.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_vulkan.cpp), etc.
|
e.g. DirectX11 ([imgui_impl_dx11.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_dx11.cpp)), OpenGL/WebGL ([imgui_impl_opengl3.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_opengl3.cpp), Vulkan ([imgui_impl_vulkan.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_vulkan.cpp), etc.
|
||||||
|
|
||||||
- For some high-level frameworks, a single backend usually handle both 'Platform' and 'Renderer' parts.<BR>
|
- For some high-level frameworks, a single backend usually handle both 'Platform' and 'Renderer' parts.<BR>
|
||||||
e.g. Allegro 5 ([imgui_impl_allegro5.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_allegro5.cpp)), Marmalade ([imgui_impl_marmalade.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_marmalade.cpp)). If you end up creating a custom backend for your engine, you may want to do the same.
|
e.g. Allegro 5 ([imgui_impl_allegro5.cpp](https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_allegro5.cpp)). If you end up creating a custom backend for your engine, you may want to do the same.
|
||||||
|
|
||||||
An application usually combines 1 Platform backend + 1 Renderer backend + main Dear ImGui sources.
|
An application usually combines 1 Platform backend + 1 Renderer backend + main Dear ImGui sources.
|
||||||
For example, the [example_win32_directx11](https://github.com/ocornut/imgui/tree/master/examples/example_win32_directx11) application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp. There are 20+ examples in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder. See [EXAMPLES.MD](https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md) for details.
|
For example, the [example_win32_directx11](https://github.com/ocornut/imgui/tree/master/examples/example_win32_directx11) application combines imgui_impl_win32.cpp + imgui_impl_dx11.cpp. There are 20+ examples in the [examples/](https://github.com/ocornut/imgui/blob/master/examples/) folder. See [EXAMPLES.MD](https://github.com/ocornut/imgui/blob/master/docs/EXAMPLES.md) for details.
|
||||||
@ -82,14 +82,13 @@ List of Renderer Backends:
|
|||||||
List of high-level Frameworks Backends (combining Platform + Renderer):
|
List of high-level Frameworks Backends (combining Platform + Renderer):
|
||||||
|
|
||||||
imgui_impl_allegro5.cpp
|
imgui_impl_allegro5.cpp
|
||||||
imgui_impl_marmalade.cpp
|
|
||||||
|
|
||||||
Emscripten is also supported.
|
Emscripten is also supported.
|
||||||
The [example_emscripten_opengl3](https://github.com/ocornut/imgui/tree/master/examples/example_emscripten_opengl3) app uses imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp, but other combos are possible.
|
The [example_emscripten_opengl3](https://github.com/ocornut/imgui/tree/master/examples/example_emscripten_opengl3) app uses imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp, but other combos are possible.
|
||||||
|
|
||||||
### Backends for third-party frameworks, graphics API or other languages
|
### Backends for third-party frameworks, graphics API or other languages
|
||||||
|
|
||||||
See https://github.com/ocornut/imgui/wiki/Bindings for the full list.
|
See https://github.com/ocornut/imgui/wiki/Bindings for the full list (e.g. Adventure Game Studio, Cinder, Cocos2d-x, Game Maker Studio2, Godot, LÖVE+LUA, Magnum, Monogame, Ogre, openFrameworks, OpenSceneGraph, SFML, Sokol, Unity, Unreal Engine and many others).
|
||||||
|
|
||||||
### Recommended Backends
|
### Recommended Backends
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ Other changes:
|
|||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
VERSION 1.86 WIP (In Progress)
|
VERSION 1.86 (Released 2021-12-22)
|
||||||
-----------------------------------------------------------------------
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
Breaking Changes:
|
Breaking Changes:
|
||||||
@ -108,8 +108,8 @@ Breaking Changes:
|
|||||||
- Removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges.
|
- Removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges.
|
||||||
Please open an issue if you think you really need this function. (#3841)
|
Please open an issue if you think you really need this function. (#3841)
|
||||||
- Backends: OSX: Added NSView* parameter to ImGui_ImplOSX_Init(). (#4759) [@stuartcarnie]
|
- Backends: OSX: Added NSView* parameter to ImGui_ImplOSX_Init(). (#4759) [@stuartcarnie]
|
||||||
Updated Apple+Metal and Apple+GL example applications accordingly.
|
- Backends: Marmalade: Removed obsolete Marmalade backend (imgui_impl_marmalade.cpp) + example app. (#368, #375)
|
||||||
|
Find last supported version at https://github.com/ocornut/imgui/wiki/Bindings
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
@ -120,12 +120,12 @@ Other Changes:
|
|||||||
- Added GetMouseClickedCount() function, returning the number of successive clicks. (#3229) [@kudaba]
|
- Added GetMouseClickedCount() function, returning the number of successive clicks. (#3229) [@kudaba]
|
||||||
(so IsMouseDoubleClicked(ImGuiMouseButton_Left) is same as GetMouseClickedCount(ImGuiMouseButton_Left) == 2,
|
(so IsMouseDoubleClicked(ImGuiMouseButton_Left) is same as GetMouseClickedCount(ImGuiMouseButton_Left) == 2,
|
||||||
but it allows testing for triple clicks and more).
|
but it allows testing for triple clicks and more).
|
||||||
- Modals: fixed issue hovering popups inside a child inside a modal. (#4676, #4527)
|
- Modals: fixed issue hovering popups inside a child windows inside a modal. (#4676, #4527)
|
||||||
- Modals, Popups, Windows: changes how appearing windows are interrupting popups and modals. (#4317) [@rokups]
|
- Modals, Popups, Windows: changes how appearing windows are interrupting popups and modals. (#4317) [@rokups]
|
||||||
- appearing windows created from within the begin stack of a popup/modal will no longer close it.
|
- appearing windows created from within the begin stack of a popup/modal will no longer close it.
|
||||||
- appearing windows created not within the begin stack of a modal will no longer close the modal,
|
- appearing windows created not within the begin stack of a modal will no longer close the modal,
|
||||||
and automatically appear behind it.
|
and automatically appear behind it.
|
||||||
- Fixed IsWindowFocused()/IsWindowHovered() issues with childs inside popups. (#4676)
|
- Fixed IsWindowFocused()/IsWindowHovered() issues with child windows inside popups. (#4676)
|
||||||
- Nav: Ctrl+tabbing to cycle through windows is now enabled regardless of using the _NavEnableKeyboard
|
- Nav: Ctrl+tabbing to cycle through windows is now enabled regardless of using the _NavEnableKeyboard
|
||||||
configuration flag. This is part of an effort to generalize the use of keyboard inputs. (#4023, #787).
|
configuration flag. This is part of an effort to generalize the use of keyboard inputs. (#4023, #787).
|
||||||
Note that while this is active you can also moving windows (with arrow) and resize (shift+arrows).
|
Note that while this is active you can also moving windows (with arrow) and resize (shift+arrows).
|
||||||
@ -141,11 +141,13 @@ Other Changes:
|
|||||||
- Menus: fixed closing a menu by clicking on its menu-bar item when inside a popup. (#3496, #4797) [@xndcn]
|
- Menus: fixed closing a menu by clicking on its menu-bar item when inside a popup. (#3496, #4797) [@xndcn]
|
||||||
- Menus: fixed menu inside a popup/modal not inhibiting hovering of items in the popup/modal. (#3496, #4797)
|
- Menus: fixed menu inside a popup/modal not inhibiting hovering of items in the popup/modal. (#3496, #4797)
|
||||||
- Menus: fixed sub-menu items inside a popups from closing the popup.
|
- Menus: fixed sub-menu items inside a popups from closing the popup.
|
||||||
|
- Menus: fixed top-level menu from not consistently using style.PopupRounding. (#4788)
|
||||||
- InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682)
|
- InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682)
|
||||||
- Inputtext, Nav: fixed using SetKeyboardFocusHere() on InputTextMultiline(). (#4761)
|
- Inputtext, Nav: fixed using SetKeyboardFocusHere() on InputTextMultiline(). (#4761)
|
||||||
- InputText: made double-click select word, triple-line select line. Word delimitation logic differs
|
- InputText: made double-click select word, triple-line select line. Word delimitation logic differs
|
||||||
slightly from the one used by CTRL+arrows. (#2244)
|
slightly from the one used by CTRL+arrows. (#2244)
|
||||||
- InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) [@actondev]
|
- InputText: fixed ReadOnly flag preventing callbacks from receiving the text buffer. (#4762) [@actondev]
|
||||||
|
- InputText: fixed Shift+Delete from not cutting into clipboard. (#4818, #1541) [@corporateshark]
|
||||||
- InputTextMultiline: fixed incorrect padding when FrameBorder > 0. (#3781, #4794)
|
- InputTextMultiline: fixed incorrect padding when FrameBorder > 0. (#3781, #4794)
|
||||||
- InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (#3781, #4794)
|
- InputTextMultiline: fixed vertical tracking with large values of FramePadding.y. (#3781, #4794)
|
||||||
- Separator: fixed cover all columns while called inside a table. (#4787)
|
- Separator: fixed cover all columns while called inside a table. (#4787)
|
||||||
@ -163,8 +165,8 @@ Other Changes:
|
|||||||
- Clipper: fixed invalid state when number of frozen table row is smaller than ItemCount.
|
- Clipper: fixed invalid state when number of frozen table row is smaller than ItemCount.
|
||||||
- Drag and Drop: BeginDragDropSource() with ImGuiDragDropFlags_SourceAllowNullID doesn't lose
|
- Drag and Drop: BeginDragDropSource() with ImGuiDragDropFlags_SourceAllowNullID doesn't lose
|
||||||
tooltip when scrolling. (#143)
|
tooltip when scrolling. (#143)
|
||||||
- Fonts: fixed infinite loop in ImFontGlyphRangesBuilder::AddRanges() when passing UINT16_MAX without
|
- Fonts: fixed infinite loop in ImFontGlyphRangesBuilder::AddRanges() when passing UINT16_MAX or UINT32_MAX
|
||||||
the IMGUI_USE_WCHAR32 compile-time option. (#4802) [@SlavicPotato]
|
without the IMGUI_USE_WCHAR32 compile-time option. (#4802) [@SlavicPotato]
|
||||||
- Metrics: Added a node showing windows in submission order and showing the Begin() stack.
|
- Metrics: Added a node showing windows in submission order and showing the Begin() stack.
|
||||||
- Misc: Added missing ImGuiMouseCursor_NotAllowed cursor for software rendering (when the
|
- Misc: Added missing ImGuiMouseCursor_NotAllowed cursor for software rendering (when the
|
||||||
io.MouseDrawCursor flag is enabled). (#4713) [@nobody-special666]
|
io.MouseDrawCursor flag is enabled). (#4713) [@nobody-special666]
|
||||||
@ -179,9 +181,11 @@ Other Changes:
|
|||||||
- Backends: OpenGL2, Allegro5, Marmalade: Fixed mishandling of the ImDrawCmd::IdxOffset field.
|
- Backends: OpenGL2, Allegro5, Marmalade: Fixed mishandling of the ImDrawCmd::IdxOffset field.
|
||||||
This is an old bug, but due to the way we created drawlists, it never had any visible side-effect before.
|
This is an old bug, but due to the way we created drawlists, it never had any visible side-effect before.
|
||||||
The new code for handling Modal and CTRL+Tab dimming/whitening recently made the bug surface. (#4790)
|
The new code for handling Modal and CTRL+Tab dimming/whitening recently made the bug surface. (#4790)
|
||||||
|
- Backends: Win32: Store left/right variants of Ctrl/Shift/Alt mods in KeysDown[] array. (#2625) [@thedmd]
|
||||||
- Backends: DX12: Fixed DRAW_EMPTY_SCISSOR_RECTANGLE warnings. (#4775)
|
- Backends: DX12: Fixed DRAW_EMPTY_SCISSOR_RECTANGLE warnings. (#4775)
|
||||||
- Backends: SDL_Renderer: Added support for large meshes (64k+ vertices) with 16-bit indices,
|
- Backends: SDL_Renderer: Added support for large meshes (64k+ vertices) with 16-bit indices,
|
||||||
enabling 'ImGuiBackendFlags_RendererHasVtxOffset' in the backend. (#3926) [@rokups]
|
enabling 'ImGuiBackendFlags_RendererHasVtxOffset' in the backend. (#3926) [@rokups]
|
||||||
|
- Backends: SDL_Renderer: Fix for SDL 2.0.19+ RenderGeometryRaw() API signature change. (#4819) [@sridenour]
|
||||||
- Backends: OSX: Generally fix keyboard support. Keyboard arrays indexed using kVK_* codes, e.g.
|
- Backends: OSX: Generally fix keyboard support. Keyboard arrays indexed using kVK_* codes, e.g.
|
||||||
ImGui::IsKeyPressed(kVK_Space). Don't set mouse cursor shape unconditionally. Handle two fingers scroll
|
ImGui::IsKeyPressed(kVK_Space). Don't set mouse cursor shape unconditionally. Handle two fingers scroll
|
||||||
cancel event. (#4759, #4253, #1873) [@stuartcarnie]
|
cancel event. (#4759, #4253, #1873) [@stuartcarnie]
|
||||||
|
@ -141,10 +141,6 @@ GLUT (e.g., FreeGLUT on Linux/Windows, GLUT framework on OSX) + OpenGL2 example.
|
|||||||
= main.cpp + imgui_impl_glut.cpp + imgui_impl_opengl2.cpp <BR>
|
= main.cpp + imgui_impl_glut.cpp + imgui_impl_opengl2.cpp <BR>
|
||||||
Note that GLUT/FreeGLUT is largely obsolete software, prefer using GLFW or SDL.
|
Note that GLUT/FreeGLUT is largely obsolete software, prefer using GLFW or SDL.
|
||||||
|
|
||||||
[example_marmalade/](https://github.com/ocornut/imgui/blob/master/examples/example_marmalade/) <BR>
|
|
||||||
Marmalade example using IwGx. <BR>
|
|
||||||
= main.cpp + imgui_impl_marmalade.cpp
|
|
||||||
|
|
||||||
[example_null/](https://github.com/ocornut/imgui/blob/master/examples/example_null/) <BR>
|
[example_null/](https://github.com/ocornut/imgui/blob/master/examples/example_null/) <BR>
|
||||||
Null example, compile and link imgui, create context, run headless with no inputs and no graphics output. <BR>
|
Null example, compile and link imgui, create context, run headless with no inputs and no graphics output. <BR>
|
||||||
= main.cpp <BR>
|
= main.cpp <BR>
|
||||||
|
@ -118,7 +118,7 @@ Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/
|
|||||||
Officially maintained backends/bindings (in repository):
|
Officially maintained backends/bindings (in repository):
|
||||||
- Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
|
- Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
|
||||||
- Platforms: GLFW, SDL2, Win32, Glut, OSX, Android.
|
- Platforms: GLFW, SDL2, Win32, Glut, OSX, Android.
|
||||||
- Frameworks: Emscripten, Allegro5, Marmalade.
|
- Frameworks: Allegro5, Emscripten.
|
||||||
|
|
||||||
[Third-party backends/bindings](https://github.com/ocornut/imgui/wiki/Bindings) wiki page:
|
[Third-party backends/bindings](https://github.com/ocornut/imgui/wiki/Bindings) wiki page:
|
||||||
- Languages: C, C# and: Beef, ChaiScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift...
|
- Languages: C, C# and: Beef, ChaiScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift...
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
# This file is for configuration settings for your
|
|
||||||
# application.
|
|
||||||
#
|
|
||||||
# The syntax is similar to windows .ini files ie
|
|
||||||
#
|
|
||||||
# [GroupName]
|
|
||||||
# Setting = Value
|
|
||||||
#
|
|
||||||
# Which can be read by your application using
|
|
||||||
# e.g s3eConfigGetString("GroupName", "Setting", string)
|
|
||||||
#
|
|
||||||
# All settings must be documented in .config.txt files.
|
|
||||||
# New settings specific to this application should be
|
|
||||||
# documented in app.config.txt
|
|
||||||
#
|
|
||||||
# Some conditional operations are also permitted, see the
|
|
||||||
# S3E documentation for details.
|
|
||||||
|
|
||||||
[S3E]
|
|
||||||
MemSize=6000000
|
|
||||||
MemSizeDebug=6000000
|
|
||||||
DispFixRot=FixedLandscape
|
|
||||||
|
|
||||||
# emulate iphone 5 resolution, change these settings to emulate other display resolution
|
|
||||||
WinWidth=1136
|
|
||||||
WinHeight=640
|
|
||||||
|
|
||||||
[GX]
|
|
||||||
DataCacheSize=131070
|
|
||||||
|
|
||||||
[Util]
|
|
||||||
#MemoryBreakpoint=1282
|
|
@ -1,125 +0,0 @@
|
|||||||
// Dear ImGui: standalone example application for Marmalade
|
|
||||||
// If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
|
|
||||||
// Read online: https://github.com/ocornut/imgui/tree/master/docs
|
|
||||||
|
|
||||||
// Copyright (C) 2015 by Giovanni Zito
|
|
||||||
// This file is part of Dear ImGui
|
|
||||||
|
|
||||||
#include "imgui.h"
|
|
||||||
#include "imgui_impl_marmalade.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <s3eKeyboard.h>
|
|
||||||
#include <s3ePointer.h>
|
|
||||||
#include <IwGx.h>
|
|
||||||
|
|
||||||
int main(int, char**)
|
|
||||||
{
|
|
||||||
IwGxInit();
|
|
||||||
|
|
||||||
// Setup Dear ImGui context
|
|
||||||
IMGUI_CHECKVERSION();
|
|
||||||
ImGui::CreateContext();
|
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
|
||||||
ImGui::StyleColorsDark();
|
|
||||||
//ImGui::StyleColorsClassic();
|
|
||||||
|
|
||||||
// Setup Platform/Renderer backends
|
|
||||||
ImGui_Marmalade_Init(true);
|
|
||||||
|
|
||||||
// Load Fonts
|
|
||||||
// - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use ImGui::PushFont()/PopFont() to select them.
|
|
||||||
// - AddFontFromFileTTF() will return the ImFont* so you can store it if you need to select the font among multiple.
|
|
||||||
// - If the file cannot be loaded, the function will return NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
|
|
||||||
// - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling ImFontAtlas::Build()/GetTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
|
|
||||||
// - Read 'docs/FONTS.md' for more instructions and details.
|
|
||||||
// - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write a double backslash \\ !
|
|
||||||
//io.Fonts->AddFontDefault();
|
|
||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Roboto-Medium.ttf", 16.0f);
|
|
||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/Cousine-Regular.ttf", 15.0f);
|
|
||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/DroidSans.ttf", 16.0f);
|
|
||||||
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
|
|
||||||
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
|
||||||
//IM_ASSERT(font != NULL);
|
|
||||||
|
|
||||||
// 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
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
if (s3eDeviceCheckQuitRequest())
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Poll and handle inputs
|
|
||||||
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
|
|
||||||
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.
|
|
||||||
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
|
|
||||||
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
|
||||||
s3eKeyboardUpdate();
|
|
||||||
s3ePointerUpdate();
|
|
||||||
|
|
||||||
// Start the Dear ImGui frame
|
|
||||||
ImGui_Marmalade_NewFrame();
|
|
||||||
ImGui::NewFrame();
|
|
||||||
|
|
||||||
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
|
|
||||||
if (show_demo_window)
|
|
||||||
ImGui::ShowDemoWindow(&show_demo_window);
|
|
||||||
|
|
||||||
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to created a named window.
|
|
||||||
{
|
|
||||||
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 (you can use a format strings too)
|
|
||||||
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 (most widgets return true when edited/activated)
|
|
||||||
counter++;
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Text("counter = %d", counter);
|
|
||||||
|
|
||||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().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();
|
|
||||||
IwGxSetColClear(clear_color.x * 255, clear_color.y * 255, clear_color.z * 255, clear_color.w * 255);
|
|
||||||
IwGxClear();
|
|
||||||
ImGui_Marmalade_RenderDrawData(ImGui::GetDrawData());
|
|
||||||
IwGxSwapBuffers();
|
|
||||||
|
|
||||||
s3eDeviceYield(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cleanup
|
|
||||||
ImGui_Marmalade_Shutdown();
|
|
||||||
ImGui::DestroyContext();
|
|
||||||
IwGxTerminate();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
#!/usr/bin/env mkb
|
|
||||||
|
|
||||||
# ImGui - standalone example application for Marmalade
|
|
||||||
# Copyright (C) 2015 by Giovanni Zito
|
|
||||||
# This file is part of ImGui
|
|
||||||
# https://github.com/ocornut/imgui
|
|
||||||
|
|
||||||
define IMGUI_DISABLE_INCLUDE_IMCONFIG_H
|
|
||||||
define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS
|
|
||||||
define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS
|
|
||||||
define _snprintf=snprintf
|
|
||||||
|
|
||||||
options
|
|
||||||
{
|
|
||||||
optimise-speed=1
|
|
||||||
}
|
|
||||||
|
|
||||||
includepaths
|
|
||||||
{
|
|
||||||
../..
|
|
||||||
../../backends
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects
|
|
||||||
{
|
|
||||||
iwgx
|
|
||||||
}
|
|
||||||
|
|
||||||
files
|
|
||||||
{
|
|
||||||
(.)
|
|
||||||
["imgui"]
|
|
||||||
../../imgui.cpp
|
|
||||||
../../imgui_demo.cpp
|
|
||||||
../../imgui_draw.cpp
|
|
||||||
../../imgui_tables.cpp
|
|
||||||
../../imgui_widgets.cpp
|
|
||||||
../../imconfig.h
|
|
||||||
../../imgui.h
|
|
||||||
../../imgui_internal.h
|
|
||||||
|
|
||||||
["imgui","Marmalade backend"]
|
|
||||||
../../backends/imgui_impl_marmalade.h
|
|
||||||
../../backends/imgui_impl_marmalade.cpp
|
|
||||||
main.cpp
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (main code and documentation)
|
// (main code and documentation)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@ -390,6 +390,7 @@ CODE
|
|||||||
- 2021/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
- 2021/XX/XX (1.XX) - Moved IME support functions from io.ImeSetInputScreenPosFn, io.ImeWindowHandle to the PlatformIO api.
|
||||||
|
|
||||||
|
|
||||||
|
- 2021/12/20 (1.86) - backends: removed obsolete Marmalade backend (imgui_impl_marmalade.cpp) + example. Find last supported version at https://github.com/ocornut/imgui/wiki/Bindings
|
||||||
- 2021/11/04 (1.86) - removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges. Please open an issue if you think you really need this function.
|
- 2021/11/04 (1.86) - removed CalcListClipping() function. Prefer using ImGuiListClipper which can return non-contiguous ranges. Please open an issue if you think you really need this function.
|
||||||
- 2021/08/23 (1.85) - removed GetWindowContentRegionWidth() function. keep inline redirection helper. can use 'GetWindowContentRegionMax().x - GetWindowContentRegionMin().x' instead for generally 'GetContentRegionAvail().x' is more useful.
|
- 2021/08/23 (1.85) - removed GetWindowContentRegionWidth() function. keep inline redirection helper. can use 'GetWindowContentRegionMax().x - GetWindowContentRegionMin().x' instead for generally 'GetContentRegionAvail().x' is more useful.
|
||||||
- 2021/07/26 (1.84) - commented out redirecting functions/enums names that were marked obsolete in 1.67 and 1.69 (March 2019):
|
- 2021/07/26 (1.84) - commented out redirecting functions/enums names that were marked obsolete in 1.67 and 1.69 (March 2019):
|
||||||
@ -18122,6 +18123,9 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat
|
|||||||
// Stack Tool: Display UI
|
// Stack Tool: Display UI
|
||||||
void ImGui::ShowStackToolWindow(bool* p_open)
|
void ImGui::ShowStackToolWindow(bool* p_open)
|
||||||
{
|
{
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize))
|
||||||
|
SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 8.0f), ImGuiCond_FirstUseEver);
|
||||||
if (!Begin("Dear ImGui Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1)
|
if (!Begin("Dear ImGui Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1)
|
||||||
{
|
{
|
||||||
End();
|
End();
|
||||||
@ -18129,7 +18133,6 @@ void ImGui::ShowStackToolWindow(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display hovered/active status
|
// Display hovered/active status
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
const ImGuiID hovered_id = g.HoveredIdPreviousFrame;
|
||||||
const ImGuiID active_id = g.ActiveId;
|
const ImGuiID active_id = g.ActiveId;
|
||||||
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
#ifdef IMGUI_ENABLE_TEST_ENGINE
|
||||||
|
6
imgui.h
6
imgui.h
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
@ -64,8 +64,8 @@ Index of this file:
|
|||||||
|
|
||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.86 WIP"
|
#define IMGUI_VERSION "1.86"
|
||||||
#define IMGUI_VERSION_NUM 18522
|
#define IMGUI_VERSION_NUM 18600
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
#define IMGUI_HAS_VIEWPORT // Viewport WIP branch
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Help:
|
// Help:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (internal structures/api)
|
// (internal structures/api)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (tables and columns code)
|
// (tables and columns code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.86 WIP
|
// dear imgui, v1.86
|
||||||
// (widgets code)
|
// (widgets code)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4325,7 +4325,7 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
|
|||||||
else if (IsKeyPressedMap(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; }
|
else if (IsKeyPressedMap(ImGuiKey_PageDown) && is_multiline) { state->OnKeyPressed(STB_TEXTEDIT_K_PGDOWN | k_mask); scroll_y += row_count_per_page * g.FontSize; }
|
||||||
else if (IsKeyPressedMap(ImGuiKey_Home)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }
|
else if (IsKeyPressedMap(ImGuiKey_Home)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }
|
||||||
else if (IsKeyPressedMap(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); }
|
else if (IsKeyPressedMap(ImGuiKey_End)) { state->OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); }
|
||||||
else if (IsKeyPressedMap(ImGuiKey_Delete) && !is_readonly) { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); }
|
else if (IsKeyPressedMap(ImGuiKey_Delete) && !is_readonly && !is_cut) { state->OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); }
|
||||||
else if (IsKeyPressedMap(ImGuiKey_Backspace) && !is_readonly)
|
else if (IsKeyPressedMap(ImGuiKey_Backspace) && !is_readonly)
|
||||||
{
|
{
|
||||||
if (!state->HasSelection())
|
if (!state->HasSelection())
|
||||||
@ -7065,7 +7065,9 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
|||||||
if (menu_is_open)
|
if (menu_is_open)
|
||||||
{
|
{
|
||||||
SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos.
|
SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos.
|
||||||
|
PushStyleVar(ImGuiStyleVar_ChildRounding, style.PopupRounding); // First level will use _PopupRounding, subsequent will use _ChildRounding
|
||||||
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)
|
||||||
|
PopStyleVar();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user