Fix The rest of UI7 Mem leaks
Throw OneFrame living objs into a pool
This commit is contained in:
@@ -111,6 +111,25 @@ class PD_API Container {
|
||||
virtual void Draw() {}
|
||||
/** Template function to update internal data (if needed) */
|
||||
virtual void Update() {}
|
||||
/** Template as well as base func for Pool based Containers */
|
||||
virtual void Reset() {
|
||||
pos = 0;
|
||||
size = 0;
|
||||
parent = nullptr;
|
||||
id = 0;
|
||||
pFlags = 0;
|
||||
skippable = false;
|
||||
rem = false;
|
||||
inp_done = false;
|
||||
pSelected = false;
|
||||
pPressed = false;
|
||||
pPressedTwice = false;
|
||||
pCLipRectUsed = false;
|
||||
pClipRect = 0;
|
||||
io = nullptr;
|
||||
list = nullptr;
|
||||
last_use = 0;
|
||||
}
|
||||
|
||||
/** Internal function */
|
||||
void PreDraw();
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace UI7 {
|
||||
*/
|
||||
class PD_API DynObj : public Container {
|
||||
public:
|
||||
DynObj() {}
|
||||
/**
|
||||
* Button Object constructor
|
||||
* @param label Label of the Button
|
||||
@@ -69,6 +70,14 @@ class PD_API DynObj : public Container {
|
||||
/** Function to Update Size if framepadding changes */
|
||||
void Update() override;
|
||||
|
||||
void Reset() override {
|
||||
Container::Reset();
|
||||
color = UI7Color_Button;
|
||||
pressed = false;
|
||||
pRenFun = nullptr;
|
||||
pInp = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
UI7Color color = UI7Color_Button; ///< current button color
|
||||
bool pressed = false; ///< ispressed value
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace UI7 {
|
||||
*/
|
||||
class PD_API Image : public Container {
|
||||
public:
|
||||
Image() {}
|
||||
/**
|
||||
* Constructor for the Image Object
|
||||
* @param img Image Texture Reference
|
||||
@@ -57,6 +58,13 @@ class PD_API Image : public Container {
|
||||
* */
|
||||
void Draw() override;
|
||||
|
||||
void Reset() override {
|
||||
Container::Reset();
|
||||
img = Li::Texture();
|
||||
newsize = 0.f;
|
||||
cuv = Li::Rect();
|
||||
}
|
||||
|
||||
private:
|
||||
Li::Texture img; ///< Texture
|
||||
fvec2 newsize = 0.f; ///< New Size
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace UI7 {
|
||||
*/
|
||||
class PD_API Label : public Container {
|
||||
public:
|
||||
Label() {}
|
||||
/**
|
||||
* Constructor for Label Object
|
||||
* @param label Label [Text] to Draw
|
||||
@@ -54,6 +55,13 @@ class PD_API Label : public Container {
|
||||
*/
|
||||
void Update() override;
|
||||
|
||||
void Reset() override {
|
||||
Container::Reset();
|
||||
tdim = 0;
|
||||
color = UI7Color_Text;
|
||||
label.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
fvec2 tdim; ///< Text Size
|
||||
UI7Color color = UI7Color_Text; ///< Color
|
||||
|
||||
Reference in New Issue
Block a user