exit gracefully and call destructor of the current active example

fflush after printf
implemented stepForward and Shutdown for the SharedMemory client/server
This commit is contained in:
=
2015-05-29 15:04:05 -07:00
parent ff15d36edf
commit bc806ab68c
10 changed files with 206 additions and 50 deletions

View File

@@ -42,13 +42,17 @@ class MyMenuItems : public Gwen::Controls::Base
public:
b3FileOpenCallback m_fileOpenCallback;
b3QuitCallback m_quitCallback;
MyMenuItems() :Gwen::Controls::Base(0),m_fileOpenCallback(0)
{
}
void myQuitApp( Gwen::Controls::Base* pControl )
{
exit(0);
if (m_quitCallback)
{
(*m_quitCallback)();
}
}
void fileOpen( Gwen::Controls::Base* pControl )
{
@@ -74,7 +78,8 @@ struct MyTestMenuBar : public Gwen::Controls::MenuStrip
{
m_menuItems = new MyMenuItems();
m_menuItems->m_fileOpenCallback = 0;
m_menuItems->m_quitCallback = 0;
m_fileMenu = AddItem( L"File" );
m_fileMenu->GetMenu()->AddItem(L"Open",m_menuItems,(Gwen::Event::Handler::Function)&MyMenuItems::fileOpen);
@@ -230,6 +235,11 @@ void GwenUserInterface::registerFileOpenCallback(b3FileOpenCallback callback)
m_data->m_menuItems->m_fileOpenCallback = callback;
}
void GwenUserInterface::registerQuitCallback(b3QuitCallback callback)
{
m_data->m_menuItems->m_quitCallback = callback;
}
void GwenUserInterface::init(int width, int height,Gwen::Renderer::Base* renderer,float retinaScale)
{
m_data->m_curYposition = 20;

View File

@@ -6,6 +6,7 @@ struct GwenInternalData;
typedef void (*b3ComboBoxCallback) (int combobox, const char* item);
typedef void (*b3ToggleButtonCallback)(int button, int state);
typedef void (*b3FileOpenCallback)();
typedef void (*b3QuitCallback)();
namespace Gwen
{
@@ -53,6 +54,7 @@ class GwenUserInterface
void registerFileOpenCallback(b3FileOpenCallback callback);
void registerQuitCallback(b3QuitCallback callback);
GwenInternalData* getInternalData()
{