mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Added non-const ImVec2 [] operator for consistency (and because some docking code needs it.)
This commit is contained in:
parent
352695bc57
commit
049c515840
3
imgui.h
3
imgui.h
@ -135,7 +135,8 @@ struct ImVec2
|
|||||||
float x, y;
|
float x, y;
|
||||||
ImVec2() { x = y = 0.0f; }
|
ImVec2() { x = y = 0.0f; }
|
||||||
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
||||||
float operator[] (size_t i) const { IM_ASSERT(i <= 1); return (&x)[i]; } // We very rarely use this [] operator, the assert overhead is fine.
|
float operator[] (size_t idx) const { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
||||||
|
float& operator[] (size_t idx) { IM_ASSERT(idx <= 1); return (&x)[idx]; } // We very rarely use this [] operator, the assert overhead is fine.
|
||||||
#ifdef IM_VEC2_CLASS_EXTRA
|
#ifdef IM_VEC2_CLASS_EXTRA
|
||||||
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
IM_VEC2_CLASS_EXTRA // Define additional constructors and implicit cast operators in imconfig.h to convert back and forth between your math types and ImVec2.
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user