Need to add a deallocator for the windows

This commit is contained in:
2025-11-13 21:56:25 +00:00
parent 9750951dfd
commit 962926333f
2 changed files with 11 additions and 7 deletions
+8 -1
View File
@@ -163,7 +163,6 @@ std::uint8_t UIElement::ChildrenCount() {
namespace WindowPool {
UIElement pool[MAX_WINDOWS];
bool inUse[MAX_WINDOWS] = {false};
// int16_t poolIndex = 0;
static inline int16_t getNextIndex() {
for (int k = 0; k < MAX_WINDOWS; k++) {
@@ -191,6 +190,14 @@ namespace WindowPool {
return nextIndex;
}
void Deallocate(int16_t id) {
pool[id].SetTitle((char*)"");
pool[id].SetUIDimensions(UIDimensions(0, 0, 0, 0));
pool[id].SetUIDecorations(UIDecorations());
inUse[id] = false;
}
UIElement* GetHandle(int16_t id) {
return &pool[id];
}
+3 -6
View File
@@ -73,15 +73,12 @@ public:
namespace WindowPool {
extern UIElement pool[MAX_WINDOWS];
// extern int16_t poolIndex;
extern bool inUse[MAX_WINDOWS];
// I need to add a list of available IDs
// And maybe a list of unavailable IDs or just create a custome type
// then make a list of that custom and have a bool saying if its available or not
// Although having a list of available IDs is best
int16_t Allocate();
// I will finish this later on, still have to figure out how to properly
// destroy the UIComponent
void Deallocate();
UIElement* GetHandle(int16_t index);
// Debugging