Landtiger LPC1768 C BigLib 1
A self made, custom C library for the LandTiger board.
 
Loading...
Searching...
No Matches
glcd_types.h
Go to the documentation of this file.
1#ifndef __GLCD_TYPES_H
2#define __GLCD_TYPES_H
3
4#include "glcd_errors.h"
5#include "types.h"
6
7#include <stdbool.h>
8
9// GENERIC
10
18
21typedef enum
22{
23 LCD_COL_WHITE = 0xFFFF,
24 LCD_COL_BLACK = 0x0000,
25 LCD_COL_GREY = 0xF7DE,
26 LCD_COL_BLUE = 0x001F,
27 LCD_COL_BLUE2 = 0x051F,
28 LCD_COL_RED = 0xF800,
30 LCD_COL_GREEN = 0x07E0,
31 LCD_COL_CYAN = 0x7FFF,
33 LCD_COL_NONE = 0x10000
35
40typedef u32 LCD_Color;
41
42typedef struct
43{
44 u16 x, y;
46
47typedef struct
48{
49 u16 width, height;
51
52typedef struct
53{
54 u8 top : 4;
55 u8 right : 4;
57 u8 left : 4;
59
60typedef struct
61{
63} LCD_BBox;
64
65// FONT
66
72
73typedef struct
74{
75 const u32 *data;
76 u16 data_size, max_char_width, max_char_height;
77 // Stores the width of each individual char, so we can move forward to the next char leaving just the right amount
78 // of space between them. It's optional, e.g. system font & msgothic font don't have this info. In this case, the
79 // spacing between chars is the same as the max_char_width.
80 const u16 *char_widths, *char_heights;
81
82 // Stores the offsets from the baseline for each char, so we can align letters like 'g' or 'h' correctly with
83 // letters like 'a' or 'b'. It's optional, e.g. system font & msgothic font don't have this info. In this case, we
84 // simply have this array = NULL. The renderer uses the baseline to determine how much we should move up from the
85 // where->y coordinate so that the char is aligned to the baseline correctly. Moving up means subtracting the offset
86 // from where-y.
89} LCD_Font;
90
91typedef i8 LCD_FontID;
92
93#define ASCII_FONT_MIN_VALUE 32
94#define ASCII_FONT_MAX_VALUE 126
95
96// SINGLE COMPONENTS
97
98typedef struct
99{
102} LCD_Line;
103
104typedef struct
105{
106 u16 width, height;
108} LCD_Rect;
109
116
117typedef struct
118{
119 const u32 *pixels; // RGB or ARGB data
120 u16 width, height;
121 bool has_alpha : 1;
122} LCD_Image;
123
124typedef struct
125{
126 char *text;
127 LCD_Color text_color, bg_color;
131} LCD_Text;
132
141
148
149#define LCD_TEXT_DEF_CHAR_SPACING 0
150#define LCD_TEXT_DEF_LINE_SPACING 0
151#define LCD_NO_PADDING (LCD_Padding){0, 0, 0, 0}
152
153// COMPONENT OBJECT
154
165
167typedef struct
168{
171 LCD_BBox cached_bbox; // Used to cache the bounding box of the component
172 union {
179 } object;
181
182// OBJECT
183
188typedef struct
189{
190 LCD_BBox bbox; // Used to cache the bounding box of the object
191 LCD_Component *comps; // Array of components, or just one.
193} LCD_Obj;
194
196
197// LCD ADDING OPTIONS
198
206
207#endif
LCD_Orientation
Definition glcd_types.h:12
@ LCD_ORIENT_VER_INV
Definition glcd_types.h:15
@ LCD_ORIENT_HOR
Definition glcd_types.h:14
@ LCD_ORIENT_VER
Definition glcd_types.h:13
@ LCD_ORIENT_HOR_INV
Definition glcd_types.h:16
i8 LCD_FontID
Definition glcd_types.h:91
LCD_DefaultFont
Definition glcd_types.h:68
@ LCD_DEF_FONT_MSGOTHIC
Definition glcd_types.h:69
@ LCD_DEF_FONT_SYSTEM
Definition glcd_types.h:70
i32 LCD_ObjID
Definition glcd_types.h:195
u32 LCD_Color
Represents a color in the RGB565 format.
Definition glcd_types.h:40
LCD_ColorPalette
Even though the LCD itself supports 260K colors, the bus interface is only 16-bit,...
Definition glcd_types.h:22
@ LCD_COL_WHITE
Definition glcd_types.h:23
@ LCD_COL_RED
Definition glcd_types.h:28
@ LCD_COL_BLUE
Definition glcd_types.h:26
@ LCD_COL_NONE
Definition glcd_types.h:33
@ LCD_COL_GREY
Definition glcd_types.h:25
@ LCD_COL_MAGENTA
Definition glcd_types.h:29
@ LCD_COL_GREEN
Definition glcd_types.h:30
@ LCD_COL_YELLOW
Definition glcd_types.h:32
@ LCD_COL_BLACK
Definition glcd_types.h:24
@ LCD_COL_CYAN
Definition glcd_types.h:31
@ LCD_COL_BLUE2
Definition glcd_types.h:27
LCD_ComponentType
Represents a drawable component that can be rendered on the screen.
Definition glcd_types.h:157
@ LCD_COMP_RECT
Definition glcd_types.h:159
@ LCD_COMP_BUTTON
Definition glcd_types.h:163
@ LCD_COMP_IMAGE
Definition glcd_types.h:161
@ LCD_COMP_CIRCLE
Definition glcd_types.h:160
@ LCD_COMP_TEXT
Definition glcd_types.h:162
@ LCD_COMP_LINE
Definition glcd_types.h:158
LCD_RMAddOption
Definition glcd_types.h:200
@ LCD_ADD_OBJ_OPT_DONT_MARK_VISIBLE
Request GLCD to not mark the newly added object as visible. In that way, it it won't be rendered by a...
Definition glcd_types.h:204
LCD_Coordinate bottom_right
Definition glcd_types.h:62
LCD_FontID font
Definition glcd_types.h:137
LCD_Color text_color
Definition glcd_types.h:136
LCD_ButtonLabel label
Definition glcd_types.h:144
LCD_Padding padding
Definition glcd_types.h:146
LCD_Color edge_color
Definition glcd_types.h:145
LCD_Color edge_color
Definition glcd_types.h:114
LCD_Coordinate center
Definition glcd_types.h:112
Used to store a drawable component of any type.
Definition glcd_types.h:168
LCD_Circle * circle
Definition glcd_types.h:175
LCD_Coordinate pos
Definition glcd_types.h:170
LCD_Text * text
Definition glcd_types.h:177
LCD_Button * button
Definition glcd_types.h:178
LCD_Line * line
Definition glcd_types.h:173
LCD_ComponentType type
Definition glcd_types.h:169
LCD_Rect * rect
Definition glcd_types.h:174
LCD_Image * image
Definition glcd_types.h:176
LCD_BBox cached_bbox
Definition glcd_types.h:171
const u32 * data
Definition glcd_types.h:75
const u16 * char_heights
Definition glcd_types.h:80
const u16 * baseline_offsets
Definition glcd_types.h:87
u16 data_size
Definition glcd_types.h:76
u16 max_baseline_offset
Definition glcd_types.h:88
bool has_alpha
Definition glcd_types.h:121
const u32 * pixels
Definition glcd_types.h:119
LCD_Color color
Definition glcd_types.h:101
LCD_Coordinate from
Definition glcd_types.h:100
Represents a generic object, made up of 1 or more basic components, that are rendered on the screen.
Definition glcd_types.h:189
LCD_BBox bbox
Definition glcd_types.h:190
u8 comps_size
Definition glcd_types.h:192
LCD_Component * comps
Definition glcd_types.h:191
LCD_Color edge_color
Definition glcd_types.h:107
char * text
Definition glcd_types.h:126
i8 char_spacing
Definition glcd_types.h:129
LCD_Color bg_color
Definition glcd_types.h:127
LCD_FontID font
Definition glcd_types.h:128
i8 line_spacing
Definition glcd_types.h:130
int32_t i32
Definition types.h:10
uint8_t u8
Definition types.h:8
uint16_t u16
Definition types.h:7
int8_t i8
Definition types.h:12
uint32_t u32
Definition types.h:6