2017-09-14 16:39:56 +02:00
|
|
|
#include "dump1090.h"
|
2017-10-05 16:58:23 +02:00
|
|
|
#include "structs.h"
|
2019-09-08 01:11:20 +02:00
|
|
|
#include "SDL2/SDL2_rotozoom.h"
|
2017-09-14 05:21:36 +02:00
|
|
|
|
2017-10-05 16:58:23 +02:00
|
|
|
static uint64_t mstime(void) {
|
|
|
|
struct timeval tv;
|
|
|
|
uint64_t mst;
|
2017-09-14 05:21:36 +02:00
|
|
|
|
2017-10-05 16:58:23 +02:00
|
|
|
gettimeofday(&tv, NULL);
|
|
|
|
mst = ((uint64_t)tv.tv_sec)*1000;
|
|
|
|
mst += tv.tv_usec/1000;
|
|
|
|
return mst;
|
2017-09-17 16:46:48 +02:00
|
|
|
}
|
|
|
|
|
2017-10-05 16:58:23 +02:00
|
|
|
void draw() {
|
2019-09-08 01:11:20 +02:00
|
|
|
|
2017-10-05 17:22:14 +02:00
|
|
|
if ((mstime() - Modes.interactive_last_update) < MODES_INTERACTIVE_REFRESH_TIME) {
|
|
|
|
return;
|
|
|
|
}
|
2017-09-14 05:21:36 +02:00
|
|
|
|
2017-10-05 17:22:14 +02:00
|
|
|
Modes.interactive_last_update = mstime();
|
2017-09-14 05:21:36 +02:00
|
|
|
|
2017-10-06 05:25:30 +02:00
|
|
|
updateStatus();
|
|
|
|
|
2019-09-08 01:11:20 +02:00
|
|
|
SDL_SetRenderDrawColor( game.renderer, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
SDL_RenderClear(game.renderer);
|
2017-09-14 05:21:36 +02:00
|
|
|
|
2019-09-08 21:29:21 +02:00
|
|
|
drawMap();
|
|
|
|
drawStatus();
|
|
|
|
if(!Modes.map) {
|
|
|
|
drawList(0);
|
2017-10-05 17:22:14 +02:00
|
|
|
}
|
2017-09-14 05:21:36 +02:00
|
|
|
|
2019-09-08 01:11:20 +02:00
|
|
|
SDL_RenderPresent(game.renderer);
|
2017-10-05 16:58:23 +02:00
|
|
|
}
|