Exemple #1
0
int HandleWsEvent(_THIS, const TWsEvent& aWsEvent)
{
    switch (aWsEvent.Type())
		{    
		case EEventSwitchOff:
			SDL_PrivateQuit();
			return 0;
    	case EEventPointerBufferReady:
    	    return PointerBufferReadyEvent(_this/*, aWsEvent.Time()*/);
        case EEventPointer: /* Mouse pointer events */
            return PointerEvent(_this, aWsEvent);
        case EEventKeyDown: /* Key events */
            return KeyDownEvent(_this, aWsEvent);
        case EEventKeyUp: /* Key events */
            return KeyUpEvent(_this, aWsEvent);
        case EEventFocusGained: /* SDL window got focus */
            return FocusGainedEvent(_this);	   
        case EEventFocusLost: /* SDL window lost focus */
        	return FocusLostEvent(_this);
        case EEventModifiersChanged: 
            return ModifiersChangedEvent(aWsEvent);         
    	case EEventScreenDeviceChanged:
    	    return ScreenDeviceChanged();
    	case ESDLWsEvent:
    	    return InternalEvent(aWsEvent);
        default:            
            return 0;
		} 
    }
// generates an external event. called once per external event
// to start the state machine executing
void StateMachine::ExternalEvent(unsigned char newState, EventData* pData)
{
    // if we are supposed to ignore this event
    if (newState == EVENT_IGNORED)
    {
        // just delete the event data, if any
        if (pData) delete pData;
    }
    else
    {
        // generate the event and execute the state engine
        InternalEvent(newState, pData);
        StateEngine();
    }
}