mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 03:47:00 +00:00
ImStrv: added imconfig class extension example, added natvis description.
This commit is contained in:
parent
194bf63863
commit
a643b23486
@ -90,6 +90,15 @@
|
||||
operator MyVec4() const { return MyVec4(x,y,z,w); }
|
||||
*/
|
||||
|
||||
//---- Define constructor to convert your string type to ImStrv (which is a non-owning begin/end pair)
|
||||
// This will be inlined as part of ImStrv class declaration.
|
||||
// This has two benefits: you won't need to use .c_str(), if length is already computed it is faster.
|
||||
//#include <string>
|
||||
//#include <string_view>
|
||||
//#define IM_STR_CLASS_EXTRA ImStrv(const std::string& s) { Begin = s.c_str(); End = Begin + s.length(); }
|
||||
//#define IM_STR_CLASS_EXTRA ImStrv(const std::string_view& s) { Begin = s.data(); End = Begin + s.length(); }
|
||||
//#define IM_STR_CLASS_EXTRA ImStrv(const MyString& s) { Begin = s.Data; End = s.end(); }
|
||||
|
||||
//---- Use 32-bit vertex indices (default is 16-bit) is one way to allow large meshes with more than 64K vertices.
|
||||
// Your renderer backend will need to support it (most example renderer backends support both 16/32-bit indices).
|
||||
// Another way to allow large meshes while keeping 16-bit indices is to handle ImDrawCmd::VtxOffset in your renderer.
|
||||
|
9
imgui.h
9
imgui.h
@ -269,7 +269,8 @@ struct ImVec4
|
||||
#endif
|
||||
};
|
||||
|
||||
// String view class.
|
||||
// String view (non-owning pair of begin/end pointers, not necessarily zero-terminated)
|
||||
// ImStrv are used as function parameters instead of passing a pair of const char*.
|
||||
#define IMGUI_HAS_IMSTR
|
||||
struct ImStrv
|
||||
{
|
||||
@ -280,9 +281,9 @@ struct ImStrv
|
||||
ImStrv(const char* b, const char* e){ Begin = b; End = e ? e : b + strlen(b); }
|
||||
inline size_t length() const { return (size_t)(End - Begin); }
|
||||
inline bool empty() const { return Begin == End; } // == "" or == NULL
|
||||
inline operator bool() const { return Begin != NULL; } // != NULL
|
||||
#ifdef IM_IMSTR_CLASS_EXTRA
|
||||
IM_IMSTR_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your string types and ImStrv.
|
||||
inline operator bool() const { return Begin != NULL; } // return true when valid ("" is valid, NULL construction is not)
|
||||
#ifdef IM_STR_CLASS_EXTRA
|
||||
IM_STR_CLASS_EXTRA // Define additional constructor in imconfig.h to convert your string types (e.g. std::string, std::string_view) to ImStrV.
|
||||
#endif
|
||||
// private: bool operator==(ImStrv) { return false; } // [DEBUG] Uncomment to catch undesirable uses of operators
|
||||
// private: bool operator!=(ImStrv) { return false; }
|
||||
|
@ -51,6 +51,11 @@ More information at: https://docs.microsoft.com/en-us/visualstudio/debugger/crea
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<!-- String view (non zero-terminated begin/end pair) -->
|
||||
<Type Name="ImStrv">
|
||||
<DisplayString>{Begin,[End-Begin]s} ({End-Begin,d})</DisplayString>
|
||||
</Type>
|
||||
|
||||
<Type Name="ImGuiWindow">
|
||||
<DisplayString>{{Name {Name,s} Active {(Active||WasActive)?1:0,d} Child {(Flags & 0x01000000)?1:0,d} Popup {(Flags & 0x04000000)?1:0,d} Hidden {(Hidden)?1:0,d}}</DisplayString>
|
||||
</Type>
|
||||
|
Loading…
Reference in New Issue
Block a user