Skip to content

Commit

Permalink
Refactor|Input: Separate function for updating device axes
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 12, 2012
1 parent 484ff71 commit 832d11c
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions doomsday/engine/portable/src/dd_input.c
Expand Up @@ -1063,14 +1063,26 @@ void DD_ConvertEvent(const ddevent_t* ddEvent, event_t* ev)
}
}

static void updateDeviceAxes(timespan_t ticLength)
{
int i;
for(i = 0; i < NUM_INPUT_DEVICES; ++i)
{
uint k;
for(k = 0; k < inputDevices[i].numAxes; ++k)
{
I_UpdateAxis(&inputDevices[i], k, ticLength);
}
}
}

/**
* Send all the events of the given timestamp down the responder chain.
*/
static void dispatchEvents(eventqueue_t* q, timespan_t ticLength, boolean updateAxes)
{
const boolean callGameResponders = DD_GameLoaded();
ddevent_t* ddev;
int i;

while((ddev = nextFromQueue(q)))
{
Expand Down Expand Up @@ -1121,14 +1133,7 @@ static void dispatchEvents(eventqueue_t* q, timespan_t ticLength, boolean update
if(updateAxes)
{
// Input events have modified input device state: update the axis positions.
for(i = 0; i < NUM_INPUT_DEVICES; ++i)
{
uint k;
for(k = 0; k < inputDevices[i].numAxes; ++k)
{
I_UpdateAxis(&inputDevices[i], k, ticLength);
}
}
updateDeviceAxes(ticLength);
}
}

Expand Down

0 comments on commit 832d11c

Please sign in to comment.