catan_gfx.h (1976B)
1 /* catan_gfx.h - dibujo de Catan en pixeles (GUI de Linux, PicoCalc, y el tablero de 2 * la TUI), sobre el renderer de comun/gfx. */ 3 #ifndef CATAN_GFX_H 4 #define CATAN_GFX_H 5 6 #include "gfx.h" 7 #include "../core/catan.h" 8 #include "../core/ctrl.h" 9 10 /* ------------------------------------------------------------- colores */ 11 extern Color PLAYER_COLOR[MAXP]; /* se puede cambiar (opciones de la app) */ 12 extern const Color PLAYER_COLOR_DEF[MAXP]; /* los originales: rojo, azul, verde, naranja */ 13 extern const Color TERRAIN_COLOR[T__COUNT]; 14 #define C_SEA RGB(28, 86, 150) 15 #define C_SEA2 RGB(40, 104, 170) 16 #define C_SAND RGB(226, 206, 160) 17 #define C_TOKEN RGB(246, 236, 204) 18 19 /* ------------------------------------------------------------- tablero */ 20 typedef struct { int cx, cy, R; const Topo *t; } BoardGeom; /* centro y radio de hexagono en px */ 21 22 enum { GB_TEXT = 1, GB_DETAIL = 2, GB_ROADS = 4, GB_BUILD = 8, GB_ROBBER = 16, GB_HILITE = 32, GB_TOKENS = 64, 23 GB_PORTS = 128, GB_ALL = 255 }; 24 25 void geom_fit(BoardGeom *g, const Game *gm, int x, int y, int w, int h); /* tablero de esa partida */ 26 void geom_vert(const BoardGeom *g, int v, int *x, int *y); 27 void geom_hex(const BoardGeom *g, int h, int *x, int *y); 28 void geom_edge(const BoardGeom *g, int e, int *x, int *y); 29 void geom_port(const BoardGeom *g, int i, int *x, int *y); 30 void gfx_board(Surface *s, const BoardGeom *g, const Game *gm, const Ctrl *c, int flags); 31 int gfx_board_hit(const BoardGeom *g, const Ctrl *c, int x, int y); /* id de objetivo o -1 */ 32 void gfx_piece(Surface *s, int x, int y, int u, int kind, Color fill); /* 0 pueblo, 1 ciudad, 2 ruta, 3 barco */ 33 34 /* --------------------------------------------------- pantalla completa (GUI/Pico) */ 35 void gfx_screen(Surface *s, const Game *g, const Ctrl *c, const UiInfo *ui, HitList *hits, BoardGeom *geom_out); 36 /* fondo y logo de los menus (gfx_form_backdrop) */ 37 int catan_form_backdrop(Surface *s, bool compact); 38 39 #endif