Added GetWindowFont(), GetWindowFontSize() + comments following user's feedback

docking
omar 10 years ago
parent 9f05a2bb16
commit af37fb1ee7

@ -2,7 +2,7 @@
// See ImGui::ShowTestWindow() for sample code.
// Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
// Get latest version at https://github.com/ocornut/imgui
// Developped by Omar Cornut and contributors.
// Developed by Omar Cornut and contributors.
/*
@ -16,7 +16,7 @@
- minimize setup and maintainance
- minimize state storage on user side
- portable, minimize dependencies, run on target (consoles, etc.)
- efficient runtime (nb- we do allocate when "growing" content - creating a window / opening a tree node for the first time, etc. - but a typical frame won't allocate anything)
- efficient runtime (NB- we do allocate when "growing" content - creating a window / opening a tree node for the first time, etc. - but a typical frame won't allocate anything)
- read about immediate-mode GUI principles @ http://mollyrocket.com/861, http://mollyrocket.com/forums/index.html
Designed for developers and content-creators, not the typical end-user! Some of the weaknesses includes:
@ -2599,6 +2599,18 @@ ImDrawList* GetWindowDrawList()
return window->DrawList;
}
ImFont GetWindowFont()
{
ImGuiWindow* window = GetCurrentWindow();
return window->Font();
}
float GetWindowFontSize()
{
ImGuiWindow* window = GetCurrentWindow();
return window->FontSize();
}
void SetWindowFontScale(float scale)
{
ImGuiWindow* window = GetCurrentWindow();

@ -151,6 +151,8 @@ namespace ImGui
ImVec2 GetWindowContentRegionMin();
ImVec2 GetWindowContentRegionMax();
ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives.
ImFont GetWindowFont();
float GetWindowFontSize();
void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontBaseScale if you want to scale all windows together.
void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use 'offset' to access sub components of a multiple component widget.
@ -575,7 +577,6 @@ struct ImDrawCmd
ImVec4 clip_rect;
};
// sizeof() == 20
struct ImDrawVert
{
ImVec2 pos;
@ -584,7 +585,11 @@ struct ImDrawVert
};
// Draw command list
// User is responsible for providing a renderer for this in ImGuiIO::RenderDrawListFn
// This is the low-level list of polygon that ImGui:: functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
// Each ImGui window contains its own ImDrawList.
// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
// Note that this only gives you access to rendering polygons. If your intent is to create custom widgets and the publicly exposed functions/data aren't sufficient, you can add code in imgui_user.inl
struct ImDrawList
{
// This is what you have to render

Loading…
Cancel
Save