Changeset 883bb5d in network-game


Ignore:
Timestamp:
May 23, 2014, 1:15:18 AM (10 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
34bd549
Parents:
a9e808e
Message:

Extra timer events removed from queue to prevent them from piling up and reducing the frame rate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    ra9e808e r883bb5d  
    260260   al_start_timer(timer);
    261261
    262    while(!doexit)
     262   while (!doexit)
    263263   {
    264264      ALLEGRO_EVENT ev;
     
    267267
    268268      if(wndCurrent->handleEvent(ev)) {
    269          cout << "Processed gui event: " << getCurrentMillis() << endl;
    270269         // do nothing
    271270      }
    272271      else if(ev.type == ALLEGRO_EVENT_TIMER) {
    273          redraw = true; // seems like we should just call a draw function here instead
     272         redraw = true;
     273
     274         // remove any other timer events in the queue
     275         while (al_peek_next_event(event_queue, &ev) && ev.type == ALLEGRO_EVENT_TIMER) {
     276            al_get_next_event(event_queue, &ev);
     277         }
    274278      }
    275279      else if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
     
    485489
    486490         if (debugging) {
    487             //debugConsole.draw(font, al_map_rgb(255,255,255));
    488491            drawMessageStatus(font);
    489492         }
Note: See TracChangeset for help on using the changeset viewer.