mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Upgraded to ImGui 1.61:
- Upgraded ImGui framework to 1.61 WIP, which adds a few improvements to context management. - Removed from plugin implementation all the references to default ImGui context. - Removed from ImGui Context Proxy destructor code switching to default ImGui context (there is no default context and decision is left for a higher level manager when to switch and to what context). - Added own font atlas that is shared by all contexts and used explicitly to create Slate resources. - Removed from ImGui Context Proxy workaround that was previously needed for copying cursor data to dynamically created contexts. - Removed explicit saving of context settings before its destruction as this is now handled in ImGui::DestroyContext(). - Reimplemented ImGuiImplementation::GetCursorData() to use new interface.
This commit is contained in:
parent
fa32fd95e3
commit
413b4f407a
@ -79,8 +79,6 @@ FImGuiContextManager::~FImGuiContextManager()
|
|||||||
{
|
{
|
||||||
// Order matters because contexts can be created during World Tick Start events.
|
// Order matters because contexts can be created during World Tick Start events.
|
||||||
FWorldDelegates::OnWorldTickStart.RemoveAll(this);
|
FWorldDelegates::OnWorldTickStart.RemoveAll(this);
|
||||||
Contexts.Empty();
|
|
||||||
ImGui::Shutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FImGuiContextManager::Tick(float DeltaSeconds)
|
void FImGuiContextManager::Tick(float DeltaSeconds)
|
||||||
@ -118,7 +116,7 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetEditorContextData()
|
|||||||
|
|
||||||
if (UNLIKELY(!Data))
|
if (UNLIKELY(!Data))
|
||||||
{
|
{
|
||||||
Data = &Contexts.Emplace(Utilities::EDITOR_CONTEXT_INDEX, FContextData{ GetEditorContextName(), Utilities::EDITOR_CONTEXT_INDEX, DrawMultiContextEvent, ImGuiDemo, -1 });
|
Data = &Contexts.Emplace(Utilities::EDITOR_CONTEXT_INDEX, FContextData{ GetEditorContextName(), Utilities::EDITOR_CONTEXT_INDEX, DrawMultiContextEvent, FontAtlas, ImGuiDemo, -1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
return *Data;
|
return *Data;
|
||||||
@ -132,7 +130,7 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetStandaloneWorldCont
|
|||||||
|
|
||||||
if (UNLIKELY(!Data))
|
if (UNLIKELY(!Data))
|
||||||
{
|
{
|
||||||
Data = &Contexts.Emplace(Utilities::STANDALONE_GAME_CONTEXT_INDEX, FContextData{ GetWorldContextName(), Utilities::STANDALONE_GAME_CONTEXT_INDEX, DrawMultiContextEvent, ImGuiDemo });
|
Data = &Contexts.Emplace(Utilities::STANDALONE_GAME_CONTEXT_INDEX, FContextData{ GetWorldContextName(), Utilities::STANDALONE_GAME_CONTEXT_INDEX, DrawMultiContextEvent, FontAtlas, ImGuiDemo });
|
||||||
}
|
}
|
||||||
|
|
||||||
return *Data;
|
return *Data;
|
||||||
@ -172,7 +170,7 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetWorldContextData(co
|
|||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
if (UNLIKELY(!Data))
|
if (UNLIKELY(!Data))
|
||||||
{
|
{
|
||||||
Data = &Contexts.Emplace(Index, FContextData{ GetWorldContextName(World), Index, DrawMultiContextEvent, ImGuiDemo, WorldContext->PIEInstance });
|
Data = &Contexts.Emplace(Index, FContextData{ GetWorldContextName(World), Index, DrawMultiContextEvent, FontAtlas, ImGuiDemo, WorldContext->PIEInstance });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -182,7 +180,7 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetWorldContextData(co
|
|||||||
#else
|
#else
|
||||||
if (UNLIKELY(!Data))
|
if (UNLIKELY(!Data))
|
||||||
{
|
{
|
||||||
Data = &Contexts.Emplace(Index, FContextData{ GetWorldContextName(World), Index, DrawMultiContextEvent, ImGuiDemo });
|
Data = &Contexts.Emplace(Index, FContextData{ GetWorldContextName(World), Index, DrawMultiContextEvent, FontAtlas, ImGuiDemo });
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -21,6 +21,10 @@ public:
|
|||||||
|
|
||||||
~FImGuiContextManager();
|
~FImGuiContextManager();
|
||||||
|
|
||||||
|
ImFontAtlas& GetFontAtlas() { return FontAtlas; }
|
||||||
|
const ImFontAtlas& GetFontAtlas() const { return FontAtlas; }
|
||||||
|
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
// Get or create editor ImGui context proxy.
|
// Get or create editor ImGui context proxy.
|
||||||
FORCEINLINE FImGuiContextProxy& GetEditorContextProxy() { return GetEditorContextData().ContextProxy; }
|
FORCEINLINE FImGuiContextProxy& GetEditorContextProxy() { return GetEditorContextData().ContextProxy; }
|
||||||
@ -56,9 +60,9 @@ private:
|
|||||||
|
|
||||||
struct FContextData
|
struct FContextData
|
||||||
{
|
{
|
||||||
FContextData(const FString& ContextName, int32 ContextIndex, FSimpleMulticastDelegate& SharedDrawEvent, FImGuiDemo& Demo, int32 InPIEInstance = -1)
|
FContextData(const FString& ContextName, int32 ContextIndex, FSimpleMulticastDelegate& SharedDrawEvent, ImFontAtlas& FontAtlas, FImGuiDemo& Demo, int32 InPIEInstance = -1)
|
||||||
: PIEInstance(InPIEInstance)
|
: PIEInstance(InPIEInstance)
|
||||||
, ContextProxy(ContextName, &SharedDrawEvent)
|
, ContextProxy(ContextName, &SharedDrawEvent, &FontAtlas)
|
||||||
{
|
{
|
||||||
ContextProxy.OnDraw().AddLambda([&Demo, ContextIndex]() { Demo.DrawControls(ContextIndex); });
|
ContextProxy.OnDraw().AddLambda([&Demo, ContextIndex]() { Demo.DrawControls(ContextIndex); });
|
||||||
}
|
}
|
||||||
@ -73,8 +77,8 @@ private:
|
|||||||
|
|
||||||
struct FContextData
|
struct FContextData
|
||||||
{
|
{
|
||||||
FContextData(const FString& ContextName, int32 ContextIndex, FSimpleMulticastDelegate& SharedDrawEvent, FImGuiDemo& Demo)
|
FContextData(const FString& ContextName, int32 ContextIndex, FSimpleMulticastDelegate& SharedDrawEvent, ImFontAtlas& FontAtlas, FImGuiDemo& Demo)
|
||||||
: ContextProxy(ContextName, &SharedDrawEvent)
|
: ContextProxy(ContextName, &SharedDrawEvent, &FontAtlas)
|
||||||
{
|
{
|
||||||
ContextProxy.OnDraw().AddLambda([&Demo, ContextIndex]() { Demo.DrawControls(ContextIndex); });
|
ContextProxy.OnDraw().AddLambda([&Demo, ContextIndex]() { Demo.DrawControls(ContextIndex); });
|
||||||
}
|
}
|
||||||
@ -103,4 +107,6 @@ private:
|
|||||||
FImGuiDemo ImGuiDemo;
|
FImGuiDemo ImGuiDemo;
|
||||||
|
|
||||||
FSimpleMulticastDelegate DrawMultiContextEvent;
|
FSimpleMulticastDelegate DrawMultiContextEvent;
|
||||||
|
|
||||||
|
ImFontAtlas FontAtlas;
|
||||||
};
|
};
|
||||||
|
@ -44,13 +44,13 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FImGuiContextProxy::FImGuiContextProxy(const FString& InName, FSimpleMulticastDelegate* InSharedDrawEvent)
|
FImGuiContextProxy::FImGuiContextProxy(const FString& InName, FSimpleMulticastDelegate* InSharedDrawEvent, ImFontAtlas* InFontAtlas)
|
||||||
: Name(InName)
|
: Name(InName)
|
||||||
, SharedDrawEvent(InSharedDrawEvent)
|
, SharedDrawEvent(InSharedDrawEvent)
|
||||||
, IniFilename(TCHAR_TO_ANSI(*GetIniFile(InName)))
|
, IniFilename(TCHAR_TO_ANSI(*GetIniFile(InName)))
|
||||||
{
|
{
|
||||||
// Create context.
|
// Create context.
|
||||||
Context = TUniquePtr<ImGuiContext>(ImGui::CreateContext());
|
Context = TUniquePtr<ImGuiContext>(ImGui::CreateContext(InFontAtlas));
|
||||||
|
|
||||||
// Set this context in ImGui for initialization (any allocations will be tracked in this context).
|
// Set this context in ImGui for initialization (any allocations will be tracked in this context).
|
||||||
SetAsCurrent();
|
SetAsCurrent();
|
||||||
@ -65,20 +65,6 @@ FImGuiContextProxy::FImGuiContextProxy(const FString& InName, FSimpleMulticastDe
|
|||||||
IO.DisplaySize = { DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT };
|
IO.DisplaySize = { DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT };
|
||||||
DisplaySize = ImGuiInterops::ToVector2D(IO.DisplaySize);
|
DisplaySize = ImGuiInterops::ToVector2D(IO.DisplaySize);
|
||||||
|
|
||||||
// When GetTexData is called for the first time it builds atlas texture and copies mouse cursor data to context.
|
|
||||||
// When multiple contexts share atlas then only the first one will get mouse data. A simple workaround is to use
|
|
||||||
// a temporary atlas if shared one is already built.
|
|
||||||
unsigned char* Pixels;
|
|
||||||
const bool bIsAltasBuilt = IO.Fonts->TexPixelsAlpha8 != nullptr;
|
|
||||||
if (bIsAltasBuilt)
|
|
||||||
{
|
|
||||||
ImFontAtlas().GetTexDataAsRGBA32(&Pixels, nullptr, nullptr);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IO.Fonts->GetTexDataAsRGBA32(&Pixels, nullptr, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize key mapping, so context can correctly interpret input state.
|
// Initialize key mapping, so context can correctly interpret input state.
|
||||||
ImGuiInterops::SetUnrealKeyMap(IO);
|
ImGuiInterops::SetUnrealKeyMap(IO);
|
||||||
|
|
||||||
@ -91,15 +77,12 @@ FImGuiContextProxy::~FImGuiContextProxy()
|
|||||||
{
|
{
|
||||||
if (Context)
|
if (Context)
|
||||||
{
|
{
|
||||||
// Set this context in ImGui for de-initialization (any de-allocations will be tracked in this context).
|
// Setting this as a current context is still required in the current framework version to properly shutdown
|
||||||
|
// and save data.
|
||||||
SetAsCurrent();
|
SetAsCurrent();
|
||||||
|
|
||||||
// Save context data and destroy.
|
// Save context data and destroy.
|
||||||
ImGuiImplementation::SaveCurrentContextIniSettings(IniFilename.c_str());
|
|
||||||
ImGui::DestroyContext(Context.Release());
|
ImGui::DestroyContext(Context.Release());
|
||||||
|
|
||||||
// Set default context in ImGui to keep global context pointer valid.
|
|
||||||
ImGui::SetCurrentContext(&ImGuiImplementation::GetDefaultContext());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class FImGuiContextProxy
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FImGuiContextProxy(const FString& Name, FSimpleMulticastDelegate* InSharedDrawEvent);
|
FImGuiContextProxy(const FString& Name, FSimpleMulticastDelegate* InSharedDrawEvent, ImFontAtlas* InFontAtlas);
|
||||||
~FImGuiContextProxy();
|
~FImGuiContextProxy();
|
||||||
|
|
||||||
FImGuiContextProxy(const FImGuiContextProxy&) = delete;
|
FImGuiContextProxy(const FImGuiContextProxy&) = delete;
|
||||||
|
@ -32,29 +32,18 @@
|
|||||||
|
|
||||||
namespace ImGuiImplementation
|
namespace ImGuiImplementation
|
||||||
{
|
{
|
||||||
// This is exposing ImGui default context for the whole module.
|
bool GetCursorData(ImGuiMouseCursor CursorType, FVector2D& OutSize, FVector2D& OutUVMin, FVector2D& OutUVMax, FVector2D& OutOutlineUVMin, FVector2D& OutOutlineUVMax)
|
||||||
// This is assuming that we don't define custom GImGui and therefore have GImDefaultContext defined in imgui.cpp.
|
|
||||||
ImGuiContext& GetDefaultContext()
|
|
||||||
{
|
{
|
||||||
return GImDefaultContext;
|
ImFontAtlas* FontAtlas = ImGui::GetIO().Fonts;
|
||||||
}
|
ImVec2 Offset, Size, UV[4];
|
||||||
|
if (FontAtlas && FontAtlas->GetMouseCursorTexData(CursorType, &Offset, &Size, &UV[0], &UV[2]))
|
||||||
void SaveCurrentContextIniSettings(const char* Filename)
|
|
||||||
{
|
|
||||||
SaveIniSettingsToDisk(Filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GetCursorData(int CursorType, FVector2D& OutSize, FVector2D& OutUVMin, FVector2D& OutUVMax, FVector2D& OutOutlineUVMin, FVector2D& OutOutlineUVMax)
|
|
||||||
{
|
|
||||||
if (static_cast<unsigned>(CursorType) < static_cast<unsigned>(ImGuiMouseCursor_Count_))
|
|
||||||
{
|
{
|
||||||
using namespace ImGuiInterops;
|
using namespace ImGuiInterops;
|
||||||
ImGuiMouseCursorData& CursorData = GImGui->MouseCursorData[CursorType];
|
OutSize = ToVector2D(Size);
|
||||||
OutSize = ToVector2D(CursorData.Size);
|
OutUVMin = ToVector2D(UV[0]);
|
||||||
OutUVMin = ToVector2D(CursorData.TexUvMin[0]);
|
OutUVMax = ToVector2D(UV[1]);
|
||||||
OutUVMax = ToVector2D(CursorData.TexUvMax[0]);
|
OutOutlineUVMin = ToVector2D(UV[2]);
|
||||||
OutOutlineUVMin = ToVector2D(CursorData.TexUvMin[1]);
|
OutOutlineUVMax = ToVector2D(UV[3]);
|
||||||
OutOutlineUVMax = ToVector2D(CursorData.TexUvMax[1]);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -8,12 +8,6 @@
|
|||||||
// Gives access to selected ImGui implementation features.
|
// Gives access to selected ImGui implementation features.
|
||||||
namespace ImGuiImplementation
|
namespace ImGuiImplementation
|
||||||
{
|
{
|
||||||
// Get default context created by ImGui framework.
|
|
||||||
ImGuiContext& GetDefaultContext();
|
|
||||||
|
|
||||||
// Save current context settings.
|
|
||||||
void SaveCurrentContextIniSettings(const char* Filename);
|
|
||||||
|
|
||||||
// Get specific cursor data.
|
// Get specific cursor data.
|
||||||
bool GetCursorData(int CursorType, FVector2D& OutSize, FVector2D& OutUVMin, FVector2D& OutUVMax, FVector2D& OutOutlineUVMin, FVector2D& OutOutlineUVMax);
|
bool GetCursorData(ImGuiMouseCursor CursorType, FVector2D& OutSize, FVector2D& OutUVMin, FVector2D& OutUVMax, FVector2D& OutOutlineUVMin, FVector2D& OutOutlineUVMax);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ namespace ImGuiInterops
|
|||||||
return EMouseCursor::Default;
|
return EMouseCursor::Default;
|
||||||
case ImGuiMouseCursor_TextInput:
|
case ImGuiMouseCursor_TextInput:
|
||||||
return EMouseCursor::TextEditBeam;
|
return EMouseCursor::TextEditBeam;
|
||||||
case ImGuiMouseCursor_Move:
|
case ImGuiMouseCursor_ResizeAll:
|
||||||
return EMouseCursor::CardinalCross;
|
return EMouseCursor::CardinalCross;
|
||||||
case ImGuiMouseCursor_ResizeNS:
|
case ImGuiMouseCursor_ResizeNS:
|
||||||
return EMouseCursor::ResizeUpDown;
|
return EMouseCursor::ResizeUpDown;
|
||||||
|
@ -76,17 +76,16 @@ void FImGuiModuleManager::LoadTextures()
|
|||||||
TextureManager.CreatePlainTexture(FName{ "ImGuiModule_Plain" }, 2, 2, FColor::White);
|
TextureManager.CreatePlainTexture(FName{ "ImGuiModule_Plain" }, 2, 2, FColor::White);
|
||||||
|
|
||||||
// Create a font atlas texture.
|
// Create a font atlas texture.
|
||||||
ImFontAtlas* Fonts = ImGui::GetIO().Fonts;
|
ImFontAtlas& Fonts = ContextManager.GetFontAtlas();
|
||||||
checkf(Fonts, TEXT("Invalid font atlas."));
|
|
||||||
|
|
||||||
unsigned char* Pixels;
|
unsigned char* Pixels;
|
||||||
int Width, Height, Bpp;
|
int Width, Height, Bpp;
|
||||||
Fonts->GetTexDataAsRGBA32(&Pixels, &Width, &Height, &Bpp);
|
Fonts.GetTexDataAsRGBA32(&Pixels, &Width, &Height, &Bpp);
|
||||||
|
|
||||||
TextureIndex FontsTexureIndex = TextureManager.CreateTexture(FName{ "ImGuiModule_FontAtlas" }, Width, Height, Bpp, Pixels, false);
|
TextureIndex FontsTexureIndex = TextureManager.CreateTexture(FName{ "ImGuiModule_FontAtlas" }, Width, Height, Bpp, Pixels, false);
|
||||||
|
|
||||||
// Set font texture index in ImGui.
|
// Set font texture index in ImGui.
|
||||||
Fonts->TexID = ImGuiInterops::ToImTextureID(FontsTexureIndex);
|
Fonts.TexID = ImGuiInterops::ToImTextureID(FontsTexureIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FImGuiModuleManager::RegisterTick()
|
void FImGuiModuleManager::RegisterTick()
|
||||||
|
@ -692,7 +692,7 @@ bool SImGuiWidget::InFrameGrabbingRange(const FVector2D& Position, float Scale,
|
|||||||
|
|
||||||
// Get the grab range based on cursor shape.
|
// Get the grab range based on cursor shape.
|
||||||
FVector2D Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax;
|
FVector2D Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax;
|
||||||
const float Range = ImGuiImplementation::GetCursorData(ImGuiMouseCursor_Move, Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax)
|
const float Range = ImGuiImplementation::GetCursorData(ImGuiMouseCursor_ResizeAll, Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax)
|
||||||
? Size.GetMax() * 0.5f + 5.f : 25.f;
|
? Size.GetMax() * 0.5f + 5.f : 25.f;
|
||||||
|
|
||||||
return (Position - ViewportCenter).GetAbsMax() <= Range;
|
return (Position - ViewportCenter).GetAbsMax() <= Range;
|
||||||
@ -887,7 +887,7 @@ int32 SImGuiWidget::OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeo
|
|||||||
|
|
||||||
// Draw a movement gizmo (using ImGui move cursor).
|
// Draw a movement gizmo (using ImGui move cursor).
|
||||||
FVector2D Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax;
|
FVector2D Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax;
|
||||||
if (ImGuiImplementation::GetCursorData(ImGuiMouseCursor_Move, Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax))
|
if (ImGuiImplementation::GetCursorData(ImGuiMouseCursor_ResizeAll, Size, UVMin, UVMax, OutlineUVMin, OutlineUVMax))
|
||||||
{
|
{
|
||||||
const TextureIndex FontAtlasIndex = ModuleManager->GetTextureManager().FindTextureIndex(FName{ FontAtlasTextureName });
|
const TextureIndex FontAtlasIndex = ModuleManager->GetTextureManager().FindTextureIndex(FName{ FontAtlasTextureName });
|
||||||
if (FontAtlasIndex != INDEX_NONE)
|
if (FontAtlasIndex != INDEX_NONE)
|
||||||
|
783
Source/ThirdParty/ImGuiLibrary/CHANGELOG.txt
vendored
Normal file
783
Source/ThirdParty/ImGuiLibrary/CHANGELOG.txt
vendored
Normal file
@ -0,0 +1,783 @@
|
|||||||
|
dear imgui
|
||||||
|
CHANGELOG
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
This document holds the programmer changelog that we also use in release notes.
|
||||||
|
We generally fold multiple commits pertaining to the same topic as a single entry, and simplify various things.
|
||||||
|
|
||||||
|
Release notes: (with links and screenshots)
|
||||||
|
https://github.com/ocornut/imgui/releases
|
||||||
|
|
||||||
|
Changes to the examples/bindings are included within the individual .cpp files in examples.
|
||||||
|
|
||||||
|
Individual commits:
|
||||||
|
https://github.com/ocornut/imgui/commits/master
|
||||||
|
|
||||||
|
Report issues, ask questions:
|
||||||
|
https://github.com/ocornut/imgui/issues
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
WHEN TO UPDATE?
|
||||||
|
|
||||||
|
It is generally safe to sync to the latest commit in master. The library is fairly stable and regressions tends to be fixed fast when reported.
|
||||||
|
Keeping your copy of dear imgui updated once in a while is recommended.
|
||||||
|
|
||||||
|
HOW TO UPDATE?
|
||||||
|
|
||||||
|
- Overwrite every file except imconfig.h (if you have modified it).
|
||||||
|
- You may also locally branch to modify imconfig.h and merge latest into your branch.
|
||||||
|
- Read the `Breaking Changes` section (in imgui.cpp or here in the Changelog).
|
||||||
|
- If you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it.
|
||||||
|
- If you are dropping this repository in your codebase, please leave the demo and text files in there, they will be useful.
|
||||||
|
- You may diff your previous Changelog with the one you just copied and read that diff.
|
||||||
|
- You may enable `IMGUI_DISABLE_OBSOLETE_FUNCTIONS` in imconfig.h to forcefully disable legacy names and symbols. Doing it every once in a while is a good way to make sure you are not using obsolete symbols. Dear ImGui is in active development API updates have a little more frequent lately. They are carefully documented and should not affect all users.
|
||||||
|
- Please report any issue!
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.61 WIP
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||||
|
|
||||||
|
- Misc: IM_DELETE() helper function added in 1.60 doesn't set the input pointer to NULL, more consistent with standard expectation and allows passing r-value.
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
(IN PROGRESS, WILL ADD TO THIS LIST AS WE WORK ON 1.61)
|
||||||
|
|
||||||
|
- Window: Fixed default proportional item width lagging by one frame on resize.
|
||||||
|
- Window: Fixed pop-ups/tooltips/menus not honoring style.DisplaySafeAreaPadding as well as it should have (part of menus displayed outside the safe area, etc.).
|
||||||
|
- Window: Fixed windows using the ImGuiWindowFlags_NoSavedSettings flag from not using the same default position as other windows. (#1760)
|
||||||
|
- Window: Relaxed the internal stack size checker to allow Push/Begin/Pop/.../End patterns to be used with PushStyleColor, PushStyleVar, PushFont without causing a false positive assert. (#1767)
|
||||||
|
- Columns: Fixed a bug introduced in 1.51 where columns would affect the contents size of their container, often creating feedback loops when ImGuiWindowFlags_AlwaysAutoResize was used. (#1760)
|
||||||
|
- Settings: Fixed saving an empty .ini file if CreateContext/DestroyContext are called without a single call to NewFrame(). (#1741)
|
||||||
|
- Settings: Added LoadIniSettingsFromDisk(), LoadIniSettingsFromMemory(), SaveIniSettingsToDisk(), SaveIniSettingsToMemory() to manually load/save .ini settings. (#923, #993)
|
||||||
|
- Settings: Added io.WantSaveIniSettings flag, which is set to notify the application that e.g. SaveIniSettingsToMemory() should be called. (#923, #993)
|
||||||
|
- MenuBar: Made BeginMainMenuBar() honor style.DisplaySafeAreaPadding so the text can be made visible on TV settings that don't display all pixels. (#1439) [@dougbinks]
|
||||||
|
- InputText: On Mac OS X, filter out characters when the CMD modifier is held. (#1747) [@sivu]
|
||||||
|
- InputText: On Mac OS X, support CMD+SHIFT+Z for Redo. CMD+Y is also supported as major apps seems to default to support both. (#1765) [@lfnoise]
|
||||||
|
- InputText: Fixed returning true when edition is canceled with ESC and the current buffer matches the initial value.
|
||||||
|
- InputFloat,InputFloat2,InputFloat3,InputFloat4: Added variations taking a more flexible and consistent optional "const char* format" parameter instead of "int decimal_precision".
|
||||||
|
This allow using custom formats to display values in scientific notation, and is generally more consistent with other API. Obsoleted functions using the optional "int decimal_precision" parameter. (#648)
|
||||||
|
- DragFloat, DragInt: Cancel mouse tweak when current value is initially past the min/max boundaries and mouse is pushing in the same direction (keyboard/gamepad version already did this).
|
||||||
|
- DragFloat, SliderFloat: Fixes to allow input of scientific notation numbers when using CTRL+Click to input the value. (~#648, #1011)
|
||||||
|
- DragFloat, SliderFloat: Rounding-on-write uses the provided format string instead of parsing the precision from the string, which allows for finer uses of %e %g etc. (#648, #642)
|
||||||
|
- Nav: Fixed hovering a Selectable() with the mouse so that it update the navigation cursor (as it happened in the pre-1.60 navigation branch). (#787)
|
||||||
|
- Style: Changed default style.DisplaySafeAreaPadding values from (4,4) to (3,3) so it is smaller than FramePadding and has no effect on main menu bar on a computer. (#1439)
|
||||||
|
- Fonts: When building font atlas, glyphs that are missing in the fonts are not using the glyph slot to render a dummy/default glyph. Saves space and allow merging fonts with
|
||||||
|
overlapping font ranges such as FontAwesome5 which split out the Brands separately from the Solid fonts. (#1703, #1671)
|
||||||
|
- Misc: Added IMGUI_CHECKVERSION() macro to compare version string and data structure sizes in order to catch issues with mismatching compilation unit settings. (#1695, #1769)
|
||||||
|
- Misc: Fix to allow compiling in unity builds where stb_rectpack/stb_truetype may be already included in the same compilation unit.
|
||||||
|
- Demo: Fixed Overlay: Added a context menu item to enable freely moving the window.
|
||||||
|
- Examples: Calling IMGUI_CHECKVERSION() in the main.cpp of every example application.
|
||||||
|
- Examples: Allegro 5: Added support for 32-bit indices setup via defining ImDrawIdx, to avoid an unnecessary conversion (Allegro 5 doesn't support 16-bit indices).
|
||||||
|
- Examples: Allegro 5: Renamed bindings from imgui_impl_a5.cpp to imgui_impl_allegro5.cpp.
|
||||||
|
- Examples: DirectX 9 : Saving/restoring Transform because they don't seem to be included in the StateBlock. Setting shading mode to Gouraud. (#1790, #1687) [@sr-tream]
|
||||||
|
- Various minor fixes, tweaks, refactoring, comments.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.60 (Released 2018-04-07)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.60
|
||||||
|
|
||||||
|
The gamepad/keyboard navigation branch (which has been in the work since July 2016) has been merged.
|
||||||
|
Gamepad/keyboard navigation is still marked as Beta and has to be enabled explicitly.
|
||||||
|
Various internal refactoring have also been done, as part of the navigation work and as part of the upcoming viewport/docking work.
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Obsoleted the io.RenderDrawListsFn callback, you can call your graphics engine render function after ImGui::Render().
|
||||||
|
e.g. with example backends, call ImDrawData* draw_data = ImGui::GetDrawData(); ImGui_ImplXXXX_RenderDrawData(draw_data).
|
||||||
|
- Reorganized context handling to be more explicit: (#1599)
|
||||||
|
- YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END.
|
||||||
|
- removed Shutdown() function, as DestroyContext() serve this purpose. If you are using an old backend from the examples/ folder, remove the line that calls Shutdown().
|
||||||
|
- you may pass a ImFontAtlas* pointer to CreateContext() to share a font atlas between contexts. Otherwise CreateContext() will create its own font atlas instance.
|
||||||
|
- removed allocator parameters from CreateContext(), they are now setup with SetAllocatorFunctions(), and shared by all contexts.
|
||||||
|
- removed the default global context and font atlas instance, which were confusing for users of DLL reloading and users of multiple contexts.
|
||||||
|
- Renamed ImGuiStyleVar_Count_ to ImGuiStyleVar_COUNT and ImGuiMouseCursor_Count_ to ImGuiMouseCursor_COUNT for consistency with other public enums.
|
||||||
|
- Fonts: Moved sample TTF files from extra_fonts/ to misc/fonts/. If you loaded files directly from the imgui repo you may need to update your paths.
|
||||||
|
- Fonts: changed ImFont::DisplayOffset.y to defaults to 0 instead of +1. Fixed vertical rounding of Ascent/Descent to match TrueType renderer.
|
||||||
|
If you were adding or subtracting (not assigning) to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||||
|
- BeginDragDropSource(): temporarily removed the optional mouse_button=0 parameter because it is not really usable in many situations at the moment.
|
||||||
|
- Obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete).
|
||||||
|
- Obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete).
|
||||||
|
- Renamed io.WantMoveMouse to io.WantSetMousePos for consistency and ease of understanding (was added in 1.52, not used by core, and honored by some binding ahead of merging the Nav branch).
|
||||||
|
- Removed ImGuiCol_CloseButton, ImGuiCol_CloseButtonActive, ImGuiCol_CloseButtonHovered style colors as the closing cross uses regular button colors now.
|
||||||
|
- Renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.
|
||||||
|
- Removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- Doc: Added a Changelog file in the repository to ease comparing versions (it goes back to dear imgui 1.48), until now it was only on GitHub.
|
||||||
|
- Navigation: merged in the gamepad/keyboard navigation (about a million changes!). (#787, #323)
|
||||||
|
The initial focus was to support game controllers, but keyboard is becoming increasingly and decently usable.
|
||||||
|
- To use Gamepad Navigation:
|
||||||
|
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad to enable.
|
||||||
|
- Backend: Set io.BackendFlags |= ImGuiBackendFlags_HasGamepad + fill the io.NavInputs[] fields before calling NewFrame(). Read imgui.cpp for more details.
|
||||||
|
- See https://github.com/ocornut/imgui/issues/1599 for recommended gamepad mapping or download PNG/PSD at http://goo.gl/9LgVZW
|
||||||
|
- See 'enum ImGuiNavInput_' in imgui.h for a description of inputs. Read imgui.cpp for more details.
|
||||||
|
- To use Keyboard Navigation:
|
||||||
|
- Set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard to enable. NewFrame() will automatically fill io.NavInputs[] based on your io.KeysDown[] + io.KeyMap[] arrays.
|
||||||
|
- Basic controls: arrows to navigate, Alt to enter menus, Space to activate item, Enter to edit text, Escape to cancel/close, Ctrl-Tab to focus windows, etc.
|
||||||
|
- When keyboard navigation is active (io.NavActive + ImGuiConfigFlags_NavEnableKeyboard), the io.WantCaptureKeyboard flag will be set.
|
||||||
|
For more advanced uses, you may want to read from io.NavActive or io.NavVisible. Read imgui.cpp for more details.
|
||||||
|
- Navigation: SetItemDefaultFocus() sets the navigation position in addition to scrolling. (#787)
|
||||||
|
- Navigation: Added IsItemFocused(), added IsAnyItemFocused(). (#787)
|
||||||
|
- Navigation: Added window flags: ImGuiWindowFlags_NoNav (== ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus).
|
||||||
|
- Navigation: Style: Added ImGuiCol_NavHighlight, ImGuiCol_NavWindowingHighlight colors. (#787)
|
||||||
|
- Navigation: TreeNode: Added ImGuiTreeNodeFlags_NavLeftJumpsBackHere flag to allow Nav Left direction to jump back to parent tree node from any of its child. (#1079)
|
||||||
|
- Navigation: IO: Added io.ConfigFlags (input), io.NavActive (output), io.NavVisible (output). (#787)
|
||||||
|
- Context: Removed the default global context and font atlas instances, which caused various problems to users of multiple contexts and DLL users. (#1565, #1599)
|
||||||
|
YOU NOW NEED TO CALL ImGui::CreateContext() AT THE BEGINNING OF YOUR APP, AND CALL ImGui::DestroyContext() AT THE END. Existing apps will assert/crash without it.
|
||||||
|
- Context: Added SetAllocatorFunctions() to rewire memory allocators (as a replacement to previous parameters to CreateContext()). Allocators are shared by all contexts and imgui helpers. (#1565, #586, #992, #1007, #1558)
|
||||||
|
- Context: You may pass a ImFontAtlas to CreateContext() to specify a font atlas to share. Shared font atlas are not owned by the context and not destroyed along with it. (#1599)
|
||||||
|
- Context: Added IMGUI_DISABLE_DEFAULT_ALLOCATORS to disable linking with malloc/free. (#1565, #586, #992, #1007, #1558)
|
||||||
|
- IO: Added io.ConfigFlags for user application to store settings for imgui and for the backend:
|
||||||
|
- ImGuiConfigFlags_NavEnableKeyboard: Enable keyboard navigation.
|
||||||
|
- ImGuiConfigFlags_NavEnableGamepad: Enable gamepad navigation (provided ImGuiBackendFlags_HasGamepad is also set by backend).
|
||||||
|
- ImGuiConfigFlags_NavEnableSetMousePos: Instruct navigation to move the mouse cursor. May be useful on TV/console systems where moving a virtual mouse is awkward.
|
||||||
|
- ImGuiConfigFlags_NoMouseCursorChange: Instruct backend to not alter mouse cursor shape and visibility (by default the example backend use mouse cursor API of the platform when available)
|
||||||
|
- ImGuiConfigFlags_NoMouse: Instruct imgui to clear mouse position/buttons in NewFrame(). This allows ignoring the mouse information passed by the backend.
|
||||||
|
- ImGuiConfigFlags_IsSRGB, ImGuiConfigFlags_IsTouchScreen: Flags for general application use.
|
||||||
|
- IO: Added io.BackendFlags for backend to store its capabilities (currently: _HasGamepad, _HasMouseCursors, _HasSetMousePos). This will be used more in the next version.
|
||||||
|
- IO: Added ImGuiKey_Insert, ImGuiKey_Space keys. Setup in all example bindings. (#1541)
|
||||||
|
- IO: Added Horizontal Mouse Wheel support for horizontal scrolling. (#1463) [@tseeker]
|
||||||
|
- IO: Added IsAnyMouseDown() helper which is helpful for bindings to handle mouse capturing.
|
||||||
|
- Window: Clicking on a window with the ImGuiWIndowFlags_NoMove flags takes an ActiveId so we can't hover something else when dragging afterwards. (#1381, #1337)
|
||||||
|
- Window: IsWindowHovered(): Added ImGuiHoveredFlags_AnyWindow, ImGuiFocusedFlags_AnyWindow flags (See Breaking Changes). Added to demo. (#1382)
|
||||||
|
- Window: Added SetNextWindowBgAlpha() helper. Particularly helpful since the legacy 5-parameters version of Begin() has been marked as obsolete in 1.53. (#1567)
|
||||||
|
- Window: Fixed SetNextWindowContentSize() with 0.0f on Y axis (or SetNextWindowContentWidth()) overwriting the contents size. Got broken on Dec 10 (1.53). (#1363)
|
||||||
|
- ArrowButton: Added ArrowButton() given a cardinal direction (e.g. ImGuiDir_Left).
|
||||||
|
- InputText: Added alternative clipboard shortcuts: Shift+Delete (cut), CTRL+Insert (copy), Shift+Insert (paste). (#1541)
|
||||||
|
- InputText: Fixed losing Cursor X position when clicking outside on an item that's submitted after the InputText(). It was only noticeable when restoring focus programmatically. (#1418, #1554)
|
||||||
|
- InputText: Added ImGuiInputTextFlags_CharsScientific flag to also allow 'e'/'E' for input of values using scientific notation. Automatically used by InputFloat.
|
||||||
|
- Style: Default style is now StyleColorsDark(), instead of the old StyleColorsClassic(). (#707)
|
||||||
|
- Style: Enable window border by default. (#707)
|
||||||
|
- Style: Exposed ImGuiStyleVar_WindowTitleAlign, ImGuiStyleVar_ScrollbarSize, ImGuiStyleVar_ScrollbarRounding, ImGuiStyleVar_GrabRounding + added an assert to reduce accidental breakage. (#1181)
|
||||||
|
- Style: Added style.MouseCursorScale help when using the software mouse cursor facility. (#939).
|
||||||
|
- Style: Close button nows display a cross before hovering. Fixed cross positioning being a little off. Uses button colors for highlight when hovering. (#707)
|
||||||
|
- Popup: OpenPopup() Always reopen existing pop-ups. (Removed imgui_internal.h's OpenPopupEx() which was used for this.) (#1497, #1533).
|
||||||
|
- Popup: BeginPopupContextItem(), BeginPopupContextWindow(), BeginPopupContextVoid(), OpenPopupOnItemClick() all react on mouse release instead of mouse press. (~#439)
|
||||||
|
- Popup: Better handling of user mistakenly calling OpenPopup() every frame (with reopen_existing option). The error will now be more visible and easier to understand. (#1497)
|
||||||
|
- Popup: BeginPopup(): Exposed extra_flags parameter that are passed through to Begin(). (#1533)
|
||||||
|
- Popup: BeginPopupModal: fixed the conditional test for SetNextWindowPos() which was polling the wrong window, which in practice made the test succeed all the time.
|
||||||
|
- Tooltip: BeginTooltip() sets ImGuiWindowFlags_NoInputs flag.
|
||||||
|
- Scrollbar: Fixed ScrollbarY enable test after ScrollbarX has been enabled being a little off (small regression from Nov 2017). (#1574)
|
||||||
|
- Scrollbar: Fixed ScrollbarX enable test subtracting WindowPadding.x (this has been there since the addition of horizontal scroll bar!).
|
||||||
|
- Columns: Clear offsets data when columns count changed. (#1525)
|
||||||
|
- Columns: Fixed a memory leak of ImGuiColumnsSet's Columns vector. (#1529) [@unprompted]
|
||||||
|
- Columns: Fixed resizing a window very small breaking some columns positioning (broken in 1.53).
|
||||||
|
- Columns: The available column extent takes consideration of the right-most clipped pixel, so the right-most column may look a little wider but will contain the same amount of visible contents.
|
||||||
|
- MenuBar: Fixed menu bar pushing a clipping rect outside of its allocated bound (usually unnoticeable).
|
||||||
|
- TreeNode: nodes with the ImGuiTreeNodeFlags_Leaf flag correctly disable highlight when DragDrop is active. (#143, #581)
|
||||||
|
- Drag and Drop: Increased payload type string to 32 characters instead of 8. (#143)
|
||||||
|
- Drag and Drop: TreeNode as drop target displays rectangle over full frame. (#1597, #143)
|
||||||
|
- DragFloat: Fix/workaround for backends which do not preserve a valid mouse position when dragged out of bounds. (#1559)
|
||||||
|
- InputFloat: Allow inputing value using scientific notation e.g. "1e+10".
|
||||||
|
- InputDouble: Added InputDouble() function. We use a format string instead of a decimal_precision parameter to also for "%e" and variants. (#1011)
|
||||||
|
- Slider, Combo: Use ImGuiCol_FrameBgHovered color when hovered. (#1456) [@stfx]
|
||||||
|
- Combo: BeginCombo(): Added ImGuiComboFlags_NoArrowButton to disable the arrow button and only display the wide value preview box.
|
||||||
|
- Combo: BeginCombo(): Added ImGuiComboFlags_NoPreview to disable the preview and only display a square arrow button.
|
||||||
|
- Combo: Arrow button isn't displayed over frame background so its blended color matches other buttons. Left side of the button isn't rounded.
|
||||||
|
- PlotLines: plot a flat line if scale_min==scale_max. (#1621)
|
||||||
|
- Fonts: Changed DisplayOffset.y to defaults to 0 instead of +1. Fixed rounding of Ascent/Descent to match TrueType renderer.
|
||||||
|
If you were adding or subtracting (not assigning) to ImFont::DisplayOffset check if your fonts are correctly aligned vertically. (#1619)
|
||||||
|
- Fonts: Updated stb_truetype from 1.14 to stb_truetype 1.19. (w/ include fix from some platforms #1622)
|
||||||
|
- Fonts: Added optional FreeType rasterizer in misc/freetype. Moved from imgui_club repo. (#618) [@Vuhdo, @mikesart, @ocornut]
|
||||||
|
- Fonts: Moved extra_fonts/ to misc/fonts/.
|
||||||
|
- ImFontAtlas: Fixed cfg.MergeMode not reusing existing glyphs if available (always overwrote).
|
||||||
|
- ImFontAtlas: Handle stb_truetype stbtt_InitFont() and stbtt_PackBegin() possible failures more gracefully, GetTexDataAsRGBA32() won't crash during conversion. (#1527)
|
||||||
|
- ImFontAtlas: Moved mouse cursor data out of ImGuiContext, fix drawing them with multiple contexts. Also remove the last remaining undesirable dependency on ImGui in imgui_draw.cpp. (#939)
|
||||||
|
- ImFontAtlas: Added ImFontAtlasFlags_NoPowerOfTwoHeight flag to disable padding font height to nearest power of two. (#1613)
|
||||||
|
- ImFontAtlas: Added ImFontAtlasFlags_NoMouseCursors flag to disable baking software mouse cursors, mostly to save texture memory on very low end hardware. (#1613)
|
||||||
|
- ImDrawList: Fixed AddRect() with anti-aliasing disabled (lower-right corner pixel was often missing, rounding looks a little better.) (#1646)
|
||||||
|
- ImDrawList: Added CloneOutput() helper to facilitate the cloning of ImDrawData or ImDrawList for multi-threaded rendering.
|
||||||
|
- Misc: Functions passed to libc qsort are explicitly marked cdecl to support compiling with vectorcall as the default calling convention. (#1230, #1611) [@RandyGaul]
|
||||||
|
- Misc: ImVec2: added [] operator. This is becoming desirable for some code working of either axes independently. Better adding it sooner than later.
|
||||||
|
- Misc: NewFrame(): Added an assert to detect incorrect filling of the io.KeyMap[] array earlier. (#1555)
|
||||||
|
- Misc: Added IM_OFFSETOF() helper in imgui.h (previously was in imgui_internal.h)
|
||||||
|
- Misc: Added IM_NEW(), IM_DELETE() helpers in imgui.h (previously were in imgui_internal.h)
|
||||||
|
- Misc: Added obsolete redirection function GetItemsLineHeightWithSpacing() (which redirects to GetFrameHeightWithSpacing()), as intended and stated in docs of 1.53.
|
||||||
|
- Misc: Added misc/natvis/imgui.natvis for visual studio debugger users to easily visualize imgui internal types. Added to examples projects.
|
||||||
|
- Misc: Added IMGUI_USER_CONFIG to define a custom configuration filename. (#255, #1573, #1144, #41)
|
||||||
|
- Misc: Added IMGUI_STB_TRUETYPE_FILENAME and IMGUI_STB_RECT_PACK_FILENAME compile time directives to use another version of the stb_ files.
|
||||||
|
- Misc: Updated stb_rect_pack from 0.10 to 0.11 (minor changes).
|
||||||
|
(Those flags are not used by ImGui itself, they only exists to make it easy for the engine/backend to pass information to the application in a standard manner.)
|
||||||
|
- Metrics: Added display of Columns state.
|
||||||
|
- Demo: Improved Selectable() examples. (#1528)
|
||||||
|
- Demo: Tweaked the Child demos, added a menu bar to the second child to test some navigation functions.
|
||||||
|
- Demo: Console: Using ImGuiCol_Text to be more friendly to color changes.
|
||||||
|
- Demo: Using IM_COL32() instead of ImColor() in ImDrawList centric contexts. Trying to phase out use of the ImColor helper whenever possible.
|
||||||
|
- Examples: Files in examples/ now include their own changelog so it is easier to occasionally update your bindings if needed.
|
||||||
|
- Examples: Using Dark theme by default. (#707). Tweaked demo code.
|
||||||
|
- Examples: Added support for horizontal mouse wheel for API that allows it. (#1463) [@tseeker]
|
||||||
|
- Examples: All examples now setup the io.BackendFlags to signify they can honor mouse cursors, gamepad, etc.
|
||||||
|
- Examples: DirectX10: Fixed erroneous call to io.Fonts->ClearInputData() + ClearTexData() that was left in DX10 example but removed in 1.47 (Nov 2015) in every other backends. (#1733)
|
||||||
|
- Examples: DirectX12: Added DirectX 12 example. (#301) [@jdm3]
|
||||||
|
- Examples: OpenGL3+GLFW,SDL: Changed GLSL shader version from 330 to 150. (#1466, #1504)
|
||||||
|
- Examples: OpenGL3+GLFW,SDL: Added a way to override the GLSL version string in the Init function. (#1466, #1504).
|
||||||
|
- Examples: OpenGL3+GLFW,SDL: Creating VAO in the render function so it can be more easily used by multiple shared OpenGL contexts. (#1217)
|
||||||
|
- Examples: OpenGL3+GLFW: Using 3.2 context instead of 3.3. (#1466)
|
||||||
|
- Examples: OpenGL: Setting up glPixelStorei() explicitly before uploading texture.
|
||||||
|
- Examples: OpenGL: Calls to glPolygonMode() are casting parameters as GLEnum to not fail with more strict bindings. (#1628) [@ilia-glushchenko]
|
||||||
|
- Examples: Win32 (DirectX9,10,11,12): Added support for mouse cursor shapes. (#1495)
|
||||||
|
- Examples: Win32 (DirectX9,10,11,12: Support for windows using the CS_DBLCLKS class flag by handling the double-click messages (WM_LBUTTONDBLCLK etc.). (#1538, #754) [@ndandoulakis]
|
||||||
|
- Examples: Win32 (DirectX9,10,11,12): Made the Win32 proc handlers not assert if there is no active context yet, to be more flexible with creation order. (#1565)
|
||||||
|
- Examples: GLFW: Added support for mouse cursor shapes (the diagonal resize cursors are unfortunately not supported by GLFW at the moment. (#1495)
|
||||||
|
- Examples: GLFW: Don't attempt to change the mouse cursor input mode if it is set to GLFW_CURSOR_DISABLED by the application. (#1202) [@PhilCK]
|
||||||
|
- Examples: SDL: Added support for mouse cursor shapes. (#1626) [@olls]
|
||||||
|
- Examples: SDL: Using SDL_CaptureMouse() to retrieve coordinates outside of client area when dragging (SDL 2.0.4+ only, otherwise using SDL_WINDOW_INPUT_FOCUS instead of previously SDL_WINDOW_MOUSE_FOCUS). (#1559)
|
||||||
|
- Examples: SDL: Enabled vsync by default so people don't come at us when the examples are running at 2000 FPS and burning a CPU core.
|
||||||
|
- Examples: SDL: Using SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency() to handle frame-rate over 1000 FPS properly. (#996)
|
||||||
|
- Examples: SDL: Using scan-code exclusively instead of a confusing mixture of scan-codes and key-codes.
|
||||||
|
- Examples: SDL: Visual Studio: Added .vcxproj file. Using %SDL2_DIR% in the default .vcxproj and build files instead of %SDL_DIR%, the earlier being more standard.
|
||||||
|
- Examples: Vulkan: Visual Studio: Added .vcxproj file.
|
||||||
|
- Examples: Apple: Fixed filenames in OSX xcode project. Various other Mac friendly fixes. [@gerryhernandez etc.]
|
||||||
|
- Examples: Visual Studio: Disabled extraneous function-level check in Release build.
|
||||||
|
- Various fixes, tweaks, internal refactoring, optimizations, comments.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.53 (Released 2017-12-25)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.53
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Renamed the emblematic `ShowTestWindow()` function to `ShowDemoWindow()`. Kept redirection function (will obsolete).
|
||||||
|
- Renamed `GetItemsLineHeightWithSpacing()` to `GetFrameHeightWithSpacing()` for consistency. Kept redirection function (will obsolete).
|
||||||
|
- Renamed `ImGuiTreeNodeFlags_AllowOverlapMode` flag to `ImGuiTreeNodeFlags_AllowItemOverlap`. Kept redirection enum (will obsolete).
|
||||||
|
- Obsoleted `IsRootWindowFocused()` in favor of using `IsWindowFocused(ImGuiFocusedFlags_RootWindow)`. Kept redirection function (will obsolete). (#1382)
|
||||||
|
- Obsoleted `IsRootWindowOrAnyChildFocused()` in favor of using `IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows)`. Kept redirection function (will obsolete). (#1382)
|
||||||
|
- Obsoleted `IsRootWindowOrAnyChildHovered()` in favor of using `IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows)`. Kept redirection function (will obsolete). (#1382)
|
||||||
|
- Obsoleted `SetNextWindowContentWidth() in favor of using `SetNextWindowContentSize()`. Kept redirection function (will obsolete).
|
||||||
|
- Renamed `ImGuiTextBuffer::append()` helper to `appendf()`, and `appendv()` to `appendfv()` for consistency. If you copied the 'Log' demo in your code, it uses appendv() so that needs to be renamed.
|
||||||
|
- ImDrawList: Removed 'bool anti_aliased = true' final parameter of `ImDrawList::AddPolyline()` and `ImDrawList::AddConvexPolyFilled()`. Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame.
|
||||||
|
- Style, ImDrawList: Renamed `style.AntiAliasedShapes` to `style.AntiAliasedFill` for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags.
|
||||||
|
- Style, Begin: Removed `ImGuiWindowFlags_ShowBorders` window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. `style.FrameBorderSize`, `style.WindowBorderSize`, `style.PopupBorderSize`).
|
||||||
|
Use `ImGui::ShowStyleEditor()` to look them up.
|
||||||
|
Please note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time.
|
||||||
|
It is recommended that you use the `StyleColorsClassic()`, `StyleColorsDark()`, `StyleColorsLight()` functions. Also see `ShowStyleSelector()`.
|
||||||
|
- Style: Removed `ImGuiCol_ComboBg` in favor of combo boxes using `ImGuiCol_PopupBg` for consistency. Combo are normal pop-ups.
|
||||||
|
- Style: Renamed `ImGuiCol_ChildWindowBg` to `ImGuiCol_ChildBg`.
|
||||||
|
- Style: Renamed `style.ChildWindowRounding` to `style.ChildRounding`, `ImGuiStyleVar_ChildWindowRounding` to `ImGuiStyleVar_ChildRounding`.
|
||||||
|
- Removed obsolete redirection functions: SetScrollPosHere() - marked obsolete in v1.42, July 2015.
|
||||||
|
- Removed obsolete redirection functions: GetWindowFont(), GetWindowFontSize() - marked obsolete in v1.48, March 2016.
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- Added `io.OptCursorBlink` option to allow disabling cursor blinking. (#1427)
|
||||||
|
- Added `GetOverlayDrawList()` helper to quickly get access to a ImDrawList that will be rendered in front of every windows.
|
||||||
|
- Added `GetFrameHeight()` helper which returns `(FontSize + style.FramePadding.y * 2)`.
|
||||||
|
- Drag and Drop: Added Beta API to easily use drag and drop patterns between imgui widgets.
|
||||||
|
- Setup a source on a widget with `BeginDragDropSource()`, `SetDragDropPayload()`, `EndDragDropSource()` functions.
|
||||||
|
- Receive data with `BeginDragDropTarget()`, `AcceptDragDropPayload()`, `EndDragDropTarget()`.
|
||||||
|
- See ImGuiDragDropFlags for various options.
|
||||||
|
- The ColorEdit4() and ColorButton() widgets now support Drag and Drop.
|
||||||
|
- The API is tagged as Beta as it still may be subject to small changes.
|
||||||
|
- Drag and Drop: When drag and drop is active, tree nodes and collapsing header can be opened by hovering on them for 0.7 seconds.
|
||||||
|
- Renamed io.OSXBehaviors to io.OptMacOSXBehaviors. Should not affect users as the compile-time default is usually enough. (#473, #650)
|
||||||
|
- Style: Added StyleColorsDark() style. (#707) [@dougbinks]
|
||||||
|
- Style: Added StyleColorsLight() style. Best used with frame borders + thicker font than the default font. (#707)
|
||||||
|
- Style: Added style.PopupRounding setting. (#1112)
|
||||||
|
- Style: Added style.FrameBorderSize, style.WindowBorderSize, style.PopupBorderSize. Removed ImGuiWindowFlags_ShowBorders window flag!
|
||||||
|
Borders are now fully set up in the ImGuiStyle structure. Use ImGui::ShowStyleEditor() to look them up. (#707, fix #819, #1031)
|
||||||
|
- Style: Various small changes to the classic style (most noticeably, buttons are now using blue shades). (#707)
|
||||||
|
- Style: Renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg.
|
||||||
|
- Style: Renamed style.ChildWindowRounding to style.ChildRounding, ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding.
|
||||||
|
- Style: Removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency. (#707)
|
||||||
|
- Style: Made the ScaleAllSizes() helper rounds down every values so they are aligned on integers.
|
||||||
|
- Focus: Added SetItemDefaultFocus(), which in the current (master) branch behave the same as doing `if (IsWindowAppearing()) SetScrollHere()`.
|
||||||
|
In the navigation branch this will also set the default focus. Prefer using this when creating combo boxes with `BeginCombo()` so your code will be forward-compatible with gamepad/keyboard navigation features. (#787)
|
||||||
|
- Combo: Pop-up grows horizontally to accommodate for contents that is larger then the parent combo button.
|
||||||
|
- Combo: Added BeginCombo()/EndCombo() API which allows use to submit content of any form and manage your selection state without relying on indices.
|
||||||
|
- Combo: Added ImGuiComboFlags_PopupAlignLeft flag to BeginCombo() to prioritize keeping the pop-up on the left side (for small-button-looking combos).
|
||||||
|
- Combo: Added ImGuiComboFlags_HeightSmall, ImGuiComboFlags_HeightLarge, ImGuiComboFlags_HeightLargest to easily provide desired pop-up height.
|
||||||
|
- Combo: You can use SetNextWindowSizeConstraints() before BeginCombo() to specify specific pop-up width/height constraints.
|
||||||
|
- Combo: Offset popup position by border size so that a double border isn't so visible. (#707)
|
||||||
|
- Combo: Recycling windows by using a stack number instead of a unique id, wasting less memory (like menus do).
|
||||||
|
- InputText: Added ImGuiInputTextFlags_NoUndoRedo flag. (#1506, #1508) [@ibachar]
|
||||||
|
- Window: Fixed auto-resize allocating too much space for scrollbar when SizeContents is bigger than maximum window size (fixes c0547d3). (#1417)
|
||||||
|
- Window: Child windows with MenuBar use regular WindowPadding.y so layout look consistent as child or as a regular window.
|
||||||
|
- Window: Begin(): Fixed appending into a child window with a second Begin() from a different window stack querying the wrong window for the window->Collapsed test.
|
||||||
|
- Window: Calling IsItemActive(), IsItemHovered() etc. after a call to Begin() provides item data for the title bar, so you can easily test if the title bar is being hovered, etc. (#823)
|
||||||
|
- Window: Made it possible to use SetNextWindowPos() on a child window.
|
||||||
|
- Window: Fixed a one frame glitch. When an appearing window claimed the focus themselves, the title bar wouldn't use the focused color for one frame.
|
||||||
|
- Window: Added ImGuiWindowFlags_ResizeFromAnySide flag to resize from any borders or from the lower-left corner of a window. This requires your backend to honor GetMouseCursor() requests for full usability. (#822)
|
||||||
|
- Window: Sizing fixes when using SetNextWindowSize() on individual axises.
|
||||||
|
- Window: Hide new window for one frame until they calculate their size. Also fixes SetNextWindowPos() given a non-zero pivot. (#1694)
|
||||||
|
- Window: Made mouse wheel scrolling accommodate better to windows that are smaller than the scroll step.
|
||||||
|
- Window: SetNextWindowContentSize() adjust for the size of decorations (title bar/menu bar), but _not_ for borders are we consistently make borders not affect layout.
|
||||||
|
If you need a non-child window of an exact size with border enabled but zero window padding, you'll need to accommodate for the border size yourself.
|
||||||
|
- Window: Using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set. (#1380, #1502)
|
||||||
|
- Window: Active Modal window always set the WantCaptureKeyboard flag. (#744)
|
||||||
|
- Window: Moving window doesn't use accumulating MouseDelta so straying out of imgui boundaries keeps moved imgui window at the same cursor-relative position.
|
||||||
|
- Window: BeginChild() which an explicit name doesn't include the hash within the internal window name. (#1698)
|
||||||
|
- IsWindowFocused(): Added ImGuiFocusedFlags_ChildWindows flag to include child windows in the focused test. (#1382).
|
||||||
|
- IsWindowFocused(): Added ImGuiFocusedFlags_RootWindow flag to start focused test from the root (top-most) window. Obsolete IsRootWindowFocused(). (#1382)
|
||||||
|
- IsWindowHovered(): Added ImGuiHoveredFlags_ChildWindows flag to include child windows in the hovered test. (#1382).
|
||||||
|
- IsWindowHovered(): Added ImGuiHoveredFlags_RootWindow flag to start hovered test from the root (top-most) window. The combination of both flags obsoletes IsRootWindowOrAnyChildHovered(). (#1382)
|
||||||
|
- IsWindowHovered(): Fixed return value when an item is active to use the same logic as IsItemHovered(). (#1382, #1404)
|
||||||
|
- IsWindowHovered(): Always return true when current window is being moved. (#1382)
|
||||||
|
- Scrollbar: Fixed issues with vertical scrollbar flickering/appearing, typically when manually resizing and using a pattern of filling available height (e.g. full sized BeginChild).
|
||||||
|
- Scrollbar: Minor graphical fix for when scrollbar don't have enough visible space to display the full grab.
|
||||||
|
- Scrolling: Fixed padding and scrolling asymmetry where lower/right sides of a window wouldn't use WindowPadding properly + causing minor scrolling glitches.
|
||||||
|
- Tree: TreePush with zero arguments was ambiguous. Resolved by making it call TreePush(const void*). [@JasonWilkins]
|
||||||
|
- Tree: Renamed ImGuiTreeNodeFlags_AllowOverlapMode to ImGuiTreeNodeFlags_AllowItemOverlap. (#600, #1330)
|
||||||
|
- MenuBar: Fixed minor rendering issues on the right size when resizing a window very small and using rounded window corners.
|
||||||
|
- MenuBar: better software clipping to handle small windows, in particular child window don't have minimum constraints so we need to render clipped menus better.
|
||||||
|
- BeginMenu(): Tweaked the Arrow/Triangle displayed on child menu items.
|
||||||
|
- Columns: Clipping columns borders on Y axis on CPU because some Linux GPU drivers appears to be unhappy with triangle spanning large regions. (#125)
|
||||||
|
- Columns: Added ImGuiColumnsFlags_GrowParentContentsSize to internal API to restore old content sizes behavior (may be obsolete). (#1444, #125)
|
||||||
|
- Columns: Columns width is no longer lost when dragging a column to the right side of the window, until releasing the mouse button you have a chance to save them. (#1499, #125). [@ggtucker]
|
||||||
|
- Columns: Fixed dragging when using a same of columns multiple times in the frame. (#125)
|
||||||
|
- Indent(), Unindent(): Allow passing negative values.
|
||||||
|
- ColorEdit4(): Made IsItemActive() return true when picker pop-up is active. (#1489)
|
||||||
|
- ColorEdit4(): Tweaked tooltip so that the color button aligns more correctly with text.
|
||||||
|
- ColorEdit4(): Support drag and drop. Color buttons can be used as drag sources, and ColorEdit widgets as drag targets. (#143)
|
||||||
|
- ColorPicker4(): Fixed continuously returning true when holding mouse button on the sat/value/alpha locations. We only return true on value change. (#1489)
|
||||||
|
- NewFrame(): using literal strings in the most-frequently firing IM_ASSERT expressions to increase the odd of programmers seeing them (especially those who don't use a debugger).
|
||||||
|
- NewFrame() now asserts if neither Render or EndFrame have been called. Exposed EndFrame(). Made it legal to call EndFrame() more than one. (#1423)
|
||||||
|
- ImGuiStorage: Added BuildSortByKey() helper to rebuild storage from scratch.
|
||||||
|
- ImFont: Added GetDebugName() helper.
|
||||||
|
- ImFontAtlas: Added missing Thai punctuation in the GetGlyphRangesThai() ranges. (#1396) [@nProtect]
|
||||||
|
- ImDrawList: Removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Anti-aliasing is controlled via the regular style.AntiAliased flags.
|
||||||
|
- ImDrawList: Added ImDrawList::AddImageRounded() helper. (#845) [@thedmd]
|
||||||
|
- ImDrawList: Refactored to make ImDrawList independent of ImGui. Removed static variable in PathArcToFast() which caused linking issues to some.
|
||||||
|
- ImDrawList: Exposed ImDrawCornerFlags, replaced occurrences of ~0 with an explicit ImDrawCornerFlags_All. NB: Inversed BotLeft (prev 1<<3, now 1<<2) and BotRight (prev 1<<2, now 1<<3).
|
||||||
|
- ImVector: Added ImVector::push_front() helper.
|
||||||
|
- ImVector: Added ImVector::contains() helper.
|
||||||
|
- ImVector: insert() uses grow_capacity() instead of using grow policy inconsistent with push_back().
|
||||||
|
- Internals: Remove requirement to define IMGUI_DEFINE_PLACEMENT_NEW to use the IM_PLACEMENT_NEW macro. (#1103)
|
||||||
|
- Internals: ButtonBehavior: Fixed ImGuiButtonFlags_NoHoldingActiveID flag from incorrectly setting the ActiveIdClickOffset field.
|
||||||
|
This had no known effect within imgui code but could have affected custom drag and drop patterns. And it is more correct this way! (#1418)
|
||||||
|
- Internals: ButtonBehavior: Fixed ImGuiButtonFlags_AllowOverlapMode to avoid temporarily activating widgets on click before they have been correctly double-hovered. (#319, #600)
|
||||||
|
- Internals: Added SplitterBehavior() helper. (#319)
|
||||||
|
- Internals: Added IM_NEW(), IM_DELETE() helpers. (#484, #504, #1517)
|
||||||
|
- Internals: Basic refactor of the settings API which now allows external elements to be loaded/saved.
|
||||||
|
- Demo: Added ShowFontSelector() showing loaded fonts.
|
||||||
|
- Demo: Added ShowStyleSelector() to select among default styles. (#707)
|
||||||
|
- Demo: Renamed the emblematic ShowTestWindow() function to ShowDemoWindow().
|
||||||
|
- Demo: Style Editor: Added a "Simplified settings" sections with check-boxes for border size and frame rounding. (#707, #1019)
|
||||||
|
- Demo: Style Editor: Added combo box to select stock styles and select current font when multiple are loaded. (#707)
|
||||||
|
- Demo: Style Editor: Using local storage so Save/Revert button makes more sense without code passing its storage. Added horizontal scroll bar. Fixed Save/Revert button to be always accessible. (#1211)
|
||||||
|
- Demo: Console: Fixed context menu issue. (#1404)
|
||||||
|
- Demo: Console: Fixed incorrect positioning which was hidden by a minor scroll issue (this would affect people who copied the Console code as is).
|
||||||
|
- Demo: Constrained Resize: Added more test cases. (#1417)
|
||||||
|
- Demo: Custom Rendering: Fixed clipping rectangle extruding out of parent window.
|
||||||
|
- Demo: Layout: Removed unnecessary and misleading BeginChild/EndChild calls.
|
||||||
|
- Demo: The "Color Picker with Palette" demo supports drag and drop. (#143)
|
||||||
|
- Demo: Display better mouse cursor info for debugging backends.
|
||||||
|
- Demo: Stopped using rand() function in demo code.
|
||||||
|
- Examples: Added a handful of extra comments (about fonts, third-party libraries used in the examples, etc.).
|
||||||
|
- Examples: DirectX9: Handle loss of D3D9 device (D3DERR_DEVICELOST). (#1464)
|
||||||
|
- Examples: Added null_example/ which is helpful for quick testing on multiple compilers/settings without relying on graphics library.
|
||||||
|
- Fix for using alloca() in "Clang with Microsoft Codechain" mode.
|
||||||
|
- Various fixes, optimizations, comments.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.52 (2017-10-27)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.52
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- IO: `io.MousePos` needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing, instead of ImVec2(-1,-1) as previously) This is needed so we can clear `io.MouseDelta` field when the mouse is made available again.
|
||||||
|
- Renamed `AlignFirstTextHeightToWidgets()` to `AlignTextToFramePadding()`. Kept inline redirection function (will obsolete).
|
||||||
|
- Obsoleted the legacy 5 parameters version of Begin(). Please avoid using it. If you need a transparent window background, uses `PushStyleColor()`. The old size parameter there was also misleading and equivalent to calling `SetNextWindowSize(size, ImGuiCond_FirstTimeEver)`. Kept inline redirection function (will obsolete).
|
||||||
|
- Obsoleted `IsItemHoveredRect()`, `IsMouseHoveringWindow()` in favor of using the newly introduced flags of `IsItemHovered()` and `IsWindowHovered()`. Kept inline redirection function (will obsolete). (#1382)
|
||||||
|
- Removed `IsItemRectHovered()`, `IsWindowRectHovered()` recently introduced in 1.51 which were merely the more consistent/correct names for the above functions which are now obsolete anyway. (#1382)
|
||||||
|
- Changed `IsWindowHovered()` default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it. (#1382)
|
||||||
|
- Renamed imconfig.h's `IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS`/`IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS` to `IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS`/`IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS` for consistency.
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- ProgressBar: fixed rendering when straddling rounded area. (#1296)
|
||||||
|
- SliderFloat, DragFloat: Using scientific notation e.g. "%.1e" in the displayed format string doesn't mistakenly trigger rounding of the value. [@MomentsInGraphics]
|
||||||
|
- Combo, InputFloat, InputInt: Made the small button on the right side align properly with the equivalent colored button of ColorEdit4().
|
||||||
|
- IO: Tweaked logic for `io.WantCaptureMouse` so it now outputs false when e.g. hovering over void while an InputText() is active. (#621) [@pdoane]
|
||||||
|
- IO: Fixed `io.WantTextInput` from mistakenly outputting true when an activated Drag or Slider was previously turned into an InputText(). (#1317)
|
||||||
|
- Misc: Added flags to `IsItemHovered()`, `IsWindowHovered()` to access advanced hovering-test behavior. Generally useful for pop-ups and drag and drop behaviors: (relates to ~#439, #1013, #143, #925)
|
||||||
|
- `ImGuiHoveredFlags_AllowWhenBlockedByPopup`
|
||||||
|
- `ImGuiHoveredFlags_AllowWhenBlockedByActiveItem`
|
||||||
|
- `ImGuiHoveredFlags_AllowWhenOverlapped`
|
||||||
|
- `ImGuiHoveredFlags_RectOnly`
|
||||||
|
- Input: Added `IsMousePosValid()` helper.
|
||||||
|
- Input: Added `GetKeyPressedAmount()` to easily measure press count when the repeat rate is faster than the frame rate.
|
||||||
|
- Input/Focus: Disabled TAB and Shift+TAB when CTRL key is held.
|
||||||
|
- CheckBox: Now rendering a tick mark instead of a full square.
|
||||||
|
- ColorEdit4: Added "Copy as..." option in context menu. (#346)
|
||||||
|
- ColorPicker: Improved ColorPicker hue wheel color interpolation. (#1313) [@thevaber]
|
||||||
|
- ColorButton: Reduced bordering artifact that would be particularly visible with an opaque Col_FrameBg and FrameRounding enabled.
|
||||||
|
- ColorButton: Fixed rendering color button with a checkerboard if the transparency comes from the global style.Alpha and not from the actual source color.
|
||||||
|
- TreeNode: Added `ImGuiTreeNodeFlags_FramePadding` flag to conveniently create a tree node with full padding at the beginning of a line, without having to call `AlignTextToFramePadding()`.
|
||||||
|
- Trees: Fixed calling `SetNextTreeNodeOpen()` on a collapsed window leaking to the first tree node item of the next frame.
|
||||||
|
- Layout: Horizontal layout is automatically enforced in a menu bar, so you can use non-MenuItem elements without calling SameLine().
|
||||||
|
- Separator: Output a vertical separator when used inside a menu bar (or in general when horizontal layout is active, but that isn't exposed yet!).
|
||||||
|
- Windows: Added `IsWindowAppearing()` helper (helpful e.g. as a condition before initializing some of your own things.).
|
||||||
|
- Windows: Fixed title bar color of top-most window under a modal window.
|
||||||
|
- Windows: Fixed not being able to move a window by clicking on one of its child window. (#1337, #635)
|
||||||
|
- Windows: Fixed `Begin()` auto-fit calculation code that predict the presence of a scrollbar so it works better when window size constraints are used.
|
||||||
|
- Windows: Fixed calling `Begin()` more than once per frame setting `window_just_activated_by_user` which in turn would set enable the Appearing condition for that frame.
|
||||||
|
- Windows: The implicit "Debug" window now uses a "Debug##Default" identifier instead of "Debug" to allow user creating a window called "Debug" without losing their custom flags.
|
||||||
|
- Windows: Made the `ImGuiWindowFlags_NoMove` flag properly inherited from parent to child. In a setup with ParentWindow (no flag) -> Child (NoMove) -> SubChild (no flag), the user won't be able to move the parent window by clicking on SubChild. (#1381)
|
||||||
|
- Popups: Pop-ups can be closed with a right-click anywhere, without altering focus under the pop-up. (~#439)
|
||||||
|
- Popups: `BeginPopupContextItem()`, `BeginPopupContextWindow()` are now setup to allow reopening a context menu by right-clicking again. (~#439)
|
||||||
|
- Popups: `BeginPopupContextItem()` now supports a NULL string identifier and uses the last item ID if available.
|
||||||
|
- Popups: Added `OpenPopupOnItemClick()` helper which mimic `BeginPopupContextItem()` but doesn't do the BeginPopup().
|
||||||
|
- MenuItem: Only activating on mouse release. [@Urmeli0815] (was already fixed in nav branch).
|
||||||
|
- MenuItem: Made tick mark thicker (thick mark?).
|
||||||
|
- MenuItem: Tweaks to be usable inside a menu bar (nb: it looks like a regular menu and thus is misleading, prefer using Button() and regular widgets in menu bar if you need to). (#1387)
|
||||||
|
- ImDrawList: Fixed a rare draw call merging bug which could lead to undisplayed triangles. (#1172, #1368)
|
||||||
|
- ImDrawList: Fixed a rare bug in `ChannelsMerge()` when all contents has been clipped, leading to an extraneous draw call being created. (#1172, #1368)
|
||||||
|
- ImFont: Added `AddGlyph()` building helper for use by custom atlas builders.
|
||||||
|
- ImFontAtlas: Added support for CustomRect API to submit custom rectangles to be packed into the atlas. You can map them as font glyphs, or use them for custom purposes.
|
||||||
|
After the atlas is built you can query the position of your rectangles in the texture and then copy your data there. You can use this features to create e.g. full color font-mapped icons.
|
||||||
|
- ImFontAtlas: Fixed fall-back handling when merging fonts, if a glyph was missing from the second font input it could have used a glyph from the first one. (#1349) [@inolen]
|
||||||
|
- ImFontAtlas: Fixed memory leak on build failure case when stbtt_InitFont failed (generally due to incorrect or supported font type). (#1391) (@Moka42)
|
||||||
|
- ImFontConfig: Added `RasterizerMultiply` option to alter the brightness of individual fonts at rasterization time, which may help increasing readability for some.
|
||||||
|
- ImFontConfig: Added `RasterizerFlags` to pass options to custom rasterizer (e.g. the [imgui_freetype](https://github.com/ocornut/imgui_club/tree/master/imgui_freetype) rasterizer in imgui_club has such options).
|
||||||
|
- ImVector: added resize() variant with initialization value.
|
||||||
|
- Misc: Changed the internal name formatting of child windows identifier to use slashes (instead of dots) as separator, more readable.
|
||||||
|
- Misc: Fixed compilation with `IMGUI_DISABLE_OBSOLETE_FUNCTIONS` defined.
|
||||||
|
- Misc: Marked all format+va_list functions with format attribute so GCC/Clang can warn about misuses.
|
||||||
|
- Misc: Fixed compilation on NetBSD due to missing alloca.h (#1319) [@RyuKojiro]
|
||||||
|
- Misc: Improved warnings compilation for newer versions of Clang. (#1324) (@waywardmonkeys)
|
||||||
|
- Misc: Added `io.WantMoveMouse flags` (from Nav branch) and honored in Examples applications. Currently unused but trying to spread Examples applications code that supports it.
|
||||||
|
- Misc: Added `IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS` support in imconfig.h to allow user reimplementing the `ImFormatString()` functions e.g. to use stb_printf(). (#1038)
|
||||||
|
- Misc: [Windows] Fixed default Win32 `SetClipboardText()` handler leaving the Win32 clipboard handler unclosed on failure. [@pdoane]
|
||||||
|
- Style: Added `ImGuiStyle::ScaleAllSizes(float)` helper to make it easier to have application transition e.g. from low to high DPI with a matching style.
|
||||||
|
- Metrics: Draw window bounding boxes when hovering Pos/Size; List all draw layers; Trimming empty commands like Render() does.
|
||||||
|
- Examples: OpenGL3: Save and restore sampler state. (#1145) [@nlguillemot]
|
||||||
|
- Examples: OpenGL2, OpenGL3: Save and restore polygon mode. (#1307) [@JJscott]
|
||||||
|
- Examples: DirectX11: Allow creating device with feature level 10 since we don't really need much for that example. (#1333)
|
||||||
|
- Examples: DirectX9/10/12: Using the Win32 SetCapture/ReleaseCapture API to read mouse coordinates when they are out of bounds. (#1375) [@Gargaj, @ocornut]
|
||||||
|
- Tools: Fixed binary_to_compressed_c tool to return 0 when successful. (#1350) [@benvanik]
|
||||||
|
- Internals: Exposed more helpers and unfinished features in imgui_internal.h. (use at your own risk!).
|
||||||
|
- Internals: A bunch of internal refactoring, hopefully haven't broken anything! Merged a bunch of internal changes from the upcoming Navigation branch.
|
||||||
|
- Various tweaks, fixes and documentation changes.
|
||||||
|
|
||||||
|
Beta Navigation Branch:
|
||||||
|
(Lots of work has been done toward merging the Beta Gamepad/Keyboard Navigation branch (#787) in master.)
|
||||||
|
(Please note that this branch is always kept up to date with master. If you are using the navigation branch, some of the changes include:)
|
||||||
|
- Nav: Added `#define IMGUI_HAS_NAV` in imgui.h to ease sharing code between both branches. (#787)
|
||||||
|
- Nav: MainMenuBar now releases focus when user gets out of the menu layer. (#787)
|
||||||
|
- Nav: When applying focus to a window with only menus, the menu layer is automatically activated. (#787)
|
||||||
|
- Nav: Added `ImGuiNavInput_KeyMenu` (~Alt key) aside from ImGuiNavInput_PadMenu input as it is one differentiator of pad vs keyboard that was detrimental to the keyboard experience. Although isn't officially supported, it makes the current experience better. (#787)
|
||||||
|
- Nav: Move requests now wrap vertically inside Menus and Pop-ups. (#787)
|
||||||
|
- Nav: Allow to collapse tree nodes with NavLeft and open them with NavRight. (#787, #1079).
|
||||||
|
- Nav: It's now possible to navigate sibling of a menu-bar while navigating inside one of their child. If a Left<>Right navigation request fails to find a match we forward the request to the root menu. (#787, #126)
|
||||||
|
- Nav: Fixed `SetItemDefaultFocus` from stealing default focus when we are initializing default focus for a menu bar layer. (#787)
|
||||||
|
- Nav: Support for fall-back horizontal scrolling with PadLeft/PadRight (nb: fall-back scrolling is only used to navigate windows that have no interactive items). (#787)
|
||||||
|
- Nav: Fixed tool-tip from being selectable in the window selection list. (#787)
|
||||||
|
- Nav: `CollapsingHeader(bool*)` variant: fixed for `IsItemHovered()` not working properly in the nav branch. (#600, #787)
|
||||||
|
- Nav: InputText: Fixed using Up/Down history callback feature when Nav is enabled. (#787)
|
||||||
|
- Nav: InputTextMultiline: Fixed navigation/selection. Disabled selecting all when activating a multi-line text editor. (#787)
|
||||||
|
- Nav: More consistently drawing a (thin) navigation rectangle hover filled frames such as tree nodes, collapsing header, menus. (#787)
|
||||||
|
- Nav: Various internal refactoring.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.51 (2017-08-24)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.51
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
Work on dear imgui has been gradually resuming. It means that fixes and new features should be tackled at a faster rate than last year. However, in order to move forward with the library and get rid of some cruft, I have taken the liberty to be a little bit more aggressive than usual with API breaking changes. Read the details below and search for those names in your code! In the grand scheme of things, those changes are small and should not affect everyone, but this is technically our most aggressive release so far in term of API breakage. If you want to be extra forward-facing, you can enable `#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS` in your imconfig.h to disable the obsolete names/redirection.
|
||||||
|
|
||||||
|
- Renamed `IsItemHoveredRect()` to `IsItemRectHovered()`. Kept inline redirection function (will obsolete).
|
||||||
|
- Renamed `IsMouseHoveringWindow()` to `IsWindowRectHovered()` for consistency. Kept inline redirection function (will obsolete).
|
||||||
|
- Renamed `IsMouseHoveringAnyWindow()` to `IsAnyWindowHovered()` for consistency. Kept inline redirection function (will obsolete).
|
||||||
|
- Renamed `ImGuiCol_Columns***` enums to `ImGuiCol_Separator***`. Kept redirection enums (will obsolete).
|
||||||
|
- Renamed `ImGuiSetCond***` types and enums to `ImGuiCond***`. Kept redirection enums (will obsolete).
|
||||||
|
- Renamed `GetStyleColName()` to `GetStyleColorName()` for consistency. Unlikely to be used by end-user!
|
||||||
|
- Added `PushStyleColor(ImGuiCol idx, ImU32 col)` overload, which _might_ cause an "ambiguous call" compilation error if you are using ImColor() with implicit cast. Cast to ImU32 or ImVec4 explicitly to fix.
|
||||||
|
- Marked the weird `IMGUI_ONCE_UPON_A_FRAME` helper macro as obsolete. Prefer using the more explicit `ImGuiOnceUponAFrame`.
|
||||||
|
- Changed `ColorEdit4(const char* label, float col[4], bool show_alpha = true)` signature to `ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)`, where flags 0x01 is a safe no-op (hello dodgy backward compatibility!). The new `ColorEdit4`/`ColorPicker4` functions have lots of available flags! Check and run the demo window, under "Color/Picker Widgets", to understand the various new options.
|
||||||
|
- Changed signature of `ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)` to `ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0))`. This function was rarely used and was very dodgy (no explicit ID!).
|
||||||
|
- Changed `BeginPopupContextWindow(bool also_over_items=true, const char* str_id=NULL, int mouse_button=1)` signature to `(const char* str_id=NULL, int mouse_button=1, bool also_over_items=true)`. This is perhaps the most aggressive change in this update, but note that the majority of users relied on default parameters completely, so this will affect only a fraction of users of this already rarely used function.
|
||||||
|
- Removed `IsPosHoveringAnyWindow()`, which was partly broken and misleading. In the vast majority of cases, people using that function wanted to use `io.WantCaptureMouse` flag. Replaced with IM_ASSERT + comment redirecting user to `io.WantCaptureMouse`. (#1237)
|
||||||
|
- Removed the old `ValueColor()` helpers, they are equivalent to calling `Text(label)` + `SameLine()` + `ColorButton()`.
|
||||||
|
- Removed `ColorEditMode()` and `ImGuiColorEditMode` type in favor of `ImGuiColorEditFlags` and parameters to the various Color*() functions. The `SetColorEditOptions()` function allows to initialize default but the user can still change them with right-click context menu. Commenting out your old call to `ColorEditMode()` may just be fine!
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- Added flags to `ColorEdit3()`, `ColorEdit4()`. The color edit widget now has a context-menu and access to the color picker. (#346)
|
||||||
|
- Added flags to `ColorButton()`. (#346)
|
||||||
|
- Added `ColorPicker3()`, `ColorPicker4()`. The API along with those of the updated `ColorEdit4()` was designed so you may use them in various situation and hopefully compose your own picker if required. There are a bunch of available flags, check the Demo window and comment for `ImGuiColorEditFlags_`. Some of the options it supports are: two color picker types (hue bar + sat/val rectangle, hue wheel + rotating sat/val triangle), display as u8 or float, lifting 0.0..1.0 constraints (currently rgba only), context menus, alpha bar, background checkerboard options, preview tooltip, basic revert. For simple use, calling the existing `ColorEdit4()` function as you did before will be enough, as you can now open the color picker from there. (#346) [@r-lyeh, @nem0, @thennequin, @dariomanesku and @ocornut]
|
||||||
|
- Added `SetColorEditOptions()` to set default color options (e.g. if you want HSV over RGBA, float over u8, select a default picker mode etc. at startup time without a user intervention. Note that the user can still change options with the context menu unless disabled with `ImGuiColorFlags_NoOptions` or explicitly enforcing a display type/picker mode etc.).
|
||||||
|
- Added user-facing `IsPopupOpen()` function. (#891) [@mkeeter]
|
||||||
|
- Added `GetColorU32(u32)` variant that perform the style alpha multiply without a floating-point round trip, and helps makes code more consistent when using ImDrawList APIs.
|
||||||
|
- Added `PushStyleColor(ImGuiCol idx, ImU32 col)` overload.
|
||||||
|
- Added `GetStyleColorVec4(ImGuiCol idx)` which is equivalent to accessing `ImGui::GetStyle().Colors[idx]` (aka return the raw style color without alpha alteration).
|
||||||
|
- ImFontAtlas: Added `GlyphRangesBuilder` helper class, which makes it easier to build custom glyph ranges from your app/game localization data, or add into existing glyph ranges.
|
||||||
|
- ImFontAtlas: Added `TexGlyphPadding` option. (#1282) [@jadwallis]
|
||||||
|
- ImFontAtlas: Made it possible to override size of AddFontDefault() (even if it isn't really recommended!).
|
||||||
|
- ImDrawList: Added `GetClipRectMin()`, `GetClipRectMax()` helpers.
|
||||||
|
- Fixed Ini saving crash if the ImGuiWindowFlags_NoSavedSettings gets removed from a window after its creation (unlikely!). (#1000)
|
||||||
|
- Fixed `PushID()`/`PopID()` from marking parent window as Accessed (which needlessly woke up the root "Debug" window when used outside of a regular window). (#747)
|
||||||
|
- Fixed an assert when calling `CloseCurrentPopup()` twice in a row. [@nem0]
|
||||||
|
- Window size can be loaded from .ini data even if ImGuiWindowFlags_NoResize flag is set. (#1048, #1056)
|
||||||
|
- Columns: Added `SetColumnWidth()`. (#913) [@ggtucker]
|
||||||
|
- Columns: Dragging a column preserve its width by default. (#913) [@ggtucker]
|
||||||
|
- Columns: Fixed first column appearing wider than others. (#1266)
|
||||||
|
- Columns: Fixed allocating space on the right-most side with the assumption of a vertical scrollbar. The space is only allocated when needed. (#125, #913, #893, #1138)
|
||||||
|
- Columns: Fixed the right-most column from registering its content width to the parent window, which led to various issues when using auto-resizing window or e.g. horizontal scrolling. (#519, #125, #913)
|
||||||
|
- Columns: Refactored some of the columns code internally toward a better API (not yet exposed) + minor optimizations. (#913) [@ggtucker, @ocornut]
|
||||||
|
- Popups: Most pop-ups windows can be moved by the user after appearing (if they don't have explicit positions provided by caller, or e.g. sub-menu pop-up). The previous restriction was totally arbitrary. (#1252)
|
||||||
|
- Tooltip: `SetTooltip()` is expanded immediately into a window, honoring current font / styling setting. Add internal mechanism to override tooltips. (#862)
|
||||||
|
- PlotHistogram: bars are drawn based on zero-line, so negative values are going under. (#828)
|
||||||
|
- Scrolling: Fixed return values of `GetScrollMaxX()`, `GetScrollMaxY()` when both scrollbars were enabled. Tweak demo to display more data. (#1271) [@degracode]
|
||||||
|
- Scrolling: Fixes for Vertical Scrollbar not automatically getting enabled if enabled Horizontal Scrollbar straddle the vertical limit. (#1271, #246)
|
||||||
|
- Scrolling: `SetScrollHere()`, `SetScrollFromPosY()`: Fixed Y scroll aiming when Horizontal Scrollbar is enabled. (#665).
|
||||||
|
- [Windows] Clipboard: Fixed not closing Win32 clipboard on early open failure path. (#1264)
|
||||||
|
- Removed an unnecessary dependency on int64_t which failed on some older compilers.
|
||||||
|
- Demo: Rearranged everything under Widgets in a more consistent way.
|
||||||
|
- Demo: Columns: Added Horizontal Scrolling demo. Tweaked another Columns demo. (#519, #125, #913)
|
||||||
|
- Examples: OpenGL: Various makefiles for MINGW, Linux. (#1209, #1229, #1209) [@fr500, @acda]
|
||||||
|
- Examples: Enabled vsync by default in example applications, so it doesn't confuse people that the sample run at 2000+ fps and waste an entire CPU. (#1213, #1151).
|
||||||
|
- Various other small fixes, tweaks, comments, optimizations.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.50 (2017-06-02)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.50
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Added a void* user_data parameter to Clipboard function handlers. (#875)
|
||||||
|
- SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.
|
||||||
|
- Renamed ImDrawList::PathFill() - rarely used directly - to ImDrawList::PathFillConvex() for clarity and consistency.
|
||||||
|
- Removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.
|
||||||
|
- Style: style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc.
|
||||||
|
- BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild().
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- InputText(): Added support for CTRL+Backspace (delete word).
|
||||||
|
- InputText(): OSX uses Super+Arrows for home/end. Add Shortcut+Backspace support. (#650) [@michaelbartnett]
|
||||||
|
- InputText(): Got rid of individual OSX-specific options in ImGuiIO, added a single io.OSXBehaviors flag. (#473, #650)
|
||||||
|
- InputText(): Fixed pressing home key on last character when it isn't a trailing \n (#588, #815)
|
||||||
|
- InputText(): Fixed state corruption/crash bug in stb_textedit.h redo logic when exhausting undo/redo char buffer. (#715. #681)
|
||||||
|
- InputTextMultiline(): Fixed CTRL+DownArrow moving scrolling out of bounds.
|
||||||
|
- InputTextMultiline(): Scrollbar fix for when input and latched internal buffers differs in a way that affects vertical scrollbar existence. (#725)
|
||||||
|
- ImFormatString(): Fixed an overflow handling bug with implementation of vsnprintf() that do not return -1. (#793)
|
||||||
|
- BeginChild(const char*) now applies stack id to provided label, consistent with other widgets. (#894, #713)
|
||||||
|
- SameLine() with explicit X position is relative to left of group/columns. (ref #746, #125, #630)
|
||||||
|
- SliderInt(), SliderFloat() supports reverse direction (where v_min > v_max). (#854)
|
||||||
|
- SliderInt(), SliderFloat() better support for when v_min==v_max. (#919)
|
||||||
|
- SliderInt(), SliderFloat() enforces writing back value when interacting, to be consistent with other widgets. (#919)
|
||||||
|
- SliderInt, SliderFloat(): Fixed edge case where style.GrabMinSize being bigger than slider width can lead to a division by zero. (#919)
|
||||||
|
- Added IsRectVisible() variation with explicit start-end positions. (#768) [@thedmd]
|
||||||
|
- Fixed TextUnformatted() clipping bug in the large-text path when horizontal scroll has been applied. (#692, #246)
|
||||||
|
- Fixed minor text clipping issue in window title when using font straying above usual line. (#699)
|
||||||
|
- Fixed SetCursorScreenPos() fixed not adjusting CursorMaxPos as well.
|
||||||
|
- Fixed scrolling offset when using SetScrollY(), SetScrollFromPosY(), SetScrollHere() with menu bar.
|
||||||
|
- Fixed using IsItemActive() after EndGroup() or any widget using groups. (#840, #479)
|
||||||
|
- Fixed IsItemActive() lagging by one frame on initial widget activation. (#840)
|
||||||
|
- Fixed Separator() zero-height bounding box resulting in clipping when laying exactly on top line of clipping rectangle (#860)
|
||||||
|
- Fixed PlotLines() PlotHistogram() calling with values_count == 0.
|
||||||
|
- Fixed clicking on a window's void while staying still overzealously marking .ini settings as dirty. (#923)
|
||||||
|
- Fixed assert triggering when a window has zero rendering but has a callback. (#810)
|
||||||
|
- Scrollbar: Fixed rendering when sizes are negative to reduce glitches (which can happen with certain style settings and zero WindowMinSize).
|
||||||
|
- EndGroup(): Made IsItemHovered() work when an item was activated within the group. (#849)
|
||||||
|
- BulletText(): Fixed stopping to display formatted string after the '##' mark.
|
||||||
|
- Closing the focused window restore focus to the first active root window in descending z-order .(part of #727)
|
||||||
|
- Word-wrapping: Fixed a bug where we never wrapped after a 1 character word. [@sronsse]
|
||||||
|
- Word-wrapping: Fixed TextWrapped() overriding wrap position if one is already set. (#690)
|
||||||
|
- Word-wrapping: Fixed incorrect testing for negative wrap coordinates, they are perfectly legal. (#706)
|
||||||
|
- ImGuiListClipper: Fixed automatic-height calc path dumbly having user display element 0 twice. (#661, #716)
|
||||||
|
- ImGuiListClipper: Fix to behave within column. (#661, #662, #716)
|
||||||
|
- ImDrawList: Renamed ImDrawList::PathFill() to ImDrawList::PathFillConvex() for clarity. (BREAKING API)
|
||||||
|
- Columns: End() avoid calling Columns(1) if no columns set is open, not sure why it wasn't the case already (pros: faster, cons: exercise less code).
|
||||||
|
- ColorButton(): Fix ColorButton showing wrong hex value for alpha. (#1068) [@codecat]
|
||||||
|
- ColorEdit4(): better preserve inputting value out of 0..255 range, display then clamped in Hexadecimal form.
|
||||||
|
- Shutdown() clear out some remaining pointers for sanity. (#836)
|
||||||
|
- Added IMGUI_USE_BGRA_PACKED_COLOR option in imconfig.h (#767, #844) [@thedmd]
|
||||||
|
- Style: Removed the inconsistent shadow under RenderCollapseTriangle() (~#707)
|
||||||
|
- Style: Added ButtonTextAlign, ImGuiStyleVar_ButtonTextAlign. (#842)
|
||||||
|
- ImFont: Allowing to use up to 0xFFFE glyphs in same font (increased from previous 0x8000).
|
||||||
|
- ImFont: Added GetGlyphRangesThai() helper. [@nProtect]
|
||||||
|
- ImFont: CalcWordWrapPositionA() fixed font scaling with fallback character.
|
||||||
|
- ImFont: Calculate and store the approximate texture surface to get an idea of how costly each source font is.
|
||||||
|
- ImFontConfig: Added GlyphOffset to explicitly offset glyphs at font build time, useful for merged fonts. Removed MergeGlyphCenterV. (BREAKING API)
|
||||||
|
- Clarified asserts in CheckStacksSize() when there is a stack mismatch.
|
||||||
|
- Context: Support for #define-ing GImGui and IMGUI_SET_CURRENT_CONTEXT_FUNC to enable custom thread-based hackery (#586)
|
||||||
|
- Updated stb_truetype.h to 1.14 (added OTF support, removed warnings). (#883, #976)
|
||||||
|
- Updated stb_rect_pack.h to 0.10 (removed warnings). (#883)
|
||||||
|
- Added ImGuiMouseCursor_None enum value for convenient usage by app/binding.
|
||||||
|
- Clipboard: Added a void* user_data parameter to Clipboard function handlers. (#875) (BREAKING API)
|
||||||
|
- Internals: Refactor internal text alignment options to use ImVec2, removed ImGuiAlign. (#842, #222)
|
||||||
|
- Internals: Renamed ImLoadFileToMemory to ImFileLoadToMemory to be consistent with ImFileOpen + fix mismatching .h name. (#917)
|
||||||
|
- Windows: Fixed Windows default clipboard handler leaving its buffer unfreed on application's exit. (#714)
|
||||||
|
- Windows: No default IME handler when compiling for Windows using GCC. (#738)
|
||||||
|
- Windows: Now using _wfopen() instead of fopen() to allow passing in paths/filenames with UTF-8 characters. (#917)
|
||||||
|
- Tools: binary_to_compressed_c: Avoid ?? trigraphs sequences in string outputs which break some older compilers. (#839)
|
||||||
|
- Demo: Added an extra 3-way columns demo.
|
||||||
|
- Demo: ShowStyleEditor: show font character map / grid in more details.
|
||||||
|
- Demo: Console: Fixed a completion bug when multiple candidates are equals and match until the end.
|
||||||
|
- Demo: Fixed 1-byte off overflow in the ShowStyleEditor() combo usage. (#783) [@bear24rw]
|
||||||
|
- Examples: Accessing ImVector fields directly, feel less stl-ey. (#810)
|
||||||
|
- Examples: OpenGL*: Saving/restoring existing scissor rectangle for completeness. (#807)
|
||||||
|
- Examples: OpenGL*: Saving/restoring active texture number (the value modified by glActiveTexture). (#1087, #1088, #1116)
|
||||||
|
- Examples: OpenGL*: Saving/restoring separate color/alpha blend functions correctly. (#1120) [@greggman]
|
||||||
|
- Examples: OpenGL2: Uploading font texture as RGBA32 to increase compatibility with users shaders for beginners. (#824)
|
||||||
|
- Examples: Vulkan: Countless fixes and improvements. (#785, #804, #910, #1017, #1039, #1041, #1042, #1043, #1080) [@martty, @Loftilus, @ParticlePeter, @SaschaWillems]
|
||||||
|
- Examples: DirectX9/10/10: Only call SetCursor(NULL) is io.MouseDrawCursor is set. (#585, #909)
|
||||||
|
- Examples: DirectX9: Explicitly setting viewport to match that other examples are doing. (#937)
|
||||||
|
- Examples: GLFW+OpenGL3: Fixed Shutdown() calling GL functions with NULL parameters if NewFrame was never called. (#800)
|
||||||
|
- Examples: GLFW+OpenGL2: Renaming opengl_example/ to opengl2_example/ for clarity.
|
||||||
|
- Examples: SDL+OpenGL: explicitly setting GL_UNPACK_ROW_LENGTH to reduce issues because SDL changes it. (#752)
|
||||||
|
- Examples: SDL2: Added build .bat files for Win32.
|
||||||
|
- Added various links to language/engine bindings.
|
||||||
|
- Various other minor fixes, tweaks, comments, optimizations.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.49 (2016-05-09)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.49
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Renamed `SetNextTreeNodeOpened()` to `SetNextTreeNodeOpen()` for consistency, no redirection.
|
||||||
|
- Removed confusing set of `GetInternalState()`, `GetInternalStateSize()`, `SetInternalState()` functions. Now using `CreateContext()`, `DestroyContext()`, `GetCurrentContext()`, `SetCurrentContext()`. If you were using multiple contexts the change should be obvious and trivial.
|
||||||
|
- Obsoleted old signature of `CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false)`, as extra parameters were badly designed and rarely used. Most uses were using 1 parameter and shouldn't affect you. You can replace the "default_open = true" flag in new API with `CollapsingHeader(label, ImGuiTreeNodeFlags_DefaultOpen)`.
|
||||||
|
- Changed `ImDrawList::PushClipRect(ImVec4 rect)` to `ImDraw::PushClipRect(ImVec2 min,ImVec2 max,bool intersect_with_current_clip_rect=false)`. Note that higher-level `ImGui::PushClipRect()` is preferable because it will clip at logic/widget level, whereas `ImDrawList::PushClipRect()` only affect your renderer.
|
||||||
|
- Title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore (see #655). If your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you. However if your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.
|
||||||
|
This helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color. (Or If this is confusing, just pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color.)
|
||||||
|
|
||||||
|
ImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col)
|
||||||
|
{
|
||||||
|
float new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w));
|
||||||
|
float k = title_bg_col.w / new_a;
|
||||||
|
return ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a);
|
||||||
|
}
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
|
||||||
|
- New version of ImGuiListClipper helper calculates item height automatically. See comments and demo code. (#662, #661, #660)
|
||||||
|
- Added SetNextWindowSizeConstraints() to enable basic min/max and programmatic size constraints on window. Added demo. (#668)
|
||||||
|
- Added PushClipRect()/PopClipRect() (previously part of imgui_internal.h). Changed ImDrawList::PushClipRect() prototype. (#610)
|
||||||
|
- Added IsRootWindowOrAnyChildHovered() helper. (#615)
|
||||||
|
- Added TreeNodeEx() functions. (#581, #600, #190)
|
||||||
|
- Added ImGuiTreeNodeFlags_Selected flag to display TreeNode as "selected". (#581, #190)
|
||||||
|
- Added ImGuiTreeNodeFlags_AllowOverlapMode flag. (#600)
|
||||||
|
- Added ImGuiTreeNodeFlags_NoTreePushOnOpen flag (#590).
|
||||||
|
- Added ImGuiTreeNodeFlags_NoAutoOpenOnLog flag (previously private).
|
||||||
|
- Added ImGuiTreeNodeFlags_DefaultOpen flag (previously private).
|
||||||
|
- Added ImGuiTreeNodeFlags_OpenOnDoubleClick flag.
|
||||||
|
- Added ImGuiTreeNodeFlags_OpenOnArrow flag.
|
||||||
|
- Added ImGuiTreeNodeFlags_Leaf flag, always opened, no arrow, for convenience. For simple use case prefer using TreeAdvanceToLabelPos()+Text().
|
||||||
|
- Added ImGuiTreeNodeFlags_Bullet flag, to add a bullet to Leaf node or replace Arrow with a bullet.
|
||||||
|
- Added TreeAdvanceToLabelPos(), GetTreeNodeToLabelSpacing() helpers. (#581, #324)
|
||||||
|
- Added CreateContext()/DestroyContext()/GetCurrentContext()/SetCurrentContext(). Obsoleted nearly identical GetInternalState()/SetInternalState() functions. (#586, #269)
|
||||||
|
- Added NewLine() to undo a SameLine() and as a shy reminder that horizontal layout support hasn't been implemented yet.
|
||||||
|
- Added IsItemClicked() helper. (#581)
|
||||||
|
- Added CollapsingHeader() variant with close button. (#600)
|
||||||
|
- Fixed MenuBar missing lower border when borders are enabled.
|
||||||
|
- InputText(): Fixed clipping of cursor rendering in case it gets out of the box (which can be forced w/ ImGuiInputTextFlags_NoHorizontalScroll. (#601)
|
||||||
|
- Style: Changed default IndentSpacing from 22 to 21. (#581, #324)
|
||||||
|
- Style: Fixed TitleBg/TitleBgActive color being rendered above WindowBg color, which was inconsistent and causing visual artifact. (#655)
|
||||||
|
This broke the meaning of TitleBg and TitleBgActive. Only affect values where Alpha<1.0f. Fixed default theme. Read comments in "API BREAKING CHANGES" section to convert.
|
||||||
|
- Relative rendering of order of Child windows creation is preserved, to allow more control with overlapping children. (#595)
|
||||||
|
- Fixed GetWindowContentRegionMax() being off by ScrollbarSize amount when explicit SizeContents is set.
|
||||||
|
- Indent(), Unindent(): optional non-default indenting width. (#324, #581)
|
||||||
|
- Bullet(), BulletText(): Slightly bigger. Less polygons.
|
||||||
|
- ButtonBehavior(): fixed subtle old bug when a repeating button would also return true on mouse release (barely noticeable unless RepeatRate is set to be very slow). (#656)
|
||||||
|
- BeginMenu(): a menu that becomes disabled while open gets closed down, facilitate user's code. (#126)
|
||||||
|
- BeginGroup(): fixed using within Columns set. (#630)
|
||||||
|
- Fixed a lag in reading the currently hovered window when dragging a window. (#635)
|
||||||
|
- Obsoleted 4 parameters version of CollapsingHeader(). Refactored code into TreeNodeBehavior. (#600, #579)
|
||||||
|
- Scrollbar: minor fix for top-right rounding of scrollbar background when window has menu bar but no title bar.
|
||||||
|
- MenuItem(): the check mark renders in disabled color when menu item is disabled.
|
||||||
|
- Fixed clipping rectangle floating point representation to ensure renderer-side float point operations yield correct results in typical DirectX/GL settings. (#582, 597)
|
||||||
|
- Fixed GetFrontMostModalRootWindow(), fixing missing fade-out when a combo pop was used stacked over a modal window. (#604)
|
||||||
|
- ImDrawList: Added AddQuad(), AddQuadFilled() helpers.
|
||||||
|
- ImDrawList: AddText() refactor, moving some code to ImFont, reserving less unused vertices when large vertical clipping occurs.
|
||||||
|
- ImFont: Added RenderChar() helper.
|
||||||
|
- ImFont: Added AddRemapChar() helper. (#609)
|
||||||
|
- ImFontConfig: Clarified persistence requirement of GlyphRanges array. (#651)
|
||||||
|
- ImGuiStorage: Added bool helper functions for completeness.
|
||||||
|
- AddFontFromMemoryCompressedTTF(): Fix ImFontConfig propagation. (#587)
|
||||||
|
- Renamed majority of use of the word "opened" to "open" for clarity. Renamed SetNextTreeNodeOpened() to SetNextTreeNodeOpen(). (#625, #579)
|
||||||
|
- Examples: OpenGL3: Saving/restoring glActiveTexture() state. (#602)
|
||||||
|
- Examples: DirectX9: save/restore all device state.
|
||||||
|
- Examples: DirectX9: Removed dependency on d3dx9.h, d3dx9.lib, dxguid.lib so it can be used in a DirectXMath.h only environment. (#611)
|
||||||
|
- Examples: DirectX10/X11: Apply depth-stencil state (no use of depth buffer). (#640, #636)
|
||||||
|
- Examples: DirectX11/X11: Added comments on removing dependency on D3DCompiler. (#638)
|
||||||
|
- Examples: SDL: Initialize video+timer subsystem only.
|
||||||
|
- Examples: Apple/iOS: lowered XCode project deployment target from 10.7 to 10.11. (#598, #575)
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
VERSION 1.48 (2016-04-09)
|
||||||
|
Decorated log: https://github.com/ocornut/imgui/releases/tag/v1.48
|
||||||
|
|
||||||
|
Breaking Changes:
|
||||||
|
|
||||||
|
- Consistently honoring exact width passed to PushItemWidth() (when positive), previously it would add extra FramePadding.x*2 over that width. Some hand-tuned layout may be affected slightly. (#346)
|
||||||
|
- Style: removed `style.WindowFillAlphaDefault` which was confusing and redundant, baked alpha into `ImGuiCol_WindowBg` color. If you had a custom WindowBg color but didn't change WindowFillAlphaDefault, multiply WindowBg alpha component by 0.7. Renamed `ImGuiCol_TooltipBg` to `ImGuiCol_PopupBG`, applies to other types of pop-ups. `bg_alpha` parameter of 5-parameters version of Begin() is an override. (#337)
|
||||||
|
- InputText(): Added BufTextLen field in ImGuiTextEditCallbackData. Requesting user to update it if the buffer is modified in the callback. Added a temporary length-check assert to minimize panic for the 3 people using the callback. (#541)
|
||||||
|
- Renamed GetWindowFont() to GetFont(), GetWindowFontSize() to GetFontSize(). Kept inline redirection function (will obsolete). (#340)
|
||||||
|
|
||||||
|
Other Changes:
|
||||||
|
|
||||||
|
- Consistently honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. Some hand-tuned layout may be affected slightly. (#346)
|
||||||
|
- Fixed clipping of child windows within parent not taking account of child outer clipping boundaries (including scrollbar, etc.). (#506)
|
||||||
|
- TextUnformatted(): Fixed rare crash bug with large blurb of text (2k+) not finished with a '\n' and fully above the clipping Y line. (#535)
|
||||||
|
- IO: Added 'KeySuper' field to hold CMD keyboard modifiers for OS X. Updated all examples accordingly. (#473)
|
||||||
|
- Added ImGuiWindowFlags_ForceVerticalScrollbar, ImGuiWindowFlags_ForceHorizontalScrollbar flags. (#476)
|
||||||
|
- Added IM_COL32 macros to generate a U32 packed color, convenient for direct use of ImDrawList api. (#346)
|
||||||
|
- Added GetFontTexUvWhitePixel() helper, convenient for direct use of ImDrawList api.
|
||||||
|
- Selectable(): Added ImGuiSelectableFlags_AllowDoubleClick flag to allow user reacting on double-click. (@zapolnov) (#516)
|
||||||
|
- Begin(): made the close button explicitly set the boolean to false instead of toggling it. (#499)
|
||||||
|
- BeginChild()/EndChild(): fixed incorrect layout to allow widgets submitted after an auto-fitted child window. (#540)
|
||||||
|
- BeginChild(): Added ImGuiWindowFlags_AlwaysUseWindowPadding flag to ensure non-bordered child window uses window padding. (#462)
|
||||||
|
- Fixed InputTextMultiLine(), ListBox(), BeginChildFrame(), ProgressBar(): outer frame not honoring bordering. (#462, #503)
|
||||||
|
- Fixed Image(), ImageButtion() rendering a rectangle 1 px too large on each axis. (#457)
|
||||||
|
- SetItemAllowOverlap(): Promoted from imgui_internal.h to public imgui.h api. (#517)
|
||||||
|
- Combo(): Right-most button stays highlighted when pop-up is open.
|
||||||
|
- Combo(): Display pop-up above if there's isn't enough space below / or select largest side. (#505)
|
||||||
|
- DragFloat(), SliderFloat(), InputFloat(): fixed cases of erroneously returning true repeatedly after a text input modification (e.g. "0.0" --> "0.000" would keep returning true). (#564)
|
||||||
|
- DragFloat(): Always apply value when mouse is held/widget active, so that an always-reseting variable (e.g. non saved local) can be passed.
|
||||||
|
- InputText(): OS X friendly behaviors: Word movement uses ALT key; Shortcuts uses CMD key; Double-clicking text select a single word; Jumping to next word sets cursor to end of current word instead of beginning of current word. (@zhiayang), (#473)
|
||||||
|
- InputText(): Added BufTextLen in ImGuiTextEditCallbackData. Requesting user to maintain it if buffer is modified. Zero-ing structure properly before use. (#541)
|
||||||
|
- CheckboxFlags(): Added support for testing/setting multiple flags at the same time. (@DMartinek) (#555)
|
||||||
|
- TreeNode(), CollapsingHeader() fixed not being able to use "##" sequence in a formatted label.
|
||||||
|
- ColorEdit4(): Empty label doesn't add InnerSpacing.x, matching behavior of other widgets. (#346)
|
||||||
|
- ColorEdit4(): Removed unnecessary calls to scanf() when idle in hexadecimal edit mode.
|
||||||
|
- BeginPopupContextItem(), BeginPopupContextWindow(): added early out optimization.
|
||||||
|
- CaptureKeyboardFromApp() / CaptureMouseFromApp(): added argument to allow clearing the capture flag. (#533)
|
||||||
|
- ImDrawList: Fixed index-overflow check broken by AddText() casting current index back to ImDrawIdx. (#514)
|
||||||
|
- ImDrawList: Fixed incorrect removal of trailing draw command if it is a callback command.
|
||||||
|
- ImDrawList: Allow windows with only a callback only to be functional. (#524)
|
||||||
|
- ImDrawList: Fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis. (#457)
|
||||||
|
- ImDrawList: Fixed ImDrawList::AddCircle() to fit precisely within bounding box like AddCircleFilled() and AddRectFilled(). (#457)
|
||||||
|
- ImDrawList: AddCircle(), AddRect() takes optional thickness parameter.
|
||||||
|
- ImDrawList: Added AddTriangle().
|
||||||
|
- ImDrawList: Added PrimQuadUV() helper to ease custom rendering of textured quads (require primitive reserve).
|
||||||
|
- ImDrawList: Allow AddText(ImFont\* font, float font_size, ...) variant to take NULL/0.0f as default.
|
||||||
|
- ImFontAtlas: heuristic increase default texture width up for large number of glyphs. (#491)
|
||||||
|
- ImTextBuffer: Fixed empty() helper which was utterly broken.
|
||||||
|
- Metrics: allow to inspect individual triangles in draw calls.
|
||||||
|
- Demo: added more draw primitives in the Custom Rendering example. (#457)
|
||||||
|
- Demo: extra comments and example for PushItemWidth(-1) patterns.
|
||||||
|
- Demo: InputText password demo filters out blanks. (#515)
|
||||||
|
- Demo: Fixed malloc/free mismatch and leak when destructing demo console, if it has been used. (@fungos) (#536)
|
||||||
|
- Demo: plot code doesn't use ImVector to avoid heap allocation and be more friendly to custom allocator users. (#538)
|
||||||
|
- Fixed compilation on DragonFly BSD (@mneumann) (#563)
|
||||||
|
- Examples: Vulkan: Added a Vulkan example (@Loftilus) (#549)
|
||||||
|
- Examples: DX10, DX11: Saving/restoring most device state so dropping render function in your codebase shouldn't have DX device side-effects. (#570)
|
||||||
|
- Examples: DX10, DX11: Fixed ImGui_ImplDX??_NewFrame() from recreating device objects if render isn't called (g_pVB not set).
|
||||||
|
- Examples: OpenGL3: Fix BindVertexArray/BindBuffer order. (@nlguillemot) (#527)
|
||||||
|
- Examples: OpenGL: skip rendering and calling glViewport() if we have zero-fixed buffer. (#486)
|
||||||
|
- Examples: SDL2+OpenGL3: Fix context creation options. Made ImGui_ImplSdlGL3_NewFrame() signature match GL2 one. (#468, #463)
|
||||||
|
- Examples: SDL2+OpenGL2/3: Fix for high-dpi displays. (@nickgravelyn)
|
||||||
|
- Various extra comments and clarification in the code.
|
||||||
|
- Various other fixes and optimizations.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
For older version, see https://github.com/ocornut/imgui/releases
|
||||||
|
|
@ -1,7 +1,14 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// USER IMPLEMENTATION
|
// COMPILE-TIME OPTIONS FOR DEAR IMGUI
|
||||||
// This file contains compile-time options for ImGui.
|
// Runtime options (clipboard callbacks, enabling various features, etc.) can generally be set via the ImGuiIO structure.
|
||||||
// Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO().
|
// You can use ImGui::SetAllocatorFunctions() before calling ImGui::CreateContext() to rewire memory allocation functions.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// A) You may edit imconfig.h (and not overwrite it when updating imgui, or maintain a patch/branch with your modifications to imconfig.h)
|
||||||
|
// B) or add configuration directives in your own file and compile with #define IMGUI_USER_CONFIG "myfilename.h"
|
||||||
|
// If you do so you need to make sure that configuration settings are defined consistently _everywhere_ dear imgui is used, which include
|
||||||
|
// the imgui*.cpp files but also _any_ of your code that uses imgui. This is because some compile-time options have an affect on data structures.
|
||||||
|
// Defining those options in imconfig.h will ensure every compilation unit gets to see the same data structure layouts.
|
||||||
|
// Call IMGUI_CHECKVERSION() from your .cpp files to verify that the data structures your files are using are matching the ones imgui.cpp is using.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -13,30 +20,35 @@
|
|||||||
//#define IMGUI_API __declspec( dllexport )
|
//#define IMGUI_API __declspec( dllexport )
|
||||||
//#define IMGUI_API __declspec( dllimport )
|
//#define IMGUI_API __declspec( dllimport )
|
||||||
|
|
||||||
//---- Don't define obsolete functions names. Consider enabling from time to time or when updating to reduce like hood of using already obsolete function/names
|
//---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names
|
||||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
|
||||||
//---- Include imgui_user.h at the end of imgui.h
|
//---- Don't implement default handlers for Windows (so as not to link with certain functions)
|
||||||
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // Don't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
|
||||||
|
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS // Don't use and link with ImmGetContext/ImmSetCompositionWindow.
|
||||||
//---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)
|
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
|
|
||||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
|
|
||||||
|
|
||||||
//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
|
//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
|
||||||
//---- It is very strongly recommended to NOT disable the demo windows. Please read the comment at the top of imgui_demo.cpp to learn why.
|
//---- It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
|
||||||
//#define IMGUI_DISABLE_DEMO_WINDOWS
|
//#define IMGUI_DISABLE_DEMO_WINDOWS
|
||||||
|
|
||||||
//---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself.
|
//---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself.
|
||||||
//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS
|
//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS
|
||||||
|
|
||||||
//---- Pack colors to BGRA instead of RGBA (remove need to post process vertex buffer in back ends)
|
//---- Include imgui_user.h at the end of imgui.h as a convenience
|
||||||
|
//#define IMGUI_INCLUDE_IMGUI_USER_H
|
||||||
|
|
||||||
|
//---- Pack colors to BGRA8 instead of RGBA8 (if you needed to convert from one to another anyway)
|
||||||
//#define IMGUI_USE_BGRA_PACKED_COLOR
|
//#define IMGUI_USE_BGRA_PACKED_COLOR
|
||||||
|
|
||||||
//---- Implement STB libraries in a namespace to avoid linkage conflicts
|
//---- Avoid multiple STB libraries implementations, or redefine path/filenames to prioritize another version
|
||||||
//#define IMGUI_STB_NAMESPACE ImGuiStb
|
// By default the embedded implementations are declared static and not available outside of imgui cpp files.
|
||||||
|
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
||||||
|
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
||||||
|
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||||
|
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||||
|
|
||||||
//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
|
//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
|
||||||
|
// This will be inlined as part of ImVec2 and ImVec4 class declarations.
|
||||||
/*
|
/*
|
||||||
#define IM_VEC2_CLASS_EXTRA \
|
#define IM_VEC2_CLASS_EXTRA \
|
||||||
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
|
ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \
|
||||||
@ -47,15 +59,13 @@
|
|||||||
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//---- Use 32-bit vertex indices (instead of default: 16-bit) to allow meshes with more than 64K vertices
|
//---- Use 32-bit vertex indices (default is 16-bit) to allow meshes with more than 64K vertices. Render function needs to support it.
|
||||||
//#define ImDrawIdx unsigned int
|
//#define ImDrawIdx unsigned int
|
||||||
|
|
||||||
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.
|
||||||
//---- e.g. create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers.
|
|
||||||
/*
|
/*
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
void Value(const char* prefix, const MyMatrix44& v, const char* float_format = NULL);
|
void MyFunction(const char* name, const MyMatrix44& v);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
708
Source/ThirdParty/ImGuiLibrary/Include/imgui.h
vendored
708
Source/ThirdParty/ImGuiLibrary/Include/imgui.h
vendored
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014-2015 Omar Cornut and ImGui contributors
|
Copyright (c) 2014-2018 Omar Cornut
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
4648
Source/ThirdParty/ImGuiLibrary/Private/imgui.cpp
vendored
4648
Source/ThirdParty/ImGuiLibrary/Private/imgui.cpp
vendored
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.53
|
// dear imgui, v1.61 WIP
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Message to the person tempted to delete this file when integrating ImGui into their code base:
|
// Message to the person tempted to delete this file when integrating ImGui into their code base:
|
||||||
@ -94,7 +94,7 @@ static void ShowHelpMarker(const char* desc)
|
|||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::PushTextWrapPos(450.0f);
|
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||||
ImGui::TextUnformatted(desc);
|
ImGui::TextUnformatted(desc);
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
@ -160,7 +160,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (show_app_about)
|
if (show_app_about)
|
||||||
{
|
{
|
||||||
ImGui::Begin("About Dear ImGui", &show_app_about, ImGuiWindowFlags_AlwaysAutoResize);
|
ImGui::Begin("About Dear ImGui", &show_app_about, ImGuiWindowFlags_AlwaysAutoResize);
|
||||||
ImGui::Text("dear imgui, %s", ImGui::GetVersion());
|
ImGui::Text("Dear ImGui, %s", ImGui::GetVersion());
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text("By Omar Cornut and all dear imgui contributors.");
|
ImGui::Text("By Omar Cornut and all dear imgui contributors.");
|
||||||
ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information.");
|
ImGui::Text("Dear ImGui is licensed under the MIT License, see LICENSE for more information.");
|
||||||
@ -174,6 +174,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
static bool no_resize = false;
|
static bool no_resize = false;
|
||||||
static bool no_collapse = false;
|
static bool no_collapse = false;
|
||||||
static bool no_close = false;
|
static bool no_close = false;
|
||||||
|
static bool no_nav = false;
|
||||||
|
|
||||||
// Demonstrate the various window flags. Typically you would just use the default.
|
// Demonstrate the various window flags. Typically you would just use the default.
|
||||||
ImGuiWindowFlags window_flags = 0;
|
ImGuiWindowFlags window_flags = 0;
|
||||||
@ -183,6 +184,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (no_move) window_flags |= ImGuiWindowFlags_NoMove;
|
if (no_move) window_flags |= ImGuiWindowFlags_NoMove;
|
||||||
if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
|
if (no_resize) window_flags |= ImGuiWindowFlags_NoResize;
|
||||||
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
if (no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;
|
||||||
|
if (no_nav) window_flags |= ImGuiWindowFlags_NoNav;
|
||||||
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
if (no_close) p_open = NULL; // Don't pass our bool* to Begin
|
||||||
|
|
||||||
ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(550,680), ImGuiCond_FirstUseEver);
|
||||||
@ -247,7 +249,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Checkbox("No move", &no_move); ImGui::SameLine(150);
|
ImGui::Checkbox("No move", &no_move); ImGui::SameLine(150);
|
||||||
ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300);
|
ImGui::Checkbox("No resize", &no_resize); ImGui::SameLine(300);
|
||||||
ImGui::Checkbox("No collapse", &no_collapse);
|
ImGui::Checkbox("No collapse", &no_collapse);
|
||||||
ImGui::Checkbox("No close", &no_close);
|
ImGui::Checkbox("No close", &no_close); ImGui::SameLine(150);
|
||||||
|
ImGui::Checkbox("No nav", &no_nav);
|
||||||
|
|
||||||
if (ImGui::TreeNode("Style"))
|
if (ImGui::TreeNode("Style"))
|
||||||
{
|
{
|
||||||
@ -297,6 +300,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Arrow buttons
|
||||||
|
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
||||||
|
if (ImGui::ArrowButton("##left", ImGuiDir_Left)) {}
|
||||||
|
ImGui::SameLine(0.0f, spacing);
|
||||||
|
if (ImGui::ArrowButton("##left", ImGuiDir_Right)) {}
|
||||||
|
|
||||||
ImGui::Text("Hover over me");
|
ImGui::Text("Hover over me");
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
ImGui::SetTooltip("I am a tooltip");
|
ImGui::SetTooltip("I am a tooltip");
|
||||||
@ -312,57 +321,43 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testing ImGuiOnceUponAFrame helper.
|
|
||||||
//static ImGuiOnceUponAFrame once;
|
|
||||||
//for (int i = 0; i < 5; i++)
|
|
||||||
// if (once)
|
|
||||||
// ImGui::Text("This will be displayed only once.");
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::LabelText("label", "Value");
|
ImGui::LabelText("label", "Value");
|
||||||
|
|
||||||
{
|
{
|
||||||
// Simplified one-liner Combo() API, using values packed in a single constant string
|
// Using the _simplified_ one-liner Combo() api here
|
||||||
static int current_item_1 = 1;
|
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" };
|
||||||
ImGui::Combo("combo", ¤t_item_1, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
static int item_current = 0;
|
||||||
//ImGui::Combo("combo w/ array of char*", ¤t_item_2_idx, items, IM_ARRAYSIZE(items)); // Combo using proper array. You can also pass a callback to retrieve array value, no need to create/copy an array just for that.
|
ImGui::Combo("combo", &item_current, items, IM_ARRAYSIZE(items));
|
||||||
|
ImGui::SameLine(); ShowHelpMarker("Refer to the \"Combo\" section below for an explanation of the full BeginCombo/EndCombo API, and demonstration of various flags.\n");
|
||||||
// General BeginCombo() API, you have full control over your selection data and display type
|
|
||||||
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO", "PPPP", "QQQQQQQQQQ", "RRR", "SSSS" };
|
|
||||||
static const char* current_item_2 = NULL;
|
|
||||||
if (ImGui::BeginCombo("combo 2", current_item_2)) // The second parameter is the label previewed before opening the combo.
|
|
||||||
{
|
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
|
||||||
{
|
|
||||||
bool is_selected = (current_item_2 == items[n]); // You can store your selection however you want, outside or inside your objects
|
|
||||||
if (ImGui::Selectable(items[n], is_selected))
|
|
||||||
current_item_2 = items[n];
|
|
||||||
if (is_selected)
|
|
||||||
ImGui::SetItemDefaultFocus(); // Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch)
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static char str0[128] = "Hello, world!";
|
static char str0[128] = "Hello, world!";
|
||||||
static int i0=123;
|
static int i0 = 123;
|
||||||
static float f0=0.001f;
|
|
||||||
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
||||||
ImGui::SameLine(); ShowHelpMarker("Hold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n");
|
ImGui::SameLine(); ShowHelpMarker("Hold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n");
|
||||||
|
|
||||||
ImGui::InputInt("input int", &i0);
|
ImGui::InputInt("input int", &i0);
|
||||||
ImGui::SameLine(); ShowHelpMarker("You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n");
|
ImGui::SameLine(); ShowHelpMarker("You can apply arithmetic operators +,*,/ on numerical values.\n e.g. [ 100 ], input \'*2\', result becomes [ 200 ]\nUse +- to subtract.\n");
|
||||||
|
|
||||||
|
static float f0 = 0.001f;
|
||||||
ImGui::InputFloat("input float", &f0, 0.01f, 1.0f);
|
ImGui::InputFloat("input float", &f0, 0.01f, 1.0f);
|
||||||
|
|
||||||
|
static double d0 = 999999.000001;
|
||||||
|
ImGui::InputDouble("input double", &d0, 0.01f, 1.0f, "%.6f");
|
||||||
|
|
||||||
|
static float f1 = 1.e10f;
|
||||||
|
ImGui::InputFloat("input scientific", &f1, 0.0f, 0.0f, "%e");
|
||||||
|
ImGui::SameLine(); ShowHelpMarker("You can input value using the scientific notation,\n e.g. \"1e+8\" becomes \"100000000\".\n");
|
||||||
|
|
||||||
static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f };
|
static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f };
|
||||||
ImGui::InputFloat3("input float3", vec4a);
|
ImGui::InputFloat3("input float3", vec4a);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
static int i1=50, i2=42;
|
static int i1 = 50, i2 = 42;
|
||||||
ImGui::DragInt("drag int", &i1, 1);
|
ImGui::DragInt("drag int", &i1, 1);
|
||||||
ImGui::SameLine(); ShowHelpMarker("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input value.");
|
ImGui::SameLine(); ShowHelpMarker("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input value.");
|
||||||
|
|
||||||
@ -385,13 +380,17 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::SliderAngle("slider angle", &angle);
|
ImGui::SliderAngle("slider angle", &angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
static float col1[3] = { 1.0f,0.0f,0.2f };
|
static float col1[3] = { 1.0f,0.0f,0.2f };
|
||||||
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
||||||
ImGui::ColorEdit3("color 1", col1);
|
ImGui::ColorEdit3("color 1", col1);
|
||||||
ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
|
ImGui::SameLine(); ShowHelpMarker("Click on the colored square to open a color picker.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
|
||||||
|
|
||||||
ImGui::ColorEdit4("color 2", col2);
|
ImGui::ColorEdit4("color 2", col2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// List box
|
||||||
const char* listbox_items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
|
const char* listbox_items[] = { "Apple", "Banana", "Cherry", "Kiwi", "Mango", "Orange", "Pineapple", "Strawberry", "Watermelon" };
|
||||||
static int listbox_item_current = 1;
|
static int listbox_item_current = 1;
|
||||||
ImGui::ListBox("listbox\n(single select)", &listbox_item_current, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
ImGui::ListBox("listbox\n(single select)", &listbox_item_current, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
||||||
@ -400,10 +399,17 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
//ImGui::PushItemWidth(-1);
|
//ImGui::PushItemWidth(-1);
|
||||||
//ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
//ImGui::ListBox("##listbox2", &listbox_item_current2, listbox_items, IM_ARRAYSIZE(listbox_items), 4);
|
||||||
//ImGui::PopItemWidth();
|
//ImGui::PopItemWidth();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Testing ImGuiOnceUponAFrame helper.
|
||||||
|
//static ImGuiOnceUponAFrame once;
|
||||||
|
//for (int i = 0; i < 5; i++)
|
||||||
|
// if (once)
|
||||||
|
// ImGui::Text("This will be displayed only once.");
|
||||||
|
|
||||||
if (ImGui::TreeNode("Trees"))
|
if (ImGui::TreeNode("Trees"))
|
||||||
{
|
{
|
||||||
if (ImGui::TreeNode("Basic trees"))
|
if (ImGui::TreeNode("Basic trees"))
|
||||||
@ -413,7 +419,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
{
|
{
|
||||||
ImGui::Text("blah blah");
|
ImGui::Text("blah blah");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::SmallButton("print")) printf("Child %d pressed", i);
|
if (ImGui::SmallButton("button")) { };
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -561,8 +567,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
|
|
||||||
if (ImGui::TreeNode("Images"))
|
if (ImGui::TreeNode("Images"))
|
||||||
{
|
{
|
||||||
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
|
||||||
|
|
||||||
// Here we are grabbing the font texture because that's the only one we have access to inside the demo code.
|
// Here we are grabbing the font texture because that's the only one we have access to inside the demo code.
|
||||||
// Remember that ImTextureID is just storage for whatever you want it to be, it is essentially a value that will be passed to the render function inside the ImDrawCmd structure.
|
// Remember that ImTextureID is just storage for whatever you want it to be, it is essentially a value that will be passed to the render function inside the ImDrawCmd structure.
|
||||||
@ -581,14 +587,15 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
{
|
{
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
float focus_sz = 32.0f;
|
float region_sz = 32.0f;
|
||||||
float focus_x = io.MousePos.x - pos.x - focus_sz * 0.5f; if (focus_x < 0.0f) focus_x = 0.0f; else if (focus_x > my_tex_w - focus_sz) focus_x = my_tex_w - focus_sz;
|
float region_x = io.MousePos.x - pos.x - region_sz * 0.5f; if (region_x < 0.0f) region_x = 0.0f; else if (region_x > my_tex_w - region_sz) region_x = my_tex_w - region_sz;
|
||||||
float focus_y = io.MousePos.y - pos.y - focus_sz * 0.5f; if (focus_y < 0.0f) focus_y = 0.0f; else if (focus_y > my_tex_h - focus_sz) focus_y = my_tex_h - focus_sz;
|
float region_y = io.MousePos.y - pos.y - region_sz * 0.5f; if (region_y < 0.0f) region_y = 0.0f; else if (region_y > my_tex_h - region_sz) region_y = my_tex_h - region_sz;
|
||||||
ImGui::Text("Min: (%.2f, %.2f)", focus_x, focus_y);
|
float zoom = 4.0f;
|
||||||
ImGui::Text("Max: (%.2f, %.2f)", focus_x + focus_sz, focus_y + focus_sz);
|
ImGui::Text("Min: (%.2f, %.2f)", region_x, region_y);
|
||||||
ImVec2 uv0 = ImVec2((focus_x) / my_tex_w, (focus_y) / my_tex_h);
|
ImGui::Text("Max: (%.2f, %.2f)", region_x + region_sz, region_y + region_sz);
|
||||||
ImVec2 uv1 = ImVec2((focus_x + focus_sz) / my_tex_w, (focus_y + focus_sz) / my_tex_h);
|
ImVec2 uv0 = ImVec2((region_x) / my_tex_w, (region_y) / my_tex_h);
|
||||||
ImGui::Image(my_tex_id, ImVec2(128,128), uv0, uv1, ImColor(255,255,255,255), ImColor(255,255,255,128));
|
ImVec2 uv1 = ImVec2((region_x + region_sz) / my_tex_w, (region_y + region_sz) / my_tex_h);
|
||||||
|
ImGui::Image(my_tex_id, ImVec2(region_sz * zoom, region_sz * zoom), uv0, uv1, ImColor(255,255,255,255), ImColor(255,255,255,128));
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
ImGui::TextWrapped("And now some textured buttons..");
|
ImGui::TextWrapped("And now some textured buttons..");
|
||||||
@ -607,22 +614,99 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::TreeNode("Selectables"))
|
if (ImGui::TreeNode("Combo"))
|
||||||
{
|
{
|
||||||
if (ImGui::TreeNode("Basic"))
|
// Expose flags as checkbox for the demo
|
||||||
|
static ImGuiComboFlags flags = 0;
|
||||||
|
ImGui::CheckboxFlags("ImGuiComboFlags_PopupAlignLeft", (unsigned int*)&flags, ImGuiComboFlags_PopupAlignLeft);
|
||||||
|
if (ImGui::CheckboxFlags("ImGuiComboFlags_NoArrowButton", (unsigned int*)&flags, ImGuiComboFlags_NoArrowButton))
|
||||||
|
flags &= ~ImGuiComboFlags_NoPreview; // Clear the other flag, as we cannot combine both
|
||||||
|
if (ImGui::CheckboxFlags("ImGuiComboFlags_NoPreview", (unsigned int*)&flags, ImGuiComboFlags_NoPreview))
|
||||||
|
flags &= ~ImGuiComboFlags_NoArrowButton; // Clear the other flag, as we cannot combine both
|
||||||
|
|
||||||
|
// General BeginCombo() API, you have full control over your selection data and display type.
|
||||||
|
// (your selection data could be an index, a pointer to the object, an id for the object, a flag stored in the object itself, etc.)
|
||||||
|
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO" };
|
||||||
|
static const char* item_current = items[0]; // Here our selection is a single pointer stored outside the object.
|
||||||
|
if (ImGui::BeginCombo("combo 1", item_current, flags)) // The second parameter is the label previewed before opening the combo.
|
||||||
{
|
{
|
||||||
static bool selected[4] = { false, true, false, false };
|
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||||
ImGui::Selectable("1. I am selectable", &selected[0]);
|
{
|
||||||
ImGui::Selectable("2. I am selectable", &selected[1]);
|
bool is_selected = (item_current == items[n]);
|
||||||
ImGui::Text("3. I am not selectable");
|
if (ImGui::Selectable(items[n], is_selected))
|
||||||
ImGui::Selectable("4. I am selectable", &selected[2]);
|
item_current = items[n];
|
||||||
if (ImGui::Selectable("5. I am double clickable", selected[3], ImGuiSelectableFlags_AllowDoubleClick))
|
if (is_selected)
|
||||||
if (ImGui::IsMouseDoubleClicked(0))
|
ImGui::SetItemDefaultFocus(); // Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch)
|
||||||
selected[3] = !selected[3];
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Simplified one-liner Combo() API, using values packed in a single constant string
|
||||||
|
static int item_current_2 = 0;
|
||||||
|
ImGui::Combo("combo 2 (one-liner)", &item_current_2, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
||||||
|
|
||||||
|
// Simplified one-liner Combo() using an array of const char*
|
||||||
|
static int item_current_3 = -1; // If the selection isn't within 0..count, Combo won't display a preview
|
||||||
|
ImGui::Combo("combo 3 (array)", &item_current_3, items, IM_ARRAYSIZE(items));
|
||||||
|
|
||||||
|
// Simplified one-liner Combo() using an accessor function
|
||||||
|
struct FuncHolder { static bool ItemGetter(void* data, int idx, const char** out_str) { *out_str = ((const char**)data)[idx]; return true; } };
|
||||||
|
static int item_current_4 = 0;
|
||||||
|
ImGui::Combo("combo 4 (function)", &item_current_4, &FuncHolder::ItemGetter, items, IM_ARRAYSIZE(items));
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
if (ImGui::TreeNode("Rendering more text into the same block"))
|
|
||||||
|
if (ImGui::TreeNode("Selectables"))
|
||||||
{
|
{
|
||||||
|
// Selectable() has 2 overloads:
|
||||||
|
// - The one taking "bool selected" as a read-only selection information. When Selectable() has been clicked is returns true and you can alter selection state accordingly.
|
||||||
|
// - The one taking "bool* p_selected" as a read-write selection information (convenient in some cases)
|
||||||
|
// The earlier is more flexible, as in real application your selection may be stored in a different manner (in flags within objects, as an external list, etc).
|
||||||
|
if (ImGui::TreeNode("Basic"))
|
||||||
|
{
|
||||||
|
static bool selection[5] = { false, true, false, false, false };
|
||||||
|
ImGui::Selectable("1. I am selectable", &selection[0]);
|
||||||
|
ImGui::Selectable("2. I am selectable", &selection[1]);
|
||||||
|
ImGui::Text("3. I am not selectable");
|
||||||
|
ImGui::Selectable("4. I am selectable", &selection[3]);
|
||||||
|
if (ImGui::Selectable("5. I am double clickable", selection[4], ImGuiSelectableFlags_AllowDoubleClick))
|
||||||
|
if (ImGui::IsMouseDoubleClicked(0))
|
||||||
|
selection[4] = !selection[4];
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
if (ImGui::TreeNode("Selection State: Single Selection"))
|
||||||
|
{
|
||||||
|
static int selected = -1;
|
||||||
|
for (int n = 0; n < 5; n++)
|
||||||
|
{
|
||||||
|
char buf[32];
|
||||||
|
sprintf(buf, "Object %d", n);
|
||||||
|
if (ImGui::Selectable(buf, selected == n))
|
||||||
|
selected = n;
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
if (ImGui::TreeNode("Selection State: Multiple Selection"))
|
||||||
|
{
|
||||||
|
ShowHelpMarker("Hold CTRL and click to select multiple items.");
|
||||||
|
static bool selection[5] = { false, false, false, false, false };
|
||||||
|
for (int n = 0; n < 5; n++)
|
||||||
|
{
|
||||||
|
char buf[32];
|
||||||
|
sprintf(buf, "Object %d", n);
|
||||||
|
if (ImGui::Selectable(buf, selection[n]))
|
||||||
|
{
|
||||||
|
if (!ImGui::GetIO().KeyCtrl) // Clear selection when CTRL is not held
|
||||||
|
memset(selection, 0, sizeof(selection));
|
||||||
|
selection[n] ^= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
|
if (ImGui::TreeNode("Rendering more text into the same line"))
|
||||||
|
{
|
||||||
|
// Using the Selectable() override that takes "bool* p_selected" parameter and toggle your booleans automatically.
|
||||||
static bool selected[3] = { false, false, false };
|
static bool selected[3] = { false, false, false };
|
||||||
ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
|
ImGui::Selectable("main.c", &selected[0]); ImGui::SameLine(300); ImGui::Text(" 2,345 bytes");
|
||||||
ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes");
|
ImGui::Selectable("Hello.cpp", &selected[1]); ImGui::SameLine(300); ImGui::Text("12,345 bytes");
|
||||||
@ -773,14 +857,14 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
{
|
{
|
||||||
static ImVec4 color = ImColor(114, 144, 154, 200);
|
static ImVec4 color = ImColor(114, 144, 154, 200);
|
||||||
|
|
||||||
static bool hdr = false;
|
|
||||||
static bool alpha_preview = true;
|
static bool alpha_preview = true;
|
||||||
static bool alpha_half_preview = false;
|
static bool alpha_half_preview = false;
|
||||||
static bool options_menu = true;
|
static bool options_menu = true;
|
||||||
ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
|
static bool hdr = false;
|
||||||
ImGui::Checkbox("With Alpha Preview", &alpha_preview);
|
ImGui::Checkbox("With Alpha Preview", &alpha_preview);
|
||||||
ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview);
|
ImGui::Checkbox("With Half Alpha Preview", &alpha_half_preview);
|
||||||
ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options.");
|
ImGui::Checkbox("With Options Menu", &options_menu); ImGui::SameLine(); ShowHelpMarker("Right-click on the individual color widget to show options.");
|
||||||
|
ImGui::Checkbox("With HDR", &hdr); ImGui::SameLine(); ShowHelpMarker("Currently all this does is to lift the 0..1 limits on dragging widgets.");
|
||||||
int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);
|
int misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions);
|
||||||
|
|
||||||
ImGui::Text("Color widget:");
|
ImGui::Text("Color widget:");
|
||||||
@ -1017,9 +1101,10 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (ImGui::TreeNode("Child regions"))
|
if (ImGui::TreeNode("Child regions"))
|
||||||
{
|
{
|
||||||
static bool disable_mouse_wheel = false;
|
static bool disable_mouse_wheel = false;
|
||||||
|
static bool disable_menu = false;
|
||||||
ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
|
ImGui::Checkbox("Disable Mouse Wheel", &disable_mouse_wheel);
|
||||||
|
ImGui::Checkbox("Disable Menu", &disable_menu);
|
||||||
|
|
||||||
ImGui::Text("Without border");
|
|
||||||
static int line = 50;
|
static int line = 50;
|
||||||
bool goto_line = ImGui::Button("Goto");
|
bool goto_line = ImGui::Button("Goto");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
@ -1027,7 +1112,9 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
|
goto_line |= ImGui::InputInt("##Line", &line, 0, 0, ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
|
|
||||||
ImGui::BeginChild("Sub1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f,300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
|
// Child 1: no border, enable horizontal scrollbar
|
||||||
|
{
|
||||||
|
ImGui::BeginChild("Child1", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, 300), false, ImGuiWindowFlags_HorizontalScrollbar | (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
ImGui::Text("%04d: scrollable region", i);
|
ImGui::Text("%04d: scrollable region", i);
|
||||||
@ -1037,12 +1124,23 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (goto_line && line >= 100)
|
if (goto_line && line >= 100)
|
||||||
ImGui::SetScrollHere();
|
ImGui::SetScrollHere();
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
// Child 2: rounded border
|
||||||
|
{
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
|
||||||
ImGui::BeginChild("Sub2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0));
|
ImGui::BeginChild("Child2", ImVec2(0,300), true, (disable_mouse_wheel ? ImGuiWindowFlags_NoScrollWithMouse : 0) | (disable_menu ? 0 : ImGuiWindowFlags_MenuBar));
|
||||||
ImGui::Text("With border");
|
if (!disable_menu && ImGui::BeginMenuBar())
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenu("Menu"))
|
||||||
|
{
|
||||||
|
ShowExampleMenuFile();
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
ImGui::Columns(2);
|
ImGui::Columns(2);
|
||||||
for (int i = 0; i < 100; i++)
|
for (int i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
@ -1054,6 +1152,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@ -1200,10 +1299,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Button("LEVERAGE\nBUZZWORD", size);
|
ImGui::Button("LEVERAGE\nBUZZWORD", size);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
ImGui::ListBoxHeader("List", size);
|
if (ImGui::ListBoxHeader("List", size))
|
||||||
|
{
|
||||||
ImGui::Selectable("Selected", true);
|
ImGui::Selectable("Selected", true);
|
||||||
ImGui::Selectable("Not Selected", false);
|
ImGui::Selectable("Not Selected", false);
|
||||||
ImGui::ListBoxFooter();
|
ImGui::ListBoxFooter();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@ -1361,8 +1462,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImVec4 clip_rect(pos.x, pos.y, pos.x+size.x, pos.y+size.y);
|
ImVec4 clip_rect(pos.x, pos.y, pos.x+size.x, pos.y+size.y);
|
||||||
ImGui::InvisibleButton("##dummy", size);
|
ImGui::InvisibleButton("##dummy", size);
|
||||||
if (ImGui::IsItemActive() && ImGui::IsMouseDragging()) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; }
|
if (ImGui::IsItemActive() && ImGui::IsMouseDragging()) { offset.x += ImGui::GetIO().MouseDelta.x; offset.y += ImGui::GetIO().MouseDelta.y; }
|
||||||
ImGui::GetWindowDrawList()->AddRectFilled(pos, ImVec2(pos.x+size.x,pos.y+size.y), ImColor(90,90,120,255));
|
ImGui::GetWindowDrawList()->AddRectFilled(pos, ImVec2(pos.x+size.x,pos.y+size.y), IM_COL32(90,90,120,255));
|
||||||
ImGui::GetWindowDrawList()->AddText(ImGui::GetFont(), ImGui::GetFontSize()*2.0f, ImVec2(pos.x+offset.x,pos.y+offset.y), ImColor(255,255,255,255), "Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect);
|
ImGui::GetWindowDrawList()->AddText(ImGui::GetFont(), ImGui::GetFontSize()*2.0f, ImVec2(pos.x+offset.x,pos.y+offset.y), IM_COL32(255,255,255,255), "Line 1 hello\nLine 2 clip me!", NULL, 0.0f, &clip_rect);
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1493,6 +1594,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
if (ImGui::Button("OK", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); }
|
if (ImGui::Button("OK", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); }
|
||||||
|
ImGui::SetItemDefaultFocus();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Cancel", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); }
|
if (ImGui::Button("Cancel", ImVec2(120,0))) { ImGui::CloseCurrentPopup(); }
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
@ -1512,7 +1614,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::OpenPopup("Stacked 2");
|
ImGui::OpenPopup("Stacked 2");
|
||||||
if (ImGui::BeginPopupModal("Stacked 2"))
|
if (ImGui::BeginPopupModal("Stacked 2"))
|
||||||
{
|
{
|
||||||
ImGui::Text("Hello from Stacked The Second");
|
ImGui::Text("Hello from Stacked The Second!");
|
||||||
if (ImGui::Button("Close"))
|
if (ImGui::Button("Close"))
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
@ -1608,14 +1710,14 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Text("ImGui");
|
ImGui::Text("ImGui");
|
||||||
ImGui::Button("Apple");
|
ImGui::Button("Apple");
|
||||||
static float foo = 1.0f;
|
static float foo = 1.0f;
|
||||||
ImGui::InputFloat("red", &foo, 0.05f, 0, 3);
|
ImGui::InputFloat("red", &foo, 0.05f, 0, "%.3f");
|
||||||
ImGui::Text("An extra line here.");
|
ImGui::Text("An extra line here.");
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
|
|
||||||
ImGui::Text("Sailor");
|
ImGui::Text("Sailor");
|
||||||
ImGui::Button("Corniflower");
|
ImGui::Button("Corniflower");
|
||||||
static float bar = 1.0f;
|
static float bar = 1.0f;
|
||||||
ImGui::InputFloat("blue", &bar, 0.05f, 0, 3);
|
ImGui::InputFloat("blue", &bar, 0.05f, 0, "%.3f");
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Category A")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn();
|
if (ImGui::CollapsingHeader("Category A")) { ImGui::Text("Blah blah blah"); } ImGui::NextColumn();
|
||||||
@ -1741,23 +1843,33 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::BulletText("%s", lines[i]);
|
ImGui::BulletText("%s", lines[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Inputs & Focus"))
|
if (ImGui::CollapsingHeader("Inputs, Navigation & Focus"))
|
||||||
{
|
{
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
|
||||||
ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
|
||||||
|
|
||||||
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||||
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||||
ImGui::Text("WantTextInput: %d", io.WantTextInput);
|
ImGui::Text("WantTextInput: %d", io.WantTextInput);
|
||||||
ImGui::Text("WantMoveMouse: %d", io.WantMoveMouse);
|
ImGui::Text("WantSetMousePos: %d", io.WantSetMousePos);
|
||||||
|
ImGui::Text("NavActive: %d, NavVisible: %d", io.NavActive, io.NavVisible);
|
||||||
|
|
||||||
if (ImGui::TreeNode("Keyboard & Mouse State"))
|
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||||
|
ImGui::SameLine(); ShowHelpMarker("Instruct ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||||
|
|
||||||
|
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableGamepad", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableGamepad);
|
||||||
|
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableKeyboard", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableKeyboard);
|
||||||
|
ImGui::CheckboxFlags("io.ConfigFlags: NavEnableSetMousePos", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NavEnableSetMousePos);
|
||||||
|
ImGui::SameLine(); ShowHelpMarker("Instruct navigation to move the mouse cursor. See comment for ImGuiConfigFlags_NavEnableSetMousePos.");
|
||||||
|
ImGui::CheckboxFlags("io.ConfigFlags: NoMouseCursorChange", (unsigned int *)&io.ConfigFlags, ImGuiConfigFlags_NoMouseCursorChange);
|
||||||
|
ImGui::SameLine(); ShowHelpMarker("Instruct back-end to not alter mouse cursor shape and visibility.");
|
||||||
|
|
||||||
|
if (ImGui::TreeNode("Keyboard, Mouse & Navigation State"))
|
||||||
{
|
{
|
||||||
if (ImGui::IsMousePosValid())
|
if (ImGui::IsMousePosValid())
|
||||||
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
ImGui::Text("Mouse pos: (%g, %g)", io.MousePos.x, io.MousePos.y);
|
||||||
else
|
else
|
||||||
ImGui::Text("Mouse pos: <INVALID>");
|
ImGui::Text("Mouse pos: <INVALID>");
|
||||||
|
ImGui::Text("Mouse delta: (%g, %g)", io.MouseDelta.x, io.MouseDelta.y);
|
||||||
ImGui::Text("Mouse down:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
ImGui::Text("Mouse down:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (io.MouseDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("b%d (%.02f secs)", i, io.MouseDownDuration[i]); }
|
||||||
ImGui::Text("Mouse clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
ImGui::Text("Mouse clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||||
ImGui::Text("Mouse dbl-clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
ImGui::Text("Mouse dbl-clicked:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseDoubleClicked(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
||||||
@ -1769,6 +1881,9 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
||||||
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
||||||
|
|
||||||
|
ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputs[i]); }
|
||||||
|
ImGui::Text("NavInputs pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] == 0.0f) { ImGui::SameLine(); ImGui::Text("[%d]", i); }
|
||||||
|
ImGui::Text("NavInputs duration:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputsDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputsDownDuration[i]); }
|
||||||
|
|
||||||
ImGui::Button("Hovering me sets the\nkeyboard capture flag");
|
ImGui::Button("Hovering me sets the\nkeyboard capture flag");
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
@ -1817,11 +1932,22 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
ImGui::InputText("3 (tab skip)", buf, IM_ARRAYSIZE(buf));
|
ImGui::InputText("3 (tab skip)", buf, IM_ARRAYSIZE(buf));
|
||||||
if (ImGui::IsItemActive()) has_focus = 3;
|
if (ImGui::IsItemActive()) has_focus = 3;
|
||||||
ImGui::PopAllowKeyboardFocus();
|
ImGui::PopAllowKeyboardFocus();
|
||||||
|
|
||||||
if (has_focus)
|
if (has_focus)
|
||||||
ImGui::Text("Item with focus: %d", has_focus);
|
ImGui::Text("Item with focus: %d", has_focus);
|
||||||
else
|
else
|
||||||
ImGui::Text("Item with focus: <none>");
|
ImGui::Text("Item with focus: <none>");
|
||||||
ImGui::TextWrapped("Cursor & selection are preserved when refocusing last used item in code.");
|
|
||||||
|
// Use >= 0 parameter to SetKeyboardFocusHere() to focus an upcoming item
|
||||||
|
static float f3[3] = { 0.0f, 0.0f, 0.0f };
|
||||||
|
int focus_ahead = -1;
|
||||||
|
if (ImGui::Button("Focus on X")) focus_ahead = 0; ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Focus on Y")) focus_ahead = 1; ImGui::SameLine();
|
||||||
|
if (ImGui::Button("Focus on Z")) focus_ahead = 2;
|
||||||
|
if (focus_ahead != -1) ImGui::SetKeyboardFocusHere(focus_ahead);
|
||||||
|
ImGui::SliderFloat3("Float3", &f3[0], 0.0f, 1.0f);
|
||||||
|
|
||||||
|
ImGui::TextWrapped("NB: Cursor & selection are preserved when refocusing last used item in code.");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1837,11 +1963,13 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
"IsWindowFocused() = %d\n"
|
"IsWindowFocused() = %d\n"
|
||||||
"IsWindowFocused(_ChildWindows) = %d\n"
|
"IsWindowFocused(_ChildWindows) = %d\n"
|
||||||
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
"IsWindowFocused(_ChildWindows|_RootWindow) = %d\n"
|
||||||
"IsWindowFocused(_RootWindow) = %d\n",
|
"IsWindowFocused(_RootWindow) = %d\n"
|
||||||
|
"IsWindowFocused(_AnyWindow) = %d\n",
|
||||||
ImGui::IsWindowFocused(),
|
ImGui::IsWindowFocused(),
|
||||||
ImGui::IsWindowFocused(ImGuiHoveredFlags_ChildWindows),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows),
|
||||||
ImGui::IsWindowFocused(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows | ImGuiFocusedFlags_RootWindow),
|
||||||
ImGui::IsWindowFocused(ImGuiHoveredFlags_RootWindow));
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_RootWindow),
|
||||||
|
ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow));
|
||||||
|
|
||||||
// Testing IsWindowHovered() function with its various flags (note that the flags can be combined)
|
// Testing IsWindowHovered() function with its various flags (note that the flags can be combined)
|
||||||
ImGui::BulletText(
|
ImGui::BulletText(
|
||||||
@ -1850,13 +1978,15 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
"IsWindowHovered(_AllowWhenBlockedByActiveItem) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows) = %d\n"
|
"IsWindowHovered(_ChildWindows) = %d\n"
|
||||||
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
"IsWindowHovered(_ChildWindows|_RootWindow) = %d\n"
|
||||||
"IsWindowHovered(_RootWindow) = %d\n",
|
"IsWindowHovered(_RootWindow) = %d\n"
|
||||||
|
"IsWindowHovered(_AnyWindow) = %d\n",
|
||||||
ImGui::IsWindowHovered(),
|
ImGui::IsWindowHovered(),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_ChildWindows | ImGuiHoveredFlags_RootWindow),
|
||||||
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow));
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootWindow),
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow));
|
||||||
|
|
||||||
// Testing IsItemHovered() function (because BulletText is an item itself and that would affect the output of IsItemHovered, we pass all lines in a single items to shorten the code)
|
// Testing IsItemHovered() function (because BulletText is an item itself and that would affect the output of IsItemHovered, we pass all lines in a single items to shorten the code)
|
||||||
ImGui::Button("ITEM");
|
ImGui::Button("ITEM");
|
||||||
@ -1894,7 +2024,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Draw a line between the button and the mouse cursor
|
// Draw a line between the button and the mouse cursor
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
draw_list->PushClipRectFullScreen();
|
draw_list->PushClipRectFullScreen();
|
||||||
draw_list->AddLine(ImGui::CalcItemRectClosestPoint(io.MousePos, true, -2.0f), io.MousePos, ImColor(ImGui::GetStyle().Colors[ImGuiCol_Button]), 4.0f);
|
draw_list->AddLine(io.MouseClickedPos[0], io.MousePos, ImGui::GetColorU32(ImGuiCol_Button), 4.0f);
|
||||||
draw_list->PopClipRect();
|
draw_list->PopClipRect();
|
||||||
|
|
||||||
// Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
// Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
||||||
@ -1910,17 +2040,17 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
if (ImGui::TreeNode("Mouse cursors"))
|
if (ImGui::TreeNode("Mouse cursors"))
|
||||||
{
|
{
|
||||||
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "Move", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE" };
|
const char* mouse_cursors_names[] = { "Arrow", "TextInput", "Move", "ResizeNS", "ResizeEW", "ResizeNESW", "ResizeNWSE" };
|
||||||
IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_Count_);
|
IM_ASSERT(IM_ARRAYSIZE(mouse_cursors_names) == ImGuiMouseCursor_COUNT);
|
||||||
|
|
||||||
ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]);
|
ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]);
|
||||||
ImGui::Text("Hover to see mouse cursors:");
|
ImGui::Text("Hover to see mouse cursors:");
|
||||||
ImGui::SameLine(); ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it.");
|
ImGui::SameLine(); ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it.");
|
||||||
for (int i = 0; i < ImGuiMouseCursor_Count_; i++)
|
for (int i = 0; i < ImGuiMouseCursor_COUNT; i++)
|
||||||
{
|
{
|
||||||
char label[32];
|
char label[32];
|
||||||
sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]);
|
sprintf(label, "Mouse cursor %d: %s", i, mouse_cursors_names[i]);
|
||||||
ImGui::Bullet(); ImGui::Selectable(label, false);
|
ImGui::Bullet(); ImGui::Selectable(label, false);
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered() || ImGui::IsItemFocused())
|
||||||
ImGui::SetMouseCursor(i);
|
ImGui::SetMouseCursor(i);
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -1934,7 +2064,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
|||||||
// Here we use the simplified Combo() api that packs items into a single literal string. Useful for quick combo boxes where the choices are known locally.
|
// Here we use the simplified Combo() api that packs items into a single literal string. Useful for quick combo boxes where the choices are known locally.
|
||||||
bool ImGui::ShowStyleSelector(const char* label)
|
bool ImGui::ShowStyleSelector(const char* label)
|
||||||
{
|
{
|
||||||
static int style_idx = 0;
|
static int style_idx = -1;
|
||||||
if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0"))
|
if (ImGui::Combo(label, &style_idx, "Classic\0Dark\0Light\0"))
|
||||||
{
|
{
|
||||||
switch (style_idx)
|
switch (style_idx)
|
||||||
@ -1965,7 +2095,7 @@ void ImGui::ShowFontSelector(const char* label)
|
|||||||
ShowHelpMarker(
|
ShowHelpMarker(
|
||||||
"- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n"
|
"- Load additional fonts with io.Fonts->AddFontFromFileTTF().\n"
|
||||||
"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
|
"- The font atlas is built when calling io.Fonts->GetTexDataAsXXXX() or io.Fonts->Build().\n"
|
||||||
"- Read FAQ and documentation in extra_fonts/ for more details.\n"
|
"- Read FAQ and documentation in misc/fonts/ for more details.\n"
|
||||||
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
"- If you need to add/remove fonts at runtime (e.g. for DPI change), do it before calling NewFrame().");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2044,6 +2174,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::Text("Alignment");
|
ImGui::Text("Alignment");
|
||||||
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
ImGui::SliderFloat2("WindowTitleAlign", (float*)&style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
|
||||||
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); ShowHelpMarker("Alignment applies when a button is larger than its text content.");
|
ImGui::SliderFloat2("ButtonTextAlign", (float*)&style.ButtonTextAlign, 0.0f, 1.0f, "%.2f"); ImGui::SameLine(); ShowHelpMarker("Alignment applies when a button is larger than its text content.");
|
||||||
|
ImGui::Text("Safe Area Padding"); ImGui::SameLine(); ShowHelpMarker("Adjust if you cannot see the edges of your screen (e.g. on a TV where scaling has not been configured).");
|
||||||
|
ImGui::SliderFloat2("DisplaySafeAreaPadding", (float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f, "%.0f");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2080,7 +2212,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::RadioButton("Alpha", &alpha_flags, ImGuiColorEditFlags_AlphaPreview); ImGui::SameLine();
|
ImGui::RadioButton("Alpha", &alpha_flags, ImGuiColorEditFlags_AlphaPreview); ImGui::SameLine();
|
||||||
ImGui::RadioButton("Both", &alpha_flags, ImGuiColorEditFlags_AlphaPreviewHalf);
|
ImGui::RadioButton("Both", &alpha_flags, ImGuiColorEditFlags_AlphaPreviewHalf);
|
||||||
|
|
||||||
ImGui::BeginChild("#colors", ImVec2(0, 300), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar);
|
ImGui::BeginChild("#colors", ImVec2(0, 300), true, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_AlwaysHorizontalScrollbar | ImGuiWindowFlags_NavFlattened);
|
||||||
ImGui::PushItemWidth(-160);
|
ImGui::PushItemWidth(-160);
|
||||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||||
{
|
{
|
||||||
@ -2092,7 +2224,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0)
|
if (memcmp(&style.Colors[i], &ref->Colors[i], sizeof(ImVec4)) != 0)
|
||||||
{
|
{
|
||||||
// Tips: in a real user application, you may want to merge and use an icon font into the main font, so instead of "Save"/"Revert" you'd use icons.
|
// Tips: in a real user application, you may want to merge and use an icon font into the main font, so instead of "Save"/"Revert" you'd use icons.
|
||||||
// Read the FAQ and extra_fonts/README.txt about using icon fonts. It's really easy and super convenient!
|
// Read the FAQ and misc/fonts/README.txt about using icon fonts. It's really easy and super convenient!
|
||||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) ref->Colors[i] = style.Colors[i];
|
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Save")) ref->Colors[i] = style.Colors[i];
|
||||||
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) style.Colors[i] = ref->Colors[i];
|
ImGui::SameLine(0.0f, style.ItemInnerSpacing.x); if (ImGui::Button("Revert")) style.Colors[i] = ref->Colors[i];
|
||||||
}
|
}
|
||||||
@ -2128,38 +2260,36 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::Text("The quick brown fox jumps over the lazy dog");
|
ImGui::Text("The quick brown fox jumps over the lazy dog");
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
|
ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
|
||||||
|
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, 0);
|
||||||
ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
|
ImGui::SameLine(); ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
|
||||||
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
||||||
ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar);
|
ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar);
|
||||||
ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)sqrtf((float)font->MetricsTotalSurface), (int)sqrtf((float)font->MetricsTotalSurface));
|
ImGui::Text("Texture surface: %d pixels (approx) ~ %dx%d", font->MetricsTotalSurface, (int)sqrtf((float)font->MetricsTotalSurface), (int)sqrtf((float)font->MetricsTotalSurface));
|
||||||
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
for (int config_i = 0; config_i < font->ConfigDataCount; config_i++)
|
||||||
{
|
if (ImFontConfig* cfg = &font->ConfigData[config_i])
|
||||||
ImFontConfig* cfg = &font->ConfigData[config_i];
|
|
||||||
ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH);
|
ImGui::BulletText("Input %d: \'%s\', Oversample: (%d,%d), PixelSnapH: %d", config_i, cfg->Name, cfg->OversampleH, cfg->OversampleV, cfg->PixelSnapH);
|
||||||
}
|
|
||||||
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
if (ImGui::TreeNode("Glyphs", "Glyphs (%d)", font->Glyphs.Size))
|
||||||
{
|
{
|
||||||
// Display all glyphs of the fonts in separate pages of 256 characters
|
// Display all glyphs of the fonts in separate pages of 256 characters
|
||||||
const ImFontGlyph* glyph_fallback = font->FallbackGlyph; // Forcefully/dodgily make FindGlyph() return NULL on fallback, which isn't the default behavior.
|
|
||||||
font->FallbackGlyph = NULL;
|
|
||||||
for (int base = 0; base < 0x10000; base += 256)
|
for (int base = 0; base < 0x10000; base += 256)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int n = 0; n < 256; n++)
|
for (int n = 0; n < 256; n++)
|
||||||
count += font->FindGlyph((ImWchar)(base + n)) ? 1 : 0;
|
count += font->FindGlyphNoFallback((ImWchar)(base + n)) ? 1 : 0;
|
||||||
if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ? "glyphs" : "glyph"))
|
if (count > 0 && ImGui::TreeNode((void*)(intptr_t)base, "U+%04X..U+%04X (%d %s)", base, base+255, count, count > 1 ? "glyphs" : "glyph"))
|
||||||
{
|
{
|
||||||
|
float cell_size = font->FontSize * 1;
|
||||||
float cell_spacing = style.ItemSpacing.y;
|
float cell_spacing = style.ItemSpacing.y;
|
||||||
ImVec2 cell_size(font->FontSize * 1, font->FontSize * 1);
|
|
||||||
ImVec2 base_pos = ImGui::GetCursorScreenPos();
|
ImVec2 base_pos = ImGui::GetCursorScreenPos();
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
for (int n = 0; n < 256; n++)
|
for (int n = 0; n < 256; n++)
|
||||||
{
|
{
|
||||||
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size.x + cell_spacing), base_pos.y + (n / 16) * (cell_size.y + cell_spacing));
|
ImVec2 cell_p1(base_pos.x + (n % 16) * (cell_size + cell_spacing), base_pos.y + (n / 16) * (cell_size + cell_spacing));
|
||||||
ImVec2 cell_p2(cell_p1.x + cell_size.x, cell_p1.y + cell_size.y);
|
ImVec2 cell_p2(cell_p1.x + cell_size, cell_p1.y + cell_size);
|
||||||
const ImFontGlyph* glyph = font->FindGlyph((ImWchar)(base+n));;
|
const ImFontGlyph* glyph = font->FindGlyphNoFallback((ImWchar)(base+n));
|
||||||
draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255,255,255,100) : IM_COL32(255,255,255,50));
|
draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255,255,255,100) : IM_COL32(255,255,255,50));
|
||||||
font->RenderChar(draw_list, cell_size.x, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base+n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
|
if (glyph)
|
||||||
|
font->RenderChar(draw_list, cell_size, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base+n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
|
||||||
if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2))
|
if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2))
|
||||||
{
|
{
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
@ -2171,11 +2301,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::Dummy(ImVec2((cell_size.x + cell_spacing) * 16, (cell_size.y + cell_spacing) * 16));
|
ImGui::Dummy(ImVec2((cell_size + cell_spacing) * 16, (cell_size + cell_spacing) * 16));
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
font->FallbackGlyph = glyph_fallback;
|
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -2262,15 +2391,16 @@ static void ShowExampleMenuFile()
|
|||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("Colors"))
|
if (ImGui::BeginMenu("Colors"))
|
||||||
{
|
{
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0,0));
|
float sz = ImGui::GetTextLineHeight();
|
||||||
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
for (int i = 0; i < ImGuiCol_COUNT; i++)
|
||||||
{
|
{
|
||||||
const char* name = ImGui::GetStyleColorName((ImGuiCol)i);
|
const char* name = ImGui::GetStyleColorName((ImGuiCol)i);
|
||||||
ImGui::ColorButton(name, ImGui::GetStyleColorVec4((ImGuiCol)i));
|
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
|
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x+sz, p.y+sz), ImGui::GetColorU32((ImGuiCol)i));
|
||||||
|
ImGui::Dummy(ImVec2(sz, sz));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::MenuItem(name);
|
ImGui::MenuItem(name);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
if (ImGui::BeginMenu("Disabled", false)) // Disabled
|
if (ImGui::BeginMenu("Disabled", false)) // Disabled
|
||||||
@ -2303,8 +2433,8 @@ static void ShowExampleAppConstrainedResize(bool* p_open)
|
|||||||
{
|
{
|
||||||
struct CustomConstraints // Helper functions to demonstrate programmatic constraints
|
struct CustomConstraints // Helper functions to demonstrate programmatic constraints
|
||||||
{
|
{
|
||||||
static void Square(ImGuiSizeConstraintCallbackData* data) { data->DesiredSize = ImVec2(IM_MAX(data->DesiredSize.x, data->DesiredSize.y), IM_MAX(data->DesiredSize.x, data->DesiredSize.y)); }
|
static void Square(ImGuiSizeCallbackData* data) { data->DesiredSize = ImVec2(IM_MAX(data->DesiredSize.x, data->DesiredSize.y), IM_MAX(data->DesiredSize.x, data->DesiredSize.y)); }
|
||||||
static void Step(ImGuiSizeConstraintCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }
|
static void Step(ImGuiSizeCallbackData* data) { float step = (float)(int)(intptr_t)data->UserData; data->DesiredSize = ImVec2((int)(data->DesiredSize.x / step + 0.5f) * step, (int)(data->DesiredSize.y / step + 0.5f) * step); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool auto_resize = false;
|
static bool auto_resize = false;
|
||||||
@ -2352,24 +2482,29 @@ static void ShowExampleAppFixedOverlay(bool* p_open)
|
|||||||
static int corner = 0;
|
static int corner = 0;
|
||||||
ImVec2 window_pos = ImVec2((corner & 1) ? ImGui::GetIO().DisplaySize.x - DISTANCE : DISTANCE, (corner & 2) ? ImGui::GetIO().DisplaySize.y - DISTANCE : DISTANCE);
|
ImVec2 window_pos = ImVec2((corner & 1) ? ImGui::GetIO().DisplaySize.x - DISTANCE : DISTANCE, (corner & 2) ? ImGui::GetIO().DisplaySize.y - DISTANCE : DISTANCE);
|
||||||
ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f);
|
ImVec2 window_pos_pivot = ImVec2((corner & 1) ? 1.0f : 0.0f, (corner & 2) ? 1.0f : 0.0f);
|
||||||
|
if (corner != -1)
|
||||||
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
|
ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot);
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.0f, 0.0f, 0.0f, 0.3f)); // Transparent background
|
ImGui::SetNextWindowBgAlpha(0.3f); // Transparent background
|
||||||
if (ImGui::Begin("Example: Fixed Overlay", p_open, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoSavedSettings))
|
if (ImGui::Begin("Example: Fixed Overlay", p_open, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_NoFocusOnAppearing|ImGuiWindowFlags_NoNav))
|
||||||
{
|
{
|
||||||
ImGui::Text("Simple overlay\nin the corner of the screen.\n(right-click to change position)");
|
ImGui::Text("Simple overlay\n" "in the corner of the screen.\n" "(right-click to change position)");
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
if (ImGui::IsMousePosValid())
|
||||||
ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
|
ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
|
||||||
|
else
|
||||||
|
ImGui::Text("Mouse Position: <invalid>");
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
|
if (ImGui::MenuItem("Custom", NULL, corner == -1)) corner = -1;
|
||||||
if (ImGui::MenuItem("Top-left", NULL, corner == 0)) corner = 0;
|
if (ImGui::MenuItem("Top-left", NULL, corner == 0)) corner = 0;
|
||||||
if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1;
|
if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1;
|
||||||
if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2;
|
if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2;
|
||||||
if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3;
|
if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3;
|
||||||
|
if (p_open && ImGui::MenuItem("Close")) *p_open = false;
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
||||||
@ -2445,7 +2580,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f); x += sz+spacing;
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f); x += sz+spacing;
|
||||||
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotRight); x += sz+spacing;
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f, ImDrawCornerFlags_TopLeft|ImDrawCornerFlags_BotRight); x += sz+spacing;
|
||||||
draw_list->AddTriangleFilled(ImVec2(x+sz*0.5f, y), ImVec2(x+sz,y+sz-0.5f), ImVec2(x,y+sz-0.5f), col32); x += sz+spacing;
|
draw_list->AddTriangleFilled(ImVec2(x+sz*0.5f, y), ImVec2(x+sz,y+sz-0.5f), ImVec2(x,y+sz-0.5f), col32); x += sz+spacing;
|
||||||
draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x+sz, y+sz), ImColor(0,0,0), ImColor(255,0,0), ImColor(255,255,0), ImColor(0,255,0));
|
draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x+sz, y+sz), IM_COL32(0,0,0,255), IM_COL32(255,0,0,255), IM_COL32(255,255,0,255), IM_COL32(0,255,0,255));
|
||||||
ImGui::Dummy(ImVec2((sz+spacing)*8, (sz+spacing)*3));
|
ImGui::Dummy(ImVec2((sz+spacing)*8, (sz+spacing)*3));
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
@ -2464,8 +2599,8 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
|
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
|
||||||
if (canvas_size.x < 50.0f) canvas_size.x = 50.0f;
|
if (canvas_size.x < 50.0f) canvas_size.x = 50.0f;
|
||||||
if (canvas_size.y < 50.0f) canvas_size.y = 50.0f;
|
if (canvas_size.y < 50.0f) canvas_size.y = 50.0f;
|
||||||
draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(50,50,50), ImColor(50,50,60), ImColor(60,60,70), ImColor(50,50,60));
|
draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(50,50,50,255), IM_COL32(50,50,60,255), IM_COL32(60,60,70,255), IM_COL32(50,50,60,255));
|
||||||
draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(255,255,255));
|
draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), IM_COL32(255,255,255,255));
|
||||||
|
|
||||||
bool adding_preview = false;
|
bool adding_preview = false;
|
||||||
ImGui::InvisibleButton("canvas", canvas_size);
|
ImGui::InvisibleButton("canvas", canvas_size);
|
||||||
@ -2474,7 +2609,7 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
{
|
{
|
||||||
adding_preview = true;
|
adding_preview = true;
|
||||||
points.push_back(mouse_pos_in_canvas);
|
points.push_back(mouse_pos_in_canvas);
|
||||||
if (!ImGui::GetIO().MouseDown[0])
|
if (!ImGui::IsMouseDown(0))
|
||||||
adding_line = adding_preview = false;
|
adding_line = adding_preview = false;
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered())
|
if (ImGui::IsItemHovered())
|
||||||
@ -2616,12 +2751,13 @@ struct ExampleAppConsole
|
|||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
|
||||||
if (copy_to_clipboard)
|
if (copy_to_clipboard)
|
||||||
ImGui::LogToClipboard();
|
ImGui::LogToClipboard();
|
||||||
|
ImVec4 col_default_text = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||||
for (int i = 0; i < Items.Size; i++)
|
for (int i = 0; i < Items.Size; i++)
|
||||||
{
|
{
|
||||||
const char* item = Items[i];
|
const char* item = Items[i];
|
||||||
if (!filter.PassFilter(item))
|
if (!filter.PassFilter(item))
|
||||||
continue;
|
continue;
|
||||||
ImVec4 col = ImVec4(1.0f,1.0f,1.0f,1.0f); // A better implementation may store a type per-item. For the sample let's just parse the text.
|
ImVec4 col = col_default_text;
|
||||||
if (strstr(item, "[error]")) col = ImColor(1.0f,0.4f,0.4f,1.0f);
|
if (strstr(item, "[error]")) col = ImColor(1.0f,0.4f,0.4f,1.0f);
|
||||||
else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f);
|
else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, col);
|
ImGui::PushStyleColor(ImGuiCol_Text, col);
|
||||||
@ -2638,6 +2774,7 @@ struct ExampleAppConsole
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// Command-line
|
// Command-line
|
||||||
|
bool reclaim_focus = false;
|
||||||
if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this))
|
if (ImGui::InputText("Input", InputBuf, IM_ARRAYSIZE(InputBuf), ImGuiInputTextFlags_EnterReturnsTrue|ImGuiInputTextFlags_CallbackCompletion|ImGuiInputTextFlags_CallbackHistory, &TextEditCallbackStub, (void*)this))
|
||||||
{
|
{
|
||||||
char* input_end = InputBuf+strlen(InputBuf);
|
char* input_end = InputBuf+strlen(InputBuf);
|
||||||
@ -2645,10 +2782,12 @@ struct ExampleAppConsole
|
|||||||
if (InputBuf[0])
|
if (InputBuf[0])
|
||||||
ExecCommand(InputBuf);
|
ExecCommand(InputBuf);
|
||||||
strcpy(InputBuf, "");
|
strcpy(InputBuf, "");
|
||||||
|
reclaim_focus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Demonstrate keeping auto focus on the input box
|
// Demonstrate keeping focus on the input box
|
||||||
if (ImGui::IsItemHovered() || (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0)))
|
ImGui::SetItemDefaultFocus();
|
||||||
|
if (reclaim_focus)
|
||||||
ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget
|
ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.53
|
// dear imgui, v1.61 WIP
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
// Contains implementation for
|
// Contains implementation for
|
||||||
@ -34,7 +34,6 @@
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
|
#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
|
||||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||||
#define snprintf _snprintf
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
@ -42,7 +41,9 @@
|
|||||||
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
||||||
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
|
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
|
||||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||||
|
#if __has_warning("-Wcomma")
|
||||||
#pragma clang diagnostic ignored "-Wcomma" // warning : possible misuse of comma operator here //
|
#pragma clang diagnostic ignored "-Wcomma" // warning : possible misuse of comma operator here //
|
||||||
|
#endif
|
||||||
#if __has_warning("-Wreserved-id-macro")
|
#if __has_warning("-Wreserved-id-macro")
|
||||||
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
||||||
#endif
|
#endif
|
||||||
@ -53,16 +54,18 @@
|
|||||||
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
||||||
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
|
#pragma GCC diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function
|
||||||
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
|
#pragma GCC diagnostic ignored "-Wconversion" // warning: conversion to 'xxxx' from 'xxxx' may alter its value
|
||||||
#pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// STB libraries implementation
|
// STB libraries implementation
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Compile time options:
|
||||||
//#define IMGUI_STB_NAMESPACE ImGuiStb
|
//#define IMGUI_STB_NAMESPACE ImGuiStb
|
||||||
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
//#define IMGUI_STB_TRUETYPE_FILENAME "my_folder/stb_truetype.h"
|
||||||
|
//#define IMGUI_STB_RECT_PACK_FILENAME "my_folder/stb_rect_pack.h"
|
||||||
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||||
|
//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||||
|
|
||||||
#ifdef IMGUI_STB_NAMESPACE
|
#ifdef IMGUI_STB_NAMESPACE
|
||||||
namespace IMGUI_STB_NAMESPACE
|
namespace IMGUI_STB_NAMESPACE
|
||||||
@ -79,30 +82,44 @@ namespace IMGUI_STB_NAMESPACE
|
|||||||
#pragma clang diagnostic ignored "-Wunused-function"
|
#pragma clang diagnostic ignored "-Wunused-function"
|
||||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
||||||
|
#pragma clang diagnostic ignored "-Wcast-qual" // warning : cast from 'const xxxx *' to 'xxx *' drops const qualifier //
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wtype-limits" // warning: comparison is always true due to limited range of data type [-Wtype-limits]
|
#pragma GCC diagnostic ignored "-Wtype-limits" // warning: comparison is always true due to limited range of data type [-Wtype-limits]
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-qual" // warning: cast from type 'const xxxx *' to type 'xxxx *' casts away qualifiers
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STBRP_ASSERT(x) IM_ASSERT(x)
|
#ifndef STB_RECT_PACK_IMPLEMENTATION // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds)
|
||||||
#ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
#ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION
|
||||||
#define STBRP_STATIC
|
#define STBRP_STATIC
|
||||||
|
#define STBRP_ASSERT(x) IM_ASSERT(x)
|
||||||
#define STB_RECT_PACK_IMPLEMENTATION
|
#define STB_RECT_PACK_IMPLEMENTATION
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IMGUI_STB_RECT_PACK_FILENAME
|
||||||
|
#include IMGUI_STB_RECT_PACK_FILENAME
|
||||||
|
#else
|
||||||
#include "stb_rect_pack.h"
|
#include "stb_rect_pack.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STB_TRUETYPE_IMPLEMENTATION // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds)
|
||||||
|
#ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
||||||
#define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x))
|
#define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x))
|
||||||
#define STBTT_free(x,u) ((void)(u), ImGui::MemFree(x))
|
#define STBTT_free(x,u) ((void)(u), ImGui::MemFree(x))
|
||||||
#define STBTT_assert(x) IM_ASSERT(x)
|
#define STBTT_assert(x) IM_ASSERT(x)
|
||||||
#ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION
|
|
||||||
#define STBTT_STATIC
|
#define STBTT_STATIC
|
||||||
#define STB_TRUETYPE_IMPLEMENTATION
|
#define STB_TRUETYPE_IMPLEMENTATION
|
||||||
#else
|
#else
|
||||||
#define STBTT_DEF extern
|
#define STBTT_DEF extern
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef IMGUI_STB_TRUETYPE_FILENAME
|
||||||
|
#include IMGUI_STB_TRUETYPE_FILENAME
|
||||||
|
#else
|
||||||
#include "stb_truetype.h"
|
#include "stb_truetype.h"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
@ -125,6 +142,55 @@ using namespace IMGUI_STB_NAMESPACE;
|
|||||||
// Style functions
|
// Style functions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
||||||
|
{
|
||||||
|
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
||||||
|
ImVec4* colors = style->Colors;
|
||||||
|
|
||||||
|
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||||
|
colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);
|
||||||
|
colors[ImGuiCol_ChildBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.00f);
|
||||||
|
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
|
||||||
|
colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
|
||||||
|
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||||
|
colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f);
|
||||||
|
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
||||||
|
colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||||
|
colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f);
|
||||||
|
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
|
||||||
|
colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
||||||
|
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);
|
||||||
|
colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f);
|
||||||
|
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
||||||
|
colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
|
||||||
|
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
|
||||||
|
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_Separator] = colors[ImGuiCol_Border];
|
||||||
|
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);
|
||||||
|
colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);
|
||||||
|
colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f);
|
||||||
|
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||||
|
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
|
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
||||||
|
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||||
|
colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
||||||
|
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
||||||
|
colors[ImGuiCol_NavHighlight] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
||||||
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||||
|
}
|
||||||
|
|
||||||
void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
||||||
{
|
{
|
||||||
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
||||||
@ -163,9 +229,6 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.16f);
|
colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.16f);
|
||||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
|
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
|
||||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
|
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
|
||||||
colors[ImGuiCol_CloseButton] = ImVec4(0.50f, 0.50f, 0.90f, 0.50f);
|
|
||||||
colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.70f, 0.70f, 0.90f, 0.60f);
|
|
||||||
colors[ImGuiCol_CloseButtonActive] = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
|
|
||||||
colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
||||||
colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||||
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||||
@ -173,56 +236,8 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
|
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
|
||||||
colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||||
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
||||||
}
|
colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
|
||||||
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
|
||||||
void ImGui::StyleColorsDark(ImGuiStyle* dst)
|
|
||||||
{
|
|
||||||
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
|
|
||||||
ImVec4* colors = style->Colors;
|
|
||||||
|
|
||||||
colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
|
||||||
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
|
||||||
colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);
|
|
||||||
colors[ImGuiCol_ChildBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.00f);
|
|
||||||
colors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);
|
|
||||||
colors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);
|
|
||||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
|
||||||
colors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f);
|
|
||||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
|
||||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
|
||||||
colors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);
|
|
||||||
colors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f);
|
|
||||||
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);
|
|
||||||
colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
|
||||||
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);
|
|
||||||
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);
|
|
||||||
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);
|
|
||||||
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);
|
|
||||||
colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
|
||||||
colors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f);
|
|
||||||
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
|
||||||
colors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);
|
|
||||||
colors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
|
||||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);
|
|
||||||
colors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);
|
|
||||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);
|
|
||||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
|
|
||||||
colors[ImGuiCol_Separator] = colors[ImGuiCol_Border];//ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
|
||||||
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);
|
|
||||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);
|
|
||||||
colors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f);
|
|
||||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
|
||||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
|
||||||
colors[ImGuiCol_CloseButton] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f);
|
|
||||||
colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);
|
|
||||||
colors[ImGuiCol_CloseButtonActive] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);
|
|
||||||
colors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);
|
|
||||||
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
|
||||||
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
|
||||||
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
|
|
||||||
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
|
||||||
colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);
|
|
||||||
colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Those light colors are better suited with a thicker font than the default one + FrameBorder
|
// Those light colors are better suited with a thicker font than the default one + FrameBorder
|
||||||
@ -233,8 +248,6 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||||||
|
|
||||||
colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
colors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
|
||||||
colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||||
//colors[ImGuiCol_TextHovered] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
|
|
||||||
//colors[ImGuiCol_TextActive] = ImVec4(1.00f, 1.00f, 0.00f, 1.00f);
|
|
||||||
colors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);
|
colors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);
|
||||||
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||||
colors[ImGuiCol_PopupBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f);
|
colors[ImGuiCol_PopupBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f);
|
||||||
@ -266,9 +279,6 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_ResizeGrip] = ImVec4(0.80f, 0.80f, 0.80f, 0.56f);
|
colors[ImGuiCol_ResizeGrip] = ImVec4(0.80f, 0.80f, 0.80f, 0.56f);
|
||||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
|
||||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
colors[ImGuiCol_CloseButton] = ImVec4(0.59f, 0.59f, 0.59f, 0.50f);
|
|
||||||
colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);
|
|
||||||
colors[ImGuiCol_CloseButtonActive] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);
|
|
||||||
colors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
colors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);
|
||||||
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);
|
||||||
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
|
||||||
@ -276,6 +286,8 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst)
|
|||||||
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);
|
||||||
colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
colors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||||
colors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
colors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);
|
||||||
|
colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
|
||||||
|
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.70f, 0.70f, 0.70f, 0.70f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -340,6 +352,16 @@ void ImDrawList::ClearFreeMemory()
|
|||||||
_Channels.clear();
|
_Channels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImDrawList* ImDrawList::CloneOutput() const
|
||||||
|
{
|
||||||
|
ImDrawList* dst = IM_NEW(ImDrawList(NULL));
|
||||||
|
dst->CmdBuffer = CmdBuffer;
|
||||||
|
dst->IdxBuffer = IdxBuffer;
|
||||||
|
dst->VtxBuffer = VtxBuffer;
|
||||||
|
dst->Flags = Flags;
|
||||||
|
return dst;
|
||||||
|
}
|
||||||
|
|
||||||
// Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds
|
// Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds
|
||||||
#define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : _Data->ClipRectFullscreen)
|
#define GetCurrentClipRect() (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1] : _Data->ClipRectFullscreen)
|
||||||
#define GetCurrentTextureId() (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : NULL)
|
#define GetCurrentTextureId() (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : NULL)
|
||||||
@ -442,7 +464,7 @@ void ImDrawList::PopClipRect()
|
|||||||
UpdateClipRect();
|
UpdateClipRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::PushTextureID(const ImTextureID& texture_id)
|
void ImDrawList::PushTextureID(ImTextureID texture_id)
|
||||||
{
|
{
|
||||||
_TextureIdStack.push_back(texture_id);
|
_TextureIdStack.push_back(texture_id);
|
||||||
UpdateTextureID();
|
UpdateTextureID();
|
||||||
@ -974,7 +996,10 @@ void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float roun
|
|||||||
{
|
{
|
||||||
if ((col & IM_COL32_A_MASK) == 0)
|
if ((col & IM_COL32_A_MASK) == 0)
|
||||||
return;
|
return;
|
||||||
PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners_flags);
|
if (Flags & ImDrawListFlags_AntiAliasedLines)
|
||||||
|
PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.50f,0.50f), rounding, rounding_corners_flags);
|
||||||
|
else
|
||||||
|
PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.49f,0.49f), rounding, rounding_corners_flags); // Better looking lower-right corner and rounded non-AA shapes.
|
||||||
PathStroke(col, true, thickness);
|
PathStroke(col, true, thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,28 +1363,30 @@ static const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA
|
|||||||
" - XX XX - "
|
" - XX XX - "
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_Count_][3] =
|
static const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_COUNT][3] =
|
||||||
{
|
{
|
||||||
// Pos ........ Size ......... Offset ......
|
// Pos ........ Size ......... Offset ......
|
||||||
{ ImVec2(0,3), ImVec2(12,19), ImVec2( 0, 0) }, // ImGuiMouseCursor_Arrow
|
{ ImVec2(0,3), ImVec2(12,19), ImVec2( 0, 0) }, // ImGuiMouseCursor_Arrow
|
||||||
{ ImVec2(13,0), ImVec2(7,16), ImVec2( 4, 8) }, // ImGuiMouseCursor_TextInput
|
{ ImVec2(13,0), ImVec2(7,16), ImVec2( 4, 8) }, // ImGuiMouseCursor_TextInput
|
||||||
{ ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_Move
|
{ ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_ResizeAll
|
||||||
{ ImVec2(21,0), ImVec2( 9,23), ImVec2( 5,11) }, // ImGuiMouseCursor_ResizeNS
|
{ ImVec2(21,0), ImVec2( 9,23), ImVec2( 5,11) }, // ImGuiMouseCursor_ResizeNS
|
||||||
{ ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 5) }, // ImGuiMouseCursor_ResizeEW
|
{ ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 5) }, // ImGuiMouseCursor_ResizeEW
|
||||||
{ ImVec2(73,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNESW
|
{ ImVec2(73,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNESW
|
||||||
{ ImVec2(55,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNWSE
|
{ ImVec2(55,0), ImVec2(17,17), ImVec2( 9, 9) }, // ImGuiMouseCursor_ResizeNWSE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ImFontAtlas::ImFontAtlas()
|
ImFontAtlas::ImFontAtlas()
|
||||||
{
|
{
|
||||||
|
Flags = 0x00;
|
||||||
TexID = NULL;
|
TexID = NULL;
|
||||||
TexDesiredWidth = 0;
|
TexDesiredWidth = 0;
|
||||||
TexGlyphPadding = 1;
|
TexGlyphPadding = 1;
|
||||||
|
|
||||||
TexPixelsAlpha8 = NULL;
|
TexPixelsAlpha8 = NULL;
|
||||||
TexPixelsRGBA32 = NULL;
|
TexPixelsRGBA32 = NULL;
|
||||||
TexWidth = TexHeight = 0;
|
TexWidth = TexHeight = 0;
|
||||||
TexUvWhitePixel = ImVec2(0, 0);
|
TexUvScale = ImVec2(0.0f, 0.0f);
|
||||||
|
TexUvWhitePixel = ImVec2(0.0f, 0.0f);
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++)
|
for (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++)
|
||||||
CustomRectIds[n] = -1;
|
CustomRectIds[n] = -1;
|
||||||
}
|
}
|
||||||
@ -1437,14 +1464,17 @@ 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)
|
||||||
|
{
|
||||||
TexPixelsRGBA32 = (unsigned int*)ImGui::MemAlloc((size_t)(TexWidth * TexHeight * 4));
|
TexPixelsRGBA32 = (unsigned int*)ImGui::MemAlloc((size_t)(TexWidth * TexHeight * 4));
|
||||||
const unsigned char* src = pixels;
|
const unsigned char* src = pixels;
|
||||||
unsigned int* dst = TexPixelsRGBA32;
|
unsigned int* dst = TexPixelsRGBA32;
|
||||||
for (int n = TexWidth * TexHeight; n > 0; n--)
|
for (int n = TexWidth * TexHeight; n > 0; n--)
|
||||||
*dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++));
|
*dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*out_pixels = (unsigned char*)TexPixelsRGBA32;
|
*out_pixels = (unsigned char*)TexPixelsRGBA32;
|
||||||
if (out_width) *out_width = TexWidth;
|
if (out_width) *out_width = TexWidth;
|
||||||
@ -1479,9 +1509,9 @@ ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
|
|||||||
return new_font_cfg.DstFont;
|
return new_font_cfg.DstFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default font TTF is compressed with stb_compress then base85 encoded (see extra_fonts/binary_to_compressed_c.cpp for encoder)
|
// Default font TTF is compressed with stb_compress then base85 encoded (see misc/fonts/binary_to_compressed_c.cpp for encoder)
|
||||||
static unsigned int stb_decompress_length(unsigned char *input);
|
static unsigned int stb_decompress_length(const unsigned char *input);
|
||||||
static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length);
|
static unsigned int stb_decompress(unsigned char *output, const unsigned char *input, unsigned int length);
|
||||||
static const char* GetDefaultCompressedFontDataTTFBase85();
|
static const char* GetDefaultCompressedFontDataTTFBase85();
|
||||||
static unsigned int Decode85Byte(char c) { return c >= '\\' ? c-36 : c-35; }
|
static unsigned int Decode85Byte(char c) { return c >= '\\' ? c-36 : c-35; }
|
||||||
static void Decode85(const unsigned char* src, unsigned char* dst)
|
static void Decode85(const unsigned char* src, unsigned char* dst)
|
||||||
@ -1509,12 +1539,13 @@ ImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)
|
|||||||
|
|
||||||
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
|
const char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();
|
||||||
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault());
|
ImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault());
|
||||||
|
font->DisplayOffset.y = 1.0f;
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
|
ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
|
||||||
{
|
{
|
||||||
int data_size = 0;
|
size_t data_size = 0;
|
||||||
void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0);
|
void* data = ImFileLoadToMemory(filename, "rb", &data_size, 0);
|
||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
@ -1527,9 +1558,9 @@ ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels,
|
|||||||
// Store a short copy of filename into into the font name for convenience
|
// Store a short copy of filename into into the font name for convenience
|
||||||
const char* p;
|
const char* p;
|
||||||
for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
|
for (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\'; p--) {}
|
||||||
snprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
|
ImFormatString(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), "%s, %.0fpx", p, size_pixels);
|
||||||
}
|
}
|
||||||
return AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges);
|
return AddFontFromMemoryTTF(data, (int)data_size, size_pixels, &font_cfg, glyph_ranges);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().
|
// NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().
|
||||||
@ -1547,9 +1578,9 @@ ImFont* ImFontAtlas::AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float si
|
|||||||
|
|
||||||
ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
|
ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)
|
||||||
{
|
{
|
||||||
const unsigned int buf_decompressed_size = stb_decompress_length((unsigned char*)compressed_ttf_data);
|
const unsigned int buf_decompressed_size = stb_decompress_length((const unsigned char*)compressed_ttf_data);
|
||||||
unsigned char* buf_decompressed_data = (unsigned char *)ImGui::MemAlloc(buf_decompressed_size);
|
unsigned char* buf_decompressed_data = (unsigned char *)ImGui::MemAlloc(buf_decompressed_size);
|
||||||
stb_decompress(buf_decompressed_data, (unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size);
|
stb_decompress(buf_decompressed_data, (const unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size);
|
||||||
|
|
||||||
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
|
ImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();
|
||||||
IM_ASSERT(font_cfg.FontData == NULL);
|
IM_ASSERT(font_cfg.FontData == NULL);
|
||||||
@ -1600,8 +1631,30 @@ void ImFontAtlas::CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, I
|
|||||||
{
|
{
|
||||||
IM_ASSERT(TexWidth > 0 && TexHeight > 0); // Font atlas needs to be built before we can calculate UV coordinates
|
IM_ASSERT(TexWidth > 0 && TexHeight > 0); // Font atlas needs to be built before we can calculate UV coordinates
|
||||||
IM_ASSERT(rect->IsPacked()); // Make sure the rectangle has been packed
|
IM_ASSERT(rect->IsPacked()); // Make sure the rectangle has been packed
|
||||||
*out_uv_min = ImVec2((float)rect->X / TexWidth, (float)rect->Y / TexHeight);
|
*out_uv_min = ImVec2((float)rect->X * TexUvScale.x, (float)rect->Y * TexUvScale.y);
|
||||||
*out_uv_max = ImVec2((float)(rect->X + rect->Width) / TexWidth, (float)(rect->Y + rect->Height) / TexHeight);
|
*out_uv_max = ImVec2((float)(rect->X + rect->Width) * TexUvScale.x, (float)(rect->Y + rect->Height) * TexUvScale.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ImFontAtlas::GetMouseCursorTexData(ImGuiMouseCursor cursor_type, ImVec2* out_offset, ImVec2* out_size, ImVec2 out_uv_border[2], ImVec2 out_uv_fill[2])
|
||||||
|
{
|
||||||
|
if (cursor_type <= ImGuiMouseCursor_None || cursor_type >= ImGuiMouseCursor_COUNT)
|
||||||
|
return false;
|
||||||
|
if (Flags & ImFontAtlasFlags_NoMouseCursors)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
IM_ASSERT(CustomRectIds[0] != -1);
|
||||||
|
ImFontAtlas::CustomRect& r = CustomRects[CustomRectIds[0]];
|
||||||
|
IM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID);
|
||||||
|
ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][0] + ImVec2((float)r.X, (float)r.Y);
|
||||||
|
ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][1];
|
||||||
|
*out_size = size;
|
||||||
|
*out_offset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[cursor_type][2];
|
||||||
|
out_uv_border[0] = (pos) * TexUvScale;
|
||||||
|
out_uv_border[1] = (pos + size) * TexUvScale;
|
||||||
|
pos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1;
|
||||||
|
out_uv_fill[0] = (pos) * TexUvScale;
|
||||||
|
out_uv_fill[1] = (pos + size) * TexUvScale;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImFontAtlas::Build()
|
bool ImFontAtlas::Build()
|
||||||
@ -1634,7 +1687,8 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
|
|
||||||
atlas->TexID = NULL;
|
atlas->TexID = NULL;
|
||||||
atlas->TexWidth = atlas->TexHeight = 0;
|
atlas->TexWidth = atlas->TexHeight = 0;
|
||||||
atlas->TexUvWhitePixel = ImVec2(0, 0);
|
atlas->TexUvScale = ImVec2(0.0f, 0.0f);
|
||||||
|
atlas->TexUvWhitePixel = ImVec2(0.0f, 0.0f);
|
||||||
atlas->ClearTexData();
|
atlas->ClearTexData();
|
||||||
|
|
||||||
// Count glyphs/ranges
|
// Count glyphs/ranges
|
||||||
@ -1657,7 +1711,8 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
// Start packing
|
// Start packing
|
||||||
const int max_tex_height = 1024*32;
|
const int max_tex_height = 1024*32;
|
||||||
stbtt_pack_context spc = {};
|
stbtt_pack_context spc = {};
|
||||||
stbtt_PackBegin(&spc, NULL, atlas->TexWidth, max_tex_height, 0, atlas->TexGlyphPadding, NULL);
|
if (!stbtt_PackBegin(&spc, NULL, atlas->TexWidth, max_tex_height, 0, atlas->TexGlyphPadding, NULL))
|
||||||
|
return false;
|
||||||
stbtt_PackSetOversampling(&spc, 1, 1);
|
stbtt_PackSetOversampling(&spc, 1, 1);
|
||||||
|
|
||||||
// Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).
|
// Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).
|
||||||
@ -1680,9 +1735,10 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas));
|
IM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas));
|
||||||
|
|
||||||
const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);
|
const int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);
|
||||||
IM_ASSERT(font_offset >= 0);
|
IM_ASSERT(font_offset >= 0 && "FontData is incorrect, or FontNo cannot be found.");
|
||||||
if (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))
|
if (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))
|
||||||
{
|
{
|
||||||
|
atlas->TexWidth = atlas->TexHeight = 0; // Reset output on failure
|
||||||
ImGui::MemFree(tmp_array);
|
ImGui::MemFree(tmp_array);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1722,26 +1778,42 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
buf_packedchars_n += range.num_chars;
|
buf_packedchars_n += range.num_chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pack
|
// Gather the sizes of all rectangle we need
|
||||||
tmp.Rects = buf_rects + buf_rects_n;
|
tmp.Rects = buf_rects + buf_rects_n;
|
||||||
tmp.RectsCount = font_glyphs_count;
|
tmp.RectsCount = font_glyphs_count;
|
||||||
buf_rects_n += font_glyphs_count;
|
buf_rects_n += font_glyphs_count;
|
||||||
stbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV);
|
stbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV);
|
||||||
int n = stbtt_PackFontRangesGatherRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects);
|
int n = stbtt_PackFontRangesGatherRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects);
|
||||||
IM_ASSERT(n == font_glyphs_count);
|
IM_ASSERT(n == font_glyphs_count);
|
||||||
|
|
||||||
|
// Detect missing glyphs and replace them with a zero-sized box instead of relying on the default glyphs
|
||||||
|
// This allows us merging overlapping icon fonts more easily.
|
||||||
|
int rect_i = 0;
|
||||||
|
for (int range_i = 0; range_i < tmp.RangesCount; range_i++)
|
||||||
|
for (int char_i = 0; char_i < tmp.Ranges[range_i].num_chars; char_i++, rect_i++)
|
||||||
|
if (stbtt_FindGlyphIndex(&tmp.FontInfo, tmp.Ranges[range_i].first_unicode_codepoint_in_range + char_i) == 0)
|
||||||
|
tmp.Rects[rect_i].w = tmp.Rects[rect_i].h = 0;
|
||||||
|
|
||||||
|
// Pack
|
||||||
stbrp_pack_rects((stbrp_context*)spc.pack_info, tmp.Rects, n);
|
stbrp_pack_rects((stbrp_context*)spc.pack_info, tmp.Rects, n);
|
||||||
|
|
||||||
// Extend texture height
|
// Extend texture height
|
||||||
|
// Also mark missing glyphs as non-packed so we don't attempt to render into them
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
|
{
|
||||||
|
if (tmp.Rects[i].w == 0 && tmp.Rects[i].h == 0)
|
||||||
|
tmp.Rects[i].was_packed = 0;
|
||||||
if (tmp.Rects[i].was_packed)
|
if (tmp.Rects[i].was_packed)
|
||||||
atlas->TexHeight = ImMax(atlas->TexHeight, tmp.Rects[i].y + tmp.Rects[i].h);
|
atlas->TexHeight = ImMax(atlas->TexHeight, tmp.Rects[i].y + tmp.Rects[i].h);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
IM_ASSERT(buf_rects_n == total_glyphs_count);
|
IM_ASSERT(buf_rects_n == total_glyphs_count);
|
||||||
IM_ASSERT(buf_packedchars_n == total_glyphs_count);
|
IM_ASSERT(buf_packedchars_n == total_glyphs_count);
|
||||||
IM_ASSERT(buf_ranges_n == total_ranges_count);
|
IM_ASSERT(buf_ranges_n == total_ranges_count);
|
||||||
|
|
||||||
// Create texture
|
// Create texture
|
||||||
atlas->TexHeight = ImUpperPowerOfTwo(atlas->TexHeight);
|
atlas->TexHeight = (atlas->Flags & ImFontAtlasFlags_NoPowerOfTwoHeight) ? (atlas->TexHeight + 1) : ImUpperPowerOfTwo(atlas->TexHeight);
|
||||||
|
atlas->TexUvScale = ImVec2(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight);
|
||||||
atlas->TexPixelsAlpha8 = (unsigned char*)ImGui::MemAlloc(atlas->TexWidth * atlas->TexHeight);
|
atlas->TexPixelsAlpha8 = (unsigned char*)ImGui::MemAlloc(atlas->TexWidth * atlas->TexHeight);
|
||||||
memset(atlas->TexPixelsAlpha8, 0, atlas->TexWidth * atlas->TexHeight);
|
memset(atlas->TexPixelsAlpha8, 0, atlas->TexWidth * atlas->TexHeight);
|
||||||
spc.pixels = atlas->TexPixelsAlpha8;
|
spc.pixels = atlas->TexPixelsAlpha8;
|
||||||
@ -1776,13 +1848,15 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
ImFontConfig& cfg = atlas->ConfigData[input_i];
|
ImFontConfig& cfg = atlas->ConfigData[input_i];
|
||||||
ImFontTempBuildData& tmp = tmp_array[input_i];
|
ImFontTempBuildData& tmp = tmp_array[input_i];
|
||||||
ImFont* dst_font = cfg.DstFont; // We can have multiple input fonts writing into a same destination font (when using MergeMode=true)
|
ImFont* dst_font = cfg.DstFont; // We can have multiple input fonts writing into a same destination font (when using MergeMode=true)
|
||||||
|
if (cfg.MergeMode)
|
||||||
|
dst_font->BuildLookupTable();
|
||||||
|
|
||||||
const float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels);
|
const float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels);
|
||||||
int unscaled_ascent, unscaled_descent, unscaled_line_gap;
|
int unscaled_ascent, unscaled_descent, unscaled_line_gap;
|
||||||
stbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
|
stbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);
|
||||||
|
|
||||||
const float ascent = unscaled_ascent * font_scale;
|
const float ascent = ImFloor(unscaled_ascent * font_scale + ((unscaled_ascent > 0.0f) ? +1 : -1));
|
||||||
const float descent = unscaled_descent * font_scale;
|
const float descent = ImFloor(unscaled_descent * font_scale + ((unscaled_descent > 0.0f) ? +1 : -1));
|
||||||
ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
|
ImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);
|
||||||
const float off_x = cfg.GlyphOffset.x;
|
const float off_x = cfg.GlyphOffset.x;
|
||||||
const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f);
|
const float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f);
|
||||||
@ -1797,7 +1871,7 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
const int codepoint = range.first_unicode_codepoint_in_range + char_idx;
|
const int codepoint = range.first_unicode_codepoint_in_range + char_idx;
|
||||||
if (cfg.MergeMode && dst_font->FindGlyph((unsigned short)codepoint))
|
if (cfg.MergeMode && dst_font->FindGlyphNoFallback((unsigned short)codepoint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
stbtt_aligned_quad q;
|
stbtt_aligned_quad q;
|
||||||
@ -1820,8 +1894,12 @@ bool ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)
|
|||||||
|
|
||||||
void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas)
|
void ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas)
|
||||||
{
|
{
|
||||||
if (atlas->CustomRectIds[0] < 0)
|
if (atlas->CustomRectIds[0] >= 0)
|
||||||
|
return;
|
||||||
|
if (!(atlas->Flags & ImFontAtlasFlags_NoMouseCursors))
|
||||||
atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF*2+1, FONT_ATLAS_DEFAULT_TEX_DATA_H);
|
atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF*2+1, FONT_ATLAS_DEFAULT_TEX_DATA_H);
|
||||||
|
else
|
||||||
|
atlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, 2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent)
|
void ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent)
|
||||||
@ -1867,40 +1945,32 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* pack_context_opaq
|
|||||||
static void ImFontAtlasBuildRenderDefaultTexData(ImFontAtlas* atlas)
|
static void ImFontAtlasBuildRenderDefaultTexData(ImFontAtlas* atlas)
|
||||||
{
|
{
|
||||||
IM_ASSERT(atlas->CustomRectIds[0] >= 0);
|
IM_ASSERT(atlas->CustomRectIds[0] >= 0);
|
||||||
|
IM_ASSERT(atlas->TexPixelsAlpha8 != NULL);
|
||||||
ImFontAtlas::CustomRect& r = atlas->CustomRects[atlas->CustomRectIds[0]];
|
ImFontAtlas::CustomRect& r = atlas->CustomRects[atlas->CustomRectIds[0]];
|
||||||
IM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID);
|
IM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID);
|
||||||
IM_ASSERT(r.Width == FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF*2+1);
|
|
||||||
IM_ASSERT(r.Height == FONT_ATLAS_DEFAULT_TEX_DATA_H);
|
|
||||||
IM_ASSERT(r.IsPacked());
|
IM_ASSERT(r.IsPacked());
|
||||||
IM_ASSERT(atlas->TexPixelsAlpha8 != NULL);
|
|
||||||
|
|
||||||
|
const int w = atlas->TexWidth;
|
||||||
|
if (!(atlas->Flags & ImFontAtlasFlags_NoMouseCursors))
|
||||||
|
{
|
||||||
// Render/copy pixels
|
// Render/copy pixels
|
||||||
|
IM_ASSERT(r.Width == FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF * 2 + 1 && r.Height == FONT_ATLAS_DEFAULT_TEX_DATA_H);
|
||||||
for (int y = 0, n = 0; y < FONT_ATLAS_DEFAULT_TEX_DATA_H; y++)
|
for (int y = 0, n = 0; y < FONT_ATLAS_DEFAULT_TEX_DATA_H; y++)
|
||||||
for (int x = 0; x < FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF; x++, n++)
|
for (int x = 0; x < FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF; x++, n++)
|
||||||
{
|
{
|
||||||
const int offset0 = (int)(r.X + x) + (int)(r.Y + y) * atlas->TexWidth;
|
const int offset0 = (int)(r.X + x) + (int)(r.Y + y) * w;
|
||||||
const int offset1 = offset0 + FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1;
|
const int offset1 = offset0 + FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1;
|
||||||
atlas->TexPixelsAlpha8[offset0] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == '.' ? 0xFF : 0x00;
|
atlas->TexPixelsAlpha8[offset0] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == '.' ? 0xFF : 0x00;
|
||||||
atlas->TexPixelsAlpha8[offset1] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == 'X' ? 0xFF : 0x00;
|
atlas->TexPixelsAlpha8[offset1] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == 'X' ? 0xFF : 0x00;
|
||||||
}
|
}
|
||||||
const ImVec2 tex_uv_scale(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight);
|
|
||||||
atlas->TexUvWhitePixel = ImVec2((r.X + 0.5f) * tex_uv_scale.x, (r.Y + 0.5f) * tex_uv_scale.y);
|
|
||||||
|
|
||||||
// Setup mouse cursors
|
|
||||||
for (int type = 0; type < ImGuiMouseCursor_Count_; type++)
|
|
||||||
{
|
|
||||||
ImGuiMouseCursorData& cursor_data = GImGui->MouseCursorData[type];
|
|
||||||
ImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][0] + ImVec2((float)r.X, (float)r.Y);
|
|
||||||
const ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][1];
|
|
||||||
cursor_data.Type = type;
|
|
||||||
cursor_data.Size = size;
|
|
||||||
cursor_data.HotOffset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][2];
|
|
||||||
cursor_data.TexUvMin[0] = (pos) * tex_uv_scale;
|
|
||||||
cursor_data.TexUvMax[0] = (pos + size) * tex_uv_scale;
|
|
||||||
pos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1;
|
|
||||||
cursor_data.TexUvMin[1] = (pos) * tex_uv_scale;
|
|
||||||
cursor_data.TexUvMax[1] = (pos + size) * tex_uv_scale;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IM_ASSERT(r.Width == 2 && r.Height == 2);
|
||||||
|
const int offset = (int)(r.X) + (int)(r.Y) * w;
|
||||||
|
atlas->TexPixelsAlpha8[offset] = atlas->TexPixelsAlpha8[offset + 1] = atlas->TexPixelsAlpha8[offset + w] = atlas->TexPixelsAlpha8[offset + w + 1] = 0xFF;
|
||||||
|
}
|
||||||
|
atlas->TexUvWhitePixel = ImVec2((r.X + 0.5f) * atlas->TexUvScale.x, (r.Y + 0.5f) * atlas->TexUvScale.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
|
void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
|
||||||
@ -1923,6 +1993,7 @@ void ImFontAtlasBuildFinish(ImFontAtlas* atlas)
|
|||||||
|
|
||||||
// Build all fonts lookup tables
|
// Build all fonts lookup tables
|
||||||
for (int i = 0; i < atlas->Fonts.Size; i++)
|
for (int i = 0; i < atlas->Fonts.Size; i++)
|
||||||
|
if (atlas->Fonts[i]->DirtyLookupTables)
|
||||||
atlas->Fonts[i]->BuildLookupTable();
|
atlas->Fonts[i]->BuildLookupTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2019,7 +2090,7 @@ const ImWchar* ImFontAtlas::GetGlyphRangesJapanese()
|
|||||||
// Unpack
|
// Unpack
|
||||||
int codepoint = 0x4e00;
|
int codepoint = 0x4e00;
|
||||||
memcpy(full_ranges, base_ranges, sizeof(base_ranges));
|
memcpy(full_ranges, base_ranges, sizeof(base_ranges));
|
||||||
ImWchar* dst = full_ranges + IM_ARRAYSIZE(base_ranges);;
|
ImWchar* dst = full_ranges + IM_ARRAYSIZE(base_ranges);
|
||||||
for (int n = 0; n < IM_ARRAYSIZE(offsets_from_0x4E00); n++, dst += 2)
|
for (int n = 0; n < IM_ARRAYSIZE(offsets_from_0x4E00); n++, dst += 2)
|
||||||
dst[0] = dst[1] = (ImWchar)(codepoint += (offsets_from_0x4E00[n] + 1));
|
dst[0] = dst[1] = (ImWchar)(codepoint += (offsets_from_0x4E00[n] + 1));
|
||||||
dst[0] = 0;
|
dst[0] = 0;
|
||||||
@ -2099,7 +2170,7 @@ ImFont::ImFont()
|
|||||||
{
|
{
|
||||||
Scale = 1.0f;
|
Scale = 1.0f;
|
||||||
FallbackChar = (ImWchar)'?';
|
FallbackChar = (ImWchar)'?';
|
||||||
DisplayOffset = ImVec2(0.0f, 1.0f);
|
DisplayOffset = ImVec2(0.0f, 0.0f);
|
||||||
ClearOutputData();
|
ClearOutputData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2128,6 +2199,7 @@ void ImFont::ClearOutputData()
|
|||||||
ConfigData = NULL;
|
ConfigData = NULL;
|
||||||
ContainerAtlas = NULL;
|
ContainerAtlas = NULL;
|
||||||
Ascent = Descent = 0.0f;
|
Ascent = Descent = 0.0f;
|
||||||
|
DirtyLookupTables = true;
|
||||||
MetricsTotalSurface = 0;
|
MetricsTotalSurface = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2140,6 +2212,7 @@ void ImFont::BuildLookupTable()
|
|||||||
IM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved
|
IM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved
|
||||||
IndexAdvanceX.clear();
|
IndexAdvanceX.clear();
|
||||||
IndexLookup.clear();
|
IndexLookup.clear();
|
||||||
|
DirtyLookupTables = false;
|
||||||
GrowIndex(max_codepoint + 1);
|
GrowIndex(max_codepoint + 1);
|
||||||
for (int i = 0; i < Glyphs.Size; i++)
|
for (int i = 0; i < Glyphs.Size; i++)
|
||||||
{
|
{
|
||||||
@ -2162,8 +2235,7 @@ void ImFont::BuildLookupTable()
|
|||||||
IndexLookup[(int)tab_glyph.Codepoint] = (unsigned short)(Glyphs.Size-1);
|
IndexLookup[(int)tab_glyph.Codepoint] = (unsigned short)(Glyphs.Size-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
FallbackGlyph = NULL;
|
FallbackGlyph = FindGlyphNoFallback(FallbackChar);
|
||||||
FallbackGlyph = FindGlyph(FallbackChar);
|
|
||||||
FallbackAdvanceX = FallbackGlyph ? FallbackGlyph->AdvanceX : 0.0f;
|
FallbackAdvanceX = FallbackGlyph ? FallbackGlyph->AdvanceX : 0.0f;
|
||||||
for (int i = 0; i < max_codepoint + 1; i++)
|
for (int i = 0; i < max_codepoint + 1; i++)
|
||||||
if (IndexAdvanceX[i] < 0.0f)
|
if (IndexAdvanceX[i] < 0.0f)
|
||||||
@ -2204,6 +2276,7 @@ void ImFont::AddGlyph(ImWchar codepoint, float x0, float y0, float x1, float y1,
|
|||||||
glyph.AdvanceX = (float)(int)(glyph.AdvanceX + 0.5f);
|
glyph.AdvanceX = (float)(int)(glyph.AdvanceX + 0.5f);
|
||||||
|
|
||||||
// Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)
|
// Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)
|
||||||
|
DirtyLookupTables = true;
|
||||||
MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + 1.99f);
|
MetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + 1.99f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2224,13 +2297,22 @@ void ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst)
|
|||||||
|
|
||||||
const ImFontGlyph* ImFont::FindGlyph(ImWchar c) const
|
const ImFontGlyph* ImFont::FindGlyph(ImWchar c) const
|
||||||
{
|
{
|
||||||
if (c < IndexLookup.Size)
|
if (c >= IndexLookup.Size)
|
||||||
{
|
|
||||||
const unsigned short i = IndexLookup[c];
|
|
||||||
if (i != (unsigned short)-1)
|
|
||||||
return &Glyphs.Data[i];
|
|
||||||
}
|
|
||||||
return FallbackGlyph;
|
return FallbackGlyph;
|
||||||
|
const unsigned short i = IndexLookup[c];
|
||||||
|
if (i == (unsigned short)-1)
|
||||||
|
return FallbackGlyph;
|
||||||
|
return &Glyphs.Data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
const ImFontGlyph* ImFont::FindGlyphNoFallback(ImWchar c) const
|
||||||
|
{
|
||||||
|
if (c >= IndexLookup.Size)
|
||||||
|
return NULL;
|
||||||
|
const unsigned short i = IndexLookup[c];
|
||||||
|
if (i == (unsigned short)-1)
|
||||||
|
return NULL;
|
||||||
|
return &Glyphs.Data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const
|
const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const
|
||||||
@ -2371,7 +2453,7 @@ ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, cons
|
|||||||
while (s < text_end)
|
while (s < text_end)
|
||||||
{
|
{
|
||||||
const char c = *s;
|
const char c = *s;
|
||||||
if (ImCharIsSpace(c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
if (ImCharIsSpace((unsigned int)c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2496,7 +2578,7 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
|||||||
while (s < text_end)
|
while (s < text_end)
|
||||||
{
|
{
|
||||||
const char c = *s;
|
const char c = *s;
|
||||||
if (ImCharIsSpace(c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
if (ImCharIsSpace((unsigned int)c)) { s++; } else if (c == '\n') { s++; break; } else { break; }
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2688,31 +2770,32 @@ void ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, Im
|
|||||||
// DEFAULT FONT DATA
|
// DEFAULT FONT DATA
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Compressed with stb_compress() then converted to a C array.
|
// Compressed with stb_compress() then converted to a C array.
|
||||||
// Use the program in extra_fonts/binary_to_compressed_c.cpp to create the array from a TTF file.
|
// Use the program in misc/fonts/binary_to_compressed_c.cpp to create the array from a TTF file.
|
||||||
// Decompression from stb.h (public domain) by Sean Barrett https://github.com/nothings/stb/blob/master/stb.h
|
// Decompression from stb.h (public domain) by Sean Barrett https://github.com/nothings/stb/blob/master/stb.h
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static unsigned int stb_decompress_length(unsigned char *input)
|
static unsigned int stb_decompress_length(const unsigned char *input)
|
||||||
{
|
{
|
||||||
return (input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11];
|
return (input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11];
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned char *stb__barrier, *stb__barrier2, *stb__barrier3, *stb__barrier4;
|
static unsigned char *stb__barrier_out_e, *stb__barrier_out_b;
|
||||||
|
static const unsigned char *stb__barrier_in_b;
|
||||||
static unsigned char *stb__dout;
|
static unsigned char *stb__dout;
|
||||||
static void stb__match(unsigned char *data, unsigned int length)
|
static void stb__match(const unsigned char *data, unsigned int length)
|
||||||
{
|
{
|
||||||
// INVERSE of memmove... write each byte before copying the next...
|
// INVERSE of memmove... write each byte before copying the next...
|
||||||
IM_ASSERT (stb__dout + length <= stb__barrier);
|
IM_ASSERT(stb__dout + length <= stb__barrier_out_e);
|
||||||
if (stb__dout + length > stb__barrier) { stb__dout += length; return; }
|
if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; }
|
||||||
if (data < stb__barrier4) { stb__dout = stb__barrier+1; return; }
|
if (data < stb__barrier_out_b) { stb__dout = stb__barrier_out_e+1; return; }
|
||||||
while (length--) *stb__dout++ = *data++;
|
while (length--) *stb__dout++ = *data++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stb__lit(unsigned char *data, unsigned int length)
|
static void stb__lit(const unsigned char *data, unsigned int length)
|
||||||
{
|
{
|
||||||
IM_ASSERT (stb__dout + length <= stb__barrier);
|
IM_ASSERT(stb__dout + length <= stb__barrier_out_e);
|
||||||
if (stb__dout + length > stb__barrier) { stb__dout += length; return; }
|
if (stb__dout + length > stb__barrier_out_e) { stb__dout += length; return; }
|
||||||
if (data < stb__barrier2) { stb__dout = stb__barrier+1; return; }
|
if (data < stb__barrier_in_b) { stb__dout = stb__barrier_out_e+1; return; }
|
||||||
memcpy(stb__dout, data, length);
|
memcpy(stb__dout, data, length);
|
||||||
stb__dout += length;
|
stb__dout += length;
|
||||||
}
|
}
|
||||||
@ -2721,7 +2804,7 @@ static void stb__lit(unsigned char *data, unsigned int length)
|
|||||||
#define stb__in3(x) ((i[x] << 16) + stb__in2((x)+1))
|
#define stb__in3(x) ((i[x] << 16) + stb__in2((x)+1))
|
||||||
#define stb__in4(x) ((i[x] << 24) + stb__in3((x)+1))
|
#define stb__in4(x) ((i[x] << 24) + stb__in3((x)+1))
|
||||||
|
|
||||||
static unsigned char *stb_decompress_token(unsigned char *i)
|
static const unsigned char *stb_decompress_token(const unsigned char *i)
|
||||||
{
|
{
|
||||||
if (*i >= 0x20) { // use fewer if's for cases that expand small
|
if (*i >= 0x20) { // use fewer if's for cases that expand small
|
||||||
if (*i >= 0x80) stb__match(stb__dout-i[1]-1, i[0] - 0x80 + 1), i += 2;
|
if (*i >= 0x80) stb__match(stb__dout-i[1]-1, i[0] - 0x80 + 1), i += 2;
|
||||||
@ -2769,21 +2852,20 @@ static unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, uns
|
|||||||
return (unsigned int)(s2 << 16) + (unsigned int)s1;
|
return (unsigned int)(s2 << 16) + (unsigned int)s1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length)
|
static unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/)
|
||||||
{
|
{
|
||||||
unsigned int olen;
|
unsigned int olen;
|
||||||
if (stb__in4(0) != 0x57bC0000) return 0;
|
if (stb__in4(0) != 0x57bC0000) return 0;
|
||||||
if (stb__in4(4) != 0) return 0; // error! stream is > 4GB
|
if (stb__in4(4) != 0) return 0; // error! stream is > 4GB
|
||||||
olen = stb_decompress_length(i);
|
olen = stb_decompress_length(i);
|
||||||
stb__barrier2 = i;
|
stb__barrier_in_b = i;
|
||||||
stb__barrier3 = i+length;
|
stb__barrier_out_e = output + olen;
|
||||||
stb__barrier = output + olen;
|
stb__barrier_out_b = output;
|
||||||
stb__barrier4 = output;
|
|
||||||
i += 16;
|
i += 16;
|
||||||
|
|
||||||
stb__dout = output;
|
stb__dout = output;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
unsigned char *old_i = i;
|
const unsigned char *old_i = i;
|
||||||
i = stb_decompress_token(i);
|
i = stb_decompress_token(i);
|
||||||
if (i == old_i) {
|
if (i == old_i) {
|
||||||
if (*i == 0x05 && i[1] == 0xfa) {
|
if (*i == 0x05 && i[1] == 0xfa) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// dear imgui, v1.53
|
// dear imgui, v1.61 WIP
|
||||||
// (internals)
|
// (internals)
|
||||||
|
|
||||||
// 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!
|
||||||
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <stdio.h> // FILE*
|
#include <stdio.h> // FILE*
|
||||||
#include <math.h> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
|
#include <math.h> // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf
|
||||||
|
#include <limits.h> // INT_MIN, INT_MAX
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning (push)
|
#pragma warning (push)
|
||||||
@ -35,10 +36,9 @@ struct ImRect;
|
|||||||
struct ImGuiColMod;
|
struct ImGuiColMod;
|
||||||
struct ImGuiStyleMod;
|
struct ImGuiStyleMod;
|
||||||
struct ImGuiGroupData;
|
struct ImGuiGroupData;
|
||||||
struct ImGuiSimpleColumns;
|
struct ImGuiMenuColumns;
|
||||||
struct ImGuiDrawContext;
|
struct ImGuiDrawContext;
|
||||||
struct ImGuiTextEditState;
|
struct ImGuiTextEditState;
|
||||||
struct ImGuiMouseCursorData;
|
|
||||||
struct ImGuiPopupRef;
|
struct ImGuiPopupRef;
|
||||||
struct ImGuiWindow;
|
struct ImGuiWindow;
|
||||||
struct ImGuiWindowSettings;
|
struct ImGuiWindowSettings;
|
||||||
@ -46,6 +46,9 @@ struct ImGuiWindowSettings;
|
|||||||
typedef int ImGuiLayoutType; // enum: horizontal or vertical // enum ImGuiLayoutType_
|
typedef int ImGuiLayoutType; // enum: horizontal or vertical // enum ImGuiLayoutType_
|
||||||
typedef int ImGuiButtonFlags; // flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_
|
typedef int ImGuiButtonFlags; // flags: for ButtonEx(), ButtonBehavior() // enum ImGuiButtonFlags_
|
||||||
typedef int ImGuiItemFlags; // flags: for PushItemFlag() // enum ImGuiItemFlags_
|
typedef int ImGuiItemFlags; // flags: for PushItemFlag() // enum ImGuiItemFlags_
|
||||||
|
typedef int ImGuiItemStatusFlags; // flags: storage for DC.LastItemXXX // enum ImGuiItemStatusFlags_
|
||||||
|
typedef int ImGuiNavHighlightFlags; // flags: for RenderNavHighlight() // enum ImGuiNavHighlightFlags_
|
||||||
|
typedef int ImGuiNavDirSourceFlags; // flags: for GetNavInputAmount2d() // enum ImGuiNavDirSourceFlags_
|
||||||
typedef int ImGuiSeparatorFlags; // flags: for Separator() - internal // enum ImGuiSeparatorFlags_
|
typedef int ImGuiSeparatorFlags; // flags: for Separator() - internal // enum ImGuiSeparatorFlags_
|
||||||
typedef int ImGuiSliderFlags; // flags: for SliderBehavior() // enum ImGuiSliderFlags_
|
typedef int ImGuiSliderFlags; // flags: for SliderBehavior() // enum ImGuiSliderFlags_
|
||||||
|
|
||||||
@ -78,7 +81,11 @@ extern IMGUI_API ImGuiContext* GImGui; // Current implicit ImGui context pointe
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define IM_PI 3.14159265358979323846f
|
#define IM_PI 3.14159265358979323846f
|
||||||
#define IM_OFFSETOF(_TYPE,_ELM) ((size_t)&(((_TYPE*)0)->_ELM))
|
#ifdef _WIN32
|
||||||
|
#define IM_NEWLINE "\r\n" // Play it nice with Windows users (2018: Notepad _still_ doesn't display files properly when they use Unix-style carriage returns)
|
||||||
|
#else
|
||||||
|
#define IM_NEWLINE "\n"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Helpers: UTF-8 <> wchar
|
// Helpers: UTF-8 <> wchar
|
||||||
IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count
|
IMGUI_API int ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end); // return output UTF-8 bytes count
|
||||||
@ -89,9 +96,9 @@ IMGUI_API int ImTextCountUtf8BytesFromStr(const ImWchar* in_text, cons
|
|||||||
|
|
||||||
// Helpers: Misc
|
// Helpers: Misc
|
||||||
IMGUI_API ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0); // Pass data_size==0 for zero-terminated strings
|
IMGUI_API ImU32 ImHash(const void* data, int data_size, ImU32 seed = 0); // Pass data_size==0 for zero-terminated strings
|
||||||
IMGUI_API void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size = NULL, int padding_bytes = 0);
|
IMGUI_API void* ImFileLoadToMemory(const char* filename, const char* file_open_mode, size_t* out_file_size = NULL, int padding_bytes = 0);
|
||||||
IMGUI_API FILE* ImFileOpen(const char* filename, const char* file_open_mode);
|
IMGUI_API FILE* ImFileOpen(const char* filename, const char* file_open_mode);
|
||||||
static inline bool ImCharIsSpace(int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
static inline bool ImCharIsSpace(unsigned int c) { return c == ' ' || c == '\t' || c == 0x3000; }
|
||||||
static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
static inline bool ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }
|
||||||
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
static inline int ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }
|
||||||
|
|
||||||
@ -106,7 +113,7 @@ IMGUI_API int ImStricmp(const char* str1, const char* str2);
|
|||||||
IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count);
|
IMGUI_API int ImStrnicmp(const char* str1, const char* str2, size_t count);
|
||||||
IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count);
|
IMGUI_API void ImStrncpy(char* dst, const char* src, size_t count);
|
||||||
IMGUI_API char* ImStrdup(const char* str);
|
IMGUI_API char* ImStrdup(const char* str);
|
||||||
IMGUI_API char* ImStrchrRange(const char* str_begin, const char* str_end, char c);
|
IMGUI_API const char* ImStrchrRange(const char* str_begin, const char* str_end, char c);
|
||||||
IMGUI_API int ImStrlenW(const ImWchar* str);
|
IMGUI_API int ImStrlenW(const ImWchar* str);
|
||||||
IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line
|
IMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line
|
||||||
IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
|
IMGUI_API const char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);
|
||||||
@ -135,8 +142,8 @@ static inline int ImMin(int lhs, int rhs)
|
|||||||
static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; }
|
static inline int ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; }
|
||||||
static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; }
|
static inline float ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; }
|
||||||
static inline float ImMax(float lhs, float rhs) { return lhs >= rhs ? lhs : rhs; }
|
static inline float ImMax(float lhs, float rhs) { return lhs >= rhs ? lhs : rhs; }
|
||||||
static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(ImMin(lhs.x,rhs.x), ImMin(lhs.y,rhs.y)); }
|
static inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }
|
||||||
static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(ImMax(lhs.x,rhs.x), ImMax(lhs.y,rhs.y)); }
|
static inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }
|
||||||
static inline int ImClamp(int v, int mn, int mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
static inline int ImClamp(int v, int mn, int mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
||||||
static inline float ImClamp(float v, float mn, float mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
static inline float ImClamp(float v, float mn, float mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }
|
||||||
static inline ImVec2 ImClamp(const ImVec2& f, const ImVec2& mn, ImVec2 mx) { return ImVec2(ImClamp(f.x,mn.x,mx.x), ImClamp(f.y,mn.y,mx.y)); }
|
static inline ImVec2 ImClamp(const ImVec2& f, const ImVec2& mn, ImVec2 mx) { return ImVec2(ImClamp(f.x,mn.x,mx.x), ImClamp(f.y,mn.y,mx.y)); }
|
||||||
@ -158,22 +165,10 @@ static inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a)
|
|||||||
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
static inline float ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }
|
||||||
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
static inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }
|
||||||
|
|
||||||
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
|
|
||||||
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
|
|
||||||
struct ImNewPlacementDummy {};
|
|
||||||
inline void* operator new(size_t, ImNewPlacementDummy, void* ptr) { return ptr; }
|
|
||||||
inline void operator delete(void*, ImNewPlacementDummy, void*) {} // This is only required so we can use the symetrical new()
|
|
||||||
#define IM_PLACEMENT_NEW(_PTR) new(ImNewPlacementDummy(), _PTR)
|
|
||||||
#define IM_NEW(_TYPE) new(ImNewPlacementDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
|
|
||||||
template <typename T> void IM_DELETE(T*& p) { if (p) { p->~T(); ImGui::MemFree(p); p = NULL; } }
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Types
|
// Types
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Internal Drag and Drop payload types. String starting with '_' are reserved for Dear ImGui.
|
|
||||||
#define IMGUI_PAYLOAD_TYPE_DOCKABLE "_IMDOCK" // ImGuiWindow* // [Internal] Docking/tabs
|
|
||||||
|
|
||||||
enum ImGuiButtonFlags_
|
enum ImGuiButtonFlags_
|
||||||
{
|
{
|
||||||
ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat
|
ImGuiButtonFlags_Repeat = 1 << 0, // hold to repeat
|
||||||
@ -188,7 +183,8 @@ enum ImGuiButtonFlags_
|
|||||||
ImGuiButtonFlags_AlignTextBaseLine = 1 << 9, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
ImGuiButtonFlags_AlignTextBaseLine = 1 << 9, // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine
|
||||||
ImGuiButtonFlags_NoKeyModifiers = 1 << 10, // disable interaction if a key modifier is held
|
ImGuiButtonFlags_NoKeyModifiers = 1 << 10, // disable interaction if a key modifier is held
|
||||||
ImGuiButtonFlags_NoHoldingActiveID = 1 << 11, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
ImGuiButtonFlags_NoHoldingActiveID = 1 << 11, // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)
|
||||||
ImGuiButtonFlags_PressedOnDragDropHold = 1 << 12 // press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
|
ImGuiButtonFlags_PressedOnDragDropHold = 1 << 12, // press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)
|
||||||
|
ImGuiButtonFlags_NoNavFocus = 1 << 13 // don't override navigation focus when activated
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSliderFlags_
|
enum ImGuiSliderFlags_
|
||||||
@ -221,6 +217,13 @@ enum ImGuiSeparatorFlags_
|
|||||||
ImGuiSeparatorFlags_Vertical = 1 << 1
|
ImGuiSeparatorFlags_Vertical = 1 << 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Storage for LastItem data
|
||||||
|
enum ImGuiItemStatusFlags_
|
||||||
|
{
|
||||||
|
ImGuiItemStatusFlags_HoveredRect = 1 << 0,
|
||||||
|
ImGuiItemStatusFlags_HasDisplayRect = 1 << 1
|
||||||
|
};
|
||||||
|
|
||||||
// FIXME: this is in development, not exposed/functional as a generic feature yet.
|
// FIXME: this is in development, not exposed/functional as a generic feature yet.
|
||||||
enum ImGuiLayoutType_
|
enum ImGuiLayoutType_
|
||||||
{
|
{
|
||||||
@ -243,19 +246,54 @@ enum ImGuiPlotType
|
|||||||
|
|
||||||
enum ImGuiDataType
|
enum ImGuiDataType
|
||||||
{
|
{
|
||||||
ImGuiDataType_Int,
|
ImGuiDataType_Int32,
|
||||||
|
ImGuiDataType_Uint32,
|
||||||
ImGuiDataType_Float,
|
ImGuiDataType_Float,
|
||||||
ImGuiDataType_Float2
|
ImGuiDataType_Double,
|
||||||
|
ImGuiDataType_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiDir
|
enum ImGuiInputSource
|
||||||
{
|
{
|
||||||
ImGuiDir_None = -1,
|
ImGuiInputSource_None = 0,
|
||||||
ImGuiDir_Left = 0,
|
ImGuiInputSource_Mouse,
|
||||||
ImGuiDir_Right = 1,
|
ImGuiInputSource_Nav,
|
||||||
ImGuiDir_Up = 2,
|
ImGuiInputSource_NavKeyboard, // Only used occasionally for storage, not tested/handled by most code
|
||||||
ImGuiDir_Down = 3,
|
ImGuiInputSource_NavGamepad, // "
|
||||||
ImGuiDir_Count_
|
ImGuiInputSource_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
// FIXME-NAV: Clarify/expose various repeat delay/rate
|
||||||
|
enum ImGuiInputReadMode
|
||||||
|
{
|
||||||
|
ImGuiInputReadMode_Down,
|
||||||
|
ImGuiInputReadMode_Pressed,
|
||||||
|
ImGuiInputReadMode_Released,
|
||||||
|
ImGuiInputReadMode_Repeat,
|
||||||
|
ImGuiInputReadMode_RepeatSlow,
|
||||||
|
ImGuiInputReadMode_RepeatFast
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavHighlightFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavHighlightFlags_TypeDefault = 1 << 0,
|
||||||
|
ImGuiNavHighlightFlags_TypeThin = 1 << 1,
|
||||||
|
ImGuiNavHighlightFlags_AlwaysDraw = 1 << 2,
|
||||||
|
ImGuiNavHighlightFlags_NoRounding = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavDirSourceFlags_
|
||||||
|
{
|
||||||
|
ImGuiNavDirSourceFlags_Keyboard = 1 << 0,
|
||||||
|
ImGuiNavDirSourceFlags_PadDPad = 1 << 1,
|
||||||
|
ImGuiNavDirSourceFlags_PadLStick = 1 << 2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ImGuiNavForward
|
||||||
|
{
|
||||||
|
ImGuiNavForward_None,
|
||||||
|
ImGuiNavForward_ForwardQueued,
|
||||||
|
ImGuiNavForward_ForwardActive
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2D axis aligned bounding-box
|
// 2D axis aligned bounding-box
|
||||||
@ -270,36 +308,26 @@ struct IMGUI_API ImRect
|
|||||||
ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}
|
ImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}
|
||||||
ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}
|
ImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}
|
||||||
|
|
||||||
ImVec2 GetCenter() const { return ImVec2((Min.x+Max.x)*0.5f, (Min.y+Max.y)*0.5f); }
|
ImVec2 GetCenter() const { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); }
|
||||||
ImVec2 GetSize() const { return ImVec2(Max.x-Min.x, Max.y-Min.y); }
|
ImVec2 GetSize() const { return ImVec2(Max.x - Min.x, Max.y - Min.y); }
|
||||||
float GetWidth() const { return Max.x-Min.x; }
|
float GetWidth() const { return Max.x - Min.x; }
|
||||||
float GetHeight() const { return Max.y-Min.y; }
|
float GetHeight() const { return Max.y - Min.y; }
|
||||||
ImVec2 GetTL() const { return Min; } // Top-left
|
ImVec2 GetTL() const { return Min; } // Top-left
|
||||||
ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right
|
ImVec2 GetTR() const { return ImVec2(Max.x, Min.y); } // Top-right
|
||||||
ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left
|
ImVec2 GetBL() const { return ImVec2(Min.x, Max.y); } // Bottom-left
|
||||||
ImVec2 GetBR() const { return Max; } // Bottom-right
|
ImVec2 GetBR() const { return Max; } // Bottom-right
|
||||||
bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; }
|
bool Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x < Max.x && p.y < Max.y; }
|
||||||
bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x < Max.x && r.Max.y < Max.y; }
|
bool Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x <= Max.x && r.Max.y <= Max.y; }
|
||||||
bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; }
|
bool Overlaps(const ImRect& r) const { return r.Min.y < Max.y && r.Max.y > Min.y && r.Min.x < Max.x && r.Max.x > Min.x; }
|
||||||
void Add(const ImVec2& rhs) { if (Min.x > rhs.x) Min.x = rhs.x; if (Min.y > rhs.y) Min.y = rhs.y; if (Max.x < rhs.x) Max.x = rhs.x; if (Max.y < rhs.y) Max.y = rhs.y; }
|
void Add(const ImVec2& p) { if (Min.x > p.x) Min.x = p.x; if (Min.y > p.y) Min.y = p.y; if (Max.x < p.x) Max.x = p.x; if (Max.y < p.y) Max.y = p.y; }
|
||||||
void Add(const ImRect& rhs) { if (Min.x > rhs.Min.x) Min.x = rhs.Min.x; if (Min.y > rhs.Min.y) Min.y = rhs.Min.y; if (Max.x < rhs.Max.x) Max.x = rhs.Max.x; if (Max.y < rhs.Max.y) Max.y = rhs.Max.y; }
|
void Add(const ImRect& r) { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; }
|
||||||
void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; }
|
void Expand(const float amount) { Min.x -= amount; Min.y -= amount; Max.x += amount; Max.y += amount; }
|
||||||
void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }
|
void Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }
|
||||||
void Translate(const ImVec2& v) { Min.x += v.x; Min.y += v.y; Max.x += v.x; Max.y += v.y; }
|
void Translate(const ImVec2& d) { Min.x += d.x; Min.y += d.y; Max.x += d.x; Max.y += d.y; }
|
||||||
void ClipWith(const ImRect& clip) { if (Min.x < clip.Min.x) Min.x = clip.Min.x; if (Min.y < clip.Min.y) Min.y = clip.Min.y; if (Max.x > clip.Max.x) Max.x = clip.Max.x; if (Max.y > clip.Max.y) Max.y = clip.Max.y; }
|
void ClipWith(const ImRect& r) { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); } // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display.
|
||||||
|
void ClipWithFull(const ImRect& r) { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped.
|
||||||
void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; }
|
void Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; }
|
||||||
void FixInverted() { if (Min.x > Max.x) ImSwap(Min.x, Max.x); if (Min.y > Max.y) ImSwap(Min.y, Max.y); }
|
bool IsInverted() const { return Min.x > Max.x || Min.y > Max.y; }
|
||||||
bool IsFinite() const { return Min.x != FLT_MAX; }
|
|
||||||
ImVec2 GetClosestPoint(ImVec2 p, bool on_edge) const
|
|
||||||
{
|
|
||||||
if (!on_edge && Contains(p))
|
|
||||||
return p;
|
|
||||||
if (p.x > Max.x) p.x = Max.x;
|
|
||||||
else if (p.x < Min.x) p.x = Min.x;
|
|
||||||
if (p.y > Max.y) p.y = Max.y;
|
|
||||||
else if (p.y < Min.y) p.y = Min.y;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stacked color modifier, backup of modified data so we can restore it
|
// Stacked color modifier, backup of modified data so we can restore it
|
||||||
@ -334,14 +362,14 @@ struct ImGuiGroupData
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper.
|
// Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper.
|
||||||
struct IMGUI_API ImGuiSimpleColumns
|
struct IMGUI_API ImGuiMenuColumns
|
||||||
{
|
{
|
||||||
int Count;
|
int Count;
|
||||||
float Spacing;
|
float Spacing;
|
||||||
float Width, NextWidth;
|
float Width, NextWidth;
|
||||||
float Pos[8], NextWidths[8];
|
float Pos[4], NextWidths[4];
|
||||||
|
|
||||||
ImGuiSimpleColumns();
|
ImGuiMenuColumns();
|
||||||
void Update(int count, float spacing, bool clear);
|
void Update(int count, float spacing, bool clear);
|
||||||
float DeclColumns(float w0, float w1, float w2);
|
float DeclColumns(float w0, float w1, float w2);
|
||||||
float CalcExtraSpace(float avail_w);
|
float CalcExtraSpace(float avail_w);
|
||||||
@ -367,7 +395,7 @@ struct IMGUI_API ImGuiTextEditState
|
|||||||
void CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); }
|
void CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); }
|
||||||
bool HasSelection() const { return StbState.select_start != StbState.select_end; }
|
bool HasSelection() const { return StbState.select_start != StbState.select_end; }
|
||||||
void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; }
|
void ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; }
|
||||||
void SelectAll() { StbState.select_start = 0; StbState.select_end = CurLenW; StbState.cursor = StbState.select_end; StbState.has_preferred_x = false; }
|
void SelectAll() { StbState.select_start = 0; StbState.cursor = StbState.select_end = CurLenW; StbState.has_preferred_x = false; }
|
||||||
void OnKeyPressed(int key);
|
void OnKeyPressed(int key);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -387,19 +415,12 @@ struct ImGuiSettingsHandler
|
|||||||
{
|
{
|
||||||
const char* TypeName; // Short description stored in .ini file. Disallowed characters: '[' ']'
|
const char* TypeName; // Short description stored in .ini file. Disallowed characters: '[' ']'
|
||||||
ImGuiID TypeHash; // == ImHash(TypeName, 0, 0)
|
ImGuiID TypeHash; // == ImHash(TypeName, 0, 0)
|
||||||
void* (*ReadOpenFn)(ImGuiContext& ctx, const char* name);
|
void* (*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name); // Read: Called when entering into a new ini entry e.g. "[Window][Name]"
|
||||||
void (*ReadLineFn)(ImGuiContext& ctx, void* entry, const char* line);
|
void (*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line); // Read: Called for every line of text within an ini entry
|
||||||
void (*WriteAllFn)(ImGuiContext& ctx, ImGuiTextBuffer* out_buf);
|
void (*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); // Write: Output every entries into 'out_buf'
|
||||||
};
|
void* UserData;
|
||||||
|
|
||||||
// Mouse cursor data (used when io.MouseDrawCursor is set)
|
ImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); }
|
||||||
struct ImGuiMouseCursorData
|
|
||||||
{
|
|
||||||
ImGuiMouseCursor Type;
|
|
||||||
ImVec2 HotOffset;
|
|
||||||
ImVec2 Size;
|
|
||||||
ImVec2 TexUvMin[2];
|
|
||||||
ImVec2 TexUvMax[2];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Storage for current popup stack
|
// Storage for current popup stack
|
||||||
@ -408,10 +429,10 @@ struct ImGuiPopupRef
|
|||||||
ImGuiID PopupId; // Set on OpenPopup()
|
ImGuiID PopupId; // Set on OpenPopup()
|
||||||
ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
|
ImGuiWindow* Window; // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()
|
||||||
ImGuiWindow* ParentWindow; // Set on OpenPopup()
|
ImGuiWindow* ParentWindow; // Set on OpenPopup()
|
||||||
ImGuiID ParentMenuSet; // Set on OpenPopup()
|
int OpenFrameCount; // Set on OpenPopup()
|
||||||
ImVec2 MousePosOnOpen; // Copy of mouse position at the time of opening popup
|
ImGuiID OpenParentId; // Set on OpenPopup(), we need this to differenciate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)
|
||||||
|
ImVec2 OpenPopupPos; // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)
|
||||||
ImGuiPopupRef(ImGuiID id, ImGuiWindow* parent_window, ImGuiID parent_menu_set, const ImVec2& mouse_pos) { PopupId = id; Window = NULL; ParentWindow = parent_window; ParentMenuSet = parent_menu_set; MousePosOnOpen = mouse_pos; }
|
ImVec2 OpenMousePos; // Set on OpenPopup(), copy of mouse position at the time of opening popup
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiColumnData
|
struct ImGuiColumnData
|
||||||
@ -433,9 +454,9 @@ struct ImGuiColumnsSet
|
|||||||
int Current;
|
int Current;
|
||||||
int Count;
|
int Count;
|
||||||
float MinX, MaxX;
|
float MinX, MaxX;
|
||||||
float StartPosY;
|
float LineMinY, LineMaxY;
|
||||||
float StartMaxPosX; // Backup of CursorMaxPos
|
float StartPosY; // Copy of CursorPos
|
||||||
float CellMinY, CellMaxY;
|
float StartMaxPosX; // Copy of CursorMaxPos
|
||||||
ImVector<ImGuiColumnData> Columns;
|
ImVector<ImGuiColumnData> Columns;
|
||||||
|
|
||||||
ImGuiColumnsSet() { Clear(); }
|
ImGuiColumnsSet() { Clear(); }
|
||||||
@ -448,14 +469,14 @@ struct ImGuiColumnsSet
|
|||||||
Current = 0;
|
Current = 0;
|
||||||
Count = 1;
|
Count = 1;
|
||||||
MinX = MaxX = 0.0f;
|
MinX = MaxX = 0.0f;
|
||||||
|
LineMinY = LineMaxY = 0.0f;
|
||||||
StartPosY = 0.0f;
|
StartPosY = 0.0f;
|
||||||
StartMaxPosX = 0.0f;
|
StartMaxPosX = 0.0f;
|
||||||
CellMinY = CellMaxY = 0.0f;
|
|
||||||
Columns.clear();
|
Columns.clear();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImDrawListSharedData
|
struct IMGUI_API ImDrawListSharedData
|
||||||
{
|
{
|
||||||
ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas
|
ImVec2 TexUvWhitePixel; // UV of white pixel in the atlas
|
||||||
ImFont* Font; // Current/default font (optional, for simplified AddText overload)
|
ImFont* Font; // Current/default font (optional, for simplified AddText overload)
|
||||||
@ -470,10 +491,74 @@ struct ImDrawListSharedData
|
|||||||
ImDrawListSharedData();
|
ImDrawListSharedData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ImDrawDataBuilder
|
||||||
|
{
|
||||||
|
ImVector<ImDrawList*> Layers[2]; // Global layers for: regular, tooltip
|
||||||
|
|
||||||
|
void Clear() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); }
|
||||||
|
void ClearFreeMemory() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); }
|
||||||
|
IMGUI_API void FlattenIntoSingleLayer();
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ImGuiNavMoveResult
|
||||||
|
{
|
||||||
|
ImGuiID ID; // Best candidate
|
||||||
|
ImGuiID ParentID; // Best candidate window->IDStack.back() - to compare context
|
||||||
|
ImGuiWindow* Window; // Best candidate window
|
||||||
|
float DistBox; // Best candidate box distance to current NavId
|
||||||
|
float DistCenter; // Best candidate center distance to current NavId
|
||||||
|
float DistAxial;
|
||||||
|
ImRect RectRel; // Best candidate bounding box in window relative space
|
||||||
|
|
||||||
|
ImGuiNavMoveResult() { Clear(); }
|
||||||
|
void Clear() { ID = ParentID = 0; Window = NULL; DistBox = DistCenter = DistAxial = FLT_MAX; RectRel = ImRect(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
// Storage for SetNexWindow** functions
|
||||||
|
struct ImGuiNextWindowData
|
||||||
|
{
|
||||||
|
ImGuiCond PosCond;
|
||||||
|
ImGuiCond SizeCond;
|
||||||
|
ImGuiCond ContentSizeCond;
|
||||||
|
ImGuiCond CollapsedCond;
|
||||||
|
ImGuiCond SizeConstraintCond;
|
||||||
|
ImGuiCond FocusCond;
|
||||||
|
ImGuiCond BgAlphaCond;
|
||||||
|
ImVec2 PosVal;
|
||||||
|
ImVec2 PosPivotVal;
|
||||||
|
ImVec2 SizeVal;
|
||||||
|
ImVec2 ContentSizeVal;
|
||||||
|
bool CollapsedVal;
|
||||||
|
ImRect SizeConstraintRect;
|
||||||
|
ImGuiSizeCallback SizeCallback;
|
||||||
|
void* SizeCallbackUserData;
|
||||||
|
float BgAlphaVal;
|
||||||
|
ImVec2 MenuBarOffsetMinVal; // This is not exposed publicly, so we don't clear it.
|
||||||
|
|
||||||
|
ImGuiNextWindowData()
|
||||||
|
{
|
||||||
|
PosCond = SizeCond = ContentSizeCond = CollapsedCond = SizeConstraintCond = FocusCond = BgAlphaCond = 0;
|
||||||
|
PosVal = PosPivotVal = SizeVal = ImVec2(0.0f, 0.0f);
|
||||||
|
ContentSizeVal = ImVec2(0.0f, 0.0f);
|
||||||
|
CollapsedVal = false;
|
||||||
|
SizeConstraintRect = ImRect();
|
||||||
|
SizeCallback = NULL;
|
||||||
|
SizeCallbackUserData = NULL;
|
||||||
|
BgAlphaVal = FLT_MAX;
|
||||||
|
MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Clear()
|
||||||
|
{
|
||||||
|
PosCond = SizeCond = ContentSizeCond = CollapsedCond = SizeConstraintCond = FocusCond = BgAlphaCond = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Main state for ImGui
|
// Main state for ImGui
|
||||||
struct ImGuiContext
|
struct ImGuiContext
|
||||||
{
|
{
|
||||||
bool Initialized;
|
bool Initialized;
|
||||||
|
bool FontAtlasOwnedByContext; // Io.Fonts-> is owned by the ImGuiContext and will be destructed along with it.
|
||||||
ImGuiIO IO;
|
ImGuiIO IO;
|
||||||
ImGuiStyle Style;
|
ImGuiStyle Style;
|
||||||
ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
|
ImFont* Font; // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()
|
||||||
@ -491,7 +576,6 @@ struct ImGuiContext
|
|||||||
ImGuiStorage WindowsById;
|
ImGuiStorage WindowsById;
|
||||||
int WindowsActiveCount;
|
int WindowsActiveCount;
|
||||||
ImGuiWindow* CurrentWindow; // Being drawn into
|
ImGuiWindow* CurrentWindow; // Being drawn into
|
||||||
ImGuiWindow* NavWindow; // Nav/focused window for navigation
|
|
||||||
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
ImGuiWindow* HoveredWindow; // Will catch mouse inputs
|
||||||
ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
|
ImGuiWindow* HoveredRootWindow; // Will catch mouse inputs (for focus/move only)
|
||||||
ImGuiID HoveredId; // Hovered widget
|
ImGuiID HoveredId; // Hovered widget
|
||||||
@ -504,41 +588,61 @@ struct ImGuiContext
|
|||||||
bool ActiveIdIsAlive; // Active widget has been seen this frame
|
bool ActiveIdIsAlive; // Active widget has been seen this frame
|
||||||
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
|
bool ActiveIdIsJustActivated; // Set at the time of activation for one frame
|
||||||
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
bool ActiveIdAllowOverlap; // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)
|
||||||
|
int ActiveIdAllowNavDirFlags; // Active widget allows using directional navigation (e.g. can activate a button and move away from it)
|
||||||
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
ImVec2 ActiveIdClickOffset; // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)
|
||||||
ImGuiWindow* ActiveIdWindow;
|
ImGuiWindow* ActiveIdWindow;
|
||||||
ImGuiWindow* MovingWindow; // Track the child window we clicked on to move a window.
|
ImGuiInputSource ActiveIdSource; // Activating with mouse or nav (gamepad/keyboard)
|
||||||
ImGuiID MovingWindowMoveId; // == MovingWindow->MoveId
|
ImGuiWindow* MovingWindow; // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.
|
||||||
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
ImVector<ImGuiColMod> ColorModifiers; // Stack for PushStyleColor()/PopStyleColor()
|
||||||
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
ImVector<ImGuiStyleMod> StyleModifiers; // Stack for PushStyleVar()/PopStyleVar()
|
||||||
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont()
|
ImVector<ImFont*> FontStack; // Stack for PushFont()/PopFont()
|
||||||
ImVector<ImGuiPopupRef> OpenPopupStack; // Which popups are open (persistent)
|
ImVector<ImGuiPopupRef> OpenPopupStack; // Which popups are open (persistent)
|
||||||
ImVector<ImGuiPopupRef> CurrentPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
ImVector<ImGuiPopupRef> CurrentPopupStack; // Which level of BeginPopup() we are in (reset every frame)
|
||||||
|
ImGuiNextWindowData NextWindowData; // Storage for SetNextWindow** functions
|
||||||
|
bool NextTreeNodeOpenVal; // Storage for SetNextTreeNode** functions
|
||||||
|
ImGuiCond NextTreeNodeOpenCond;
|
||||||
|
|
||||||
// Storage for SetNexWindow** and SetNextTreeNode*** functions
|
// Navigation data (for gamepad/keyboard)
|
||||||
ImVec2 SetNextWindowPosVal;
|
ImGuiWindow* NavWindow; // Focused window for navigation. Could be called 'FocusWindow'
|
||||||
ImVec2 SetNextWindowPosPivot;
|
ImGuiID NavId; // Focused item for navigation
|
||||||
ImVec2 SetNextWindowSizeVal;
|
ImGuiID NavActivateId; // ~~ (g.ActiveId == 0) && IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0, also set when calling ActivateItem()
|
||||||
ImVec2 SetNextWindowContentSizeVal;
|
ImGuiID NavActivateDownId; // ~~ IsNavInputDown(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
bool SetNextWindowCollapsedVal;
|
ImGuiID NavActivatePressedId; // ~~ IsNavInputPressed(ImGuiNavInput_Activate) ? NavId : 0
|
||||||
ImGuiCond SetNextWindowPosCond;
|
ImGuiID NavInputId; // ~~ IsNavInputPressed(ImGuiNavInput_Input) ? NavId : 0
|
||||||
ImGuiCond SetNextWindowSizeCond;
|
ImGuiID NavJustTabbedId; // Just tabbed to this id.
|
||||||
ImGuiCond SetNextWindowContentSizeCond;
|
ImGuiID NavJustMovedToId; // Just navigated to this id (result of a successfully MoveRequest)
|
||||||
ImGuiCond SetNextWindowCollapsedCond;
|
ImGuiID NavNextActivateId; // Set by ActivateItem(), queued until next frame
|
||||||
ImRect SetNextWindowSizeConstraintRect; // Valid if 'SetNextWindowSizeConstraint' is true
|
ImGuiInputSource NavInputSource; // Keyboard or Gamepad mode?
|
||||||
ImGuiSizeConstraintCallback SetNextWindowSizeConstraintCallback;
|
ImRect NavScoringRectScreen; // Rectangle used for scoring, in screen space. Based of window->DC.NavRefRectRel[], modified for directional navigation scoring.
|
||||||
void* SetNextWindowSizeConstraintCallbackUserData;
|
int NavScoringCount; // Metrics for debugging
|
||||||
bool SetNextWindowSizeConstraint;
|
ImGuiWindow* NavWindowingTarget; // When selecting a window (holding Menu+FocusPrev/Next, or equivalent of CTRL-TAB) this window is temporarily displayed front-most.
|
||||||
bool SetNextWindowFocus;
|
float NavWindowingHighlightTimer;
|
||||||
bool SetNextTreeNodeOpenVal;
|
float NavWindowingHighlightAlpha;
|
||||||
ImGuiCond SetNextTreeNodeOpenCond;
|
bool NavWindowingToggleLayer;
|
||||||
|
int NavLayer; // Layer we are navigating on. For now the system is hard-coded for 0=main contents and 1=menu/title bar, may expose layers later.
|
||||||
|
int NavIdTabCounter; // == NavWindow->DC.FocusIdxTabCounter at time of NavId processing
|
||||||
|
bool NavIdIsAlive; // Nav widget has been seen this frame ~~ NavRefRectRel is valid
|
||||||
|
bool NavMousePosDirty; // When set we will update mouse position if (io.ConfigFlags & ImGuiConfigFlags_NavEnableSetMousePos) if set (NB: this not enabled by default)
|
||||||
|
bool NavDisableHighlight; // When user starts using mouse, we hide gamepad/keyboard highlight (NB: but they are still available, which is why NavDisableHighlight isn't always != NavDisableMouseHover)
|
||||||
|
bool NavDisableMouseHover; // When user starts using gamepad/keyboard, we hide mouse hovering highlight until mouse is touched again.
|
||||||
|
bool NavAnyRequest; // ~~ NavMoveRequest || NavInitRequest
|
||||||
|
bool NavInitRequest; // Init request for appearing window to select first item
|
||||||
|
bool NavInitRequestFromMove;
|
||||||
|
ImGuiID NavInitResultId;
|
||||||
|
ImRect NavInitResultRectRel;
|
||||||
|
bool NavMoveFromClampedRefRect; // Set by manual scrolling, if we scroll to a point where NavId isn't visible we reset navigation from visible items
|
||||||
|
bool NavMoveRequest; // Move request for this frame
|
||||||
|
ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
|
||||||
|
ImGuiDir NavMoveDir, NavMoveDirLast; // Direction of the move request (left/right/up/down), direction of the previous move request
|
||||||
|
ImGuiNavMoveResult NavMoveResultLocal; // Best move request candidate within NavWindow
|
||||||
|
ImGuiNavMoveResult NavMoveResultOther; // Best move request candidate within NavWindow's flattened hierarchy (when using the NavFlattened flag)
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
ImDrawData RenderDrawData; // Main ImDrawData instance to pass render information to the user
|
ImDrawData DrawData; // Main ImDrawData instance to pass render information to the user
|
||||||
ImVector<ImDrawList*> RenderDrawLists[3];
|
ImDrawDataBuilder DrawDataBuilder;
|
||||||
float ModalWindowDarkeningRatio;
|
float ModalWindowDarkeningRatio;
|
||||||
ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays
|
ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays
|
||||||
ImGuiMouseCursor MouseCursor;
|
ImGuiMouseCursor MouseCursor;
|
||||||
ImGuiMouseCursorData MouseCursorData[ImGuiMouseCursor_Count_];
|
|
||||||
|
|
||||||
// Drag and Drop
|
// Drag and Drop
|
||||||
bool DragDropActive;
|
bool DragDropActive;
|
||||||
@ -552,7 +656,7 @@ struct ImGuiContext
|
|||||||
ImGuiID DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
|
ImGuiID DragDropAcceptIdPrev; // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)
|
||||||
int DragDropAcceptFrameCount; // Last time a target expressed a desire to accept the source
|
int DragDropAcceptFrameCount; // Last time a target expressed a desire to accept the source
|
||||||
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly
|
ImVector<unsigned char> DragDropPayloadBufHeap; // We don't expose the ImVector<> directly
|
||||||
unsigned char DragDropPayloadBufLocal[8];
|
unsigned char DragDropPayloadBufLocal[8]; // Local buffer for small payloads
|
||||||
|
|
||||||
// Widget state
|
// Widget state
|
||||||
ImGuiTextEditState InputTextState;
|
ImGuiTextEditState InputTextState;
|
||||||
@ -568,41 +672,44 @@ struct ImGuiContext
|
|||||||
ImVec2 ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
ImVec2 ScrollbarClickDeltaToGrabCenter; // Distance between mouse and center of grab box, normalized in parent space. Use storage?
|
||||||
int TooltipOverrideCount;
|
int TooltipOverrideCount;
|
||||||
ImVector<char> PrivateClipboard; // If no custom clipboard handler is defined
|
ImVector<char> PrivateClipboard; // If no custom clipboard handler is defined
|
||||||
ImVec2 OsImePosRequest, OsImePosSet; // Cursor position request & last passed to the OS Input Method Editor
|
ImVec2 PlatformImePos, PlatformImeLastPos; // Cursor position request & last passed to the OS Input Method Editor
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
float SettingsDirtyTimer; // Save .ini Settings on disk when time reaches zero
|
bool SettingsLoaded;
|
||||||
ImVector<ImGuiWindowSettings> SettingsWindows; // .ini settings for ImGuiWindow
|
float SettingsDirtyTimer; // Save .ini Settings to memory when time reaches zero
|
||||||
|
ImGuiTextBuffer SettingsIniData; // In memory .ini settings
|
||||||
ImVector<ImGuiSettingsHandler> SettingsHandlers; // List of .ini settings handlers
|
ImVector<ImGuiSettingsHandler> SettingsHandlers; // List of .ini settings handlers
|
||||||
|
ImVector<ImGuiWindowSettings> SettingsWindows; // ImGuiWindow .ini settings entries (parsed from the last loaded .ini file and maintained on saving)
|
||||||
|
|
||||||
// Logging
|
// Logging
|
||||||
bool LogEnabled;
|
bool LogEnabled;
|
||||||
FILE* LogFile; // If != NULL log to stdout/ file
|
FILE* LogFile; // If != NULL log to stdout/ file
|
||||||
ImGuiTextBuffer* LogClipboard; // Else log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
ImGuiTextBuffer LogClipboard; // Accumulation buffer when log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.
|
||||||
int LogStartDepth;
|
int LogStartDepth;
|
||||||
int LogAutoExpandMaxDepth;
|
int LogAutoExpandMaxDepth;
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
float FramerateSecPerFrame[120]; // calculate estimate of framerate for user
|
float FramerateSecPerFrame[120]; // Calculate estimate of framerate for user over the last 2 seconds.
|
||||||
int FramerateSecPerFrameIdx;
|
int FramerateSecPerFrameIdx;
|
||||||
float FramerateSecPerFrameAccum;
|
float FramerateSecPerFrameAccum;
|
||||||
int WantCaptureMouseNextFrame; // explicit capture via CaptureInputs() sets those flags
|
int WantCaptureMouseNextFrame; // Explicit capture via CaptureKeyboardFromApp()/CaptureMouseFromApp() sets those flags
|
||||||
int WantCaptureKeyboardNextFrame;
|
int WantCaptureKeyboardNextFrame;
|
||||||
int WantTextInputNextFrame;
|
int WantTextInputNextFrame;
|
||||||
char TempBuffer[1024*3+1]; // temporary text buffer
|
char TempBuffer[1024*3+1]; // Temporary text buffer
|
||||||
|
|
||||||
ImGuiContext() : OverlayDrawList(NULL)
|
ImGuiContext(ImFontAtlas* shared_font_atlas) : OverlayDrawList(NULL)
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
Font = NULL;
|
Font = NULL;
|
||||||
FontSize = FontBaseSize = 0.0f;
|
FontSize = FontBaseSize = 0.0f;
|
||||||
|
FontAtlasOwnedByContext = shared_font_atlas ? false : true;
|
||||||
|
IO.Fonts = shared_font_atlas ? shared_font_atlas : IM_NEW(ImFontAtlas)();
|
||||||
|
|
||||||
Time = 0.0f;
|
Time = 0.0f;
|
||||||
FrameCount = 0;
|
FrameCount = 0;
|
||||||
FrameCountEnded = FrameCountRendered = -1;
|
FrameCountEnded = FrameCountRendered = -1;
|
||||||
WindowsActiveCount = 0;
|
WindowsActiveCount = 0;
|
||||||
CurrentWindow = NULL;
|
CurrentWindow = NULL;
|
||||||
NavWindow = NULL;
|
|
||||||
HoveredWindow = NULL;
|
HoveredWindow = NULL;
|
||||||
HoveredRootWindow = NULL;
|
HoveredRootWindow = NULL;
|
||||||
HoveredId = 0;
|
HoveredId = 0;
|
||||||
@ -615,30 +722,48 @@ struct ImGuiContext
|
|||||||
ActiveIdIsAlive = false;
|
ActiveIdIsAlive = false;
|
||||||
ActiveIdIsJustActivated = false;
|
ActiveIdIsJustActivated = false;
|
||||||
ActiveIdAllowOverlap = false;
|
ActiveIdAllowOverlap = false;
|
||||||
|
ActiveIdAllowNavDirFlags = 0;
|
||||||
ActiveIdClickOffset = ImVec2(-1,-1);
|
ActiveIdClickOffset = ImVec2(-1,-1);
|
||||||
ActiveIdWindow = NULL;
|
ActiveIdWindow = NULL;
|
||||||
|
ActiveIdSource = ImGuiInputSource_None;
|
||||||
MovingWindow = NULL;
|
MovingWindow = NULL;
|
||||||
MovingWindowMoveId = 0;
|
NextTreeNodeOpenVal = false;
|
||||||
|
NextTreeNodeOpenCond = 0;
|
||||||
|
|
||||||
SetNextWindowPosVal = ImVec2(0.0f, 0.0f);
|
NavWindow = NULL;
|
||||||
SetNextWindowSizeVal = ImVec2(0.0f, 0.0f);
|
NavId = NavActivateId = NavActivateDownId = NavActivatePressedId = NavInputId = 0;
|
||||||
SetNextWindowCollapsedVal = false;
|
NavJustTabbedId = NavJustMovedToId = NavNextActivateId = 0;
|
||||||
SetNextWindowPosCond = 0;
|
NavInputSource = ImGuiInputSource_None;
|
||||||
SetNextWindowSizeCond = 0;
|
NavScoringRectScreen = ImRect();
|
||||||
SetNextWindowContentSizeCond = 0;
|
NavScoringCount = 0;
|
||||||
SetNextWindowCollapsedCond = 0;
|
NavWindowingTarget = NULL;
|
||||||
SetNextWindowSizeConstraintRect = ImRect();
|
NavWindowingHighlightTimer = NavWindowingHighlightAlpha = 0.0f;
|
||||||
SetNextWindowSizeConstraintCallback = NULL;
|
NavWindowingToggleLayer = false;
|
||||||
SetNextWindowSizeConstraintCallbackUserData = NULL;
|
NavLayer = 0;
|
||||||
SetNextWindowSizeConstraint = false;
|
NavIdTabCounter = INT_MAX;
|
||||||
SetNextWindowFocus = false;
|
NavIdIsAlive = false;
|
||||||
SetNextTreeNodeOpenVal = false;
|
NavMousePosDirty = false;
|
||||||
SetNextTreeNodeOpenCond = 0;
|
NavDisableHighlight = true;
|
||||||
|
NavDisableMouseHover = false;
|
||||||
|
NavAnyRequest = false;
|
||||||
|
NavInitRequest = false;
|
||||||
|
NavInitRequestFromMove = false;
|
||||||
|
NavInitResultId = 0;
|
||||||
|
NavMoveFromClampedRefRect = false;
|
||||||
|
NavMoveRequest = false;
|
||||||
|
NavMoveRequestForward = ImGuiNavForward_None;
|
||||||
|
NavMoveDir = NavMoveDirLast = ImGuiDir_None;
|
||||||
|
|
||||||
|
ModalWindowDarkeningRatio = 0.0f;
|
||||||
|
OverlayDrawList._Data = &DrawListSharedData;
|
||||||
|
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
|
||||||
|
MouseCursor = ImGuiMouseCursor_Arrow;
|
||||||
|
|
||||||
DragDropActive = false;
|
DragDropActive = false;
|
||||||
DragDropSourceFlags = 0;
|
DragDropSourceFlags = 0;
|
||||||
DragDropMouseButton = -1;
|
DragDropMouseButton = -1;
|
||||||
DragDropTargetId = 0;
|
DragDropTargetId = 0;
|
||||||
|
DragDropAcceptIdCurrRectSurface = 0.0f;
|
||||||
DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;
|
DragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;
|
||||||
DragDropAcceptFrameCount = -1;
|
DragDropAcceptFrameCount = -1;
|
||||||
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
|
memset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));
|
||||||
@ -652,19 +777,13 @@ struct ImGuiContext
|
|||||||
DragSpeedScaleFast = 10.0f;
|
DragSpeedScaleFast = 10.0f;
|
||||||
ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f);
|
ScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f);
|
||||||
TooltipOverrideCount = 0;
|
TooltipOverrideCount = 0;
|
||||||
OsImePosRequest = OsImePosSet = ImVec2(-1.0f, -1.0f);
|
PlatformImePos = PlatformImeLastPos = ImVec2(FLT_MAX, FLT_MAX);
|
||||||
|
|
||||||
ModalWindowDarkeningRatio = 0.0f;
|
|
||||||
OverlayDrawList._Data = &DrawListSharedData;
|
|
||||||
OverlayDrawList._OwnerName = "##Overlay"; // Give it a name for debugging
|
|
||||||
MouseCursor = ImGuiMouseCursor_Arrow;
|
|
||||||
memset(MouseCursorData, 0, sizeof(MouseCursorData));
|
|
||||||
|
|
||||||
|
SettingsLoaded = false;
|
||||||
SettingsDirtyTimer = 0.0f;
|
SettingsDirtyTimer = 0.0f;
|
||||||
|
|
||||||
LogEnabled = false;
|
LogEnabled = false;
|
||||||
LogFile = NULL;
|
LogFile = NULL;
|
||||||
LogClipboard = NULL;
|
|
||||||
LogStartDepth = 0;
|
LogStartDepth = 0;
|
||||||
LogAutoExpandMaxDepth = 2;
|
LogAutoExpandMaxDepth = 2;
|
||||||
|
|
||||||
@ -677,13 +796,14 @@ struct ImGuiContext
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
|
// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().
|
||||||
|
// This is going to be exposed in imgui.h when stabilized enough.
|
||||||
enum ImGuiItemFlags_
|
enum ImGuiItemFlags_
|
||||||
{
|
{
|
||||||
ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true
|
ImGuiItemFlags_AllowKeyboardFocus = 1 << 0, // true
|
||||||
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
ImGuiItemFlags_ButtonRepeat = 1 << 1, // false // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.
|
||||||
ImGuiItemFlags_Disabled = 1 << 2, // false // FIXME-WIP: Disable interactions but doesn't affect visuals. Should be: grey out and disable interactions with widgets that affect data + view widgets (WIP)
|
ImGuiItemFlags_Disabled = 1 << 2, // false // FIXME-WIP: Disable interactions but doesn't affect visuals. Should be: grey out and disable interactions with widgets that affect data + view widgets (WIP)
|
||||||
//ImGuiItemFlags_NoNav = 1 << 3, // false
|
ImGuiItemFlags_NoNav = 1 << 3, // false
|
||||||
//ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
ImGuiItemFlags_NoNavDefaultFocus = 1 << 4, // false
|
||||||
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
ImGuiItemFlags_SelectableDontClosePopup = 1 << 5, // false // MenuItem/Selectable() automatically closes current Popup window
|
||||||
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus
|
||||||
};
|
};
|
||||||
@ -702,14 +822,23 @@ struct IMGUI_API ImGuiDrawContext
|
|||||||
float PrevLineTextBaseOffset;
|
float PrevLineTextBaseOffset;
|
||||||
float LogLinePosY;
|
float LogLinePosY;
|
||||||
int TreeDepth;
|
int TreeDepth;
|
||||||
|
ImU32 TreeDepthMayJumpToParentOnPop; // Store a copy of !g.NavIdIsAlive for TreeDepth 0..31
|
||||||
ImGuiID LastItemId;
|
ImGuiID LastItemId;
|
||||||
ImRect LastItemRect;
|
ImGuiItemStatusFlags LastItemStatusFlags;
|
||||||
bool LastItemRectHoveredRect;
|
ImRect LastItemRect; // Interaction rect
|
||||||
bool MenuBarAppending;
|
ImRect LastItemDisplayRect; // End-user display rect (only valid if LastItemStatusFlags & ImGuiItemStatusFlags_HasDisplayRect)
|
||||||
float MenuBarOffsetX;
|
bool NavHideHighlightOneFrame;
|
||||||
|
bool NavHasScroll; // Set when scrolling can be used (ScrollMax > 0.0f)
|
||||||
|
int NavLayerCurrent; // Current layer, 0..31 (we currently only use 0..1)
|
||||||
|
int NavLayerCurrentMask; // = (1 << NavLayerCurrent) used by ItemAdd prior to clipping.
|
||||||
|
int NavLayerActiveMask; // Which layer have been written to (result from previous frame)
|
||||||
|
int NavLayerActiveMaskNext; // Which layer have been written to (buffer for current frame)
|
||||||
|
bool MenuBarAppending; // FIXME: Remove this
|
||||||
|
ImVec2 MenuBarOffset; // MenuBarOffset.x is sort of equivalent of a per-layer CursorPos.x, saved/restored as we switch to the menu bar. The only situation when MenuBarOffset.y is > 0 if when (SafeAreaPadding.y > FramePadding.y), often used on TVs.
|
||||||
ImVector<ImGuiWindow*> ChildWindows;
|
ImVector<ImGuiWindow*> ChildWindows;
|
||||||
ImGuiStorage* StateStorage;
|
ImGuiStorage* StateStorage;
|
||||||
ImGuiLayoutType LayoutType;
|
ImGuiLayoutType LayoutType;
|
||||||
|
ImGuiLayoutType ParentLayoutType; // Layout type of parent window at the time of Begin()
|
||||||
|
|
||||||
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.
|
||||||
ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default]
|
ImGuiItemFlags ItemFlags; // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default]
|
||||||
@ -733,13 +862,19 @@ struct IMGUI_API ImGuiDrawContext
|
|||||||
CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
|
CurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;
|
||||||
LogLinePosY = -1.0f;
|
LogLinePosY = -1.0f;
|
||||||
TreeDepth = 0;
|
TreeDepth = 0;
|
||||||
|
TreeDepthMayJumpToParentOnPop = 0x00;
|
||||||
LastItemId = 0;
|
LastItemId = 0;
|
||||||
LastItemRect = ImRect();
|
LastItemStatusFlags = 0;
|
||||||
LastItemRectHoveredRect = false;
|
LastItemRect = LastItemDisplayRect = ImRect();
|
||||||
|
NavHideHighlightOneFrame = false;
|
||||||
|
NavHasScroll = false;
|
||||||
|
NavLayerActiveMask = NavLayerActiveMaskNext = 0x00;
|
||||||
|
NavLayerCurrent = 0;
|
||||||
|
NavLayerCurrentMask = 1 << 0;
|
||||||
MenuBarAppending = false;
|
MenuBarAppending = false;
|
||||||
MenuBarOffsetX = 0.0f;
|
MenuBarOffset = ImVec2(0.0f, 0.0f);
|
||||||
StateStorage = NULL;
|
StateStorage = NULL;
|
||||||
LayoutType = ImGuiLayoutType_Vertical;
|
LayoutType = ParentLayoutType = ImGuiLayoutType_Vertical;
|
||||||
ItemWidth = 0.0f;
|
ItemWidth = 0.0f;
|
||||||
ItemFlags = ImGuiItemFlags_Default_;
|
ItemFlags = ImGuiItemFlags_Default_;
|
||||||
TextWrapPos = -1.0f;
|
TextWrapPos = -1.0f;
|
||||||
@ -758,8 +893,7 @@ struct IMGUI_API ImGuiWindow
|
|||||||
char* Name;
|
char* Name;
|
||||||
ImGuiID ID; // == ImHash(Name)
|
ImGuiID ID; // == ImHash(Name)
|
||||||
ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_
|
ImGuiWindowFlags Flags; // See enum ImGuiWindowFlags_
|
||||||
ImVec2 PosFloat;
|
ImVec2 Pos; // Position (always rounded-up to nearest pixel)
|
||||||
ImVec2 Pos; // Position rounded-up to nearest pixel
|
|
||||||
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
ImVec2 Size; // Current size (==SizeFull or collapsed title bar size)
|
||||||
ImVec2 SizeFull; // Size when non collapsed
|
ImVec2 SizeFull; // Size when non collapsed
|
||||||
ImVec2 SizeFullAtLastBegin; // Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
|
ImVec2 SizeFullAtLastBegin; // Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.
|
||||||
@ -770,15 +904,17 @@ struct IMGUI_API ImGuiWindow
|
|||||||
float WindowRounding; // Window rounding at the time of begin.
|
float WindowRounding; // Window rounding at the time of begin.
|
||||||
float WindowBorderSize; // Window border size at the time of begin.
|
float WindowBorderSize; // Window border size at the time of begin.
|
||||||
ImGuiID MoveId; // == window->GetID("#MOVE")
|
ImGuiID MoveId; // == window->GetID("#MOVE")
|
||||||
|
ImGuiID ChildId; // Id of corresponding item in parent window (for child windows)
|
||||||
ImVec2 Scroll;
|
ImVec2 Scroll;
|
||||||
ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
|
ImVec2 ScrollTarget; // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)
|
||||||
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
|
ImVec2 ScrollTargetCenterRatio; // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered
|
||||||
bool ScrollbarX, ScrollbarY;
|
|
||||||
ImVec2 ScrollbarSizes;
|
ImVec2 ScrollbarSizes;
|
||||||
bool Active; // Set to true on Begin()
|
bool ScrollbarX, ScrollbarY;
|
||||||
|
bool Active; // Set to true on Begin(), unless Collapsed
|
||||||
bool WasActive;
|
bool WasActive;
|
||||||
bool WriteAccessed; // Set to true when any widget access the current window
|
bool WriteAccessed; // Set to true when any widget access the current window
|
||||||
bool Collapsed; // Set when collapsing window to become only title-bar
|
bool Collapsed; // Set when collapsing window to become only title-bar
|
||||||
|
bool CollapseToggleWanted;
|
||||||
bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed)
|
bool SkipItems; // Set when items can safely be all clipped (e.g. window not visible or collapsed)
|
||||||
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
bool Appearing; // Set during the frame where the window is appearing (or re-appearing)
|
||||||
bool CloseButton; // Set when the window has a close button (p_open != NULL)
|
bool CloseButton; // Set when the window has a close button (p_open != NULL)
|
||||||
@ -791,9 +927,9 @@ struct IMGUI_API ImGuiWindow
|
|||||||
int AutoFitChildAxises;
|
int AutoFitChildAxises;
|
||||||
ImGuiDir AutoPosLastDirection;
|
ImGuiDir AutoPosLastDirection;
|
||||||
int HiddenFrames;
|
int HiddenFrames;
|
||||||
ImGuiCond SetWindowPosAllowFlags; // store condition flags for next SetWindowPos() call.
|
ImGuiCond SetWindowPosAllowFlags; // store acceptable condition flags for SetNextWindowPos() use.
|
||||||
ImGuiCond SetWindowSizeAllowFlags; // store condition flags for next SetWindowSize() call.
|
ImGuiCond SetWindowSizeAllowFlags; // store acceptable condition flags for SetNextWindowSize() use.
|
||||||
ImGuiCond SetWindowCollapsedAllowFlags; // store condition flags for next SetWindowCollapsed() call.
|
ImGuiCond SetWindowCollapsedAllowFlags; // store acceptable condition flags for SetNextWindowCollapsed() use.
|
||||||
ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
|
ImVec2 SetWindowPosVal; // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)
|
||||||
ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right.
|
ImVec2 SetWindowPosPivot; // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right.
|
||||||
|
|
||||||
@ -801,19 +937,28 @@ struct IMGUI_API ImGuiWindow
|
|||||||
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
ImVector<ImGuiID> IDStack; // ID stack. ID are hashes seeded with the value at the top of the stack
|
||||||
ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
ImRect ClipRect; // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.
|
||||||
ImRect WindowRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window.
|
ImRect WindowRectClipped; // = WindowRect just after setup in Begin(). == window->Rect() for root window.
|
||||||
ImRect InnerRect;
|
ImRect InnerRect, InnerClipRect;
|
||||||
int LastFrameActive;
|
int LastFrameActive;
|
||||||
float ItemWidthDefault;
|
float ItemWidthDefault;
|
||||||
ImGuiSimpleColumns MenuColumns; // Simplified columns storage for menu items
|
ImGuiMenuColumns MenuColumns; // Simplified columns storage for menu items
|
||||||
ImGuiStorage StateStorage;
|
ImGuiStorage StateStorage;
|
||||||
ImVector<ImGuiColumnsSet> ColumnsStorage;
|
ImVector<ImGuiColumnsSet> ColumnsStorage;
|
||||||
float FontWindowScale; // Scale multiplier per-window
|
float FontWindowScale; // User scale multiplier per-window
|
||||||
ImDrawList* DrawList;
|
|
||||||
|
ImDrawList* DrawList; // == &DrawListInst (for backward compatibility reason with code using imgui_internal.h we keep this a pointer)
|
||||||
|
ImDrawList DrawListInst;
|
||||||
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
ImGuiWindow* ParentWindow; // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.
|
||||||
ImGuiWindow* RootWindow; // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window.
|
ImGuiWindow* RootWindow; // Point to ourself or first ancestor that is not a child window.
|
||||||
ImGuiWindow* RootNonPopupWindow; // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
ImGuiWindow* RootWindowForTitleBarHighlight; // Point to ourself or first ancestor which will display TitleBgActive color when this window is active.
|
||||||
|
ImGuiWindow* RootWindowForTabbing; // Point to ourself or first ancestor which can be CTRL-Tabbed into.
|
||||||
|
ImGuiWindow* RootWindowForNav; // Point to ourself or first ancestor which doesn't have the NavFlattened flag.
|
||||||
|
|
||||||
|
ImGuiWindow* NavLastChildNavWindow; // When going to the menu bar, we remember the child window we came from. (This could probably be made implicit if we kept g.Windows sorted by last focused including child window.)
|
||||||
|
ImGuiID NavLastIds[2]; // Last known NavId for this window, per layer (0/1)
|
||||||
|
ImRect NavRectRel[2]; // Reference rectangle, in window relative space
|
||||||
|
|
||||||
// Navigation / Focus
|
// Navigation / Focus
|
||||||
|
// FIXME-NAV: Merge all this with the new Nav system, at least the request variables should be moved to ImGuiContext
|
||||||
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()
|
int FocusIdxAllCounter; // Start at -1 and increase as assigned via FocusItemRegister()
|
||||||
int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through)
|
int FocusIdxTabCounter; // (same, but only count widgets which you can Tab through)
|
||||||
int FocusIdxAllRequestCurrent; // Item being requested for focus
|
int FocusIdxAllRequestCurrent; // Item being requested for focus
|
||||||
@ -835,7 +980,7 @@ public:
|
|||||||
float CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; }
|
float CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; }
|
||||||
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; }
|
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; }
|
||||||
ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); }
|
ImRect TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); }
|
||||||
float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; }
|
float MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? DC.MenuBarOffset.y + CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; }
|
||||||
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
|
ImRect MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -843,12 +988,13 @@ public:
|
|||||||
struct ImGuiItemHoveredDataBackup
|
struct ImGuiItemHoveredDataBackup
|
||||||
{
|
{
|
||||||
ImGuiID LastItemId;
|
ImGuiID LastItemId;
|
||||||
|
ImGuiItemStatusFlags LastItemStatusFlags;
|
||||||
ImRect LastItemRect;
|
ImRect LastItemRect;
|
||||||
bool LastItemRectHoveredRect;
|
ImRect LastItemDisplayRect;
|
||||||
|
|
||||||
ImGuiItemHoveredDataBackup() { Backup(); }
|
ImGuiItemHoveredDataBackup() { Backup(); }
|
||||||
void Backup() { ImGuiWindow* window = GImGui->CurrentWindow; LastItemId = window->DC.LastItemId; LastItemRect = window->DC.LastItemRect; LastItemRectHoveredRect = window->DC.LastItemRectHoveredRect; }
|
void Backup() { ImGuiWindow* window = GImGui->CurrentWindow; LastItemId = window->DC.LastItemId; LastItemStatusFlags = window->DC.LastItemStatusFlags; LastItemRect = window->DC.LastItemRect; LastItemDisplayRect = window->DC.LastItemDisplayRect; }
|
||||||
void Restore() const { ImGuiWindow* window = GImGui->CurrentWindow; window->DC.LastItemId = LastItemId; window->DC.LastItemRect = LastItemRect; window->DC.LastItemRectHoveredRect = LastItemRectHoveredRect; }
|
void Restore() const { ImGuiWindow* window = GImGui->CurrentWindow; window->DC.LastItemId = LastItemId; window->DC.LastItemStatusFlags = LastItemStatusFlags; window->DC.LastItemRect = LastItemRect; window->DC.LastItemDisplayRect = LastItemDisplayRect; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -869,21 +1015,29 @@ namespace ImGui
|
|||||||
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
|
IMGUI_API void BringWindowToFront(ImGuiWindow* window);
|
||||||
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
|
IMGUI_API void BringWindowToBack(ImGuiWindow* window);
|
||||||
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
|
||||||
|
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
|
||||||
|
|
||||||
IMGUI_API void Initialize();
|
IMGUI_API void Initialize(ImGuiContext* context);
|
||||||
|
IMGUI_API void Shutdown(ImGuiContext* context); // Since 1.60 this is a _private_ function. You can call DestroyContext() to destroy the context created by CreateContext().
|
||||||
|
|
||||||
|
IMGUI_API void NewFrameUpdateHoveredWindowAndCaptureFlags();
|
||||||
|
|
||||||
IMGUI_API void MarkIniSettingsDirty();
|
IMGUI_API void MarkIniSettingsDirty();
|
||||||
IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(ImGuiID type_id);
|
IMGUI_API void MarkIniSettingsDirty(ImGuiWindow* window);
|
||||||
|
IMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name);
|
||||||
IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id);
|
IMGUI_API ImGuiWindowSettings* FindWindowSettings(ImGuiID id);
|
||||||
|
|
||||||
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
|
IMGUI_API void SetActiveID(ImGuiID id, ImGuiWindow* window);
|
||||||
|
IMGUI_API ImGuiID GetActiveID();
|
||||||
|
IMGUI_API void SetFocusID(ImGuiID id, ImGuiWindow* window);
|
||||||
IMGUI_API void ClearActiveID();
|
IMGUI_API void ClearActiveID();
|
||||||
IMGUI_API void SetHoveredID(ImGuiID id);
|
IMGUI_API void SetHoveredID(ImGuiID id);
|
||||||
|
IMGUI_API ImGuiID GetHoveredID();
|
||||||
IMGUI_API void KeepAliveID(ImGuiID id);
|
IMGUI_API void KeepAliveID(ImGuiID id);
|
||||||
|
|
||||||
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
|
IMGUI_API void ItemSize(const ImVec2& size, float text_offset_y = 0.0f);
|
||||||
IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
|
IMGUI_API void ItemSize(const ImRect& bb, float text_offset_y = 0.0f);
|
||||||
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool ItemAdd(const ImRect& bb, ImGuiID id, const ImRect* nav_bb = NULL);
|
||||||
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
IMGUI_API bool ItemHoverable(const ImRect& bb, ImGuiID id);
|
||||||
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
IMGUI_API bool IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);
|
||||||
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
|
IMGUI_API bool FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true); // Return true if focus is requested
|
||||||
@ -894,12 +1048,22 @@ namespace ImGui
|
|||||||
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
IMGUI_API void PushItemFlag(ImGuiItemFlags option, bool enabled);
|
||||||
IMGUI_API void PopItemFlag();
|
IMGUI_API void PopItemFlag();
|
||||||
|
|
||||||
IMGUI_API void OpenPopupEx(ImGuiID id, bool reopen_existing);
|
IMGUI_API void SetCurrentFont(ImFont* font);
|
||||||
|
|
||||||
|
IMGUI_API void OpenPopupEx(ImGuiID id);
|
||||||
IMGUI_API void ClosePopup(ImGuiID id);
|
IMGUI_API void ClosePopup(ImGuiID id);
|
||||||
|
IMGUI_API void ClosePopupsOverWindow(ImGuiWindow* ref_window);
|
||||||
IMGUI_API bool IsPopupOpen(ImGuiID id);
|
IMGUI_API bool IsPopupOpen(ImGuiID id);
|
||||||
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
IMGUI_API bool BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);
|
||||||
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
|
IMGUI_API void BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);
|
||||||
|
IMGUI_API ImGuiWindow* GetFrontMostPopupModal();
|
||||||
|
|
||||||
|
IMGUI_API void NavInitWindow(ImGuiWindow* window, bool force_reinit);
|
||||||
|
IMGUI_API void NavMoveRequestCancel();
|
||||||
|
IMGUI_API void ActivateItem(ImGuiID id); // Remotely activate a button, checkbox, tree node etc. given its unique ID. activation is queued and processed on the next frame when the item is encountered again.
|
||||||
|
|
||||||
|
IMGUI_API float GetNavInputAmount(ImGuiNavInput n, ImGuiInputReadMode mode);
|
||||||
|
IMGUI_API ImVec2 GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInputReadMode mode, float slow_factor = 0.0f, float fast_factor = 0.0f);
|
||||||
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
||||||
|
|
||||||
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
||||||
@ -923,30 +1087,30 @@ namespace ImGui
|
|||||||
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
IMGUI_API void RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);
|
||||||
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f);
|
IMGUI_API void RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f);
|
||||||
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0);
|
IMGUI_API void RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0);
|
||||||
IMGUI_API void RenderTriangle(ImVec2 pos, ImGuiDir dir, float scale = 1.0f);
|
IMGUI_API void RenderArrow(ImVec2 pos, ImGuiDir dir, float scale = 1.0f);
|
||||||
IMGUI_API void RenderBullet(ImVec2 pos);
|
IMGUI_API void RenderBullet(ImVec2 pos);
|
||||||
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz);
|
IMGUI_API void RenderCheckMark(ImVec2 pos, ImU32 col, float sz);
|
||||||
|
IMGUI_API void RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags = ImGuiNavHighlightFlags_TypeDefault); // Navigation highlight
|
||||||
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
||||||
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
|
IMGUI_API const char* FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.
|
||||||
|
|
||||||
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
IMGUI_API bool ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0,0), ImGuiButtonFlags flags = 0);
|
||||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||||
IMGUI_API bool ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags = 0);
|
|
||||||
|
|
||||||
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, const char* format, float power, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);
|
IMGUI_API bool SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* format, float power);
|
||||||
IMGUI_API bool SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format);
|
IMGUI_API bool SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* format);
|
||||||
|
|
||||||
IMGUI_API bool DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power);
|
IMGUI_API bool DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, const char* format, float power);
|
||||||
IMGUI_API bool DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power);
|
IMGUI_API bool DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* format, float power);
|
||||||
IMGUI_API bool DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format);
|
IMGUI_API bool DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* format);
|
||||||
|
|
||||||
IMGUI_API bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags);
|
IMGUI_API bool InputFloatN(const char* label, float* v, int components, const char* format, ImGuiInputTextFlags extra_flags);
|
||||||
IMGUI_API bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags);
|
IMGUI_API bool InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags);
|
||||||
IMGUI_API bool InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags);
|
IMGUI_API bool InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* format, ImGuiInputTextFlags extra_flags = 0);
|
||||||
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision);
|
IMGUI_API bool InputScalarAsWidgetReplacement(const ImRect& bb, ImGuiID id, const char* label, ImGuiDataType data_type, void* data_ptr, const char* format);
|
||||||
|
|
||||||
IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
|
IMGUI_API void ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);
|
||||||
IMGUI_API void ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags);
|
IMGUI_API void ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags);
|
||||||
@ -957,10 +1121,12 @@ namespace ImGui
|
|||||||
|
|
||||||
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size);
|
IMGUI_API void PlotEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size);
|
||||||
|
|
||||||
IMGUI_API int ParseFormatPrecision(const char* fmt, int default_value);
|
IMGUI_API const char* ParseFormatTrimDecorationsLeading(const char* format);
|
||||||
IMGUI_API float RoundScalar(float value, int decimal_precision);
|
IMGUI_API const char* ParseFormatTrimDecorations(const char* format, char* buf, int buf_size);
|
||||||
|
IMGUI_API int ParseFormatPrecision(const char* format, int default_value);
|
||||||
|
IMGUI_API float RoundScalarWithFormat(const char* format, float value);
|
||||||
|
|
||||||
// Shade functions
|
// Shade functions (write over already created vertices)
|
||||||
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDrawVert* vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);
|
IMGUI_API void ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDrawVert* vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);
|
||||||
IMGUI_API void ShadeVertsLinearAlphaGradientForLeftToRightText(ImDrawVert* vert_start, ImDrawVert* vert_end, float gradient_p0_x, float gradient_p1_x);
|
IMGUI_API void ShadeVertsLinearAlphaGradientForLeftToRightText(ImDrawVert* vert_start, ImDrawVert* vert_end, float gradient_p0_x, float gradient_p1_x);
|
||||||
IMGUI_API void ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);
|
IMGUI_API void ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// stb_rect_pack.h - v0.10 - public domain - rectangle packing
|
// stb_rect_pack.h - v0.11 - public domain - rectangle packing
|
||||||
// Sean Barrett 2014
|
// Sean Barrett 2014
|
||||||
//
|
//
|
||||||
// Useful for e.g. packing rectangular textures into an atlas.
|
// Useful for e.g. packing rectangular textures into an atlas.
|
||||||
@ -27,11 +27,14 @@
|
|||||||
// Sean Barrett
|
// Sean Barrett
|
||||||
// Minor features
|
// Minor features
|
||||||
// Martins Mozeiko
|
// Martins Mozeiko
|
||||||
|
// github:IntellectualKitty
|
||||||
|
//
|
||||||
// Bugfixes / warning fixes
|
// Bugfixes / warning fixes
|
||||||
// Jeremy Jaussaud
|
// Jeremy Jaussaud
|
||||||
//
|
//
|
||||||
// Version history:
|
// Version history:
|
||||||
//
|
//
|
||||||
|
// 0.11 (2017-03-03) return packing success/fail result
|
||||||
// 0.10 (2016-10-25) remove cast-away-const to avoid warnings
|
// 0.10 (2016-10-25) remove cast-away-const to avoid warnings
|
||||||
// 0.09 (2016-08-27) fix compiler warnings
|
// 0.09 (2016-08-27) fix compiler warnings
|
||||||
// 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0)
|
// 0.08 (2015-09-13) really fix bug with empty rects (w=0 or h=0)
|
||||||
@ -43,9 +46,7 @@
|
|||||||
//
|
//
|
||||||
// LICENSE
|
// LICENSE
|
||||||
//
|
//
|
||||||
// This software is dual-licensed to the public domain and under the following
|
// See end of file for license information.
|
||||||
// license: you are granted a perpetual, irrevocable license to copy, modify,
|
|
||||||
// publish, and distribute this file as you see fit.
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@ -77,7 +78,7 @@ typedef int stbrp_coord;
|
|||||||
typedef unsigned short stbrp_coord;
|
typedef unsigned short stbrp_coord;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STBRP_DEF void stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
|
STBRP_DEF int stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int num_rects);
|
||||||
// Assign packed locations to rectangles. The rectangles are of type
|
// Assign packed locations to rectangles. The rectangles are of type
|
||||||
// 'stbrp_rect' defined below, stored in the array 'rects', and there
|
// 'stbrp_rect' defined below, stored in the array 'rects', and there
|
||||||
// are 'num_rects' many of them.
|
// are 'num_rects' many of them.
|
||||||
@ -98,6 +99,9 @@ STBRP_DEF void stbrp_pack_rects (stbrp_context *context, stbrp_rect *rects, int
|
|||||||
// arrays will probably produce worse packing results than calling it
|
// arrays will probably produce worse packing results than calling it
|
||||||
// a single time with the full rectangle array, but the option is
|
// a single time with the full rectangle array, but the option is
|
||||||
// available.
|
// available.
|
||||||
|
//
|
||||||
|
// The function returns 1 if all of the rectangles were successfully
|
||||||
|
// packed and 0 otherwise.
|
||||||
|
|
||||||
struct stbrp_rect
|
struct stbrp_rect
|
||||||
{
|
{
|
||||||
@ -202,8 +206,10 @@ struct stbrp_context
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#define STBRP__NOTUSED(v) (void)(v)
|
#define STBRP__NOTUSED(v) (void)(v)
|
||||||
|
#define STBRP__CDECL __cdecl
|
||||||
#else
|
#else
|
||||||
#define STBRP__NOTUSED(v) (void)sizeof(v)
|
#define STBRP__NOTUSED(v) (void)sizeof(v)
|
||||||
|
#define STBRP__CDECL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -488,17 +494,14 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i
|
|||||||
STBRP_ASSERT(cur->next == NULL);
|
STBRP_ASSERT(cur->next == NULL);
|
||||||
|
|
||||||
{
|
{
|
||||||
stbrp_node *L1 = NULL, *L2 = NULL;
|
|
||||||
int count=0;
|
int count=0;
|
||||||
cur = context->active_head;
|
cur = context->active_head;
|
||||||
while (cur) {
|
while (cur) {
|
||||||
L1 = cur;
|
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
cur = context->free_head;
|
cur = context->free_head;
|
||||||
while (cur) {
|
while (cur) {
|
||||||
L2 = cur;
|
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
@ -509,7 +512,7 @@ static stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, i
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rect_height_compare(const void *a, const void *b)
|
static int STBRP__CDECL rect_height_compare(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||||
@ -520,18 +523,7 @@ static int rect_height_compare(const void *a, const void *b)
|
|||||||
return (p->w > q->w) ? -1 : (p->w < q->w);
|
return (p->w > q->w) ? -1 : (p->w < q->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rect_width_compare(const void *a, const void *b)
|
static int STBRP__CDECL rect_original_order(const void *a, const void *b)
|
||||||
{
|
|
||||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
|
||||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
|
||||||
if (p->w > q->w)
|
|
||||||
return -1;
|
|
||||||
if (p->w < q->w)
|
|
||||||
return 1;
|
|
||||||
return (p->h > q->h) ? -1 : (p->h < q->h);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int rect_original_order(const void *a, const void *b)
|
|
||||||
{
|
{
|
||||||
const stbrp_rect *p = (const stbrp_rect *) a;
|
const stbrp_rect *p = (const stbrp_rect *) a;
|
||||||
const stbrp_rect *q = (const stbrp_rect *) b;
|
const stbrp_rect *q = (const stbrp_rect *) b;
|
||||||
@ -544,9 +536,9 @@ static int rect_original_order(const void *a, const void *b)
|
|||||||
#define STBRP__MAXVAL 0xffff
|
#define STBRP__MAXVAL 0xffff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
|
STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
|
||||||
{
|
{
|
||||||
int i;
|
int i, all_rects_packed = 1;
|
||||||
|
|
||||||
// we use the 'was_packed' field internally to allow sorting/unsorting
|
// we use the 'was_packed' field internally to allow sorting/unsorting
|
||||||
for (i=0; i < num_rects; ++i) {
|
for (i=0; i < num_rects; ++i) {
|
||||||
@ -576,8 +568,56 @@ STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int n
|
|||||||
// unsort
|
// unsort
|
||||||
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);
|
STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);
|
||||||
|
|
||||||
// set was_packed flags
|
// set was_packed flags and all_rects_packed status
|
||||||
for (i=0; i < num_rects; ++i)
|
for (i=0; i < num_rects; ++i) {
|
||||||
rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
|
rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
|
||||||
|
if (!rects[i].was_packed)
|
||||||
|
all_rects_packed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// return the all_rects_packed status
|
||||||
|
return all_rects_packed;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
This software is available under 2 licenses -- choose whichever you prefer.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
ALTERNATIVE A - MIT License
|
||||||
|
Copyright (c) 2017 Sean Barrett
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||||
|
software, either in source code form or as a compiled binary, for any purpose,
|
||||||
|
commercial or non-commercial, and by any means.
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||||
|
software dedicate any and all copyright interest in the software to the public
|
||||||
|
domain. We make this dedication for the benefit of the public at large and to
|
||||||
|
the detriment of our heirs and successors. We intend this dedication to be an
|
||||||
|
overt act of relinquishment in perpetuity of all present and future rights to
|
||||||
|
this software under copyright law.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// [ImGui] this is a slightly modified version of stb_truetype.h 1.9. Those changes would need to be pushed into nothings/sb
|
// [ImGui] this is a slightly modified version of stb_textedit.h 1.9. Those changes would need to be pushed into nothings/stb
|
||||||
// [ImGui] - fixed linestart handler when over last character of multi-line buffer + simplified existing code (#588, #815)
|
// [ImGui] - fixed linestart handler when over last character of multi-line buffer + simplified existing code (#588, #815)
|
||||||
// [ImGui] - fixed a state corruption/crash bug in stb_text_redo and stb_textedit_discard_redo (#715)
|
// [ImGui] - fixed a state corruption/crash bug in stb_text_redo and stb_textedit_discard_redo (#715)
|
||||||
// [ImGui] - fixed a crash bug in stb_textedit_discard_redo (#681)
|
// [ImGui] - fixed a crash bug in stb_textedit_discard_redo (#681)
|
||||||
@ -677,9 +677,8 @@ static int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API paste: replace existing selection with passed-in text
|
// API paste: replace existing selection with passed-in text
|
||||||
static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)
|
static int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *text, int len)
|
||||||
{
|
{
|
||||||
STB_TEXTEDIT_CHARTYPE *text = (STB_TEXTEDIT_CHARTYPE *) ctext;
|
|
||||||
// if there's a selection, the paste should delete it
|
// if there's a selection, the paste should delete it
|
||||||
stb_textedit_clamp(str, state);
|
stb_textedit_clamp(str, state);
|
||||||
stb_textedit_delete_selection(str,state);
|
stb_textedit_delete_selection(str,state);
|
||||||
|
File diff suppressed because it is too large
Load Diff
312
Source/ThirdParty/ImGuiLibrary/README.md
vendored
312
Source/ThirdParty/ImGuiLibrary/README.md
vendored
@ -3,109 +3,198 @@ dear imgui,
|
|||||||
[![Build Status](https://travis-ci.org/ocornut/imgui.svg?branch=master)](https://travis-ci.org/ocornut/imgui)
|
[![Build Status](https://travis-ci.org/ocornut/imgui.svg?branch=master)](https://travis-ci.org/ocornut/imgui)
|
||||||
[![Coverity Status](https://scan.coverity.com/projects/4720/badge.svg)](https://scan.coverity.com/projects/4720)
|
[![Coverity Status](https://scan.coverity.com/projects/4720/badge.svg)](https://scan.coverity.com/projects/4720)
|
||||||
|
|
||||||
(This library is free and will stay free, but needs your support to sustain its development. There are lots of desirable new features and maintenance to do. If you work for a company using ImGui or have the means to do so, please consider financial support)
|
_(This library is free but needs your support to sustain its development. There are many desirable features and maintenance ahead. If you are an individual using dear imgui, please consider donating via Patreon or PayPal. If your company is using dear imgui, please consider financial support (e.g. sponsoring a few weeks/months of development. I can invoice for technical support, custom development etc. E-mail: omarcornut at gmail)._
|
||||||
|
|
||||||
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/imgui) [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
Monthly donations via Patreon:
|
||||||
|
<br>[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/imgui)
|
||||||
|
|
||||||
dear imgui (AKA ImGui), is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).
|
One-off donations via PayPal:
|
||||||
|
<br>[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
||||||
|
|
||||||
ImGui is designed to enable fast iteration and empower programmers to create content creation tools and visualization/ debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and thus lacks certain features normally found in more high-level libraries.
|
Dear ImGui is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).
|
||||||
|
|
||||||
ImGui is particularly suited to integration in realtime 3D applications, fullscreen applications, embedded applications, games, or any applications on consoles platforms where operating system features are non-standard.
|
Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and lacks certain features normally found in more high-level libraries.
|
||||||
|
|
||||||
ImGui is self-contained within a few files that you can easily copy and compile into your application/engine:
|
Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.
|
||||||
|
|
||||||
- imgui.cpp
|
Dear ImGui is self-contained within a few files that you can easily copy and compile into your application/engine:
|
||||||
- imgui.h
|
- imgui.cpp
|
||||||
- imgui_demo.cpp
|
- imgui.h
|
||||||
- imgui_draw.cpp
|
- imgui_demo.cpp
|
||||||
- imgui_internal.h
|
- imgui_draw.cpp
|
||||||
- imconfig.h (empty by default, user-editable)
|
- imgui_internal.h
|
||||||
- stb_rect_pack.h
|
- imconfig.h (empty by default, user-editable)
|
||||||
- stb_textedit.h
|
- stb_rect_pack.h
|
||||||
- stb_truetype.h
|
- stb_textedit.h
|
||||||
|
- stb_truetype.h
|
||||||
|
|
||||||
No specific build process is required. You can add the .cpp files to your project or #include them from an existing file.
|
No specific build process is required. You can add the .cpp files to your project or #include them from an existing file.
|
||||||
|
|
||||||
Your code passes mouse/keyboard inputs and settings to ImGui (see example applications for more details). After ImGui is setup, you can use it like in this example:
|
### Usage
|
||||||
|
|
||||||
![screenshot of sample code alongside its output with ImGui](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/code_sample_01.png)
|
Your code passes mouse/keyboard/gamepad inputs and settings to Dear ImGui (see example applications for more details). After Dear ImGui is setup, you can use it from \_anywhere\_ in your program loop:
|
||||||
|
|
||||||
ImGui outputs vertex buffers and simple command-lists that you can render in your application. The number of draw calls and state changes is typically very small. Because it doesn't know or touch graphics state directly, you can call ImGui commands anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate ImGui with your existing codebase.
|
Code:
|
||||||
|
```cpp
|
||||||
|
ImGui::Text("Hello, world %d", 123);
|
||||||
|
if (ImGui::Button("Save"))
|
||||||
|
{
|
||||||
|
// do stuff
|
||||||
|
}
|
||||||
|
ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
|
||||||
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||||
|
```
|
||||||
|
Result:
|
||||||
|
<br>![sample code output](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/code_sample_02.png)
|
||||||
|
<br>_(settings: Dark style (left), Light style (right) / Font: Roboto-Medium, 16px / Rounding: 5)_
|
||||||
|
|
||||||
_A common misunderstanding is to think that immediate mode gui == immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes, as the gui functions as called by the user. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._
|
Code:
|
||||||
|
```cpp
|
||||||
|
// Create a window called "My First Tool", with a menu bar.
|
||||||
|
ImGui::Begin("My First Tool", &my_tool_active, ImGuiWindowFlags_MenuBar);
|
||||||
|
if (ImGui::BeginMenuBar())
|
||||||
|
{
|
||||||
|
if (ImGui::BeginMenu("File"))
|
||||||
|
{
|
||||||
|
if (ImGui::MenuItem("Open..", "Ctrl+O")) { /* Do stuff */ }
|
||||||
|
if (ImGui::MenuItem("Save", "Ctrl+S")) { /* Do stuff */ }
|
||||||
|
if (ImGui::MenuItem("Close", "Ctrl+W")) { my_tool_active = false; }
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
ImGui::EndMenuBar();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui allows you create elaborate tools as well as very short-lived ones. On the extreme side of short-liveness: using the Edit&Continue feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, etc.
|
// Edit a color (stored as ~4 floats)
|
||||||
|
ImGui::ColorEdit4("Color", my_color);
|
||||||
|
|
||||||
Binaries/Demo
|
// Plot some values
|
||||||
|
const float my_values[] = { 0.2f, 0.1f, 1.0f, 0.5f, 0.9f, 2.2f };
|
||||||
|
ImGui::PlotLines("Frame Times", my_values, IM_ARRAYSIZE(my_values));
|
||||||
|
|
||||||
|
// Display contents in a scrolling region
|
||||||
|
ImGui::TextColored(ImVec4(1,1,0,1), "Important Stuff");
|
||||||
|
ImGui::BeginChild("Scrolling");
|
||||||
|
for (int n = 0; n < 50; n++)
|
||||||
|
ImGui::Text("%04d: Some text", n);
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::End();
|
||||||
|
```
|
||||||
|
Result:
|
||||||
|
<br>![sample code output](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/code_sample_03_color.gif)
|
||||||
|
|
||||||
|
### How it works
|
||||||
|
|
||||||
|
Check out the References section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize state duplication, state synchronization and state storage from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.
|
||||||
|
|
||||||
|
Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes is typically very small. Because it doesn't know or touch graphics state directly, you can call ImGui commands anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate dear imgui with your existing codebase.
|
||||||
|
|
||||||
|
_A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely._
|
||||||
|
|
||||||
|
Dear ImGui allows you create elaborate tools as well as very short-lived ones. On the extreme side of short-liveness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game making editor/framework, etc.
|
||||||
|
|
||||||
|
Demo Binaries
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at the features of ImGui, you can download Windows binaries of the demo app here.
|
You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let me know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:
|
||||||
- [imgui-demo-binaries-20161113.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20161113.zip) (Windows binaries, ImGui 1.49+ 2016/11/13, 5 executables, 588 KB)
|
- [imgui-demo-binaries-20180407.zip](http://www.miracleworld.net/imgui/binaries/imgui-demo-binaries-20180407.zip) (Windows binaries, Dear ImGui 1.60 built 2018/04/07, 5 executables)
|
||||||
|
|
||||||
|
The demo applications are unfortunately not yet DPI aware so expect some blurriness on a 4K screen. For DPI awareness you can load/reload your font at different scale, and scale your Style with `style.ScaleAllSizes()`.
|
||||||
|
|
||||||
Bindings
|
Bindings
|
||||||
--------
|
--------
|
||||||
|
|
||||||
_NB: those third-party bindings may be more or less maintained, more or less close to the spirit of original API and therefore I cannot give much guarantee about them. People who create language bindings sometimes haven't used the C++ API themselves (for the good reason that they aren't C++ users). ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The [examples/](https://github.com/ocornut/imgui/tree/master/examples) folder is populated with applications doing just that. If you are an experienced programmer and at ease with those concepts, it should take you less than an hour to integrate Dear ImGui in your custom engine, but make sure to spend time reading the FAQ, the comments and other documentation!
|
||||||
|
|
||||||
_Integrating Dear ImGui within your custom engine is a matter of wiring mouse/keyboard inputs and providing a render function that can bind a texture and render simple textured triangles. The examples/ folder is populated with applications doing just that. If you are an experienced programmer it should take you less than an hour to integrate Dear ImGui in your custom engine, but make sure to spend time reading the FAQ, the comments and other documentation!_
|
_NB: those third-party bindings may be more or less maintained, more or less close to the original API (as people who create language bindings sometimes haven't used the C++ API themselves.. for the good reason that they aren't C++ users). Dear ImGui was designed with C++ in mind and some of the subtleties may be lost in translation with other languages. If your language supports it, I would suggest replicating the function overloading and default parameters used in the original, else the API may be harder to use. In doubt, please check the original C++ version first!_
|
||||||
|
|
||||||
Languages:
|
Languages: (third-party bindings)
|
||||||
- cimgui: thin c-api wrapper for ImGui https://github.com/Extrawurst/cimgui
|
- C: [cimgui](https://github.com/Extrawurst/cimgui)
|
||||||
- ImGui.NET: An ImGui wrapper for .NET Core https://github.com/mellinoe/ImGui.NET
|
- C#/.Net: [ImGui.NET](https://github.com/mellinoe/ImGui.NET)
|
||||||
- imgui-rs: Rust bindings for dear imgui https://github.com/Gekkio/imgui-rs
|
- ChaiScript: [imgui-chaiscript](https://github.com/JuJuBoSc/imgui-chaiscript)
|
||||||
- DerelictImgui: Dynamic bindings for the D programming language: https://github.com/Extrawurst/DerelictImgui
|
- D: [DerelictImgui](https://github.com/Extrawurst/DerelictImgui)
|
||||||
- CyImGui: Python bindings for dear imgui using Cython: https://github.com/chromy/cyimgui
|
- Go: [go-imgui](https://github.com/Armored-Dragon/go-imgui)
|
||||||
- pyimgui: Another Python bindings for dear imgui: https://github.com/swistakm/pyimgui
|
- Haxe/hxcpp: [linc_imgui](https://github.com/Aidan63/linc_imgui)
|
||||||
- LUA: https://github.com/patrickriordan/imgui_lua_bindings
|
- JavaScript: [imgui-js](https://github.com/flyover/imgui-js)
|
||||||
|
- Lua: [imgui_lua_bindings](https://github.com/patrickriordan/imgui_lua_bindings)
|
||||||
|
- Odin: [odin-dear_imgui](https://github.com/ThisDrunkDane/odin-dear_imgui)
|
||||||
|
- Pascal: [imgui-pas](https://github.com/dpethes/imgui-pas)
|
||||||
|
- Python [CyImGui](https://github.com/chromy/cyimgui)
|
||||||
|
- Python [pyimgui](https://github.com/swistakm/pyimgui)
|
||||||
|
- Rust: [imgui-rs](https://github.com/Gekkio/imgui-rs)
|
||||||
|
|
||||||
Frameworks:
|
Frameworks:
|
||||||
- Main ImGui repository include examples for DirectX9, DirectX10, DirectX11, OpenGL2/3, Vulkan, Allegro 5, SDL+GL2/3, iOS and Marmalade: https://github.com/ocornut/imgui/tree/master/examples
|
- DirectX 9, DirectX 10, DirectX 11, DirectX 12: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged PR: DirectX12 example (with issues) https://github.com/ocornut/imgui/pull/301
|
- OpenGL 2/3 (with GLFW or SDL): [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged PR: SDL2 + OpenGLES + Emscripten example https://github.com/ocornut/imgui/pull/336
|
- Vulkan (with GLFW): [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged PR: FreeGlut + OpenGL2 example https://github.com/ocornut/imgui/pull/801
|
- Allegro 5, iOS, Marmalade: [examples/](https://github.com/ocornut/imgui/tree/master/examples)
|
||||||
- Unmerged PR: Native Win32 and OSX example https://github.com/ocornut/imgui/pull/281
|
- Unmerged PR: SDL2 + OpenGLES + Emscripten: [#336](https://github.com/ocornut/imgui/pull/336)
|
||||||
- Unmerged PR: Android Example https://github.com/ocornut/imgui/pull/421
|
- Unmerged PR: FreeGlut + OpenGL2: [#801](https://github.com/ocornut/imgui/pull/801)
|
||||||
- Cinder backend for dear imgui https://github.com/simongeilfus/Cinder-ImGui
|
- Unmerged PR: Native Win32 and OSX: [#281](https://github.com/ocornut/imgui/pull/281)
|
||||||
- FlexGUI: Flexium/SFML backend for dear imgui https://github.com/DXsmiley/FlexGUI
|
- Unmerged PR: Android: [#421](https://github.com/ocornut/imgui/pull/421)
|
||||||
- IrrIMGUI: Irrlicht backend for dear imgui https://github.com/ZahlGraf/IrrIMGUI
|
- Cinder: [Cinder-ImGui](https://github.com/simongeilfus/Cinder-ImGui)
|
||||||
- LÖVE backend for dear imgui https://github.com/slages/love-imgui
|
- Cocos2d-x: [imguix](https://github.com/c0i/imguix), [issue #551](https://github.com/ocornut/imgui/issues/551)
|
||||||
- Ogre backend for dear imgui https://bitbucket.org/LMCrashy/ogreimgui/src
|
- Flexium/SFML: [FlexGUI](https://github.com/DXsmiley/FlexGUI)
|
||||||
- ofxImGui: openFrameworks backend for dear imgui https://github.com/jvcleave/ofxImGui
|
- GML/GameMakerStudio2: [ImGuiGML](https://marketplace.yoyogames.com/assets/6221/imguigml)
|
||||||
- SFML backend for dear imgui https://github.com/EliasD/imgui-sfml
|
- Irrlicht: [IrrIMGUI](https://github.com/ZahlGraf/IrrIMGUI)
|
||||||
- SFML backend for dear imgui https://github.com/Mischa-Alff/imgui-backends
|
- Ogre: [ogreimgui](https://bitbucket.org/LMCrashy/ogreimgui/src)
|
||||||
- cocos2d-x with imgui https://github.com/c0i/imguix https://github.com/ocornut/imgui/issues/551
|
- OpenFrameworks: [ofxImGui](https://github.com/jvcleave/ofxImGui)
|
||||||
- NanoRT: software raytraced version https://github.com/syoyo/imgui/tree/nanort/examples/raytrace_example
|
- OpenSceneGraph/OSG: [gist](https://gist.github.com/fulezi/d2442ca7626bf270226014501357042c)
|
||||||
|
- LÖVE: [love-imgui](https://github.com/slages/love-imgui)
|
||||||
|
- NanoRT: [syoyo/imgui](https://github.com/syoyo/imgui/tree/nanort)
|
||||||
|
- Qt3d: [imgui-qt3d](https://github.com/alpqr/imgui-qt3d)
|
||||||
|
- Unreal Engine 4: [segross/UnrealImGui](https://github.com/segross/UnrealImGui) or [sronsse/UnrealEngine_ImGui](https://github.com/sronsse/UnrealEngine_ImGui)
|
||||||
|
- SFML: [imgui-sfml](https://github.com/EliasD/imgui-sfml) or [imgui-backends](https://github.com/Mischa-Alff/imgui-backends)
|
||||||
|
|
||||||
For other bindings: see [this page](https://github.com/ocornut/imgui/wiki/Links/).
|
For other bindings: see [this page](https://github.com/ocornut/imgui/wiki/Links/). Also see [wiki](https://github.com/ocornut/imgui/wiki) for a few other links and ideas. Contact me if you would like to add to those lists.
|
||||||
Please contact me with the Issues tracker or Twitter to fix/update this list.
|
|
||||||
|
Roadmap
|
||||||
|
-------
|
||||||
|
Some of the goals for 2018 are:
|
||||||
|
- Finish work on gamepad/keyboard controls. (see [#787](https://github.com/ocornut/imgui/issues/787))
|
||||||
|
- Finish work on viewports and multiple OS windows management. (see [#1542](https://github.com/ocornut/imgui/issues/1542))
|
||||||
|
- Finish work on docking, tabs. (see [#351](https://github.com/ocornut/imgui/issues/351#issuecomment-346865709))
|
||||||
|
- Make Columns better. (they are currently pretty terrible!)
|
||||||
|
- Make the examples look better, improve styles, improve font support, make the examples hi-DPI aware.
|
||||||
|
|
||||||
Gallery
|
Gallery
|
||||||
-------
|
-------
|
||||||
|
|
||||||
See the [Screenshots Thread](https://github.com/ocornut/imgui/issues/123) for some user creations.
|
User screenshots:
|
||||||
|
<br>[Gallery Part 1](https://github.com/ocornut/imgui/issues/123) (Feb 2015 to Feb 2016)
|
||||||
|
<br>[Gallery Part 2](https://github.com/ocornut/imgui/issues/539) (Feb 2016 to Aug 2016)
|
||||||
|
<br>[Gallery Part 3](https://github.com/ocornut/imgui/issues/772) (Aug 2016 to Jan 2017)
|
||||||
|
<br>[Gallery Part 4](https://github.com/ocornut/imgui/issues/973) (Jan 2017 to Aug 2017)
|
||||||
|
<br>[Gallery Part 5](https://github.com/ocornut/imgui/issues/1269) (Aug 2017 to Feb 2018)
|
||||||
|
<br>[Gallery Part 6](https://github.com/ocornut/imgui/issues/1607) (Feb 2018 onward)
|
||||||
|
<br>Also see the [Mega screenshots](https://github.com/ocornut/imgui/issues/1273) for an idea of the available features.
|
||||||
|
|
||||||
![screenshot 1](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v148/examples_01.png)
|
Various tools
|
||||||
[![screenshot game](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v149/gallery_TheDragonsTrap-01-thumb.jpg)](https://cloud.githubusercontent.com/assets/8225057/20628927/33e14cac-b329-11e6-80f6-9524e93b048a.png)
|
[![screenshot game](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v149/gallery_TheDragonsTrap-01-thumb.jpg)](https://cloud.githubusercontent.com/assets/8225057/20628927/33e14cac-b329-11e6-80f6-9524e93b048a.png)
|
||||||
![screenshot 2](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v148/examples_02.png)
|
|
||||||
|
[![screenshot tool](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white_preview.jpg)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/editor_white.png)
|
||||||
|
|
||||||
|
![screenshot demo](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/v160-misc-classic.png)
|
||||||
|
|
||||||
[![screenshot profiler](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v148/profiler-880.jpg)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v148/profiler.png)
|
[![screenshot profiler](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v148/profiler-880.jpg)](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v148/profiler.png)
|
||||||
|
|
||||||
![screenshot 3](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v143/test_window_01.png)
|
Dear ImGui can load TTF/OTF fonts. UTF-8 is supported for text display and input. Here using Arial Unicode font to display Japanese. Initialize custom font with:
|
||||||
![screenshot 4](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v143/test_window_03.png)
|
Code:
|
||||||
![screenshot 5](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v140/test_window_05_menus.png)
|
```cpp
|
||||||
![screenshot 6](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v143/skinning_sample_02.png)
|
|
||||||
![screenshot 7](https://cloud.githubusercontent.com/assets/8225057/7903336/96f0fb7c-07d0-11e5-95d6-41c6a1595e5a.png)
|
|
||||||
|
|
||||||
ImGui can load TTF fonts. UTF-8 is supported for text display and input. Here using Arial Unicode font to display Japanese. Initialize custom font with:
|
|
||||||
```
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.Fonts->AddFontFromFileTTF("ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
io.Fonts->AddFontFromFileTTF("NotoSansCJKjp-Medium.otf", 20.0f, NULL, io.Fonts->GetGlyphRangesJapanese());
|
||||||
|
|
||||||
// For Microsoft IME, pass your HWND to enable IME positioning:
|
|
||||||
io.ImeWindowHandle = my_hwnd;
|
|
||||||
```
|
```
|
||||||
![Japanese screenshot](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/code_sample_01_jp.png)
|
```cpp
|
||||||
|
ImGui::Text(u8"こんにちは!テスト %d", 123);
|
||||||
|
if (ImGui::Button(u8"ロード"))
|
||||||
|
{
|
||||||
|
// do stuff
|
||||||
|
}
|
||||||
|
ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
|
||||||
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
|
||||||
|
```
|
||||||
|
Result:
|
||||||
|
<br>![sample code output](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v160/code_sample_02_jp.png)
|
||||||
|
<br>_(settings: Dark style (left), Light style (right) / Font: NotoSansCJKjp-Medium, 20px / Rounding: 5)_
|
||||||
|
|
||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
@ -115,6 +204,8 @@ The Immediate Mode GUI paradigm may at first appear unusual to some users. This
|
|||||||
- [A presentation by Rickard Gustafsson and Johannes Algelind](http://www.cse.chalmers.se/edu/year/2011/course/TDA361/Advanced%20Computer%20Graphics/IMGUI.pdf).
|
- [A presentation by Rickard Gustafsson and Johannes Algelind](http://www.cse.chalmers.se/edu/year/2011/course/TDA361/Advanced%20Computer%20Graphics/IMGUI.pdf).
|
||||||
- [Jari Komppa's tutorial on building an ImGui library](http://iki.fi/sol/imgui/).
|
- [Jari Komppa's tutorial on building an ImGui library](http://iki.fi/sol/imgui/).
|
||||||
- [Casey Muratori's original video that popularized the concept](https://mollyrocket.com/861).
|
- [Casey Muratori's original video that popularized the concept](https://mollyrocket.com/861).
|
||||||
|
- [Nicolas Guillemot's CppCon'16 flash-talk about Dear ImGui](https://www.youtube.com/watch?v=LSRJ1jZq90k).
|
||||||
|
- [Thierry Excoffier's Zero Memory Widget](http://perso.univ-lyon1.fr/thierry.excoffier/ZMW/).
|
||||||
|
|
||||||
See the [Links page](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to different languages and frameworks.
|
See the [Links page](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to different languages and frameworks.
|
||||||
|
|
||||||
@ -124,72 +215,76 @@ Frequently Asked Question (FAQ)
|
|||||||
<b>Where is the documentation?</b>
|
<b>Where is the documentation?</b>
|
||||||
|
|
||||||
- The documentation is at the top of imgui.cpp + effectively imgui.h.
|
- The documentation is at the top of imgui.cpp + effectively imgui.h.
|
||||||
- Example code is in imgui_demo.cpp and particularly the ImGui::ShowTestWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output.
|
- Example code is in imgui_demo.cpp and particularly the ImGui::ShowDemoWindow() function. It covers most features of ImGui so you can read the code and call the function itself to see its output.
|
||||||
- Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder.
|
- Standalone example applications using e.g. OpenGL/DirectX are provided in the examples/ folder.
|
||||||
- We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.
|
- We obviously needs better documentation! Consider contributing or becoming a [Patron](http://www.patreon.com/imgui) to promote this effort.
|
||||||
|
|
||||||
|
<b>Which version should I get?</b>
|
||||||
|
|
||||||
|
I occasionally tag [Releases](https://github.com/ocornut/imgui/releases) but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.
|
||||||
|
|
||||||
|
<b>Who uses Dear ImGui?</b>
|
||||||
|
|
||||||
|
See the [Software using dear imgui page](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) for an (incomplete) list of games/software which are publicly known to use dear imgui. Please add yours if you can!
|
||||||
|
|
||||||
<b>Why the odd dual naming, "dear imgui" vs "ImGui"?</b>
|
<b>Why the odd dual naming, "dear imgui" vs "ImGui"?</b>
|
||||||
|
|
||||||
The library started its life and is best known as "ImGui" only due to the fact that I didn't give it a proper name when I released it. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations. It seemed confusing and unfair to hog the name. To reduce the ambiguity without affecting existing codebases, I have decided on an alternate, longer name "dear imgui" that people can use to refer to this specific library in ambiguous situations.
|
The library started its life and is best known as "ImGui" only due to the fact that I didn't give it a proper name when I released it. However, the term IMGUI (immediate-mode graphical user interface) was coined before and is being used in variety of other situations. It seemed confusing and unfair to hog the name. To reduce the ambiguity without affecting existing codebases, I have decided on an alternate, longer name "dear imgui" that people can use to refer to this specific library in ambiguous situations.
|
||||||
|
|
||||||
<b>How do I update to a newer version of ImGui?</b>
|
<b>How can I tell whether to dispatch mouse/keyboard to imgui or to my application?</b>
|
||||||
<br><b>What is ImTextureID and how do I display an image?</b>
|
<br><b>How can I display an image? What is ImTextureID, how does it works?</b>
|
||||||
<br><b>I integrated ImGui in my engine and the text or lines are blurry..</b>
|
<br><b>How can I have multiple widgets with the same label or without a label? A primer on labels and the ID Stack.</b>
|
||||||
<br><b>I integrated ImGui in my engine and some elements are disappearing when I move windows around..</b>
|
|
||||||
<br><b>How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs.</b>
|
|
||||||
<br><b>How can I tell when ImGui wants my mouse/keyboard inputs and when I can pass them to my application?</b>
|
|
||||||
<br><b>How can I load a different font than the default?</b>
|
<br><b>How can I load a different font than the default?</b>
|
||||||
<br><b>How can I easily use icons in my application?</b>
|
<br><b>How can I easily use icons in my application?</b>
|
||||||
<br><b>How can I load multiple fonts?</b>
|
<br><b>How can I load multiple fonts?</b>
|
||||||
<br><b>How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?</b>
|
<br><b>How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?</b>
|
||||||
<br><b>How can I use the drawing facilities without an ImGui window? (using ImDrawList API)</b>
|
<br><b>How can I use the drawing facilities without an Dear ImGui window? (using ImDrawList API)</b>
|
||||||
|
<br><b>I integrated Dear ImGui in my engine and the text or lines are blurry..</b>
|
||||||
|
<br><b>I integrated Dear ImGui in my engine and some elements are disappearing when I move windows around..</b>
|
||||||
|
<br><b>How can I help?</b>
|
||||||
|
|
||||||
See the FAQ in imgui.cpp for answers.
|
See the FAQ in imgui.cpp for answers.
|
||||||
|
|
||||||
<b>How do you use ImGui on a platform that may not have a mouse or keyboard?</b>
|
<b>How do you use Dear ImGui on a platform that may not have a mouse or keyboard?</b>
|
||||||
|
|
||||||
I recommend using [Synergy](http://synergy-project.org) ([sources](https://github.com/symless/synergy)). In particular, the _src/micro/uSynergy.c_ file contains a small client that you can use on any platform to connect to your host PC. You can seamlessly use your PC input devices from a video game console or a tablet. ImGui allows to increase the hit box of widgets (via the _TouchPadding_ setting) to accommodate a little for the lack of precision of touch inputs, but it is recommended you use a mouse to allow optimising for screen real-estate.
|
You can control Dear ImGui with a gamepad, see the explanation in imgui.cpp about how to use the navigation feature (short version: map your gamepad inputs into the `io.NavInputs[]` array and set `io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad`).
|
||||||
|
|
||||||
<b>Can you create elaborate/serious tools with ImGui?</b>
|
You can share your computer mouse seamlessly with your console/tablet/phone using [Synergy](http://synergy-project.org). This is the preferred solution for developer productivity. In particular, their [micro-synergy-client](https://github.com/symless/micro-synergy-client) repo there is _uSynergy.c_ sources for a small embeddable that you can use on any platform to connect to your host PC using Synergy 1.x. You may also use a third party solution such as [Remote ImGui](https://github.com/JordiRos/remoteimgui).
|
||||||
|
|
||||||
Yes. I have written data browsers, debuggers, profilers and all sort of non-trivial tools with the library. In my experience the simplicity of the API is very empowering. Your UI runs close to your live data. Make the tools always-on and everybody in the team will be inclined to create new tools (as opposed to more "offline" UI toolkits where only a fraction of your team effectively creates tools).
|
For touch inputs, you can increase the hit box of widgets (via the _style.TouchPadding_ setting) to accommodate a little for the lack of precision of touch inputs, but it is recommended you use a mouse or gamepad to allow optimizing for screen real-estate and precision.
|
||||||
|
|
||||||
ImGui is very programmer centric and the immediate-mode GUI paradigm might requires you to readjust some habits before you can realize its full potential. Many programmers have unfortunately been taught by their environment to make unnecessarily complicated things. ImGui is about making things that are simple, efficient and powerful.
|
<b>Can you create elaborate/serious tools with Dear ImGui?</b>
|
||||||
|
|
||||||
<b>Is ImGui fast?</b>
|
Yes. People have written game editors, data browsers, debuggers, profilers and all sort of non-trivial tools with the library. In my experience the simplicity of the API is very empowering. Your UI runs close to your live data. Make the tools always-on and everybody in the team will be inclined to create new tools (as opposed to more "offline" UI toolkits where only a fraction of your team effectively creates tools). The list of sponsors below is also an indicator that serious game teams have been using the library.
|
||||||
|
|
||||||
Probably fast enough for most uses. Down to the foundation of its visual design, ImGui is engineered to be fairly performant both in term of CPU and GPU usage. Running elaborate code and creating elaborate UI will of course have a cost but ImGui aims to minimize it.
|
Dear ImGui is very programmer centric and the immediate-mode GUI paradigm might requires you to readjust some habits before you can realize its full potential. Dear ImGui is about making things that are simple, efficient and powerful.
|
||||||
|
|
||||||
Mileage may vary but the following screenshot can give you a rough idea of the cost of running and rendering UI code (In the case of a trivial demo application like this one, your driver/os setup are likely to be the bottleneck. Testing performance as part of a real application is recommended).
|
<b>Can you reskin the look of Dear ImGui?</b>
|
||||||
|
|
||||||
![performance screenshot](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v138/performance_01.png)
|
You can alter the look of the interface to some degree: changing colors, sizes, padding, rounding, fonts. However, as Dear ImGui is designed and optimized to create debug tools, the amount of skinning you can apply is limited. There is only so much you can stray away from the default look and feel of the interface. Below is a screenshot from [LumixEngine](https://github.com/nem0/LumixEngine) with custom colors + a docking/tabs extension (both of which you can find in the Issues section and will eventually be merged):
|
||||||
|
|
||||||
This is showing framerate for the full application loop on my 2011 iMac running Windows 7, OpenGL, AMD Radeon HD 6700M with an optimized executable. In contrast, librairies featuring higher-quality rendering and layouting techniques may have a higher resources footprint.
|
![LumixEngine](https://raw.githubusercontent.com/wiki/ocornut/imgui/web/v151/lumix-201710-rearranged.png)
|
||||||
|
|
||||||
If you intend to display large lists of items (say, 1000+) it can be beneficial for your code to perform clipping manually - one way is using helpers such as ImGuiListClipper - in order to avoid submitting them to ImGui in the first place. Even though ImGui will discard your clipped items it still needs to calculate their size and that overhead will add up if you have thousands of items. If you can handle clipping and height positionning yourself then browsing a list with millions of items isn't a problem.
|
|
||||||
|
|
||||||
<b>Can you reskin the look of ImGui?</b>
|
|
||||||
|
|
||||||
You can alter the look of the interface to some degree: changing colors, sizes, padding, rounding, fonts. However, as ImGui is designed and optimised to create debug tools, the amount of skinning you can apply is limited. There is only so much you can stray away from the default look and feel of the interface.
|
|
||||||
|
|
||||||
This is [LumixEngine](https://github.com/nem0/LumixEngine) with a minor skinning hack + a docking/tabs extension (both of which you can find in the Issues section and will eventually be merged).
|
|
||||||
|
|
||||||
[![Skinning in LumixEngine](https://cloud.githubusercontent.com/assets/8225057/13198792/92808c5c-d812-11e5-9507-16b63918b05b.jpg)](https://cloud.githubusercontent.com/assets/8225057/13044612/59f07aec-d3cf-11e5-8ccb-39adf2e13e69.png)
|
|
||||||
|
|
||||||
<b>Why using C++ (as opposed to C)?</b>
|
<b>Why using C++ (as opposed to C)?</b>
|
||||||
|
|
||||||
ImGui takes advantage of a few C++ features for convenience but nothing anywhere Boost-insanity/quagmire. In particular, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience but could be removed.
|
Dear ImGui takes advantage of a few C++ languages features for convenience but nothing anywhere Boost-insanity/quagmire. Dear ImGui does NOT require C++11 so it can be used with most old C++ compilers. Dear ImGui doesn't use any C++ header file. Language-wise, function overloading and default parameters are used to make the API easier to use and code more terse. Doing so I believe the API is sitting on a sweet spot and giving up on those features would make the API more cumbersome. Other features such as namespace, constructors and templates (in the case of the ImVector<> class) are also relied on as a convenience.
|
||||||
|
|
||||||
There is an unofficial but reasonably maintained [c-api for ImGui](https://github.com/Extrawurst/cimgui) by Stephan Dilly. I would suggest using your target language functionality to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. It was really designed with C++ in mind and may not make the same amount of sense with another language. Also see [Links](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to other languages.
|
There is an reasonably maintained [c-api for ImGui](https://github.com/Extrawurst/cimgui) by Stephan Dilly designed for binding in other languages. I would suggest using your target language functionalities to try replicating the function overloading and default parameters used in C++ else the API may be harder to use. Also see [Links](https://github.com/ocornut/imgui/wiki/Links) for third-party bindings to other languages.
|
||||||
|
|
||||||
Donate
|
Support dear imgui
|
||||||
------
|
------------------
|
||||||
|
|
||||||
<b>Can I donate to support the development of ImGui?</b>
|
<b>How can I help financing further development of Dear ImGui?</b>
|
||||||
|
|
||||||
[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/imgui) [![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
Your contributions are keeping the library alive. If you are an individual using dear imgui, please consider donating to enable me to spend more time improving the library.
|
||||||
|
|
||||||
I'm currently an independent developer and your contributions are useful. I have setup an [**ImGui Patreon page**](http://www.patreon.com/imgui) if you want to donate and enable me to spend more time improving the library. If your company uses ImGui please consider making a contribution. One-off donations are also greatly appreciated. I am available for hire to work on or with ImGui. Thanks!
|
Monthly donations via Patreon:
|
||||||
|
<br>[![Patreon](https://cloud.githubusercontent.com/assets/8225057/5990484/70413560-a9ab-11e4-8942-1a63607c0b00.png)](http://www.patreon.com/imgui)
|
||||||
|
|
||||||
|
One-off donations via PayPal:
|
||||||
|
<br>[![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Q73FPZ9C526U)
|
||||||
|
|
||||||
|
If your company uses dear imgui, please consider financial support (e.g. sponsoring a few weeks/months of development. I can invoice for private support, custom development etc. E-mail: omarcornut at gmail). Thanks!
|
||||||
|
|
||||||
Credits
|
Credits
|
||||||
-------
|
-------
|
||||||
@ -204,21 +299,26 @@ Embeds [stb_textedit.h, stb_truetype.h, stb_rectpack.h](https://github.com/nothi
|
|||||||
|
|
||||||
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. And everybody posting feedback, questions and patches on the GitHub.
|
Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. And everybody posting feedback, questions and patches on the GitHub.
|
||||||
|
|
||||||
Ongoing ImGui development is financially supported on [**Patreon**](http://www.patreon.com/imgui).
|
Ongoing dear imgui development is financially supported on [**Patreon**](http://www.patreon.com/imgui) and by private sponsors.
|
||||||
|
|
||||||
Double-chocolate sponsors:
|
Double-chocolate sponsors:
|
||||||
|
- Blizzard Entertainment
|
||||||
- Media Molecule
|
- Media Molecule
|
||||||
- Mobigame
|
- Mobigame
|
||||||
- Insomniac Games (sponsored the gamepad/keyboard navigation branch)
|
- Insomniac Games
|
||||||
- Aras Pranckevičius
|
- Aras Pranckevičius
|
||||||
|
- Lizardcube
|
||||||
|
- Greggman
|
||||||
|
- DotEmu
|
||||||
|
|
||||||
Salty caramel supporters:
|
Salty caramel supporters:
|
||||||
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Recognition Robotics, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko.
|
- Jetha Chan, Wild Sheep Studio, Pastagames, Mārtiņš Možeiko, Daniel Collin, Recognition Robotics, Chris Genova, ikrima, Glenn Fiedler, Geoffrey Evans, Dakko Dakko, Mercury Labs, Singularity Demo Group, Mischa Alff, Sebastien Ronsse, Lionel Landwerlin, Nikolay Ivanov, Ron Gilbert.
|
||||||
|
|
||||||
Caramel supporters:
|
Caramel supporters:
|
||||||
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Jeff Roberts, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, [Kit framework](http://svkonsult.se/kit), Josh Faust, Martin Donlon, Quinton, Felix.
|
- Michel Courtine, César Leblic, Dale Kim, Alex Evans, Rui Figueira, Paul Patrashcu, Jerome Lanquetot, Ctrl Alt Ninja, Paul Fleming, Neil Henning, Stephan Dilly, Neil Blakey-Milner, Aleksei, NeiloGD, Justin Paver, FiniteSol, Vincent Pancaldi, James Billot, Robin Hübner, furrtek, Eric, Simon Barratt, Game Atelier, Julian Bosch, Simon Lundmark, Vincent Hamm, Farhan Wali, Jeff Roberts, Matt Reyer, Colin Riley, Victor Martins, Josh Simmons, Garrett Hoofman, Sergio Gonzales, Andrew Berridge, Roy Eltham, Game Preservation Society, Kit framework, Josh Faust, Martin Donlon, Quinton, Felix, Andrew Belt, Codecat, Cort Stratton, Claudio Canepa, Doug McNabb, Emmanuel Julien, Guillaume Chereau, Jeffrey Slutter, Jeremiah Deckard, r-lyeh, Roger Clark, Nekith, Joshua Fisher, Malte Hoffmann, Mustafa Karaalioglu, Merlyn Morgan-Graham, Per Vognsen, Fabian Giesen, Jan Staubach, Matt Hargett, John Shearer, Jesse Chounard, kingcoopa, Miloš Tošić, Jonas Bernemann, Johan Andersson, Nathan Hartman, Michael Labbe, Tomasz Golebiowski, Louis Schnellbach, Felipe Alfonso, Jimmy Andrews, Bojan Endrovski, Robin Berg Pettersen, Rachel Crawford, Edsel Malasig, Andrew Johnson, Sean Hunter, Jordan Mellow.
|
||||||
|
|
||||||
And other supporters; thanks!
|
And other supporters; thanks!
|
||||||
|
(Please contact me or PR if you would like to be added or removed from this list)
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
287
Source/ThirdParty/ImGuiLibrary/TODO.txt
vendored
Normal file
287
Source/ThirdParty/ImGuiLibrary/TODO.txt
vendored
Normal file
@ -0,0 +1,287 @@
|
|||||||
|
dear imgui
|
||||||
|
ISSUES & TODO LIST
|
||||||
|
|
||||||
|
Issue numbers (#) refer to github issues listed at https://github.com/ocornut/imgui/issues/XXXX
|
||||||
|
The list below consist mostly of ideas noted down before they are requested/discussed by users (at which point they usually exist on the github issue tracker).
|
||||||
|
It's mostly a bunch of personal notes, probably incomplete. Feel free to query if you have any questions.
|
||||||
|
|
||||||
|
- doc/test: add a proper documentation+regression testing system (#435)
|
||||||
|
- doc/test: checklist app to verify binding/integration of imgui (test inputs, rendering, callback, etc.).
|
||||||
|
- doc/tips: tips of the day: website? applet in imgui_club?
|
||||||
|
- project: folder or separate repository with maintained helpers (e.g. imgui_memory_editor.h, imgui_stl.h, maybe imgui_dock would be there?)
|
||||||
|
|
||||||
|
- window: calling SetNextWindowSize() every frame with <= 0 doesn't do anything, may be useful to allow (particularly when used for a single axis). (#690)
|
||||||
|
- window: add a way for very transient windows (non-saved, temporary overlay over hundreds of objects) to "clean" up from the global window list. perhaps a lightweight explicit cleanup pass.
|
||||||
|
- window: auto-fit feedback loop when user relies on any dynamic layout (window width multiplier, column) appears weird to end-user. clarify.
|
||||||
|
- window: allow resizing of child windows (possibly given min/max for each axis?.)
|
||||||
|
- window: background options for child windows, border option (disable rounding).
|
||||||
|
- window: resizing from any sides? done. > need backends to honor mouse cursors properly. (#822)
|
||||||
|
- window: resize from borders: support some form of outer padding to make it easier to grab borders. (#822)
|
||||||
|
- window: begin with *p_open == false should return false.
|
||||||
|
- window: get size/pos helpers given names (see discussion in #249)
|
||||||
|
- window: a collapsed window can be stuck behind the main menu bar?
|
||||||
|
- window: when window is very small, prioritize resize button over close button.
|
||||||
|
- window: detect extra End() call that pop the "Debug" window out and assert at End() call site instead of at end of frame.
|
||||||
|
- window: increase minimum size of a window with menus or fix the menu rendering so that it doesn't look odd.
|
||||||
|
- window: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon?
|
||||||
|
- window: expose contents size. (#1045)
|
||||||
|
- window: GetWindowSize() returns (0,0) when not calculated? (#1045)
|
||||||
|
- window: freeze window flag: if not focused/hovered, return false, render with previous ImDrawList. and/or reduce refresh rate.
|
||||||
|
!- scrolling: allow immediately effective change of scroll after Begin() if we haven't appended items yet.
|
||||||
|
- scrolling/clipping: separator on the initial position of a window is not visible (cursorpos.y <= clippos.y). (2017-08-20: can't repro)
|
||||||
|
|
||||||
|
- drawdata: make it easy to clone (or swap?) a ImDrawData so user can easily save that data if they use threaded renderering.
|
||||||
|
- drawlist: end-user probably can't call Clear() directly because we expect a texture to be pushed in the stack.
|
||||||
|
- drawlist: maintaining bounding box per command would allow to merge draw command when clipping isn't relied on (typical non-scrolling window or non-overflowing column would merge with previous command).
|
||||||
|
- drawlist: primtiives/helpers to manipulate vertices post submission, so e.g. a quad/rect can be resized to fit later submitted content, _without_ using the ChannelSplit api
|
||||||
|
- drawlist: make it easier to toggle AA per primitive, so we can use e.g. non-AA fill + AA borders more naturally
|
||||||
|
- drawlist: non-AA strokes have gaps between points (#593, #288), especially RenderCheckmark().
|
||||||
|
- drawlist: would be good to be able to deep copy a draw list (ImVector= op?).
|
||||||
|
- drawlist/opt: AddRect() axis aligned pixel aligned (no-aa) could use 8 triangles instead of 16 and no normal calculation.
|
||||||
|
|
||||||
|
- main: considering adding an Init() function? some constructs are awkward in the implementation because of the lack of them.
|
||||||
|
- main: find a way to preserve relative orders of multiple reappearing windows (so an app toggling between "modes" e.g. fullscreen vs all tools) won't lose relative ordering.
|
||||||
|
- main: IsItemHovered() make it more consistent for various type of widgets, widgets with multiple components, etc. also effectively IsHovered() region sometimes differs from hot region, e.g tree nodes
|
||||||
|
- main: IsItemHovered() info stored in a stack? so that 'if TreeNode() { Text; TreePop; } if IsHovered' return the hover state of the TreeNode?
|
||||||
|
- main: rename the main "Debug" window to avoid ID collision with user who may want to use "Debug" with specific flags.
|
||||||
|
|
||||||
|
- widgets: display mode: widget-label, label-widget (aligned on column or using fixed size), label-newline-tab-widget etc. (#395)
|
||||||
|
- widgets: clean up widgets internal toward exposing everything and stabilizing imgui_internals.h.
|
||||||
|
- widgets: add visauls for Disabled/ReadOnly mode and expose publicly (#211)
|
||||||
|
- widgets: add always-allow-overlap mode.
|
||||||
|
- widgets: alignment options in style (e.g. center Selectable, Right-Align within Button, etc.) #1260
|
||||||
|
- widgets: activate by identifier (trigger button, focus given id)
|
||||||
|
|
||||||
|
- input text: clean up the mess caused by converting UTF-8 <> wchar. the code is rather inefficient right now and super fragile.
|
||||||
|
- input text: reorganize event handling, allow CharFilter to modify buffers, allow multiple events? (#541)
|
||||||
|
- input text: expose CursorPos in char filter event (#816)
|
||||||
|
- input text: access public fields via a non-callback API e.g. InputTextGetState("xxx") that may return NULL if not active.
|
||||||
|
- input text: flag to disable live update of the user buffer (also applies to float/int text input) (#701)
|
||||||
|
- input text: way to dynamically grow the buffer without forcing the user to initially allocate for worse case, e.g. more natural std::string (follow up on #200)
|
||||||
|
- input text: hover tooltip could show unclamped text
|
||||||
|
- input text: option to Tab after an Enter validation.
|
||||||
|
- input text: add ImGuiInputTextFlags_EnterToApply? (off #218)
|
||||||
|
- input text: easier ways to update buffer (from source char*) while owned. preserve some sort of cursor position for multi-line text.
|
||||||
|
- input text: add discard flag (e.g. ImGuiInputTextFlags_DiscardActiveBuffer) or make it easier to clear active focus for text replacement during edition (#725)
|
||||||
|
- input text: display bug when clicking a drag/slider after an input text in a different window has all-selected text (order dependant). actually a very old bug but no one appears to have noticed it.
|
||||||
|
- input text multi-line: don't directly call AddText() which does an unnecessary vertex reserve for character count prior to clipping. and/or more line-based clipping to AddText(). and/or reorganize TextUnformatted/RenderText for more efficiency for large text (e.g TextUnformatted could clip and log separately, etc).
|
||||||
|
- input text multi-line: support for cut/paste without selection (cut/paste the current line)
|
||||||
|
- input text multi-line: line numbers? status bar? (follow up on #200)
|
||||||
|
- input text multi-line: behave better when user changes input buffer while editing is active (even though it is illegal behavior). namely, the change of buffer can create a scrollbar glitch (#725)
|
||||||
|
- input text multi-line: better horizontal scrolling support (#383, #1224)
|
||||||
|
- input text: allow centering/positioning text so that ctrl+clicking Drag or Slider keeps the textual value at the same pixel position.
|
||||||
|
- input number: optional range min/max for Input*() functions
|
||||||
|
- input number: holding [-]/[+] buttons could increase the step speed non-linearly (or user-controlled)
|
||||||
|
- input number: use mouse wheel to step up/down
|
||||||
|
- input number: applying arithmetics ops (+,-,*,/) messes up with text edit undo stack.
|
||||||
|
|
||||||
|
- layout: helper or a way to express ImGui::SameLine(ImGui::GetCursorStartPos().x + ImGui::CalcItemWidth() + ImGui::GetStyle().ItemInnerSpacing.x); in a simpler manner.
|
||||||
|
- layout: generalization of the above: a concept equivalent to word processor ruler tab stop ~ mini columns (position in X, no clipping implied) (vaguely relate to #267, #395, also what is used internally for menu items)
|
||||||
|
- layout: horizontal layout helper (#97)
|
||||||
|
- layout: horizontal flow until no space left (#404)
|
||||||
|
- layout: more generic alignment state (left/right/centered) for single items?
|
||||||
|
- layout: clean up the InputFloatN/SliderFloatN/ColorEdit4 layout code. item width should include frame padding.
|
||||||
|
- layout: BeginGroup() needs a border option. (~#1496)
|
||||||
|
- layout: vertical alignement of mixed height items (e.g. buttons) within a same line (#1284)
|
||||||
|
|
||||||
|
- columns: sizing policy (e.g. for each column: fixed size, %, fill, distribute default size among fills) (#513, #125)
|
||||||
|
- columns: add a conditional parameter to SetColumnOffset() (#513, #125)
|
||||||
|
- columns: headers. reorderable. (#513, #125)
|
||||||
|
- columns: optional sorting modifiers (up/down), sort list so sorting can be done multi-critera. notify user when sort order changed.
|
||||||
|
- columns: option to alternate background colors on odd/even scanlines.
|
||||||
|
- columns: allow columns to recurse.
|
||||||
|
- columns: allow a same columns set to be interrupted by e.g. CollapsingHeader and resume with columns in sync when moving them.
|
||||||
|
- columns: separator function or parameter that works within the column (currently Separator() bypass all columns) (#125)
|
||||||
|
- columns: flag to add horizontal separator above/below?
|
||||||
|
- columns/layout: setup minimum line height (equivalent of automatically calling AlignFirstTextHeightToWidgets)
|
||||||
|
|
||||||
|
!- color: the color conversion helpers/types are a mess and needs sorting out.
|
||||||
|
- color: (api breaking) ImGui::ColorConvertXXX functions should be loose ImColorConvertXX to match imgui_internals.h
|
||||||
|
- coloredit: it is still somehow awkward to copy colors around (unless going through Hex mode).
|
||||||
|
|
||||||
|
- plot: full featured plot/graph api w/ scrolling, zooming etc. all bell & whistle. why not!
|
||||||
|
- plot: PlotLines() should use the polygon-stroke facilities, less verticles (currently issues with averaging normals)
|
||||||
|
- plot: make it easier for user to draw extra stuff into the graph (e.g: draw basis, highlight certain points, 2d plots, multiple plots)
|
||||||
|
- plot: "smooth" automatic scale over time, user give an input 0.0(full user scale) 1.0(full derived from value)
|
||||||
|
- plot: option/feature: draw the zero line
|
||||||
|
- plot: option/feature: draw grid, vertical markers
|
||||||
|
- plot: option/feature: draw unit
|
||||||
|
- plot: add a helper e.g. Plot(char* label, float value, float time_span=2.0f) that stores values and Plot them for you - probably another function name. and/or automatically allow to plot ANY displayed value (more reliance on stable ID)
|
||||||
|
|
||||||
|
- clipper: ability to force display 1 item in the list would be convenient (for patterns where we need to set active id etc.)
|
||||||
|
- clipper: ability to disable the clipping through a simple flag/bool.
|
||||||
|
- clipper: ability to run without knowing full count in advance.
|
||||||
|
|
||||||
|
- splitter/separator: formalize the splitter idiom into an official api (we want to handle n-way split) (#319)
|
||||||
|
|
||||||
|
- dock: docking extension
|
||||||
|
- dock: dock out from a collapsing header? would work nicely but need emitting window to keep submitting the code.
|
||||||
|
|
||||||
|
- tabs: re-ordering, close buttons, context menu, persistent order (#261, #351)
|
||||||
|
|
||||||
|
- ext: stl-ish friendly extension (imgui_stl.h) that has wrapped for std::string, std::vector etc.
|
||||||
|
|
||||||
|
- button: provide a button that looks framed.
|
||||||
|
- image/image button: misalignment on padded/bordered button?
|
||||||
|
- image/image button: parameters are confusing, image() has tint_col,border_col whereas imagebutton() has bg_col/tint_col. Even thou they are different parameters ordering could be more consistent. can we fix that?
|
||||||
|
- image button: not taking an explicit id is odd.
|
||||||
|
- slider: allow using the [-]/[+] buttons used by InputFloat()/InputInt()
|
||||||
|
- slider: initial absolute click is imprecise. change to relative movement slider (same as scrollbar).
|
||||||
|
- slider: add dragging-based widgets to edit values with mouse (on 2 axises), saving screen real-estate.
|
||||||
|
- slider: tint background based on value (e.g. v_min -> v_max, or use 0.0f either side of the sign)
|
||||||
|
- slider: precision dragging
|
||||||
|
- slider: step option (#1183)
|
||||||
|
- knob: rotating knob widget (#942)
|
||||||
|
- slider & drag: int data passing through a float
|
||||||
|
- drag float: up/down axis
|
||||||
|
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
|
||||||
|
|
||||||
|
- combo: use clipper: make it easier to disable clipper with a single flag.
|
||||||
|
- combo: flag for BeginCombo to not return true when unchanged (#1182)
|
||||||
|
- combo: a way/helper to customize the combo preview (#1658)
|
||||||
|
- combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203)
|
||||||
|
- listbox: refactor and clean the begin/end api
|
||||||
|
- listbox: multiple selection.
|
||||||
|
- listbox: unselect option (#1208)
|
||||||
|
- listbox: make it easier/more natural to implement range-select (need some sort of info/ref about the last clicked/focused item that user can translate to an index?) (wip stash)
|
||||||
|
- listbox: user may want to initial scroll to focus on the one selected value?
|
||||||
|
- listbox: expose hovered item for a basic ListBox
|
||||||
|
- listbox: keyboard navigation.
|
||||||
|
- listbox: scrolling should track modified selection.
|
||||||
|
|
||||||
|
!- popups/menus: clarify usage of popups id, how MenuItem/Selectable closing parent popups affects the ID, etc. this is quite fishy needs improvement! (#331, #402)
|
||||||
|
- popups: reopening context menu at new position should be the behavior by default? (equivalent to internal OpenPopupEx() with reopen_existing=true) (~#1497)
|
||||||
|
- popups: if the popup functions took explicit ImGuiID it would allow the user to manage the scope of those ID. (#331)
|
||||||
|
- popups: clicking outside (to close popup) and holding shouldn't drag window below.
|
||||||
|
- popups: add variant using global identifier similar to Begin/End (#402)
|
||||||
|
- popups: border options. richer api like BeginChild() perhaps? (#197)
|
||||||
|
- tooltip: tooltip that doesn't fit in entire screen seems to lose their "last preferred direction" and may teleport when moving mouse.
|
||||||
|
- tooltip: allow to set the width of a tooltip to allow TextWrapped() etc. while keeping the height automatic.
|
||||||
|
- tooltip: allow tooltips with timers? or general timer policy? (instaneous vs timed)
|
||||||
|
|
||||||
|
- menus: calling BeginMenu() twice with a same name doesn't append as Begin() does for regular windows (#1207)
|
||||||
|
- menus: menu bars inside modals windows are acting weird.
|
||||||
|
- statusbar: add a per-window status bar helper similar to what menubar does.
|
||||||
|
- shortcuts: local-style shortcut api, e.g. parse "&Save"
|
||||||
|
- shortcuts,menus: global-style shortcut api e.g. "Save (CTRL+S)" -> explicit flag for recursing into closed menu
|
||||||
|
- shortcuts: programmatically access shortcuts "Focus("&Save"))
|
||||||
|
- menus: menubars: main menu-bar could affect clamping of windows position (~ akin to modifying DisplayMin)
|
||||||
|
- menus: hovering from menu to menu on a menu-bar has 1 frame without any menu, which is a little annoying. ideally either 0 either longer.
|
||||||
|
|
||||||
|
- text: selectable text (for copy) as a generic feature (ItemFlags?)
|
||||||
|
- text: proper alignment options in imgui_internal.h
|
||||||
|
- text wrapped: figure out better way to use TextWrapped() in an always auto-resize context (tooltip, etc.) (#249)
|
||||||
|
- text: it's currently impossible to have a window title with "##". perhaps an official workaround would be nice. \ style inhibitor? non-visible ascii code to insert between #?
|
||||||
|
- text: provided a framed text helper, e.g. https://pastebin.com/1Laxy8bT
|
||||||
|
- text link/url button: underlined. should api expose an ID or use text contents as ID? which colors enum to use?
|
||||||
|
|
||||||
|
- tree node / optimization: avoid formatting when clipped.
|
||||||
|
- tree node: tree-node/header right-most side doesn't take account of horizontal scrolling.
|
||||||
|
- tree node: add treenode/treepush int variants? not there because (void*) cast from int warns on some platforms/settings?
|
||||||
|
- tree node: try to apply scrolling at time of TreePop() if node was just opened and end of node is past scrolling limits?
|
||||||
|
- tree node / selectable render mismatch which is visible if you use them both next to each other (e.g. cf. property viewer)
|
||||||
|
- tree node: tweak color scheme to distinguish headers from selected tree node (#581)
|
||||||
|
- tree node: leaf/non-leaf highlight mismatch.
|
||||||
|
|
||||||
|
- settings: write more decent code to allow saving/loading new fields: columns, selected tree nodes?
|
||||||
|
- settings: api for per-tool simple persistent data (bool,int,float,columns sizes,etc.) in .ini file (#437)
|
||||||
|
- stb: add defines to disable stb implementations
|
||||||
|
|
||||||
|
!- style: better default styles. (#707)
|
||||||
|
- style: add a highlighted text color (for headers, etc.)
|
||||||
|
- style: border types: out-screen, in-screen, etc. (#447)
|
||||||
|
- style/optimization: store rounded corners in texture to use 1 quad per corner (filled and wireframe) to lower the cost of rounding.
|
||||||
|
- style: add window shadow (fading away from the window. Paint-style calculation of vertices alpha after drawlist would be easier)
|
||||||
|
- style: a concept of "compact style" that the end-user can easily rely on (e.g. PushStyleCompact()?) that maps to other settings? avoid implementing duplicate helpers such as SmallCheckbox(), etc.
|
||||||
|
- style: try to make PushStyleVar() more robust to incorrect parameters (to be more friendly to edit & continues situation).
|
||||||
|
- style: global scale setting.
|
||||||
|
- style: WindowPadding needs to be EVEN as the 0.5 multiplier used on this value probably have a subtle effect on clip rectangle
|
||||||
|
- style: have a more global HSV setter (e.g. alter hue on all elements). consider replacing active/hovered by offset in HSV space? (#438, #707, #1223)
|
||||||
|
- style: gradients fill (#1223) ~ 2 bg colors for each fill? tricky with rounded shapes and using textures for corners.
|
||||||
|
- style editor: color child window height expressed in multiple of line height.
|
||||||
|
|
||||||
|
- log: LogButtons() options for specifying depth and/or hiding depth slider
|
||||||
|
- log: have more control over the log scope (e.g. stop logging when leaving current tree node scope)
|
||||||
|
- log: be able to log anything (e.g. right-click on a window/tree-node, shows context menu? log into tty/file/clipboard)
|
||||||
|
- log: let user copy any window content to clipboard easily (CTRL+C on windows? while moving it? context menu?). code is commented because it fails with multiple Begin/End pairs.
|
||||||
|
|
||||||
|
- filters: set a current filter that tree node can automatically query to hide themselves
|
||||||
|
- filters: handle wildcards (with implicit leading/trailing *), regexps
|
||||||
|
- filters: fuzzy matches (may use code at blog.forrestthewoods.com/4cffeed33fdb)
|
||||||
|
|
||||||
|
- drag and drop: add demo. (#143, #479)
|
||||||
|
- drag and drop: allow using with other mouse buttons (where activeid won't be set). (#1637)
|
||||||
|
- drag and drop: test with reordering nodes (in a list, or a tree node). (#143)
|
||||||
|
- drag and drop: test integrating with os drag and drop.
|
||||||
|
- node/graph editor (#306)
|
||||||
|
- pie menus patterns (#434)
|
||||||
|
- markup: simple markup language for color change? (#902)
|
||||||
|
|
||||||
|
!- font: need handling of missing glyphs by not packing/rasterizing glyph 0 of a given font.
|
||||||
|
- font: MergeMode: flags to select overwriting or not.
|
||||||
|
- font: MergeMode: duplicate glyphs are stored in the atlas texture which is suboptimal.
|
||||||
|
- font: better vertical centering (based e.g on height of lowercase 'x'?). currently Roboto-Medium size 16 px isn't currently centered. (#1619)
|
||||||
|
- font: free the Alpha buffer if user only requested RGBA.
|
||||||
|
!- font: better CalcTextSizeA() API, at least for simple use cases. current one is horrible (perhaps have simple vs extended versions).
|
||||||
|
- font: a CalcTextHeight() helper could run faster than CalcTextSize().y
|
||||||
|
- font: enforce monospace through ImFontConfig (for icons?) + create dual ImFont output from same input, reusing rasterized data but with different glyphs/AdvanceX
|
||||||
|
- font: finish CustomRectRegister() to allow mapping unicode codepoint to custom texture data
|
||||||
|
- font: PushFontSize API (#1018)
|
||||||
|
- font/atlas: incremental updates
|
||||||
|
- font/atlas: dynamic font atlas to avoid baking huge ranges into bitmap and make scaling easier.
|
||||||
|
- font/atlas: allow user to submit its own primitive to be rectpacked, and allow to map them on a Unicode point.
|
||||||
|
- font: MemoryTTF taking ownership confusing/not obvious, maybe default should be opposite?
|
||||||
|
- font/text: vertical and/or rotated text renderer (#705) - vertical is easier clipping wise
|
||||||
|
- font: imgui_freetype.h alternative renderer (#618)
|
||||||
|
- font: optimization: for monospace font (like the default one) we can trim IndexXAdvance as long as trailing value is == FallbackXAdvance (need to make sure TAB is still correct).
|
||||||
|
- font: add support for kerning, probably optional. A) perhaps default to (32..128)^2 matrix ~ 9K entries = 36KB, then hash for non-ascii?. B) or sparse lookup into per-char list?
|
||||||
|
- font: add a simpler CalcTextSizeA() api? current one ok but not welcome if user needs to call it directly (without going through ImGui::CalcTextSize)
|
||||||
|
- font: fix AddRemapChar() to work before font has been built.
|
||||||
|
- font: (api breaking) removed "TTF" from symbol names. also because it now supports OTF.
|
||||||
|
|
||||||
|
- nav: SetItemDefaultFocus() level of priority, so widget like Selectable when inside a popup could claim a low-priority default focus on the first selected iem
|
||||||
|
- nav: allow input system to be be more tolerant of io.DeltaTime=0.0f
|
||||||
|
- nav: ESC on a flattened child
|
||||||
|
- nav: Left within a tree node block as a fallback (ImGuiTreeNodeFlags_NavLeftJumpsBackHere by default?)
|
||||||
|
- nav: menus: pressing left-right on a vertically clipped menu bar tends to jump to the collapse/close buttons.
|
||||||
|
- nav: menus: allow pressing Menu to leave a sub-menu.
|
||||||
|
- nav: simulate right-click or context activation? (SHIFT+F10)
|
||||||
|
- nav: tabs should go through most/all widgets (in submission order?).
|
||||||
|
- nav: when CTRL-Tab/windowing is active, the HoveredWindow detection doesn't take account of the window display re-ordering.
|
||||||
|
- nav: cannot access menubar of a flattened child window with Alt/menu key (not a very common use case..).
|
||||||
|
- nav: esc/enter default behavior for popups, e.g. be able to mark an "ok" or "cancel" button that would get triggered by those keys.
|
||||||
|
- nav: when activating a button that changes label (without a static ID) or disappear, can we somehow automatically recover into a nearest highlight item?
|
||||||
|
- nav: there's currently no way to completely clear focus with the keyboard. depending on patterns used by the application to dispatch inputs, it may be desirable.
|
||||||
|
- nav: configuration flag to disable global shortcuts (currently only CTRL-tab) ?
|
||||||
|
- focus: preserve ActiveId/focus stack state, e.g. when opening a menu and close it, previously selected InputText() focus gets restored (#622)
|
||||||
|
- focus: SetKeyboardFocusHere() on with >= 0 offset could be done on same frame (else latch and modulate on beginning of next frame)
|
||||||
|
- focus: unable to use SetKeyboardFocusHere() on clipped widgets. (#787)
|
||||||
|
|
||||||
|
- inputs: we need an explicit flag about whether the imgui window is focused, to be able to distinguish focused key releases vs alt-tabbing all release behaviors.
|
||||||
|
- inputs: rework IO system to be able to pass actual ordered/timestamped events. use an event queue? (~#335, #71)
|
||||||
|
- inputs: support track pad style scrolling & slider edit.
|
||||||
|
|
||||||
|
- misc: idle refresh: expose cursor blink animation timer for backend to be able to lower framerate.
|
||||||
|
- misc: make the ImGuiCond values linear (non-power-of-two). internal storage for ImGuiWindow can use integers to combine into flags (Why?)
|
||||||
|
- misc: provide a way to compile out the entire implementation while providing a dummy API (e.g. #define IMGUI_DUMMY_IMPL)
|
||||||
|
- misc: PushItemFlag(): add a flag to disable keyboard capture when used with mouse? (#1682)
|
||||||
|
- misc: use more size_t in public api?
|
||||||
|
- misc: ImVector: erase_unsorted() helper
|
||||||
|
|
||||||
|
- web/emscriptem: refactor some examples to facilitate integration with emscripten main loop system. (#1713, #336)
|
||||||
|
- web/emscriptem: tweak OpenGL renderers to support OpenGL ES. (#1713, #336)
|
||||||
|
|
||||||
|
- remote: make a system like RemoteImGui first-class citizen/project (#75)
|
||||||
|
|
||||||
|
- demo: add vertical separator demo
|
||||||
|
- demo: add virtual scrolling example?
|
||||||
|
- examples: directx9: save/restore device state more thoroughly.
|
||||||
|
- examples: window minimize, maximize (#583)
|
||||||
|
- examples: provide a zero-framerate/idle example.
|
||||||
|
- examples: glfw: could go idle when minimized? if (glfwGetWindowAttrib(window, GLFW_ICONIFIED)) { glfwWaitEvents(); continue; } // the problem is that DeltaTime will be super high on resume, perhaps provide a way to let impl know (#440)
|
||||||
|
- optimization: replace vsnprintf with stb_printf? or enable the defines/infrastructure to allow it (#1038)
|
||||||
|
- optimization: add clipping for multi-component widgets (SliderFloatX, ColorEditX, etc.). one problem is that nav branch can't easily clip parent group when there is a move request.
|
||||||
|
- optimization: add a flag to disable most of rendering, for the case where the user expect to skip it (#335)
|
||||||
|
- optimization: use another hash function than crc32, e.g. FNV1a
|
||||||
|
- optimization/render: merge command-lists with same clip-rect into one even if they aren't sequential? (as long as in-between clip rectangle don't overlap)?
|
||||||
|
- optimization: turn some the various stack vectors into statically-sized arrays
|
Loading…
Reference in New Issue
Block a user