bool CMainMenu::OnEvent(irr::SEvent event) {
using namespace irr;
using namespace gui;
if (event.EventType == EET_GUI_EVENT) {
s32 id = event.GUIEvent.Caller->getID();
switch(event.GUIEvent.EventType) {
case EGET_BUTTON_CLICKED:
if(id == 2) {
printf("it's an event");
return true;
}
break;
}
}
return false;
}
This is the techdemo real code is bad too:
bool CMainMenu::OnEvent(irr::SEvent event)
{
if (event.EventType == EET_GUI_EVENT)
{
s32 id = event.GUIEvent.Caller->getID();
switch(id)
{
case 2:
if (event.GUIEvent.EventType == gui::EGET_BUTTON_CLICKED )
{
device->closeDevice();
start = true;
}
break;
}
}
return false;
}
The tutorial 5 events is perfetcly. What is the problem