Go to the source code of this file.
Macros | |
#define | RGB8_TO_RGB565(rgb) (u16)((((rgb >> 16) & 0xFF) >> 3) << 11 | (((rgb >> 8) & 0xFF) >> 2) << 5 | ((rgb & 0xFF) >> 3)) |
Converts RGB (24 bit) into RGB565 (16 bit): | |
Functions | |
LCD_Error | LCD_Init (LCD_Orientation orientation, MEM_Allocator *const alloc, const LCD_Color *const clear_to) |
Initializes TFT LCD Controller. | |
bool | LCD_IsInitialized (void) |
Checks if the LCD has been initialized. | |
u16 | LCD_GetWidth (void) |
Returns the width of the screen at the current orientation. | |
u16 | LCD_GetHeight (void) |
Returns the height of the screen at the current orientation. | |
LCD_Coordinate | LCD_GetSize (void) |
Returns the size of the screen at the current orientation. | |
LCD_Coordinate | LCD_GetCenter (void) |
Returns the center of the screen at the current orientation. | |
LCD_Color | LCD_GetPointColor (LCD_Coordinate point) |
Returns the RGB565 color of the pixel at the specified coordinates. | |
LCD_Error | LCD_SetPointColor (LCD_Color color, LCD_Coordinate point) |
Sets the color of the pixel at the specified coordinates. | |
LCD_Error | LCD_SetBackgroundColor (LCD_Color color, bool redraw_objects) |
Sets the background color of the screen. | |
LCD_Error | LCD_RMAdd (LCD_Obj *const obj, LCD_ObjID *out_id, u8 options) |
Adds a new object to the render list, and returns its ID (if out_id is not NULL) through the out_id pointer. | |
LCD_Error | LCD_RMRemove (LCD_ObjID id, bool redraw_underneath) |
Removes an object from the render list by its ID. It also deallocates the memory used by that object in the memory arena. | |
LCD_Error | LCD_RMClear (void) |
Removes all visible and non-visible objects from the screen. | |
LCD_Error | LCD_RMRender (void) |
Manually triggers an update of the screen. Useful when you want to add multiple objects at once, and only update the screen at the end. | |
LCD_Error | LCD_RMRenderTemporary (LCD_Obj *const obj) |
Renders the object immediately, without adding neither to the render list nor to the memory arena. This is useful for objects that are not frequently updated, and that you don't want to store in the memory arena. | |
LCD_Error | LCD_RMSetVisibility (LCD_ObjID id, bool visible, bool redraw_underneath) |
Shows/hides an object on/from the screen without modifying the render list. | |
bool | LCD_RMIsVisible (LCD_ObjID id) |
Returns whether an object is visible on the screen or not. | |
LCD_Error | LCD_RMMove (LCD_ObjID id, LCD_Coordinate new_pos, bool redraw_underneath) |
Moves an object in the render list to a new position. It also updates the object's position in the RL itself, and in the memory arena. | |
LCD_Error | LCD_FMAddFont (LCD_Font font, LCD_FontID *out_id) |
Adds a new font to the font manager, and returns its ID through the out_id pointer. | |
LCD_Error | LCD_FMRemoveFont (LCD_FontID id) |
Removes a font from the font manager by its ID. | |
LCD_Error | LCD_GetBBox (LCD_ObjID id, LCD_BBox *out_bbox) |
Returns the bounding box of an object in the render list. | |
LCD_Error | LCD_CalcBBoxForObject (const LCD_Obj *const obj, LCD_BBox *out_bbox) |
Returns the bounding box of a temporary object. | |
LCD_Error | LCD_DEBUG_RenderBBox (LCD_ObjID id) |
Debug function to render the bounding box of a component. | |
#define RGB8_TO_RGB565 | ( | rgb | ) | (u16)((((rgb >> 16) & 0xFF) >> 3) << 11 | (((rgb >> 8) & 0xFF) >> 2) << 5 | ((rgb & 0xFF) >> 3)) |
Returns the bounding box of a temporary object.
obj | The object to get the bounding box of. |
out_bbox | The bounding box of the object, if it was found. |
Definition at line 621 of file glcd.c.
Debug function to render the bounding box of a component.
id | The ID of the object to render the bounding box of. |
Definition at line 635 of file glcd.c.
LCD_Error LCD_FMAddFont | ( | LCD_Font | font, |
LCD_FontID * | out_id | ||
) |
Adds a new font to the font manager, and returns its ID through the out_id pointer.
font | The font to add |
out_id | The ID of the font, if it was added successfully to the font manager. |
Definition at line 577 of file glcd.c.
LCD_Error LCD_FMRemoveFont | ( | LCD_FontID | id | ) |
Removes a font from the font manager by its ID.
id | The ID of the font to remove from the font manager. |
Returns the bounding box of an object in the render list.
id | The ID of the object to get the bounding box of. |
out_bbox | The bounding box of the object, if it was found. |
Definition at line 602 of file glcd.c.
LCD_Coordinate LCD_GetCenter | ( | void | ) |
u16 LCD_GetHeight | ( | void | ) |
LCD_Color LCD_GetPointColor | ( | LCD_Coordinate | point | ) |
LCD_Coordinate LCD_GetSize | ( | void | ) |
u16 LCD_GetWidth | ( | void | ) |
LCD_Error LCD_Init | ( | LCD_Orientation | orientation, |
MEM_Allocator *const | alloc, | ||
const LCD_Color *const | clear_to | ||
) |
Initializes TFT LCD Controller.
orientation | The orientation of the screen, from the LCD_Orientation enum |
alloc | The memory allocator to use for the LCD objects |
clear_to | [OPTIONAL] The color to clear the screen with |
Definition at line 200 of file glcd.c.
bool LCD_IsInitialized | ( | void | ) |
Adds a new object to the render list, and returns its ID (if out_id is not NULL) through the out_id pointer.
obj | The object to add |
out_id | The ID of the object, or NULL on error. |
options | Adding preferences, from the LCD_RMAddOption enum. |
Definition at line 292 of file glcd.c.
LCD_Error LCD_RMClear | ( | void | ) |
Removes all visible and non-visible objects from the screen.
Definition at line 395 of file glcd.c.
bool LCD_RMIsVisible | ( | LCD_ObjID | id | ) |
LCD_Error LCD_RMMove | ( | LCD_ObjID | id, |
LCD_Coordinate | new_pos, | ||
bool | redraw_underneath | ||
) |
Moves an object in the render list to a new position. It also updates the object's position in the RL itself, and in the memory arena.
id | The ID of the object to move |
new_pos | The new position of the object, which will replace the old one |
redraw_underneath | Whether to redraw the objects that are below the object prior to the move |
Definition at line 507 of file glcd.c.
Removes an object from the render list by its ID. It also deallocates the memory used by that object in the memory arena.
id | The ID of the object to remove |
redraw_underneath | Whether to redraw the objects that are below the removed object |
Definition at line 362 of file glcd.c.
LCD_Error LCD_RMRender | ( | void | ) |
Renders the object immediately, without adding neither to the render list nor to the memory arena. This is useful for objects that are not frequently updated, and that you don't want to store in the memory arena.
obj | The object to render immediately |
Definition at line 438 of file glcd.c.
Shows/hides an object on/from the screen without modifying the render list.
id | The ID of the object to hide |
visible | Whether the object should be visible or not |
redraw_underneath | Whether to redraw the objects that are below the current one. |
Definition at line 449 of file glcd.c.
Sets the background color of the screen.
color | The RGB565 color to set |
redraw_objects | If true, the object that were previously visible are re-rendered on top of the new background color. |
Definition at line 264 of file glcd.c.
LCD_Error LCD_SetPointColor | ( | LCD_Color | color, |
LCD_Coordinate | point | ||
) |
Sets the color of the pixel at the specified coordinates.
color | The RGB565 color to set |
point | The coordinates of the pixel to color |
Definition at line 245 of file glcd.c.