src/Graphics.cc
changeset 311 440763821484
parent 282 e0e4dfc3e528
child 312 10743f190aab
equal deleted inserted replaced
310:7e0cfc5f0944 311:440763821484
    18 
    18 
    19     // enable
    19     // enable
    20     update_timer.start();
    20     update_timer.start();
    21 }
    21 }
    22 
    22 
    23 void Graphics::check_input (TimeMS dt) {
    23 void Graphics::check_input (void) {
    24     LocalPlayer *player;
    24     LocalPlayer *player;
    25     PlayerInput input_mask = 0;
    25     PlayerInput input_mask;
       
    26     TimeMS input_dt;
    26     
    27     
    27     // update gui flags
    28     // update gui flags
    28     this->flags = input.readGuiInput();
    29     this->flags = input.readGuiInput();
    29 
    30 
    30     // quit?
    31     // quit?
    41     // dump debug info on stderr
    42     // dump debug info on stderr
    42     if (flags & GUI_INPUT_DEBUG_PLAYER)
    43     if (flags & GUI_INPUT_DEBUG_PLAYER)
    43         player->printDebugInfo();
    44         player->printDebugInfo();
    44     
    45     
    45     // build input_mask
    46     // build input_mask
    46     input_mask = input.readPlayerInput();
    47     input.readPlayerInput(input_mask, input_dt);
    47     
    48     
    48     // apply input if there was any
    49     // apply input if there was any
    49     if (input_mask)
    50     if (input_mask)
    50         player->handleInput(input_mask, dt);
    51         player->handleInput(input_mask, input_dt);
    51 }
    52 }
    52 
    53 
    53 static PixelDimension value_between (PixelDimension low, PixelDimension value, PixelDimension high) {
    54 static PixelDimension value_between (PixelDimension low, PixelDimension value, PixelDimension high) {
    54     if (value < low)
    55     if (value < low)
    55         return low;
    56         return low;
    89     // Flip window buffer, sync
    90     // Flip window buffer, sync
    90     flip(1);
    91     flip(1);
    91 }
    92 }
    92 
    93 
    93 void Graphics::on_update (TimeMS tick_length) {
    94 void Graphics::on_update (TimeMS tick_length) {
       
    95     (void) tick_length;
       
    96 
    94     // check keyboard input
    97     // check keyboard input
    95     check_input(tick_length);
    98     check_input();
    96 
    99 
    97     // redraw display
   100     // redraw display
    98     do_redraw();
   101     do_redraw();
    99 }
   102 }