viz1090/sdl1090/draw.c
Nathan aa8e3dca4b status boxes on map layout
Former-commit-id: 0ef788b2ddd092a1d30bdcc6d83bc0e972d5e229
Former-commit-id: 733d714f10f3ea03cf011aa4226c62a7784b2a36
2017-10-05 22:25:30 -05:00

51 lines
1.1 KiB
C

#include "dump1090.h"
#include "structs.h"
#include "SDL/SDL_rotozoom.h"
static uint64_t mstime(void) {
struct timeval tv;
uint64_t mst;
gettimeofday(&tv, NULL);
mst = ((uint64_t)tv.tv_sec)*1000;
mst += tv.tv_usec/1000;
return mst;
}
void draw() {
if ((mstime() - Modes.interactive_last_update) < MODES_INTERACTIVE_REFRESH_TIME) {
return;
}
Modes.interactive_last_update = mstime();
updateStatus();
SDL_FillRect(game.screen, NULL, 0);
if (Modes.map) {
drawMap();
drawStatus();
} else {
drawList(10,0);
}
if(Modes.screen_upscale > 1) {
SDL_Surface *temp = zoomSurface(game.screen, Modes.screen_upscale, Modes.screen_upscale, 0);
SDL_Surface *temp2 = SDL_DisplayFormat(temp);
SDL_Rect clip;
clip.x = 0;
clip.y = 0;
clip.w = temp2->w;
clip.h = temp2->h;
SDL_BlitSurface(temp2, 0, game.bigScreen, 0);
SDL_Flip(game.bigScreen);
SDL_FreeSurface(temp);
SDL_FreeSurface(temp2);
} else {
SDL_Flip(game.screen);
}
}