1 /* 2 * Ben NanoNote graphical user interface utilities. 3 * 4 * Copyright (C) 2013 Paul Boddie 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 */ 11 12 #ifndef __GUI_H__ 13 #define __GUI_H__ 14 15 #include "SDL.h" 16 #include "SDL_gfxPrimitives.h" 17 #include "ui.h" 18 #include "geo.h" 19 20 typedef struct 21 { 22 uint16_t x, y; 23 uint8_t r, g, b, a; 24 } gui_printer; 25 26 /* Device properties. */ 27 28 #define SCREEN_WIDTH 320 29 #define SCREEN_HEIGHT 240 30 31 #define SCREEN_COLUMN_WIDTH 8 32 #define SCREEN_ROW_HEIGHT 8 33 34 #define GUI_BUFSIZE 256 35 36 #define PROJECTION_FACTOR 320 37 #define SKY_GRID_STEP 15 38 39 /* Colours in RGBA format. */ 40 41 #define SKY_UPPER_COLOUR 0xff0000ff 42 #define SKY_LOWER_COLOUR 0x0000ffff 43 #define MOTION_REVERSE_COLOUR 0xff00ffff 44 #define MOTION_FORWARD_COLOUR 0x00ff00ff 45 46 /* Access functions. */ 47 48 void gui_init(); 49 void gui_display_init(); 50 void gui_shutdown(int signum); 51 void gui_shutdown_threaded(int signum); 52 void gui_quit(); 53 void gui_clear(); 54 void gui_fill(uint8_t r, uint8_t g, uint8_t b); 55 void gui_next_row(gui_printer *printer, uint16_t rows); 56 void gui_next_column(gui_printer *printer, uint16_t columns); 57 int gui_printf(const char *format, ...); 58 void gui_sky(vectorf *viewx, vectorf *viewy, vectorf *viewz); 59 void gui_sky_vertical(vectorf *viewx, vectorf *viewy, vectorf *viewz, int direction, int elevation, int16_t x, int16_t y, uint32_t colour); 60 void gui_motion(vectorf *viewx, vectorf *viewy, vectorf *viewz, vectorf *accelerationD); 61 void gui_point(vectorf *viewx, vectorf *viewy, vectorf *viewz, vectorf *point, uint8_t r, uint8_t g, uint8_t b, uint8_t a); 62 void gui_origin(vectorf *viewx, vectorf *viewy, vectorf *viewz, vectorf *point); 63 void gui_bar(vectorf *value); 64 void gui_plot(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b, uint8_t a); 65 void gui_flush(); 66 imu_ui_op gui_handle_events(); 67 68 #endif /* __GUI_H__ */