mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Renamed ImBitmapFont -> ImFont, removed abstraction-pretend typedef
This commit is contained in:
parent
07a6ba8aaf
commit
df2ad5e899
@ -224,7 +224,7 @@ void InitImGui()
|
|||||||
IM_ASSERT(tex_data != NULL);
|
IM_ASSERT(tex_data != NULL);
|
||||||
#else
|
#else
|
||||||
// Custom font from filesystem
|
// Custom font from filesystem
|
||||||
io.Font = new ImBitmapFont();
|
io.Font = new ImFont();
|
||||||
io.Font->LoadFromFile("../../extra_fonts/mplus-2m-medium_18.fnt");
|
io.Font->LoadFromFile("../../extra_fonts/mplus-2m-medium_18.fnt");
|
||||||
IM_ASSERT(io.Font->IsLoaded());
|
IM_ASSERT(io.Font->IsLoaded());
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ Configure bmfont:
|
|||||||
1. Load the .FNT data from 'fnt_data' (NB: this is done for you by default if you don't do anything)
|
1. Load the .FNT data from 'fnt_data' (NB: this is done for you by default if you don't do anything)
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
io.Font = new ImBitmapFont();
|
io.Font = new ImFont();
|
||||||
io.Font->LoadFromMemory(fnt_data, fnt_size);
|
io.Font->LoadFromMemory(fnt_data, fnt_size);
|
||||||
|
|
||||||
2. Load the .PNG data from 'png_data' into a texture
|
2. Load the .PNG data from 'png_data' into a texture
|
||||||
@ -66,21 +66,21 @@ Configure bmfont:
|
|||||||
ImGuiIO& io = ImGui::GetIO();
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
|
||||||
// proggy_clean_13 [default]
|
// proggy_clean_13 [default]
|
||||||
io.Font = new ImBitmapFont();
|
io.Font = new ImFont();
|
||||||
io.Font->LoadFromFile("proggy_clean_13.fnt");
|
io.Font->LoadFromFile("proggy_clean_13.fnt");
|
||||||
IM_ASSERT(io.Font->IsLoaded());
|
IM_ASSERT(io.Font->IsLoaded());
|
||||||
io.FontTexUvForWhite = ImVec2(0.0f/256.0f,0.0f/128);
|
io.FontTexUvForWhite = ImVec2(0.0f/256.0f,0.0f/128);
|
||||||
io.FontYOffset = +1;
|
io.FontYOffset = +1;
|
||||||
|
|
||||||
// proggy_small_12
|
// proggy_small_12
|
||||||
io.Font = new ImBitmapFont();
|
io.Font = new ImFont();
|
||||||
io.Font->LoadFromFile("proggy_small_12.fnt");
|
io.Font->LoadFromFile("proggy_small_12.fnt");
|
||||||
IM_ASSERT(io.Font->IsLoaded());
|
IM_ASSERT(io.Font->IsLoaded());
|
||||||
io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64);
|
io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64);
|
||||||
io.FontYOffset = +2;
|
io.FontYOffset = +2;
|
||||||
|
|
||||||
// proggy_small_14
|
// proggy_small_14
|
||||||
io.Font = new ImBitmapFont();
|
io.Font = new ImFont();
|
||||||
io.Font->LoadFromFile("proggy_small_14.fnt");
|
io.Font->LoadFromFile("proggy_small_14.fnt");
|
||||||
IM_ASSERT(io.Font->IsLoaded());
|
IM_ASSERT(io.Font->IsLoaded());
|
||||||
io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64);
|
io.FontTexUvForWhite = ImVec2(84.0f/256.0f,20.0f/64);
|
||||||
|
64
imgui.cpp
64
imgui.cpp
@ -695,7 +695,7 @@ struct ImGuiTextEditState
|
|||||||
float CursorAnim;
|
float CursorAnim;
|
||||||
ImVec2 LastCursorPos; // Cursor position in screen space to be used by IME callback.
|
ImVec2 LastCursorPos; // Cursor position in screen space to be used by IME callback.
|
||||||
bool SelectedAllMouseLock;
|
bool SelectedAllMouseLock;
|
||||||
ImFont Font;
|
ImFont* Font;
|
||||||
float FontSize;
|
float FontSize;
|
||||||
|
|
||||||
ImGuiTextEditState() { memset(this, 0, sizeof(*this)); }
|
ImGuiTextEditState() { memset(this, 0, sizeof(*this)); }
|
||||||
@ -710,9 +710,9 @@ struct ImGuiTextEditState
|
|||||||
ImVec2 CalcDisplayOffsetFromCharIdx(int i) const;
|
ImVec2 CalcDisplayOffsetFromCharIdx(int i) const;
|
||||||
|
|
||||||
// Static functions because they are used to render non-focused instances of a text input box
|
// Static functions because they are used to render non-focused instances of a text input box
|
||||||
static const char* GetTextPointerClippedA(ImFont font, float font_size, const char* text, float width, ImVec2* out_text_size = NULL);
|
static const char* GetTextPointerClippedA(ImFont* font, float font_size, const char* text, float width, ImVec2* out_text_size = NULL);
|
||||||
static const ImWchar* GetTextPointerClippedW(ImFont font, float font_size, const ImWchar* text, float width, ImVec2* out_text_size = NULL);
|
static const ImWchar* GetTextPointerClippedW(ImFont* font, float font_size, const ImWchar* text, float width, ImVec2* out_text_size = NULL);
|
||||||
static void RenderTextScrolledClipped(ImFont font, float font_size, const char* text, ImVec2 pos_base, float width, float scroll_x);
|
static void RenderTextScrolledClipped(ImFont* font, float font_size, const char* text, ImVec2 pos_base, float width, float scroll_x);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ImGuiIniData
|
struct ImGuiIniData
|
||||||
@ -844,7 +844,7 @@ public:
|
|||||||
void FocusItemUnregister();
|
void FocusItemUnregister();
|
||||||
|
|
||||||
ImGuiAabb Aabb() const { return ImGuiAabb(Pos, Pos+Size); }
|
ImGuiAabb Aabb() const { return ImGuiAabb(Pos, Pos+Size); }
|
||||||
ImFont Font() const { return GImGui.IO.Font; }
|
ImFont* Font() const { return GImGui.IO.Font; }
|
||||||
float FontSize() const { return GImGui.FontSize * FontWindowScale; }
|
float FontSize() const { return GImGui.FontSize * FontWindowScale; }
|
||||||
ImVec2 CursorPos() const { return DC.CursorPos; }
|
ImVec2 CursorPos() const { return DC.CursorPos; }
|
||||||
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui.Style.FramePadding.y * 2.0f; }
|
float TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0 : FontSize() + GImGui.Style.FramePadding.y * 2.0f; }
|
||||||
@ -1364,8 +1364,8 @@ void ImGui::NewFrame()
|
|||||||
const void* fnt_data;
|
const void* fnt_data;
|
||||||
unsigned int fnt_size;
|
unsigned int fnt_size;
|
||||||
ImGui::GetDefaultFontData(&fnt_data, &fnt_size, NULL, NULL);
|
ImGui::GetDefaultFontData(&fnt_data, &fnt_size, NULL, NULL);
|
||||||
g.IO.Font = (ImBitmapFont*)ImGui::MemAlloc(sizeof(ImBitmapFont));
|
g.IO.Font = (ImFont*)ImGui::MemAlloc(sizeof(ImFont));
|
||||||
new(g.IO.Font) ImBitmapFont();
|
new(g.IO.Font) ImFont();
|
||||||
g.IO.Font->LoadFromMemory(fnt_data, fnt_size);
|
g.IO.Font->LoadFromMemory(fnt_data, fnt_size);
|
||||||
IM_ASSERT(g.IO.Font->IsLoaded()); // Font failed to load
|
IM_ASSERT(g.IO.Font->IsLoaded()); // Font failed to load
|
||||||
g.IO.FontYOffset = +1;
|
g.IO.FontYOffset = +1;
|
||||||
@ -1518,7 +1518,7 @@ void ImGui::Shutdown()
|
|||||||
}
|
}
|
||||||
if (g.IO.Font)
|
if (g.IO.Font)
|
||||||
{
|
{
|
||||||
g.IO.Font->~ImBitmapFont();
|
g.IO.Font->~ImFont();
|
||||||
ImGui::MemFree(g.IO.Font);
|
ImGui::MemFree(g.IO.Font);
|
||||||
g.IO.Font = NULL;
|
g.IO.Font = NULL;
|
||||||
}
|
}
|
||||||
@ -2818,7 +2818,7 @@ ImDrawList* ImGui::GetWindowDrawList()
|
|||||||
return window->DrawList;
|
return window->DrawList;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImFont ImGui::GetWindowFont()
|
ImFont* ImGui::GetWindowFont()
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
return window->Font();
|
return window->Font();
|
||||||
@ -4018,8 +4018,8 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
|||||||
RenderFrame(check_bb.Min, check_bb.Max, window->Color(hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg));
|
RenderFrame(check_bb.Min, check_bb.Max, window->Color(hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg));
|
||||||
if (*v)
|
if (*v)
|
||||||
{
|
{
|
||||||
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
||||||
const float pad = check_sz < 8.0f ? 1.0f : check_sz < 13.0f ? 2.0f : 3.0f;
|
const float pad = check_sz < 8.0f ? 1.0f : check_sz < 13.0f ? 2.0f : 3.0f;
|
||||||
window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), window->Color(ImGuiCol_CheckActive));
|
window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), window->Color(ImGuiCol_CheckActive));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4076,11 +4076,11 @@ bool ImGui::RadioButton(const char* label, bool active)
|
|||||||
|
|
||||||
window->DrawList->AddCircleFilled(center, radius, window->Color(hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg), 16);
|
window->DrawList->AddCircleFilled(center, radius, window->Color(hovered ? ImGuiCol_CheckHovered : ImGuiCol_FrameBg), 16);
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
const float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());
|
||||||
const float pad = check_sz < 8.0f ? 1.0f : check_sz < 13.0f ? 2.0f : 3.0f;
|
const float pad = check_sz < 8.0f ? 1.0f : check_sz < 13.0f ? 2.0f : 3.0f;
|
||||||
window->DrawList->AddCircleFilled(center, radius-pad, window->Color(ImGuiCol_CheckActive), 16);
|
window->DrawList->AddCircleFilled(center, radius-pad, window->Color(ImGuiCol_CheckActive), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
if (window->Flags & ImGuiWindowFlags_ShowBorders)
|
||||||
{
|
{
|
||||||
@ -4191,7 +4191,7 @@ ImVec2 ImGuiTextEditState::CalcDisplayOffsetFromCharIdx(int i) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// [Static]
|
// [Static]
|
||||||
const char* ImGuiTextEditState::GetTextPointerClippedA(ImFont font, float font_size, const char* text, float width, ImVec2* out_text_size)
|
const char* ImGuiTextEditState::GetTextPointerClippedA(ImFont* font, float font_size, const char* text, float width, ImVec2* out_text_size)
|
||||||
{
|
{
|
||||||
if (width <= 0.0f)
|
if (width <= 0.0f)
|
||||||
return text;
|
return text;
|
||||||
@ -4204,7 +4204,7 @@ const char* ImGuiTextEditState::GetTextPointerClippedA(ImFont font, float font_s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// [Static]
|
// [Static]
|
||||||
const ImWchar* ImGuiTextEditState::GetTextPointerClippedW(ImFont font, float font_size, const ImWchar* text, float width, ImVec2* out_text_size)
|
const ImWchar* ImGuiTextEditState::GetTextPointerClippedW(ImFont* font, float font_size, const ImWchar* text, float width, ImVec2* out_text_size)
|
||||||
{
|
{
|
||||||
if (width <= 0.0f)
|
if (width <= 0.0f)
|
||||||
return text;
|
return text;
|
||||||
@ -4217,7 +4217,7 @@ const ImWchar* ImGuiTextEditState::GetTextPointerClippedW(ImFont font, float fon
|
|||||||
}
|
}
|
||||||
|
|
||||||
// [Static]
|
// [Static]
|
||||||
void ImGuiTextEditState::RenderTextScrolledClipped(ImFont font, float font_size, const char* buf, ImVec2 pos, float width, float scroll_x)
|
void ImGuiTextEditState::RenderTextScrolledClipped(ImFont* font, float font_size, const char* buf, ImVec2 pos, float width, float scroll_x)
|
||||||
{
|
{
|
||||||
// NB- We start drawing at character boundary
|
// NB- We start drawing at character boundary
|
||||||
ImVec2 text_size;
|
ImVec2 text_size;
|
||||||
@ -5657,7 +5657,7 @@ void ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImDrawList::AddText(ImFont font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width)
|
void ImDrawList::AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width)
|
||||||
{
|
{
|
||||||
if ((col >> 24) == 0)
|
if ((col >> 24) == 0)
|
||||||
return;
|
return;
|
||||||
@ -5684,7 +5684,7 @@ void ImDrawList::AddText(ImFont font, float font_size, const ImVec2& pos, ImU32
|
|||||||
// ImBitmapFont
|
// ImBitmapFont
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ImBitmapFont::ImBitmapFont()
|
ImFont::ImFont()
|
||||||
{
|
{
|
||||||
Data = NULL;
|
Data = NULL;
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
@ -5698,7 +5698,7 @@ ImBitmapFont::ImBitmapFont()
|
|||||||
TabCount = 4;
|
TabCount = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImBitmapFont::Clear()
|
void ImFont::Clear()
|
||||||
{
|
{
|
||||||
if (Data && DataOwned)
|
if (Data && DataOwned)
|
||||||
ImGui::MemFree(Data);
|
ImGui::MemFree(Data);
|
||||||
@ -5712,7 +5712,7 @@ void ImBitmapFont::Clear()
|
|||||||
IndexLookup.clear();
|
IndexLookup.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImBitmapFont::LoadFromFile(const char* filename)
|
bool ImFont::LoadFromFile(const char* filename)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!IsLoaded()); // Call Clear()
|
IM_ASSERT(!IsLoaded()); // Call Clear()
|
||||||
|
|
||||||
@ -5753,7 +5753,7 @@ bool ImBitmapFont::LoadFromFile(const char* filename)
|
|||||||
return LoadFromMemory(Data, DataSize);
|
return LoadFromMemory(Data, DataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImBitmapFont::LoadFromMemory(const void* data, size_t data_size)
|
bool ImFont::LoadFromMemory(const void* data, size_t data_size)
|
||||||
{
|
{
|
||||||
IM_ASSERT(!IsLoaded()); // Call Clear()
|
IM_ASSERT(!IsLoaded()); // Call Clear()
|
||||||
|
|
||||||
@ -5803,7 +5803,7 @@ bool ImBitmapFont::LoadFromMemory(const void* data, size_t data_size)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImBitmapFont::BuildLookupTable()
|
void ImFont::BuildLookupTable()
|
||||||
{
|
{
|
||||||
ImU32 max_c = 0;
|
ImU32 max_c = 0;
|
||||||
for (size_t i = 0; i != GlyphsCount; i++)
|
for (size_t i = 0; i != GlyphsCount; i++)
|
||||||
@ -5818,7 +5818,7 @@ void ImBitmapFont::BuildLookupTable()
|
|||||||
IndexLookup[Glyphs[i].Id] = (int)i;
|
IndexLookup[Glyphs[i].Id] = (int)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImBitmapFont::FntGlyph* ImBitmapFont::FindGlyph(unsigned short c, const ImBitmapFont::FntGlyph* fallback) const
|
const ImFont::FntGlyph* ImFont::FindGlyph(unsigned short c, const ImFont::FntGlyph* fallback) const
|
||||||
{
|
{
|
||||||
if (c < (int)IndexLookup.size())
|
if (c < (int)IndexLookup.size())
|
||||||
{
|
{
|
||||||
@ -5987,7 +5987,7 @@ static int ImTextCountUtf8BytesFromWchar(const ImWchar* in_text, const ImWchar*
|
|||||||
return bytes_count;
|
return bytes_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ImBitmapFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width, const FntGlyph* fallback_glyph) const
|
const char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width, const FntGlyph* fallback_glyph) const
|
||||||
{
|
{
|
||||||
// Simple word-wrapping for English, not full-featured. Please submit failing cases!
|
// Simple word-wrapping for English, not full-featured. Please submit failing cases!
|
||||||
// FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.)
|
// FIXME: Much possible improvements (don't cut things like "word !", "word!!!" but cut within "word,,,,", more sensible support for punctuations, support for Unicode punctuations, etc.)
|
||||||
@ -6089,7 +6089,7 @@ const char* ImBitmapFont::CalcWordWrapPositionA(float scale, const char* text, c
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 ImBitmapFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining) const
|
ImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining) const
|
||||||
{
|
{
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text_begin + strlen(text_begin); // FIXME-OPT
|
text_end = text_begin + strlen(text_begin); // FIXME-OPT
|
||||||
@ -6180,7 +6180,7 @@ ImVec2 ImBitmapFont::CalcTextSizeA(float size, float max_width, float wrap_width
|
|||||||
return text_size;
|
return text_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImVec2 ImBitmapFont::CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining) const
|
ImVec2 ImFont::CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining) const
|
||||||
{
|
{
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text_begin + ImStrlenW(text_begin);
|
text_end = text_begin + ImStrlenW(text_begin);
|
||||||
@ -6238,7 +6238,7 @@ ImVec2 ImBitmapFont::CalcTextSizeW(float size, float max_width, const ImWchar* t
|
|||||||
return text_size;
|
return text_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImBitmapFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect_ref, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width) const
|
void ImFont::RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect_ref, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width) const
|
||||||
{
|
{
|
||||||
if (!text_end)
|
if (!text_end)
|
||||||
text_end = text_begin + strlen(text_begin);
|
text_end = text_begin + strlen(text_begin);
|
||||||
@ -6687,9 +6687,9 @@ void ImGui::ShowTestWindow(bool* open)
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
//static ImGuiOnceUponAFrame oaf;
|
//static ImGuiOnceUponAFrame oaf;
|
||||||
//if (oaf) ImGui::Text("This will be displayed.");
|
//if (oaf) ImGui::Text("This will be displayed.");
|
||||||
//if (oaf) ImGui::Text("This won't be displayed!");
|
//if (oaf) ImGui::Text("This won't be displayed!");
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Text("^ Horizontal separator");
|
ImGui::Text("^ Horizontal separator");
|
||||||
|
16
imgui.h
16
imgui.h
@ -7,7 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
struct ImDrawList;
|
struct ImDrawList;
|
||||||
struct ImBitmapFont;
|
struct ImFont;
|
||||||
struct ImGuiAabb;
|
struct ImGuiAabb;
|
||||||
struct ImGuiIO;
|
struct ImGuiIO;
|
||||||
struct ImGuiStorage;
|
struct ImGuiStorage;
|
||||||
@ -38,7 +38,6 @@ typedef int ImGuiKey; // enum ImGuiKey_
|
|||||||
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
||||||
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
||||||
typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_
|
typedef int ImGuiInputTextFlags; // enum ImGuiInputTextFlags_
|
||||||
typedef ImBitmapFont* ImFont;
|
|
||||||
struct ImGuiTextEditCallbackData;
|
struct ImGuiTextEditCallbackData;
|
||||||
|
|
||||||
struct ImVec2
|
struct ImVec2
|
||||||
@ -159,7 +158,7 @@ namespace ImGui
|
|||||||
IMGUI_API ImVec2 GetWindowContentRegionMin(); // window boundaries
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // window boundaries
|
||||||
IMGUI_API ImVec2 GetWindowContentRegionMax();
|
IMGUI_API ImVec2 GetWindowContentRegionMax();
|
||||||
IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives.
|
IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives.
|
||||||
IMGUI_API ImFont GetWindowFont();
|
IMGUI_API ImFont* GetWindowFont();
|
||||||
IMGUI_API float GetWindowFontSize();
|
IMGUI_API float GetWindowFontSize();
|
||||||
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontBaseScale if you want to scale all windows together.
|
IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontBaseScale if you want to scale all windows together.
|
||||||
IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
||||||
@ -455,7 +454,7 @@ struct ImGuiIO
|
|||||||
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
float MouseDoubleClickTime; // = 0.30f // Time for a double-click, in seconds.
|
||||||
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
float MouseDoubleClickMaxDist; // = 6.0f // Distance threshold to stay in to validate a double-click, in pixels.
|
||||||
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array
|
int KeyMap[ImGuiKey_COUNT]; // <unset> // Map of indices into the KeysDown[512] entries array
|
||||||
ImFont Font; // <auto> // Gets passed to text functions. Typedef ImFont to the type you want (ImBitmapFont* or your own font).
|
ImFont* Font; // <auto> // Font
|
||||||
float FontYOffset; // = 0.0f // Offset font rendering by xx pixels in Y axis.
|
float FontYOffset; // = 0.0f // Offset font rendering by xx pixels in Y axis.
|
||||||
ImVec2 FontTexUvForWhite; // = (0.0f,0.0f) // Font texture must have a white pixel at this UV coordinate. Adjust if you are using custom texture.
|
ImVec2 FontTexUvForWhite; // = (0.0f,0.0f) // Font texture must have a white pixel at this UV coordinate. Adjust if you are using custom texture.
|
||||||
float FontBaseScale; // = 1.0f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
|
float FontBaseScale; // = 1.0f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
|
||||||
@ -682,18 +681,17 @@ struct ImDrawList
|
|||||||
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
||||||
IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
||||||
IMGUI_API void AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
|
IMGUI_API void AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
|
||||||
IMGUI_API void AddText(ImFont font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f);
|
IMGUI_API void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Optional bitmap font data loader & renderer into vertices
|
// Optional bitmap font data loader & renderer into vertices
|
||||||
// #define ImFont to ImBitmapFont to use
|
|
||||||
// Using the .fnt format exported by BMFont
|
// Using the .fnt format exported by BMFont
|
||||||
// - tool: http://www.angelcode.com/products/bmfont
|
// - tool: http://www.angelcode.com/products/bmfont
|
||||||
// - file-format: http://www.angelcode.com/products/bmfont/doc/file_format.html
|
// - file-format: http://www.angelcode.com/products/bmfont/doc/file_format.html
|
||||||
// Assume valid file data (won't handle invalid/malicious data)
|
// Assume valid file data (won't handle invalid/malicious data)
|
||||||
// Handle a subset of parameters.
|
// Handle a subset of parameters.
|
||||||
// - kerning pair are not supported (because ImGui code does per-character CalcTextSize calls, need to turn it into something more stateful to allow kerning)
|
// - kerning pair are not supported (because ImGui code does per-character CalcTextSize calls, need to turn it into something more stateful to allow kerning)
|
||||||
struct ImBitmapFont
|
struct ImFont
|
||||||
{
|
{
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct FntInfo
|
struct FntInfo
|
||||||
@ -751,8 +749,8 @@ struct ImBitmapFont
|
|||||||
ImVector<const char*> Filenames; // (point into raw data)
|
ImVector<const char*> Filenames; // (point into raw data)
|
||||||
ImVector<int> IndexLookup; // (built)
|
ImVector<int> IndexLookup; // (built)
|
||||||
|
|
||||||
IMGUI_API ImBitmapFont();
|
IMGUI_API ImFont();
|
||||||
IMGUI_API ~ImBitmapFont() { Clear(); }
|
IMGUI_API ~ImFont() { Clear(); }
|
||||||
|
|
||||||
IMGUI_API bool LoadFromMemory(const void* data, size_t data_size);
|
IMGUI_API bool LoadFromMemory(const void* data, size_t data_size);
|
||||||
IMGUI_API bool LoadFromFile(const char* filename);
|
IMGUI_API bool LoadFromFile(const char* filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user