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