I've got an Event Receiver class (CEventReceiver) that I call in my CGame class when I use createDevice.
Now I want to add GUI events in the Event Receiver class. Let's say when a button is clicked, I want to display a text message on the screen. What should I do?
I'm not sure how to write anything to affect the CGame class. I thought about declaring OnEvent(SEvent Event, CGame* world) as such, but OnEvent isn't changable is it?
// Event handler function
bool CEventReceiver::OnEvent(SEvent Event)
{
if (Event.EventType == EET_KEY_INPUT_EVENT)
{
keys[Event.KeyInput.Key] = Event.KeyInput.PressedDown;
}
if (Event.EventType == EET_GUI_EVENT) {
s32 id = Event.GUIEvent.Caller->getID();
switch(Event.GUIEvent.EventType) {
case EGET_BUTTON_CLICKED:
if (id == 101)
{
//what do I put here to affect the CGame class?
return true;
}
break;
}
}
return false;
}