Add ImGuiIdIssuer class for child id
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <stack>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -139,6 +145,9 @@ uint16_t ldle16b_i(uint8_t const *const p_arr, size_t const p_index) {
|
|||||||
return ldle16b(p_arr + (2 * p_index));
|
return ldle16b(p_arr + (2 * p_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the static member
|
||||||
|
std::stack<ImGuiID> ImGuiIdIssuer::idStack;
|
||||||
|
|
||||||
} // namespace core
|
} // namespace core
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
#ifndef YAZE_CORE_COMMON_H
|
#ifndef YAZE_CORE_COMMON_H
|
||||||
#define YAZE_CORE_COMMON_H
|
#define YAZE_CORE_COMMON_H
|
||||||
|
|
||||||
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <stack>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -38,6 +41,9 @@ class ExperimentFlags {
|
|||||||
|
|
||||||
// Attempt to run the dungeon room draw routine when opening a room.
|
// Attempt to run the dungeon room draw routine when opening a room.
|
||||||
bool kDrawDungeonRoomGraphics = true;
|
bool kDrawDungeonRoomGraphics = true;
|
||||||
|
|
||||||
|
// Use the new platform specific file dialog wrappers.
|
||||||
|
bool kNewFileDialogWrapper = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
ExperimentFlags() = default;
|
ExperimentFlags() = default;
|
||||||
@@ -164,6 +170,27 @@ class TaskManager {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ImGuiIdIssuer {
|
||||||
|
private:
|
||||||
|
static std::stack<ImGuiID> idStack;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Generate and push a new ID onto the stack
|
||||||
|
static ImGuiID GetNewID() {
|
||||||
|
static int counter = 1; // Start from 1 to ensure uniqueness
|
||||||
|
ImGuiID child_id = ImGui::GetID((void *)(intptr_t)counter++);
|
||||||
|
idStack.push(child_id);
|
||||||
|
return child_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pop all IDs from the stack (can be called explicitly or upon program exit)
|
||||||
|
static void Cleanup() {
|
||||||
|
while (!idStack.empty()) {
|
||||||
|
idStack.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
uint32_t SnesToPc(uint32_t addr);
|
uint32_t SnesToPc(uint32_t addr);
|
||||||
uint32_t PcToSnes(uint32_t addr);
|
uint32_t PcToSnes(uint32_t addr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user