Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F624023
events.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
events.cpp
View Options
#ifdef USE_SDL
#include
<SDL.h>
#endif
#include
"events.h"
#include
"shutdown_exception.h"
#include
"thread.h"
#include
"funcs.h"
namespace
Util
{
EventManager
::
EventManager
(){
}
#ifdef USE_SDL
void
EventManager
::
runSDL
(){
SDL_Event
event
;
while
(
SDL_PollEvent
(
&
event
)
==
1
){
switch
(
event
.
type
){
case
SDL_QUIT
:
{
dispatch
(
CloseWindow
);
break
;
}
default
:
{
break
;
}
}
}
}
#endif
void
EventManager
::
run
(){
#ifdef USE_SDL
runSDL
();
#endif
}
/* kill the program if the user requests */
void
EventManager
::
waitForThread
(
Thread
&
thread
){
while
(
!
thread
.
isRunning
()){
try
{
run
();
}
catch
(
const
ShutdownException
&
death
){
thread
.
kill
();
throw
death
;
}
Util
::
rest
(
10
);
}
}
EventManager
::~
EventManager
(){
}
void
EventManager
::
dispatch
(
Event
type
){
switch
(
type
){
case
CloseWindow
:
{
throw
ShutdownException
();
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, Nov 14, 9:52 PM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140323
Default Alt Text
events.cpp (1 KB)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline