mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Merge branch 'master' into navigation
# Conflicts: # imgui.cpp
This commit is contained in:
commit
533fe8cb55
@ -22,6 +22,11 @@ void DebugHUD_InitDefaults( DebugHUD *hud )
|
|||||||
hud->cubeColor2[1] = 0.4f;
|
hud->cubeColor2[1] = 0.4f;
|
||||||
hud->cubeColor2[2] = 0.4f;
|
hud->cubeColor2[2] = 0.4f;
|
||||||
hud->cubeColor2[3] = 1.0f;
|
hud->cubeColor2[3] = 1.0f;
|
||||||
|
|
||||||
|
hud->clearColor[0] = 0.45f;
|
||||||
|
hud->clearColor[1] = 0.55f;
|
||||||
|
hud->clearColor[2] = 0.60f;
|
||||||
|
hud->clearColor[3] = 1.00f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugHUD_DoInterface(DebugHUD *hud)
|
void DebugHUD_DoInterface(DebugHUD *hud)
|
||||||
@ -33,7 +38,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
|
|||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
ImGui::Text("Hello, world!"); // Display some text (you can use a format string too)
|
||||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||||
ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color
|
ImGui::ColorEdit3("clear color", hud->clearColor); // Edit 3 floats representing a color
|
||||||
|
|
||||||
ImGui::Checkbox("Demo Window", &hud->show_demo_window); // Edit bools storing our windows open/close state
|
ImGui::Checkbox("Demo Window", &hud->show_demo_window); // Edit bools storing our windows open/close state
|
||||||
ImGui::Checkbox("Another Window", &hud->show_another_window);
|
ImGui::Checkbox("Another Window", &hud->show_another_window);
|
||||||
@ -49,7 +54,7 @@ void DebugHUD_DoInterface(DebugHUD *hud)
|
|||||||
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
// 2. Show another simple window. In most cases you will use an explicit Begin/End pair to name your windows.
|
||||||
if (hud->show_another_window)
|
if (hud->show_another_window)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Another Window", &hud-?show_another_window);
|
ImGui::Begin("Another Window", &hud->show_another_window);
|
||||||
ImGui::Text("Hello from another window!");
|
ImGui::Text("Hello from another window!");
|
||||||
ImGui::ColorEdit3("Cube 1 Color", hud->cubeColor1);
|
ImGui::ColorEdit3("Cube 1 Color", hud->cubeColor1);
|
||||||
ImGui::ColorEdit3("Cube 2 Color", hud->cubeColor2);
|
ImGui::ColorEdit3("Cube 2 Color", hud->cubeColor2);
|
||||||
|
@ -11,6 +11,7 @@ typedef struct DebugHUD
|
|||||||
float rotation_speed;
|
float rotation_speed;
|
||||||
float cubeColor1[4];
|
float cubeColor1[4];
|
||||||
float cubeColor2[4];
|
float cubeColor2[4];
|
||||||
|
float clearColor[4];
|
||||||
} DebugHUD;
|
} DebugHUD;
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
|
@ -5834,7 +5834,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
// Title bar only
|
// Title bar only
|
||||||
float backup_border_size = style.FrameBorderSize;
|
float backup_border_size = style.FrameBorderSize;
|
||||||
g.Style.FrameBorderSize = window->WindowBorderSize;
|
g.Style.FrameBorderSize = window->WindowBorderSize;
|
||||||
RenderFrame(title_bar_rect.Min, title_bar_rect.Max, GetColorU32((window_is_focused && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed), true, window_rounding);
|
ImU32 title_bar_col = GetColorU32((window_is_focused && !g.NavDisableHighlight) ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBgCollapsed);
|
||||||
|
RenderFrame(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, true, window_rounding);
|
||||||
g.Style.FrameBorderSize = backup_border_size;
|
g.Style.FrameBorderSize = backup_border_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -5849,8 +5850,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
window->DrawList->AddRectFilled(window->Pos+ImVec2(0,window->TitleBarHeight()), window->Pos+window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);
|
||||||
|
|
||||||
// Title bar
|
// Title bar
|
||||||
|
ImU32 title_bar_col = GetColorU32(window->Collapsed ? ImGuiCol_TitleBgCollapsed : window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg);
|
||||||
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
||||||
window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImDrawCornerFlags_Top);
|
window->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, title_bar_col, window_rounding, ImDrawCornerFlags_Top);
|
||||||
|
|
||||||
// Menu bar
|
// Menu bar
|
||||||
if (flags & ImGuiWindowFlags_MenuBar)
|
if (flags & ImGuiWindowFlags_MenuBar)
|
||||||
|
@ -17,6 +17,12 @@ ImGuiFreeType::BuildFontAtlas(io.Fonts, flags);
|
|||||||
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Gamma Correct Blending**
|
||||||
|
FreeType assumes blending in linear space rather than gamma space.
|
||||||
|
See FreeType note for [FT_Render_Glyph](https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Render_Glyph).
|
||||||
|
For correct results you need to be using sRGB and convert to linear space in the pixel shader output.
|
||||||
|
The default imgui styles will be impacted by this change (alpha values will need tweaking).
|
||||||
|
|
||||||
**Test code Usage**
|
**Test code Usage**
|
||||||
```cpp
|
```cpp
|
||||||
#include "misc/freetype/imgui_freetype.h"
|
#include "misc/freetype/imgui_freetype.h"
|
||||||
|
@ -10,6 +10,12 @@
|
|||||||
// - v0.54: (2018/01/22) fix for addition of ImFontAtlas::TexUvscale member
|
// - v0.54: (2018/01/22) fix for addition of ImFontAtlas::TexUvscale member
|
||||||
// - v0.55: (2018/02/04) moved to main imgui repository (away from http://www.github.com/ocornut/imgui_club)
|
// - v0.55: (2018/02/04) moved to main imgui repository (away from http://www.github.com/ocornut/imgui_club)
|
||||||
|
|
||||||
|
// Gamma Correct Blending:
|
||||||
|
// FreeType assumes blending in linear space rather than gamma space.
|
||||||
|
// See https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Render_Glyph
|
||||||
|
// For correct results you need to be using sRGB and convert to linear space in the pixel shader output.
|
||||||
|
// The default imgui styles will be impacted by this change (alpha values will need tweaking).
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - Output texture has excessive resolution (lots of vertical waste)
|
// - Output texture has excessive resolution (lots of vertical waste)
|
||||||
// - FreeType's memory allocator is not overridden.
|
// - FreeType's memory allocator is not overridden.
|
||||||
|
Loading…
Reference in New Issue
Block a user