viz1090/sdl1090/draw.c
Nathan a9a6bc9584 draw.c refactor. draw.c now handles outer draw routine, previous contents moved to maps.c
Former-commit-id: c1374d41abd475f83a32fa9ec639d0feef018a20
Former-commit-id: 39838a5e1d346c49df1a8f65c910db943a228c61
2017-10-05 09:58:23 -05:00

46 lines
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) {
Modes.interactive_last_update = mstime();
SDL_FillRect(game.screen, NULL, 0);
if (Modes.map) {
drawMap();
//drawList(3,320);
} else {
drawList(10,0);
}
#ifdef RPI
SDL_Flip(game.screen);
#else
SDL_Rect clip;
SDL_Surface *temp = SDL_DisplayFormat(zoomSurface(game.screen, UPSCALE, UPSCALE, 0));
clip.x = 0;
clip.y = 0;
clip.w = temp->w;
clip.h = temp->h;
SDL_BlitSurface(temp, &clip, game.bigScreen, 0);
SDL_Flip(game.bigScreen);
#endif
}
}