This repository was archived by the owner on May 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminiUI.h
58 lines (45 loc) · 1.35 KB
/
miniUI.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Author: Thomas Dubosc
* Licence: This work is licensed under the Creative Commons Attribution License.
* View this license at http://creativecommons.org/licenses/
*/
#include <stdio.h>
#include <string.h>
#include <avr/io.h>
#include <util/delay.h>
#include "lcd.h"
#include <avr/interrupt.h>
void init_stdio_uart1( void );
void scanswitch_init( void );
/* volatile int8_t delta; // -128 ... 127 */
/* int8_t iob_delta(void); */
int16_t iob_delta(void);
volatile int16_t delta;
//move rectangle
void move_rectangle(rectangle *r,int x, int y);
//rectangle border
void stroke_rectangle(rectangle r, uint16_t col);
//simple collision
int rectangle_collide(rectangle a,rectangle b);
typedef struct {
int left, right, up, down;
int center;
int wheel_d;
int has_pressed_button;
} button_map;
//button listener
void listen_to_button(button_map *bmap);
//display text at a x y coordinate
void display_string_at(char *str,int x, int y);
//disaplay a menu at
int display_menu_at(char *menu, int choice, int x,int y, int padding);
int rectangle_inside(rectangle a,rectangle b);
int rectangle_collide(rectangle a,rectangle b);
typedef struct {
uint16_t menu_background;
uint16_t button_foreground;
uint16_t button_background;
uint16_t button_selected_foreground;
uint16_t button_selected_background;
} miniUI;
miniUI default_UI;
void init_miniUI();