Updated imgui.

This commit is contained in:
Branimir Karadžić 2015-09-05 16:28:08 -07:00
parent 6482c8901f
commit fa88b844ed
6 changed files with 37 additions and 17 deletions

View File

@ -1,11 +1,13 @@
// ImGui library v1.45
// ImGui library v1.46 WIP
// Main code & documentation
// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code.
// Read 'Programmer guide' below for notes on how to setup ImGui in your codebase.
// Get latest version at https://github.com/ocornut/imgui
// Releases change-log at https://github.com/ocornut/imgui/releases
// Developed by Omar Cornut and ImGui contributors.
// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.
// This library is free but I need your support to sustain development and maintenance.
// If you work for a company, please consider financial support, e.g: https://www.patreon.com/imgui
/*
@ -2704,14 +2706,15 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs)
// Test if mouse cursor is hovering given rectangle
// NB- Rectangle is clipped by our current clip setting
// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)
bool ImGui::IsMouseHoveringRect(const ImVec2& pos_min, const ImVec2& pos_max)
bool ImGui::IsMouseHoveringRect(const ImVec2& pos_min, const ImVec2& pos_max, bool clip)
{
ImGuiState& g = *GImGui;
ImGuiWindow* window = GetCurrentWindowRead();
// Clip
ImRect rect_clipped(pos_min, pos_max);
rect_clipped.Clip(window->ClipRect);
if (clip)
rect_clipped.Clip(window->ClipRect);
// Expand for touch input
const ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);
@ -3532,8 +3535,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
{
window->AutoPosLastDirection = -1;
if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
FocusWindow(window);
if (!(flags & ImGuiWindowFlags_NoFocusOnAppearing))
if (!(flags & (ImGuiWindowFlags_ChildWindow|ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))
FocusWindow(window);
// Popup first latch mouse position, will position itself when it appears next frame
if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api)

View File

@ -1,4 +1,4 @@
// ImGui library v1.45
// ImGui library v1.46 WIP
// Headers
// See imgui.cpp file for documentation.
@ -17,7 +17,7 @@
#include <stdlib.h> // NULL, malloc, free, qsort, atoi
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
#define IMGUI_VERSION "1.45"
#define IMGUI_VERSION "1.46 WIP"
// Define assertion handler.
#ifndef IM_ASSERT
@ -404,7 +404,7 @@ namespace ImGui
IMGUI_API bool IsMouseReleased(int button); // did mouse button released (went from Down to !Down)
IMGUI_API bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window). disregarding of any consideration of being blocked by a popup. (unlike IsWindowHovered() this will return true even if the window is blocked because of a popup)
IMGUI_API bool IsMouseHoveringAnyWindow(); // is mouse hovering any visible window
IMGUI_API bool IsMouseHoveringRect(const ImVec2& pos_min, const ImVec2& pos_max); // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup.
IMGUI_API bool IsMouseHoveringRect(const ImVec2& pos_min, const ImVec2& pos_max, bool clip = true); // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup.
IMGUI_API bool IsMouseDragging(int button = 0, float lock_threshold = -1.0f); // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
IMGUI_API ImVec2 GetMousePosOnOpeningCurrentPopup(); // retrieve backup of mouse positioning at the time of opening popup we have BeginPopup() into
@ -456,6 +456,7 @@ enum ImGuiWindowFlags_
ImGuiWindowFlags_NoInputs = 1 << 9, // Disable catching mouse or keyboard inputs
ImGuiWindowFlags_MenuBar = 1 << 10, // Has a menu-bar
ImGuiWindowFlags_HorizontalScrollbar = 1 << 11, // Enable horizontal scrollbar (off by default). You need to use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the "Horizontal Scrolling" section.
ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12, // Disable taking focus when transitioning from hidden to visible state
// [Internal]
ImGuiWindowFlags_ChildWindow = 1 << 20, // Don't use! For internal use by BeginChild()
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 21, // Don't use! For internal use by BeginChild()
@ -1241,7 +1242,7 @@ struct ImFont
// Members: Settings
float FontSize; // <user set> // Height of characters, set during loading (don't change after loading)
float Scale; // = 1.0f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
ImVec2 DisplayOffset; // = (0.0f,0.0f) // Offset font rendering by xx pixels
ImVec2 DisplayOffset; // = (0.0f,1.0f) // Offset font rendering by xx pixels
ImWchar FallbackChar; // = '?' // Replacement glyph if one isn't found. Only set via SetFallbackChar()
ImFontConfig* ConfigData; // // Pointer within ImFontAtlas->ConfigData
int ConfigDataCount; //

View File

@ -1,4 +1,4 @@
// ImGui library v1.45
// ImGui library v1.46 WIP
// Demo code
// Don't remove this file from your project! It is useful reference code that you can execute.

View File

@ -1,4 +1,4 @@
// ImGui library v1.45
// ImGui library v1.46 WIP
// Drawing and font code
// Contains implementation for
@ -157,12 +157,22 @@ void ImDrawList::ChannelsSplit(int channels_count)
if (old_channels_count < channels_count)
_Channels.resize(channels_count);
_ChannelsCount = channels_count;
for (int i = 0; i < channels_count; i++)
// _Channels[] (24 bytes each) hold storage that we'll swap with this->_CmdBuffer/_IdxBuffer
// The content of _Channels[0] at this point doesn't matter. We clear it to make state tidy in a debugger but we don't strictly need to.
// When we switch to the next channel, we'll copy _CmdBuffer/_IdxBuffer into _Channels[0] and then _Channels[1] into _CmdBuffer/_IdxBuffer
memset(&_Channels[0], 0, sizeof(ImDrawChannel));
for (int i = 1; i < channels_count; i++)
{
if (i >= old_channels_count)
{
new(&_Channels[i]) ImDrawChannel();
else if (i > 0)
_Channels[i].CmdBuffer.resize(0), _Channels[i].IdxBuffer.resize(0);
}
else
{
_Channels[i].CmdBuffer.resize(0);
_Channels[i].IdxBuffer.resize(0);
}
if (_Channels[i].CmdBuffer.Size == 0)
{
ImDrawCmd draw_cmd;

View File

@ -1,4 +1,4 @@
// ImGui library v1.45
// ImGui library v1.46 WIP
// Internals
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!

View File

@ -1,3 +1,7 @@
#ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wshadow"
#endif
// stb_truetype.h - v1.07 - public domain
// authored from 2009-2015 by Sean Barrett / RAD Game Tools
//
@ -2048,7 +2052,8 @@ static void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill,
static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)
{
(void)vsubsample;
stbtt__hheap hh = {};
stbtt__hheap hh;
memset(&hh, 0, sizeof(hh));
stbtt__active_edge *active = NULL;
int y,j=0, i;
float scanline_data[129], *scanline, *scanline2;