implemented debugmenu shutdown
This commit is contained in:
parent
1ef67aee22
commit
59bfbaddfb
@ -6,6 +6,7 @@
|
|||||||
#include "rtcharse.h"
|
#include "rtcharse.h"
|
||||||
#include "inttypes.h"
|
#include "inttypes.h"
|
||||||
#include "debugmenu.h"
|
#include "debugmenu.h"
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
|
||||||
@ -152,6 +153,7 @@ struct Menu
|
|||||||
void update(void);
|
void update(void);
|
||||||
void draw(void);
|
void draw(void);
|
||||||
Menu(void){ memset(this, 0, sizeof(Menu)); }
|
Menu(void){ memset(this, 0, sizeof(Menu)); }
|
||||||
|
~Menu(void);
|
||||||
};
|
};
|
||||||
extern Menu toplevel;
|
extern Menu toplevel;
|
||||||
|
|
||||||
@ -160,6 +162,7 @@ struct MenuEntry_Sub : MenuEntry
|
|||||||
Menu *submenu;
|
Menu *submenu;
|
||||||
|
|
||||||
MenuEntry_Sub(const char *name, Menu *menu);
|
MenuEntry_Sub(const char *name, Menu *menu);
|
||||||
|
~MenuEntry_Sub(void) { delete submenu; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MenuEntry_Var : MenuEntry
|
struct MenuEntry_Var : MenuEntry
|
||||||
@ -705,6 +708,16 @@ Menu::draw(void)
|
|||||||
((MenuEntry_Sub*)this->selectedEntry)->submenu->draw();
|
((MenuEntry_Sub*)this->selectedEntry)->submenu->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Menu::~Menu(void)
|
||||||
|
{
|
||||||
|
MenuEntry *e, *next;
|
||||||
|
for(e = entries; e; e = next){
|
||||||
|
next = e->next;
|
||||||
|
delete e;
|
||||||
|
}
|
||||||
|
memset(this, 0, sizeof(Menu));
|
||||||
|
}
|
||||||
|
|
||||||
Menu*
|
Menu*
|
||||||
findMenu(const char *name)
|
findMenu(const char *name)
|
||||||
{
|
{
|
||||||
@ -792,6 +805,7 @@ DebugMenuInit(void)
|
|||||||
assert(arrow);
|
assert(arrow);
|
||||||
RwImageDestroy(img);
|
RwImageDestroy(img);
|
||||||
|
|
||||||
|
|
||||||
menuInitialized = true;
|
menuInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,7 +818,14 @@ DebugMenuShutdown(void)
|
|||||||
cursor = nil;
|
cursor = nil;
|
||||||
RwRasterDestroy(arrow);
|
RwRasterDestroy(arrow);
|
||||||
arrow = nil;
|
arrow = nil;
|
||||||
// TODO: the menus ...
|
|
||||||
|
toplevel.~Menu();
|
||||||
|
new (&toplevel) Menu();
|
||||||
|
|
||||||
|
activeMenu = &toplevel;
|
||||||
|
deepestMenu = &toplevel;
|
||||||
|
mouseOverMenu = nil;
|
||||||
|
mouseOverEntry = nil;
|
||||||
}
|
}
|
||||||
menuInitialized = false;
|
menuInitialized = false;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ struct MenuEntry
|
|||||||
Menu *menu;
|
Menu *menu;
|
||||||
|
|
||||||
MenuEntry(const char *name);
|
MenuEntry(const char *name);
|
||||||
|
virtual ~MenuEntry(void) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef MenuEntry DebugMenuEntry;
|
typedef MenuEntry DebugMenuEntry;
|
||||||
|
Loading…
Reference in New Issue
Block a user