mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
tmp
This commit is contained in:
@@ -1281,12 +1281,16 @@ public:
|
||||
// Helper: IM_NEW(), IM_PLACEMENT_NEW(), IM_DELETE() macros to call MemAlloc + Placement New, Placement Delete + MemFree
|
||||
// We call C++ constructor on own allocated memory via the placement "new(ptr) Type()" syntax.
|
||||
// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.
|
||||
struct ImNewDummy {};
|
||||
inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; }
|
||||
inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symetrical new()
|
||||
#define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR)
|
||||
#define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
|
||||
template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
|
||||
//struct ImNewDummy {};
|
||||
//inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; }
|
||||
//inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symetrical new()
|
||||
//#define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR)
|
||||
//#define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
|
||||
//template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
|
||||
|
||||
#define IM_PLACEMENT_NEW(_PTR) new (_PTR)
|
||||
#define IM_NEW(_TYPE) new _TYPE
|
||||
#define IM_DELETE(_X) delete _X
|
||||
|
||||
// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
|
||||
// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
|
||||
#undef new
|
||||
#include "imgui.h"
|
||||
#define IMGUI_DEFINE_MATH_OPERATORS
|
||||
#include "imgui_internal.h"
|
||||
|
||||
Reference in New Issue
Block a user