juegos

Juegos de terminal de Pancho: Catan (TUI, GUI, web, servidor, PicoCalc), ajedrez, calculadora y minijuegos
git clone https://git.lu3dhn.xyz/juegos.git
Log | Files | Refs

hal.h (1339B)


      1 /* hal.h - capa de hardware de la PicoCalc (la app se escribe contra esto).
      2  * Implementaciones: hal_rp2040.c (la PicoCalc real) y hal_sim.c (simulador en la PC con SDL). */
      3 #ifndef COMUN_HAL_H
      4 #define COMUN_HAL_H
      5 
      6 #include "gfx.h"
      7 
      8 void     hal_init(void);
      9 uint32_t hal_ms(void);
     10 void     hal_sleep(int ms);
     11 /* Dibuja la pantalla entera llamando a paint (en la PicoCalc, una vez por franja). */
     12 void     hal_draw(void (*paint)(Surface *s, void *ctx), void *ctx);
     13 int      hal_key(void);                         /* K_* o caracter; -1 si no hay */
     14 /* Teclas extendidas (falso por defecto, como usan los juegos): Supr da K_DEL en vez
     15  * de K_BKSP, y llegan F1-F10, Inicio/Fin/RePag/AvPag y K_RAW|codigo de las demas. */
     16 extern bool hal_keys_ext;
     17 /* Cable: bytes crudos, no bloqueante. */
     18 void     hal_link_write(const char *buf, int n);
     19 int      hal_link_read(char *buf, int max);
     20 /* Guardado persistente (flash / archivo). */
     21 bool     hal_store_save(const char *data, int n);
     22 int      hal_store_load(char *buf, int max);
     23 int      hal_battery(void);                     /* porcentaje o -1 */
     24 uint32_t hal_random(void);
     25 void     hal_log(const char *line);                 /* diagnostico: pantalla + SD (o stderr en el simulador) */
     26 void     hal_log_clear(void);
     27 
     28 /* la app define esta funcion; la llama main() */
     29 void app_main(void);
     30 
     31 #endif