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