app.h (1815B)
1 /* app.h - declaraciones compartidas del cliente Linux. */ 2 #ifndef APP_H 3 #define APP_H 4 #include <stdbool.h> 5 #include <stdint.h> 6 #include "frontend.h" 7 #include "session.h" 8 9 typedef struct { 10 int lang; 11 int theme; 12 int layout; 13 int scale; 14 int level; /* 0..4 */ 15 int color; /* contra la maquina: 0 blancas, 1 negras, 2 al azar */ 16 int tc; /* indice en TC_PRESETS */ 17 int undo; /* permitir deshacer */ 18 int show_eval; 19 int watch_speed; /* IA contra IA: 0 rapido, 1 normal, 2 lento */ 20 char name[20]; 21 char server[128]; 22 } Settings; 23 24 typedef struct { const char *label; int32_t base, inc, per_move; } TcPreset; 25 extern const TcPreset TC_PRESETS[]; 26 extern const int NTC_PRESETS; 27 28 void settings_load(Settings *st); 29 void settings_save(const Settings *st); 30 31 int app_selftest(bool deep); 32 int app_sim(int n, uint64_t seed, int level); 33 int app_perft(const char *fen, int depth); 34 int app_bench(void); 35 36 enum { MODE_AI, MODE_HOTSEAT, MODE_WATCH }; 37 void app_menu(Frontend *fe, Settings *st); 38 bool app_new_game(Frontend *fe, Settings *st, int mode, const Pos *start); 39 void app_play(Frontend *fe, Session *s, Settings *st); 40 void app_puzzles(Frontend *fe, Settings *st); 41 void app_import(Frontend *fe, Settings *st, const char *text); 42 bool app_viewer(Frontend *fe, Settings *st, const char *pgn_text, char *err, int errlen); 43 /* red (online.c) */ 44 bool online_menu(Frontend *fe, Settings *st, const char *server); 45 bool lan_host(Frontend *fe, Settings *st, int port); 46 bool lan_join(Frontend *fe, Settings *st, const char *host, int port); 47 bool parse_hostport(const char *in, char *host, int hn, int *port); 48 49 int run_form(Frontend *fe, Form *f, void (*on_change)(Form *, void *), void *ctx); 50 char *read_file(const char *path, long *len); 51 52 #endif