@ -78,7 +78,7 @@ struct ImVec4
} ;
// Helpers at bottom of the file:
// - class ImVector<> // Lightweight std::vector like class. Use '#define ImVector std::vector' if you want to use the STL type or your own type.
// - class ImVector<> // Lightweight std::vector like class.
// - IMGUI_ONCE_UPON_A_FRAME // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times)
// - struct ImGuiTextFilter // Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
// - struct ImGuiTextBuffer // Text buffer for logging/accumulating text
@ -241,9 +241,9 @@ namespace ImGui
IMGUI_API bool ColorEdit3 ( const char * label , float col [ 3 ] ) ;
IMGUI_API bool ColorEdit4 ( const char * label , float col [ 4 ] , bool show_alpha = true ) ;
IMGUI_API void ColorEditMode ( ImGuiColorEditMode mode ) ;
IMGUI_API void PlotLines ( const char * label , const float * values , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) , size_ t stride = sizeof ( float ) ) ;
IMGUI_API void PlotLines ( const char * label , const float * values , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) , in t stride = sizeof ( float ) ) ;
IMGUI_API void PlotLines ( const char * label , float ( * values_getter ) ( void * data , int idx ) , void * data , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) ) ;
IMGUI_API void PlotHistogram ( const char * label , const float * values , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) , size_ t stride = sizeof ( float ) ) ;
IMGUI_API void PlotHistogram ( const char * label , const float * values , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) , in t stride = sizeof ( float ) ) ;
IMGUI_API void PlotHistogram ( const char * label , float ( * values_getter ) ( void * data , int idx ) , void * data , int values_count , int values_offset = 0 , const char * overlay_text = NULL , float scale_min = FLT_MAX , float scale_max = FLT_MAX , ImVec2 graph_size = ImVec2 ( 0 , 0 ) ) ;
// Widgets: Drags (tip: ctrl+click on a drag box to input text)
@ -742,15 +742,13 @@ struct ImGuiIO
//-----------------------------------------------------------------------------
// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
// Use '#define ImVector std::vector' if you want to use the STL type or your own type.
// Our implementation does NOT call c++ constructors because we don't use them in ImGui. Don't use this class as a straight std::vector replacement in your code!
# ifndef ImVector
template < typename T >
class ImVector
{
protected :
size_t Size ;
size_t Capacity ;
int Size ;
int Capacity ;
T * Data ;
public :
@ -762,13 +760,11 @@ public:
~ ImVector ( ) { if ( Data ) ImGui : : MemFree ( Data ) ; }
inline bool empty ( ) const { return Size = = 0 ; }
inline size_t size ( ) const { return Size ; }
inline size_t capacity ( ) const { return Capacity ; }
inline int size ( ) const { return Size ; }
inline int capacity ( ) const { return Capacity ; }
inline value_type & at ( size_t i ) { IM_ASSERT ( i < Size ) ; return Data [ i ] ; }
inline const value_type & at ( size_t i ) const { IM_ASSERT ( i < Size ) ; return Data [ i ] ; }
inline value_type & operator [ ] ( size_t i ) { IM_ASSERT ( i < Size ) ; return Data [ i ] ; }
inline const value_type & operator [ ] ( size_t i ) const { IM_ASSERT ( i < Size ) ; return Data [ i ] ; }
inline value_type & operator [ ] ( int i ) { IM_ASSERT ( i < Size ) ; return Data [ i ] ; }
inline const value_type & operator [ ] ( int i ) const { IM_ASSERT ( i < Size ) ; return Data [ i ] ; }
inline void clear ( ) { if ( Data ) { Size = Capacity = 0 ; ImGui : : MemFree ( Data ) ; Data = NULL ; } }
inline iterator begin ( ) { return Data ; }
@ -779,16 +775,16 @@ public:
inline const value_type & front ( ) const { IM_ASSERT ( Size > 0 ) ; return Data [ 0 ] ; }
inline value_type & back ( ) { IM_ASSERT ( Size > 0 ) ; return Data [ Size - 1 ] ; }
inline const value_type & back ( ) const { IM_ASSERT ( Size > 0 ) ; return Data [ Size - 1 ] ; }
inline void swap ( ImVector < T > & rhs ) { const size_ t rhs_size = rhs . Size ; rhs . Size = Size ; Size = rhs_size ; const size_ t rhs_cap = rhs . Capacity ; rhs . Capacity = Capacity ; Capacity = rhs_cap ; value_type * rhs_data = rhs . Data ; rhs . Data = Data ; Data = rhs_data ; }
inline void swap ( ImVector < T > & rhs ) { in t rhs_size = rhs . Size ; rhs . Size = Size ; Size = rhs_size ; in t rhs_cap = rhs . Capacity ; rhs . Capacity = Capacity ; Capacity = rhs_cap ; value_type * rhs_data = rhs . Data ; rhs . Data = Data ; Data = rhs_data ; }
inline size_t _grow_capacity ( size_t new_size ) { size_ t new_capacity = Capacity ? ( Capacity + Capacity / 2 ) : 8 ; return new_capacity > new_size ? new_capacity : new_size ; }
inline int _grow_capacity ( int new_size ) { in t new_capacity = Capacity ? ( Capacity + Capacity / 2 ) : 8 ; return new_capacity > new_size ? new_capacity : new_size ; }
inline void resize ( size_t new_size ) { if ( new_size > Capacity ) reserve ( _grow_capacity ( new_size ) ) ; Size = new_size ; }
inline void reserve ( size_ t new_capacity )
inline void resize ( int new_size ) { if ( new_size > Capacity ) reserve ( _grow_capacity ( new_size ) ) ; Size = new_size ; }
inline void reserve ( in t new_capacity )
{
if ( new_capacity < = Capacity ) return ;
T * new_data = ( value_type * ) ImGui : : MemAlloc ( new_capacity * sizeof ( value_type ) ) ;
memcpy ( new_data , Data , Size * sizeof ( value_type ) ) ;
T * new_data = ( value_type * ) ImGui : : MemAlloc ( ( size_t ) new_capacity * sizeof ( value_type ) ) ;
memcpy ( new_data , Data , ( size_t ) Size * sizeof ( value_type ) ) ;
ImGui : : MemFree ( Data ) ;
Data = new_data ;
Capacity = new_capacity ;
@ -797,10 +793,9 @@ public:
inline void push_back ( const value_type & v ) { if ( Size = = Capacity ) reserve ( _grow_capacity ( Size + 1 ) ) ; Data [ Size + + ] = v ; }
inline void pop_back ( ) { IM_ASSERT ( Size > 0 ) ; Size - - ; }
inline iterator erase ( const_iterator it ) { IM_ASSERT ( it > = begin ( ) & & it < end ( ) ) ; const ptrdiff_t off = it - begin ( ) ; memmove ( Data + off , Data + off + 1 , ( Size - ( size_t ) off - 1 ) * sizeof ( value_type ) ) ; Size - - ; return Data + off ; }
inline iterator insert ( const_iterator it , const value_type & v ) { IM_ASSERT ( it > = begin ( ) & & it < = end ( ) ) ; const ptrdiff_t off = it - begin ( ) ; if ( Size = = Capacity ) reserve ( Capacity ? Capacity * 2 : 4 ) ; if ( off < ( int ) Size ) memmove ( Data + off + 1 , Data + off , ( Size - ( size_t ) off ) * sizeof ( value_type ) ) ; Data [ off ] = v ; Size + + ; return Data + off ; }
inline iterator erase ( const_iterator it ) { IM_ASSERT ( it > = begin ( ) & & it < end ( ) ) ; const ptrdiff_t off = it - begin ( ) ; memmove ( Data + off , Data + off + 1 , ( ( size_t ) Size - ( size_t ) off - 1 ) * sizeof ( value_type ) ) ; Size - - ; return Data + off ; }
inline iterator insert ( const_iterator it , const value_type & v ) { IM_ASSERT ( it > = begin ( ) & & it < = end ( ) ) ; const ptrdiff_t off = it - begin ( ) ; if ( Size = = Capacity ) reserve ( Capacity ? Capacity * 2 : 4 ) ; if ( off < ( int ) Size ) memmove ( Data + off + 1 , Data + off , ( ( size_t ) Size - ( size_t ) off ) * sizeof ( value_type ) ) ; Data [ off ] = v ; Size + + ; return Data + off ; }
} ;
# endif // #ifndef ImVector
// Helper: execute a block of code once a frame only
// Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
@ -857,7 +852,7 @@ struct ImGuiTextBuffer
ImGuiTextBuffer ( ) { Buf . push_back ( 0 ) ; }
const char * begin ( ) const { return & Buf . front ( ) ; }
const char * end ( ) const { return & Buf . back ( ) ; } // Buf is zero-terminated, so end() will point on the zero-terminator
size_t size ( ) const { return Buf . size ( ) - 1 ; }
int size ( ) const { return Buf . size ( ) - 1 ; }
bool empty ( ) { return size ( ) > = 1 ; }
void clear ( ) { Buf . clear ( ) ; Buf . push_back ( 0 ) ; }
IMGUI_API void append ( const char * fmt , . . . ) ;
@ -921,7 +916,7 @@ struct ImGuiTextEditCallbackData
// Completion,History,Always events:
ImGuiKey EventKey ; // Key pressed (Up/Down/TAB) // Read-only
char * Buf ; // Current text // Read-write (pointed data only)
size_t BufSize ; // // Read-only
int BufSize ; // // Read-only
bool BufDirty ; // Set if you modify Buf directly // Write
int CursorPos ; // // Read-write
int SelectionStart ; // // Read-write (== to SelectionEnd when no selection)
@ -1081,7 +1076,7 @@ struct ImDrawList
IMGUI_API void AddDrawCmd ( ) ; // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible
// Internal helpers
IMGUI_API void PrimReserve ( unsigned int idx_count , unsigned int vtx_count ) ;
IMGUI_API void PrimReserve ( int idx_count , int vtx_count ) ;
IMGUI_API void PrimRect ( const ImVec2 & a , const ImVec2 & b , ImU32 col ) ;
IMGUI_API void PrimRectUV ( const ImVec2 & a , const ImVec2 & b , const ImVec2 & uv_a , const ImVec2 & uv_b , ImU32 col ) ;
IMGUI_API void UpdateClipRect ( ) ;
@ -1188,7 +1183,7 @@ struct ImFont
IMGUI_API ~ ImFont ( ) ;
IMGUI_API void Clear ( ) ;
IMGUI_API void BuildLookupTable ( ) ;
IMGUI_API float GetCharAdvance ( unsigned short c ) const { return ( ( size_ t) c < IndexXAdvance . size ( ) ) ? IndexXAdvance [ ( size_ t) c ] : FallbackXAdvance ; }
IMGUI_API float GetCharAdvance ( unsigned short c ) const { return ( ( in t) c < IndexXAdvance . size ( ) ) ? IndexXAdvance [ ( in t) c ] : FallbackXAdvance ; }
IMGUI_API const Glyph * FindGlyph ( unsigned short c ) const ;
IMGUI_API void SetFallbackChar ( ImWchar c ) ;
IMGUI_API bool IsLoaded ( ) const { return ContainerAtlas ! = NULL ; }