|
|
@ -240,9 +240,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), int 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), int 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,8 +742,8 @@ template<typename T> |
|
|
|
class ImVector |
|
|
|
{ |
|
|
|
protected: |
|
|
|
size_t Size; |
|
|
|
size_t Capacity; |
|
|
|
int Size; |
|
|
|
int Capacity; |
|
|
|
T* Data; |
|
|
|
|
|
|
|
public: |
|
|
@ -755,13 +755,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; } |
|
|
@ -772,16 +770,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) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int 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) { int 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(int 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; |
|
|
@ -790,8 +788,8 @@ 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; } |
|
|
|
}; |
|
|
|
|
|
|
|
// Helper: execute a block of code once a frame only
|
|
|
@ -849,7 +847,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, ...); |
|
|
@ -913,7 +911,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)
|
|
|
@ -1155,7 +1153,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 ((int)c < IndexXAdvance.size()) ? IndexXAdvance[(int)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; } |
|
|
|