initial sdl list mode
Former-commit-id: 00846e544ad84ed8c7d0d7fe9a62bebe9999cf2d Former-commit-id: 4688e987806e16e57798803f632e14d4e0f71b77
This commit is contained in:
parent
0dd0cbc13c
commit
28cc65fc6a
1
sdl1090/Anonymous_Pro.ttf.REMOVED.git-id
Normal file
1
sdl1090/Anonymous_Pro.ttf.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
|||
06aafc067310fba0d33b0a133654475ac73388ab
|
1
sdl1090/Anonymous_Pro_B.ttf.REMOVED.git-id
Normal file
1
sdl1090/Anonymous_Pro_B.ttf.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
|||
985bd4002d7a293f50db1ab1d7b90f5a3da066b4
|
1
sdl1090/Anonymous_Pro_BI.ttf.REMOVED.git-id
Normal file
1
sdl1090/Anonymous_Pro_BI.ttf.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
|||
838f2d125233f373f3b5cff30ae3fde7f1089514
|
1
sdl1090/Anonymous_Pro_I.ttf.REMOVED.git-id
Normal file
1
sdl1090/Anonymous_Pro_I.ttf.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
|||
43505c164f6a77fc43068440a586c380296f0125
|
1
sdl1090/DroidSansMono.ttf.REMOVED.git-id
Normal file
1
sdl1090/DroidSansMono.ttf.REMOVED.git-id
Normal file
|
@ -0,0 +1 @@
|
|||
a007071944f7c90020e798eea53b10065e2b45a5
|
|
@ -25,8 +25,8 @@ all: view1090
|
|||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(EXTRACFLAGS) -c $<
|
||||
|
||||
view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o input.o draw.o font.o init.o maps.o mapdata.o
|
||||
$(CC) -g -o view1090 view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o input.o draw.o font.o init.o maps.o mapdata.o $(LIBS) $(LDFLAGS)
|
||||
view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o input.o draw.o font.o init.o maps.o mapdata.o list.o parula.o
|
||||
$(CC) -g -o view1090 view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o input.o draw.o font.o init.o maps.o mapdata.o list.o parula.o $(LIBS) $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -f *.o view1090
|
||||
|
|
|
@ -135,9 +135,7 @@ void drawPlaneHeading(double dx, double dy, double heading, int signal, char *fl
|
|||
filledTrigonRGBA (game.screen, x1, y1, x2, y2, x+round(-body*.5*vec[0]), y+round(-body*.5*vec[1]),planeColor.r,planeColor.g,planeColor.b,SDL_ALPHA_OPAQUE);
|
||||
}
|
||||
|
||||
if(strlen(flight)) {
|
||||
drawString(flight, x + 10, y + 10, game.font, planeColor);
|
||||
}
|
||||
drawString(flight, x + 10, y + 10, game.font, planeColor);
|
||||
}
|
||||
|
||||
void drawPlane(double dx, double dy, int signal)
|
||||
|
|
|
@ -28,6 +28,10 @@ void closeFont(TTF_Font *font)
|
|||
|
||||
void drawString(char * text, int x, int y, TTF_Font *font, SDL_Color color)
|
||||
{
|
||||
if(!strlen(text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_Surface *surface;
|
||||
SDL_Rect dest;
|
||||
|
||||
|
@ -52,7 +56,35 @@ void drawString(char * text, int x, int y, TTF_Font *font, SDL_Color color)
|
|||
/* Free the generated string image */
|
||||
|
||||
SDL_FreeSurface(surface);
|
||||
|
||||
}
|
||||
|
||||
void drawStringBG(char * text, int x, int y, TTF_Font *font, SDL_Color color, SDL_Color bgColor) {
|
||||
if(!strlen(text)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_Surface *surface;
|
||||
SDL_Rect dest;
|
||||
|
||||
surface = TTF_RenderUTF8_Shaded(font, text, color, bgColor);
|
||||
|
||||
if (surface == NULL)
|
||||
{
|
||||
printf("Couldn't create String %s: %s\n", text, SDL_GetError());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Blit the entire surface to the screen */
|
||||
|
||||
dest.x = x;
|
||||
dest.y = y;
|
||||
dest.w = surface->w;
|
||||
dest.h = surface->h;
|
||||
|
||||
SDL_BlitSurface(surface, NULL, game.screen, &dest);
|
||||
|
||||
/* Free the generated string image */
|
||||
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,9 @@ void init(char *title)
|
|||
|
||||
/* Load the font */
|
||||
|
||||
game.font = loadFont("ArialBold.ttf", 12);
|
||||
game.font = loadFont("Anonymous_Pro_B.ttf", 12);
|
||||
|
||||
game.listFont = loadFont("Anonymous_Pro_B.ttf", 18);
|
||||
|
||||
/* Set the screen title */
|
||||
|
||||
|
|
|
@ -5,9 +5,17 @@ void getInput()
|
|||
{
|
||||
|
||||
#ifdef RPI
|
||||
if(!digitalRead(23) || !digitalRead(22)) {
|
||||
if(!digitalRead(27)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if(!digitalRead(22)) {
|
||||
Modes.mapLogDist = !Modes.mapLogDist;
|
||||
}
|
||||
|
||||
if(!digitalRead(23)) {
|
||||
Modes.map = !Modes.map;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_Event event;
|
||||
|
@ -35,6 +43,10 @@ void getInput()
|
|||
Modes.mapLogDist = !Modes.mapLogDist;
|
||||
break;
|
||||
|
||||
case SDLK_m:
|
||||
Modes.map = !Modes.map;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
195
sdl1090/list.c
Normal file
195
sdl1090/list.c
Normal file
|
@ -0,0 +1,195 @@
|
|||
#include "dump1090.h"
|
||||
#include "structs.h"
|
||||
#include "parula.h"
|
||||
#include "SDL/SDL_gfxPrimitives.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;
|
||||
}
|
||||
|
||||
SDL_Color pink = {249,38,114,255};
|
||||
SDL_Color blue = {102,217,239,255};
|
||||
SDL_Color green = {166,226,46,255};
|
||||
SDL_Color yellow = {253,250,31,255};
|
||||
SDL_Color orange = {253,151,31,255};
|
||||
SDL_Color lightGrey = {196,196,196,255};
|
||||
SDL_Color grey = {127,127,127,255};
|
||||
SDL_Color darkGrey = {64,64,64,255};
|
||||
SDL_Color black = {0,0,0,255};
|
||||
SDL_Color white = {255,255,255,255};
|
||||
|
||||
void drawList() {
|
||||
struct aircraft *a = Modes.aircrafts;
|
||||
time_t now = time(NULL);
|
||||
int count = 0;
|
||||
char progress;
|
||||
char spinner[4] = "|/-\\";
|
||||
|
||||
// Refresh screen every (MODES_INTERACTIVE_REFRESH_TIME) miliseconde
|
||||
if ((mstime() - Modes.interactive_last_update) < MODES_INTERACTIVE_REFRESH_TIME)
|
||||
{return;}
|
||||
|
||||
Modes.interactive_last_update = mstime();
|
||||
|
||||
progress = spinner[time(NULL)%4];
|
||||
|
||||
SDL_FillRect(game.screen, NULL, 0);
|
||||
|
||||
drawStringBG(" Flight Alt(m) km/h D(km) H S ", 0, 0, game.listFont, black, white);
|
||||
|
||||
// int xstride = 10;
|
||||
// for(int i = 0; i < 320 / xstride; i++) {
|
||||
// vlineRGBA (game.screen, i*xstride, 0, SCREEN_HEIGHT, 127, 127, 127, SDL_ALPHA_OPAQUE);
|
||||
// }
|
||||
|
||||
// int ystride = 20;
|
||||
// for(int i = 0; i < 240 / ystride; i++) {
|
||||
// hlineRGBA (game.screen, 0, SCREEN_WIDTH, i * ystride, 127, 127, 127, SDL_ALPHA_OPAQUE);
|
||||
// }
|
||||
|
||||
int numNoDir = 0;
|
||||
while(a && (count < 10)) {
|
||||
if ((now - a->seen) < Modes.interactive_display_ttl)
|
||||
{
|
||||
int msgs = a->messages;
|
||||
int flags = a->modeACflags;
|
||||
|
||||
if ( (((flags & (MODEAC_MSG_FLAG )) == 0 ) )
|
||||
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEA_ONLY)) == MODEAC_MSG_MODEA_ONLY) && (msgs > 4 ) )
|
||||
|| (((flags & (MODEAC_MSG_MODES_HIT | MODEAC_MSG_MODEC_OLD )) == 0 ) && (msgs > 127) )
|
||||
) {
|
||||
int altitude = a->altitude, speed = a->speed;
|
||||
char strSquawk[5] = " ";
|
||||
char strFl[6] = " ";
|
||||
char strTt[5] = " ";
|
||||
char strGs[5] = " ";
|
||||
|
||||
// Convert units to metric if --metric was specified
|
||||
//if (Modes.metric) {
|
||||
altitude = (int) (altitude / 3.2828);
|
||||
speed = (int) (speed * 1.852);
|
||||
//}
|
||||
|
||||
if (a->bFlags & MODES_ACFLAGS_SQUAWK_VALID) {
|
||||
snprintf(strSquawk,5,"%04x", a->modeA);}
|
||||
|
||||
if (a->bFlags & MODES_ACFLAGS_SPEED_VALID) {
|
||||
snprintf (strGs, 5,"%3d", speed);}
|
||||
|
||||
if (a->bFlags & MODES_ACFLAGS_HEADING_VALID) {
|
||||
snprintf (strTt, 5,"%03d", a->track);}
|
||||
|
||||
if (msgs > 99999) {
|
||||
msgs = 99999;}
|
||||
|
||||
// Dump1090 display mode
|
||||
char strMode[5] = " ";
|
||||
// char strLat[8] = " ";
|
||||
// char strLon[9] = " ";
|
||||
|
||||
char strD[5] = " ";
|
||||
char strDir[3] = " ";
|
||||
char cLat = ' ';
|
||||
char cLon = ' ';
|
||||
|
||||
char strS[3] = " ";
|
||||
double d;
|
||||
|
||||
unsigned char * pSig = a->signalLevel;
|
||||
unsigned int signalAverage = (pSig[0] + pSig[1] + pSig[2] + pSig[3] +
|
||||
pSig[4] + pSig[5] + pSig[6] + pSig[7] + 3) >> 3;
|
||||
|
||||
if (a->bFlags & MODES_ACFLAGS_AOG) {
|
||||
snprintf(strFl, 6," grnd");
|
||||
} else if (a->bFlags & MODES_ACFLAGS_ALTITUDE_VALID) {
|
||||
snprintf(strFl, 6, "%5d", altitude);
|
||||
}
|
||||
|
||||
if ((flags & MODEAC_MSG_FLAG) == 0) {
|
||||
strMode[0] = 'S';
|
||||
} else if (flags & MODEAC_MSG_MODEA_ONLY) {
|
||||
strMode[0] = 'A';
|
||||
}
|
||||
if (flags & MODEAC_MSG_MODEA_HIT) {strMode[2] = 'a';}
|
||||
if (flags & MODEAC_MSG_MODEC_HIT) {strMode[3] = 'c';}
|
||||
|
||||
snprintf(strS, 3,"%3d", (int)((float)signalAverage/25.0f));
|
||||
|
||||
if (a->bFlags & MODES_ACFLAGS_LATLON_VALID) {
|
||||
|
||||
if(fabs(a->dx) < .01 && fabs(a->dy) > fabs(a->dx)) {
|
||||
cLon = ' ';
|
||||
} else {
|
||||
if(a->dx < 0) {
|
||||
cLon = 'W';
|
||||
} else {
|
||||
cLon = 'E';
|
||||
}
|
||||
}
|
||||
|
||||
if(fabs(a->dy) < .01 && fabs(a->dx) > fabs(a->dy)) {
|
||||
cLat = ' ';
|
||||
} else {
|
||||
if(a->dy < 0) {
|
||||
cLat = 'S';
|
||||
} else {
|
||||
cLat = 'N';
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(strDir,3,"%c%c",cLat,cLon);
|
||||
|
||||
d = sqrt(a->dx * a->dx + a->dy * a->dy);
|
||||
|
||||
snprintf(strD, 5,"%4.01f", d);
|
||||
|
||||
if ((now - a->seen) > 30 ) {
|
||||
|
||||
drawString(a->flight, 0, (count + 1) * 20, game.listFont, (SDL_Color){96,96,96,255});
|
||||
|
||||
// printf("\x1B[1;30m%-8s%5s %4s %5s %c%c %d",
|
||||
// a->flight,
|
||||
// strFl,
|
||||
// strGs,
|
||||
// strD,
|
||||
// cLat, cLon,
|
||||
// (int)((float)signalAverage/25.0f));
|
||||
} else {
|
||||
drawString(a->flight, 10, (count + 1) * 20, game.listFont, pink);
|
||||
|
||||
drawString(strFl, 90, (count + 1) * 20, game.listFont, orange);
|
||||
|
||||
drawString(strGs, 160, (count + 1) * 20, game.listFont, green);
|
||||
|
||||
drawString(strD, 210, (count + 1) * 20, game.listFont, blue);
|
||||
|
||||
drawString(strDir, 270, (count + 1) * 20, game.listFont, yellow);
|
||||
|
||||
// drawString(strS, 290, (count + 1) * 20, game.listFont, (SDL_Color){255,9,96,255});
|
||||
|
||||
// printf("\x1B[1;31m%-8s\x1B[1;32m%5s \x1B[1;33m%4s \x1B[1;34m%5s \x1B[1;36m%c%c \x1B[1;35m%d",
|
||||
// a->flight,
|
||||
// strFl,
|
||||
// strGs,
|
||||
// strD,
|
||||
// cLat, cLon,
|
||||
// (int)((float)signalAverage/25.0f));
|
||||
}
|
||||
count++;
|
||||
} else {
|
||||
numNoDir++;
|
||||
}
|
||||
}
|
||||
}
|
||||
a = a->next;
|
||||
}
|
||||
|
||||
SDL_Flip(game.screen);
|
||||
|
||||
}
|
|
@ -2,8 +2,6 @@
|
|||
#include "dump1090.h"
|
||||
#include "structs.h"
|
||||
|
||||
Game game;
|
||||
|
||||
//
|
||||
// ============================= Utility functions ==========================
|
||||
//
|
||||
|
@ -17,7 +15,6 @@ static uint64_t mstime(void) {
|
|||
return mst;
|
||||
}
|
||||
|
||||
|
||||
void drawMap(void) {
|
||||
struct aircraft *a = Modes.aircrafts;
|
||||
time_t now = time(NULL);
|
||||
|
|
130
sdl1090/parula.c
Normal file
130
sdl1090/parula.c
Normal file
|
@ -0,0 +1,130 @@
|
|||
int parula[128][3] = {
|
||||
{53, 42, 135},
|
||||
{54, 45, 141},
|
||||
{54, 48, 147},
|
||||
{54, 51, 153},
|
||||
{54, 54, 160},
|
||||
{54, 58, 166},
|
||||
{53, 61, 172},
|
||||
{52, 64, 179},
|
||||
{50, 67, 185},
|
||||
{47, 71, 192},
|
||||
{44, 74, 198},
|
||||
{39, 78, 205},
|
||||
{33, 82, 211},
|
||||
{25, 87, 217},
|
||||
{16, 91, 221},
|
||||
{8, 95, 224},
|
||||
{3, 98, 225},
|
||||
{1, 101, 225},
|
||||
{1, 104, 225},
|
||||
{2, 106, 225},
|
||||
{4, 108, 224},
|
||||
{6, 111, 223},
|
||||
{8, 113, 223},
|
||||
{10, 115, 222},
|
||||
{12, 117, 221},
|
||||
{14, 119, 219},
|
||||
{16, 120, 218},
|
||||
{17, 122, 217},
|
||||
{18, 124, 216},
|
||||
{19, 126, 215},
|
||||
{20, 128, 214},
|
||||
{20, 130, 213},
|
||||
{20, 132, 212},
|
||||
{20, 134, 211},
|
||||
{19, 136, 211},
|
||||
{18, 139, 210},
|
||||
{17, 141, 210},
|
||||
{15, 144, 210},
|
||||
{13, 146, 210},
|
||||
{11, 149, 210},
|
||||
{9, 151, 209},
|
||||
{8, 154, 209},
|
||||
{7, 156, 208},
|
||||
{6, 158, 207},
|
||||
{6, 160, 205},
|
||||
{6, 161, 204},
|
||||
{6, 163, 202},
|
||||
{6, 165, 201},
|
||||
{6, 166, 199},
|
||||
{6, 167, 197},
|
||||
{6, 169, 195},
|
||||
{7, 170, 193},
|
||||
{9, 171, 191},
|
||||
{11, 173, 188},
|
||||
{14, 174, 186},
|
||||
{17, 175, 184},
|
||||
{20, 176, 181},
|
||||
{23, 177, 179},
|
||||
{27, 178, 176},
|
||||
{31, 179, 173},
|
||||
{35, 181, 171},
|
||||
{39, 182, 168},
|
||||
{44, 183, 165},
|
||||
{48, 183, 162},
|
||||
{53, 184, 159},
|
||||
{58, 185, 156},
|
||||
{63, 186, 153},
|
||||
{68, 187, 150},
|
||||
{74, 188, 147},
|
||||
{80, 188, 144},
|
||||
{85, 189, 141},
|
||||
{91, 190, 138},
|
||||
{97, 190, 135},
|
||||
{103, 190, 133},
|
||||
{109, 191, 130},
|
||||
{115, 191, 127},
|
||||
{121, 191, 125},
|
||||
{126, 191, 122},
|
||||
{132, 191, 120},
|
||||
{137, 191, 118},
|
||||
{142, 191, 116},
|
||||
{147, 191, 114},
|
||||
{152, 191, 112},
|
||||
{157, 190, 110},
|
||||
{162, 190, 108},
|
||||
{167, 190, 106},
|
||||
{171, 190, 104},
|
||||
{176, 190, 103},
|
||||
{180, 189, 101},
|
||||
{185, 189, 99},
|
||||
{189, 189, 97},
|
||||
{193, 188, 96},
|
||||
{197, 188, 94},
|
||||
{202, 187, 92},
|
||||
{206, 187, 90},
|
||||
{210, 187, 89},
|
||||
{214, 186, 87},
|
||||
{218, 186, 85},
|
||||
{222, 186, 83},
|
||||
{226, 185, 82},
|
||||
{230, 185, 80},
|
||||
{234, 185, 78},
|
||||
{238, 185, 76},
|
||||
{242, 185, 73},
|
||||
{245, 186, 70},
|
||||
{249, 187, 67},
|
||||
{252, 188, 64},
|
||||
{254, 190, 61},
|
||||
{255, 193, 58},
|
||||
{255, 196, 55},
|
||||
{254, 198, 52},
|
||||
{254, 201, 50},
|
||||
{253, 203, 48},
|
||||
{252, 206, 46},
|
||||
{251, 209, 43},
|
||||
{249, 211, 41},
|
||||
{248, 214, 39},
|
||||
{247, 216, 37},
|
||||
{246, 219, 35},
|
||||
{245, 222, 33},
|
||||
{245, 225, 31},
|
||||
{245, 228, 29},
|
||||
{244, 232, 26},
|
||||
{245, 235, 24},
|
||||
{245, 239, 22},
|
||||
{246, 243, 19},
|
||||
{248, 247, 17},
|
||||
{249, 251, 14}
|
||||
};
|
131
sdl1090/parula.h
131
sdl1090/parula.h
|
@ -1,130 +1 @@
|
|||
int parula[128][3] = {
|
||||
{53, 42, 135},
|
||||
{54, 45, 141},
|
||||
{54, 48, 147},
|
||||
{54, 51, 153},
|
||||
{54, 54, 160},
|
||||
{54, 58, 166},
|
||||
{53, 61, 172},
|
||||
{52, 64, 179},
|
||||
{50, 67, 185},
|
||||
{47, 71, 192},
|
||||
{44, 74, 198},
|
||||
{39, 78, 205},
|
||||
{33, 82, 211},
|
||||
{25, 87, 217},
|
||||
{16, 91, 221},
|
||||
{8, 95, 224},
|
||||
{3, 98, 225},
|
||||
{1, 101, 225},
|
||||
{1, 104, 225},
|
||||
{2, 106, 225},
|
||||
{4, 108, 224},
|
||||
{6, 111, 223},
|
||||
{8, 113, 223},
|
||||
{10, 115, 222},
|
||||
{12, 117, 221},
|
||||
{14, 119, 219},
|
||||
{16, 120, 218},
|
||||
{17, 122, 217},
|
||||
{18, 124, 216},
|
||||
{19, 126, 215},
|
||||
{20, 128, 214},
|
||||
{20, 130, 213},
|
||||
{20, 132, 212},
|
||||
{20, 134, 211},
|
||||
{19, 136, 211},
|
||||
{18, 139, 210},
|
||||
{17, 141, 210},
|
||||
{15, 144, 210},
|
||||
{13, 146, 210},
|
||||
{11, 149, 210},
|
||||
{9, 151, 209},
|
||||
{8, 154, 209},
|
||||
{7, 156, 208},
|
||||
{6, 158, 207},
|
||||
{6, 160, 205},
|
||||
{6, 161, 204},
|
||||
{6, 163, 202},
|
||||
{6, 165, 201},
|
||||
{6, 166, 199},
|
||||
{6, 167, 197},
|
||||
{6, 169, 195},
|
||||
{7, 170, 193},
|
||||
{9, 171, 191},
|
||||
{11, 173, 188},
|
||||
{14, 174, 186},
|
||||
{17, 175, 184},
|
||||
{20, 176, 181},
|
||||
{23, 177, 179},
|
||||
{27, 178, 176},
|
||||
{31, 179, 173},
|
||||
{35, 181, 171},
|
||||
{39, 182, 168},
|
||||
{44, 183, 165},
|
||||
{48, 183, 162},
|
||||
{53, 184, 159},
|
||||
{58, 185, 156},
|
||||
{63, 186, 153},
|
||||
{68, 187, 150},
|
||||
{74, 188, 147},
|
||||
{80, 188, 144},
|
||||
{85, 189, 141},
|
||||
{91, 190, 138},
|
||||
{97, 190, 135},
|
||||
{103, 190, 133},
|
||||
{109, 191, 130},
|
||||
{115, 191, 127},
|
||||
{121, 191, 125},
|
||||
{126, 191, 122},
|
||||
{132, 191, 120},
|
||||
{137, 191, 118},
|
||||
{142, 191, 116},
|
||||
{147, 191, 114},
|
||||
{152, 191, 112},
|
||||
{157, 190, 110},
|
||||
{162, 190, 108},
|
||||
{167, 190, 106},
|
||||
{171, 190, 104},
|
||||
{176, 190, 103},
|
||||
{180, 189, 101},
|
||||
{185, 189, 99},
|
||||
{189, 189, 97},
|
||||
{193, 188, 96},
|
||||
{197, 188, 94},
|
||||
{202, 187, 92},
|
||||
{206, 187, 90},
|
||||
{210, 187, 89},
|
||||
{214, 186, 87},
|
||||
{218, 186, 85},
|
||||
{222, 186, 83},
|
||||
{226, 185, 82},
|
||||
{230, 185, 80},
|
||||
{234, 185, 78},
|
||||
{238, 185, 76},
|
||||
{242, 185, 73},
|
||||
{245, 186, 70},
|
||||
{249, 187, 67},
|
||||
{252, 188, 64},
|
||||
{254, 190, 61},
|
||||
{255, 193, 58},
|
||||
{255, 196, 55},
|
||||
{254, 198, 52},
|
||||
{254, 201, 50},
|
||||
{253, 203, 48},
|
||||
{252, 206, 46},
|
||||
{251, 209, 43},
|
||||
{249, 211, 41},
|
||||
{248, 214, 39},
|
||||
{247, 216, 37},
|
||||
{246, 219, 35},
|
||||
{245, 222, 33},
|
||||
{245, 225, 31},
|
||||
{245, 228, 29},
|
||||
{244, 232, 26},
|
||||
{245, 235, 24},
|
||||
{245, 239, 22},
|
||||
{246, 243, 19},
|
||||
{248, 247, 17},
|
||||
{249, 251, 14}
|
||||
};
|
||||
int parula[128][3];
|
|
@ -4,14 +4,18 @@ typedef struct Game
|
|||
{
|
||||
SDL_Surface *screen;
|
||||
TTF_Font *font;
|
||||
TTF_Font *listFont;
|
||||
} Game;
|
||||
|
||||
Game game;
|
||||
|
||||
// functions
|
||||
|
||||
//font.c
|
||||
TTF_Font *loadFont(char *, int);
|
||||
void closeFont(TTF_Font *);
|
||||
void drawString(char *, int, int, TTF_Font *, SDL_Color);
|
||||
void drawStringBG(char *, int, int, TTF_Font *, SDL_Color, SDL_Color);
|
||||
|
||||
//init.c
|
||||
void init(char *);
|
||||
|
@ -29,3 +33,6 @@ void drawGrid();
|
|||
|
||||
//mapdata.c
|
||||
void initMaps();
|
||||
|
||||
//list.c
|
||||
void drawList();
|
||||
|
|
|
@ -1 +1 @@
|
|||
5a960086a7570a50a9f1c694d7fccf5b246c727b
|
||||
3dc133421ef7d0474dfec87001d49f3cf4f7d3b4
|
|
@ -364,8 +364,11 @@ int main(int argc, char **argv) {
|
|||
|
||||
if (Modes.map) {
|
||||
drawMap();
|
||||
} else {
|
||||
drawList();
|
||||
}
|
||||
|
||||
|
||||
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {
|
||||
free(c);
|
||||
usleep(1000000);
|
||||
|
|
Loading…
Reference in a new issue