mirror of https://github.com/stella-emu/stella.git
Use 'enum class' instead of raw enum.
This commit is contained in:
parent
4250f5d102
commit
44c5882920
|
@ -148,42 +148,42 @@ void EventHandlerSDL2::pollEvent()
|
|||
switch(myEvent.window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_SHOWN:
|
||||
handleSystemEvent(EVENT_WINDOW_SHOWN);
|
||||
handleSystemEvent(SystemEvent::WINDOW_SHOWN);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
handleSystemEvent(EVENT_WINDOW_HIDDEN);
|
||||
handleSystemEvent(SystemEvent::WINDOW_HIDDEN);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_EXPOSED:
|
||||
handleSystemEvent(EVENT_WINDOW_EXPOSED);
|
||||
handleSystemEvent(SystemEvent::WINDOW_EXPOSED);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
handleSystemEvent(EVENT_WINDOW_MOVED,
|
||||
handleSystemEvent(SystemEvent::WINDOW_MOVED,
|
||||
myEvent.window.data1, myEvent.window.data1);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_RESIZED:
|
||||
handleSystemEvent(EVENT_WINDOW_RESIZED,
|
||||
handleSystemEvent(SystemEvent::WINDOW_RESIZED,
|
||||
myEvent.window.data1, myEvent.window.data1);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
handleSystemEvent(EVENT_WINDOW_MINIMIZED);
|
||||
handleSystemEvent(SystemEvent::WINDOW_MINIMIZED);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MAXIMIZED:
|
||||
handleSystemEvent(EVENT_WINDOW_MAXIMIZED);
|
||||
handleSystemEvent(SystemEvent::WINDOW_MAXIMIZED);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_RESTORED:
|
||||
handleSystemEvent(EVENT_WINDOW_RESTORED);
|
||||
handleSystemEvent(SystemEvent::WINDOW_RESTORED);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_ENTER:
|
||||
handleSystemEvent(EVENT_WINDOW_ENTER);
|
||||
handleSystemEvent(SystemEvent::WINDOW_ENTER);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_LEAVE:
|
||||
handleSystemEvent(EVENT_WINDOW_LEAVE);
|
||||
handleSystemEvent(SystemEvent::WINDOW_LEAVE);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
handleSystemEvent(EVENT_WINDOW_FOCUS_GAINED);
|
||||
handleSystemEvent(SystemEvent::WINDOW_FOCUS_GAINED);
|
||||
break;
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
handleSystemEvent(EVENT_WINDOW_FOCUS_LOST);
|
||||
handleSystemEvent(SystemEvent::WINDOW_FOCUS_LOST);
|
||||
break;
|
||||
}
|
||||
break; // SDL_WINDOWEVENT
|
||||
|
|
|
@ -902,18 +902,18 @@ void EventHandler::handleSystemEvent(SystemEvent e, int, int)
|
|||
{
|
||||
switch(e)
|
||||
{
|
||||
case EVENT_WINDOW_EXPOSED:
|
||||
case SystemEvent::WINDOW_EXPOSED:
|
||||
myOSystem.frameBuffer().update();
|
||||
break;
|
||||
|
||||
case EVENT_WINDOW_FOCUS_GAINED:
|
||||
case SystemEvent::WINDOW_FOCUS_GAINED:
|
||||
// Used to handle Alt-x key combos; sometimes the key associated with
|
||||
// Alt gets 'stuck' and is passed to the core for processing
|
||||
if(myAltKeyCounter > 0)
|
||||
myAltKeyCounter = 2;
|
||||
break;
|
||||
#if 0
|
||||
case EVENT_WINDOW_MINIMIZED:
|
||||
case SystemEvent::WINDOW_MINIMIZED:
|
||||
if(myState == EventHandlerState::EMULATION) enterMenuMode(EventHandlerState::OPTIONSMENU);
|
||||
break;
|
||||
#endif
|
||||
|
|
|
@ -322,19 +322,19 @@ class EventHandler
|
|||
virtual void pollEvent() = 0;
|
||||
|
||||
// Other events that can be received from the underlying event handler
|
||||
enum SystemEvent {
|
||||
EVENT_WINDOW_SHOWN,
|
||||
EVENT_WINDOW_HIDDEN,
|
||||
EVENT_WINDOW_EXPOSED,
|
||||
EVENT_WINDOW_MOVED,
|
||||
EVENT_WINDOW_RESIZED,
|
||||
EVENT_WINDOW_MINIMIZED,
|
||||
EVENT_WINDOW_MAXIMIZED,
|
||||
EVENT_WINDOW_RESTORED,
|
||||
EVENT_WINDOW_ENTER,
|
||||
EVENT_WINDOW_LEAVE,
|
||||
EVENT_WINDOW_FOCUS_GAINED,
|
||||
EVENT_WINDOW_FOCUS_LOST
|
||||
enum class SystemEvent {
|
||||
WINDOW_SHOWN,
|
||||
WINDOW_HIDDEN,
|
||||
WINDOW_EXPOSED,
|
||||
WINDOW_MOVED,
|
||||
WINDOW_RESIZED,
|
||||
WINDOW_MINIMIZED,
|
||||
WINDOW_MAXIMIZED,
|
||||
WINDOW_RESTORED,
|
||||
WINDOW_ENTER,
|
||||
WINDOW_LEAVE,
|
||||
WINDOW_FOCUS_GAINED,
|
||||
WINDOW_FOCUS_LOST
|
||||
};
|
||||
void handleSystemEvent(SystemEvent e, int data1 = 0, int data2 = 0);
|
||||
|
||||
|
|
Loading…
Reference in New Issue