fix spritesheet overwrite warning
This commit is contained in:
1 parent
2b662d24d6
commit
c5a9ab8119
3 files changed
+19
-3
No files matched your search
@@ -6,6 +6,8 @@
|
||||
|
||||
namespace anm2ed::imgui
|
||||
{
|
||||
int PopupHelper::nextId = 1;
|
||||
|
||||
#define POPUP_LIST \
|
||||
X(POPUP_SMALL, 0.25f, true) \
|
||||
X(POPUP_NORMAL, 0.5f, true) \
|
||||
@@ -32,6 +34,15 @@ namespace anm2ed::imgui
|
||||
this->labelId = labelId;
|
||||
this->type = type;
|
||||
this->position = position;
|
||||
id = nextId++;
|
||||
}
|
||||
|
||||
const char* PopupHelper::label() const
|
||||
{
|
||||
labelText = localize.get(labelId);
|
||||
labelText += "##Popup";
|
||||
labelText += std::to_string(id);
|
||||
return labelText.c_str();
|
||||
}
|
||||
|
||||
void PopupHelper::open()
|
||||
@@ -45,7 +56,7 @@ namespace anm2ed::imgui
|
||||
|
||||
void PopupHelper::trigger()
|
||||
{
|
||||
if (isTriggered) ImGui::OpenPopup(localize.get(labelId));
|
||||
if (isTriggered) ImGui::OpenPopup(label());
|
||||
isTriggered = false;
|
||||
|
||||
auto viewport = ImGui::GetMainViewport();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "strings.hpp"
|
||||
|
||||
namespace anm2ed::imgui
|
||||
@@ -31,12 +33,15 @@ namespace anm2ed::imgui
|
||||
StringType labelId{};
|
||||
PopupType type{};
|
||||
PopupPosition position{};
|
||||
int id{};
|
||||
bool isOpen{};
|
||||
bool isTriggered{};
|
||||
bool isJustOpened{};
|
||||
mutable std::string labelText{};
|
||||
static int nextId;
|
||||
|
||||
PopupHelper(StringType, PopupType = POPUP_NORMAL, PopupPosition = POPUP_CENTER);
|
||||
const char* label() const { return localize.get(labelId); }
|
||||
const char* label() const;
|
||||
bool is_open();
|
||||
void open();
|
||||
void trigger();
|
||||
|
||||
Reference in new issue
Block a user