summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorJapa2011-07-16 20:25:38 +0000
committerJapa2011-07-16 20:25:38 +0000
commit3eacec9eef6da5e6ce6f7d966a6b601f6268557c (patch)
treea3f5aa3ede09e0a916be3256104fb3319b482d90 /main.cpp
parent0c4c063bc1df25c4b9c8941321fa5c76dc070781 (diff)
downloadstonesense-3eacec9eef6da5e6ce6f7d966a6b601f6268557c.tar.gz
stonesense-3eacec9eef6da5e6ce6f7d966a6b601f6268557c.tar.bz2
stonesense-3eacec9eef6da5e6ce6f7d966a6b601f6268557c.tar.xz
Got windows to stop repeating events.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index c6e4494..b5182d5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -91,9 +91,11 @@ static void main_loop(ALLEGRO_DISPLAY * display, ALLEGRO_EVENT_QUEUE *queue, ALL
con.print("Focus on the main window (black) and press keys to see events. \n");
con.print("Escape quits.\n\n");
- while (!al_get_thread_should_stop(thred)) {
+ while (!al_get_thread_should_stop(thred))
+ {
/* Take the next event out of the event queue, and store it in `event'. */
- al_wait_for_event_timed(queue, &event, 1.0f);
+ bool in_time = 0;
+ in_time = al_wait_for_event_timed(queue, &event, 1.0f);
/* Check what type of event we got and act accordingly. ALLEGRO_EVENT
* is a union type and interpretation of its contents is dependent on
@@ -104,8 +106,10 @@ static void main_loop(ALLEGRO_DISPLAY * display, ALLEGRO_EVENT_QUEUE *queue, ALL
* fields respectively, e.g. 'event.any.timestamp'
*/
+ if(in_time)
{
- switch (event.type) {
+ switch (event.type)
+ {
/* ALLEGRO_EVENT_KEY_DOWN - a keyboard key was pressed.
*/