62#define SCREEN_FOR_TEXT_ATTR true
63#define SCREEN_FOR_TEXT_CHAR false
65#define SCREEN_COPY_TO_SCREEN true
66#define SCREEN_COPY_FROM_SCREEN false
70#define COLOR_BLACK (unsigned char)0x00
71#define COLOR_RED (unsigned char)0x01
72#define COLOR_GREEN (unsigned char)0x02
73#define COLOR_YELLOW (unsigned char)0x03
74#define COLOR_BLUE (unsigned char)0x04
75#define COLOR_MAGENTA (unsigned char)0x05
76#define COLOR_CYAN (unsigned char)0x06
77#define COLOR_WHITE (unsigned char)0x07
78#define COLOR_GRAY (unsigned char)0x08
79#define COLOR_BRIGHT_RED (unsigned char)0x09
80#define COLOR_BRIGHT_GREEN (unsigned char)0x0A
81#define COLOR_BRIGHT_YELLOW (unsigned char)0x0B
82#define COLOR_BRIGHT_BLUE (unsigned char)0x0C
83#define COLOR_BRIGHT_MAGENTA (unsigned char)0x0D
84#define COLOR_BRIGHT_CYAN (unsigned char)0x0E
85#define COLOR_BRIGHT_WHITE (unsigned char)0x0F
88#define FG_COLOR_BLACK (unsigned char)0x00
89#define FG_COLOR_RED (unsigned char)0x01
90#define FG_COLOR_GREEN (unsigned char)0x02
91#define FG_COLOR_YELLOW (unsigned char)0x03
92#define FG_COLOR_BLUE (unsigned char)0x04
93#define FG_COLOR_MAGENTA (unsigned char)0x05
94#define FG_COLOR_CYAN (unsigned char)0x06
95#define FG_COLOR_WHITE (unsigned char)0x07
96#define FG_COLOR_GRAY (unsigned char)0x08
97#define FG_COLOR_BRIGHT_RED (unsigned char)0x09
98#define FG_COLOR_BRIGHT_GREEN (unsigned char)0x0A
99#define FG_COLOR_BRIGHT_YELLOW (unsigned char)0x0B
100#define FG_COLOR_BRIGHT_BLUE (unsigned char)0x0C
101#define FG_COLOR_BRIGHT_MAGENTA (unsigned char)0x0D
102#define FG_COLOR_BRIGHT_CYAN (unsigned char)0x0E
103#define FG_COLOR_BRIGHT_WHITE (unsigned char)0x0F
105#define BG_COLOR_BLACK (unsigned char)0x00
106#define BG_COLOR_RED (unsigned char)0x01
107#define BG_COLOR_GREEN (unsigned char)0x02
108#define BG_COLOR_YELLOW (unsigned char)0x03
109#define BG_COLOR_BLUE (unsigned char)0x04
110#define BG_COLOR_MAGENTA (unsigned char)0x05
111#define BG_COLOR_CYAN (unsigned char)0x06
112#define BG_COLOR_WHITE (unsigned char)0x07
113#define BG_COLOR_GRAY (unsigned char)0x08
114#define BG_COLOR_BRIGHT_RED (unsigned char)0x09
115#define BG_COLOR_BRIGHT_GREEN (unsigned char)0x0A
116#define BG_COLOR_BRIGHT_YELLOW (unsigned char)0x0B
117#define BG_COLOR_BRIGHT_BLUE (unsigned char)0x0C
118#define BG_COLOR_BRIGHT_MAGENTA (unsigned char)0x0D
119#define BG_COLOR_BRIGHT_CYAN (unsigned char)0x0E
120#define BG_COLOR_BRIGHT_WHITE (unsigned char)0x0F
130typedef enum text_draw_choice
158int16_t General_StrFindNextWordEnd(
const char* the_string, int16_t max_search_len);
161int16_t General_StrFindNextLineBreak(
const char* the_string, int16_t max_search_len);
175int16_t
General_WrapAndTrimTextToFit(
char** orig_string,
char** formatted_string, int16_t max_chars_to_format, int16_t max_width, int16_t max_height, int16_t one_char_width, int16_t one_row_height,
Font* the_font, int16_t (* measure_function)(
Font*,
char*, int16_t, int16_t, int16_t, int16_t*));
222bool Text_CopyMemBox(
Screen* the_screen,
char* the_buffer, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
bool to_screen,
bool for_attr);
262bool Text_FillBoxSlow(
Screen* the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice);
274bool Text_FillBox(
Screen* the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
unsigned char the_char, uint8_t fore_color, uint8_t back_color);
295bool Text_FillBoxAttrOnly(
Screen* the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t fore_color, uint8_t back_color);
416bool Text_DrawHLine(
Screen* the_screen, int16_t x, int16_t y, int16_t the_line_len,
unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice);
429bool Text_DrawHLineSlow(
Screen* the_screen, int16_t x, int16_t y, int16_t the_line_len,
unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice);
441bool Text_DrawVLine(
Screen* the_screen, int16_t x, int16_t y, int16_t the_line_len,
unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice);
454bool Text_DrawBoxCoords(
Screen* the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice);
478bool Text_DrawBox(
Screen* the_screen, int16_t x, int16_t y, int16_t width, int16_t height,
unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice);
495bool Text_DrawStringAtXY(
Screen* the_screen, int16_t x, int16_t y,
char* the_string, uint8_t fore_color, uint8_t back_color);
510char*
Text_DrawStringInBox(
Screen* the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2,
char* the_string,
char** work_buffer, uint8_t fore_color, uint8_t back_color,
bool (* continue_function)(
void));
521int16_t
Text_MeasureStringWidth(
Font* the_font,
char* the_string, int16_t num_chars, int16_t available_width, int16_t fixed_char_width, int16_t* measured_width);
This Font object is essentially the Mac "fontRecord" struct, with added pointers for the data tables.
Definition: font.h:71
Definition: a2560k.h:1375
bool Text_ShowFontChars(Screen *the_screen, int16_t y)
Test function to display all 256 font characters.
Definition: text.c:1211
bool Text_DrawStringAtXY(Screen *the_screen, int16_t x, int16_t y, char *the_string, uint8_t fore_color, uint8_t back_color)
Draw a string at a specified x, y coord, also setting the color attributes.
Definition: text.c:1890
bool Text_SetCharAndColorAtXY(Screen *the_screen, int16_t x, int16_t y, unsigned char the_char, uint8_t fore_color, uint8_t back_color)
Draw a char at a specified x, y coord, also setting the color attributes.
Definition: text.c:1336
bool Text_CopyMemBox(Screen *the_screen, char *the_buffer, int16_t x1, int16_t y1, int16_t x2, int16_t y2, bool to_screen, bool for_attr)
Copy a rectangular area of text or attr to or from an off-screen buffer.
Definition: text.c:762
bool Text_DrawBoxCoords(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice)
Draws a basic box based on 2 sets of coords, using the specified char and/or attribute for all cells.
Definition: text.c:1674
char * Text_DrawStringInBox(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, char *the_string, char **work_buffer, uint8_t fore_color, uint8_t back_color, bool(*continue_function)(void))
Draw a string in a rectangular block on the screen, with wrap.
Definition: text.c:1953
bool Text_DrawHLine(Screen *the_screen, int16_t x, int16_t y, int16_t the_line_len, unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice)
Draws a horizontal line from specified coords, for n characters, using the specified char and/or attr...
Definition: text.c:1506
unsigned char Text_GetCharAtXY(Screen *the_screen, int16_t x, int16_t y)
Get the char at a specified x, y coord.
Definition: text.c:1377
uint8_t Text_CalculateAttributeValue(uint8_t fore_color, uint8_t back_color)
Calculate the combined text attribute value for a given foreground/background combination.
Definition: text.c:2200
bool Text_DrawVLine(Screen *the_screen, int16_t x, int16_t y, int16_t the_line_len, unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice)
Draws a vertical line from specified coords, for n characters, using the specified char and/or attrib...
Definition: text.c:1618
void Text_ClearScreen(Screen *the_screen, uint8_t fore_color, uint8_t back_color)
Clear the text screen and reset foreground and background colors.
Definition: text.c:838
bool Text_FillAttrMemForeBack(Screen *the_screen, uint8_t fore_color, uint8_t back_color)
Fill the entire attribute memory of the passed screen with the specified fore- and back-color.
Definition: text.c:862
bool Text_DrawBoxCoordsFancy(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t fore_color, uint8_t back_color)
Draws a box based on 2 sets of coords, using the predetermined line and corner "graphics",...
Definition: text.c:1746
bool Text_CopyAttrMemFromScreen(Screen *the_screen, char *the_target_buffer)
Copy a full screen of text attributes to an off-screen buffer.
Definition: text.c:638
bool Text_DrawHLineSlow(Screen *the_screen, int16_t x, int16_t y, int16_t the_line_len, unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice)
Draws a horizontal line from specified coords, for n characters, using the specified char and/or attr...
Definition: text.c:1563
bool Text_UpdateFontData(Screen *the_screen, char *new_font_data)
replace the current font data with the data at the passed memory buffer
Definition: text.c:1186
bool Text_SetAttrAtXY(Screen *the_screen, int16_t x, int16_t y, uint8_t the_attribute_value)
Set the attribute value at a specified x, y coord.
Definition: text.c:1280
bool Text_FillBoxAttrOnly(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t fore_color, uint8_t back_color)
Fill attribute memory for a specific box area.
Definition: text.c:1070
bool Text_InvertBox(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2)
Invert the colors of a rectangular block.
Definition: text.c:1121
uint8_t Text_GetBackColorAtXY(Screen *the_screen, int16_t x, int16_t y)
Get the background color at a specified x, y coord.
Definition: text.c:1466
bool Text_SetColorAtXY(Screen *the_screen, int16_t x, int16_t y, uint8_t fore_color, uint8_t back_color)
Set the attribute value at a specified x, y coord based on the foreground and background colors passe...
Definition: text.c:1310
uint8_t Text_GetAttrAtXY(Screen *the_screen, int16_t x, int16_t y)
Get the attribute value at a specified x, y coord.
Definition: text.c:1406
bool Text_FillBoxSlow(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice)
Fill a box-shaped section of character and/or attribute memory This version uses char-by-char functio...
Definition: text.c:918
bool Text_CopyCharMemFromScreen(Screen *the_screen, char *the_target_buffer)
Copy a full screen of text to an off-screen buffer.
Definition: text.c:684
uint8_t Text_GetForeColorAtXY(Screen *the_screen, int16_t x, int16_t y)
Get the foreground color at a specified x, y coord.
Definition: text.c:1435
int16_t General_WrapAndTrimTextToFit(char **orig_string, char **formatted_string, int16_t max_chars_to_format, int16_t max_width, int16_t max_height, int16_t one_char_width, int16_t one_row_height, Font *the_font, int16_t(*measure_function)(Font *, char *, int16_t, int16_t, int16_t, int16_t *))
Format a string by wrapping and trimming to fit the passed width and height.
Definition: text.c:517
bool Text_SetCharAtXY(Screen *the_screen, int16_t x, int16_t y, unsigned char the_char)
Set a char at a specified x, y coord.
Definition: text.c:1251
bool Text_CopyScreen(Screen *the_screen, char *the_buffer, bool to_screen, bool for_attr)
Copy a full screen worth of EITHER text or attribute data to OR from an off-screen buffer.
Definition: text.c:710
bool Text_DrawBox(Screen *the_screen, int16_t x, int16_t y, int16_t width, int16_t height, unsigned char the_char, uint8_t fore_color, uint8_t back_color, text_draw_choice the_draw_choice)
Draws a basic box based on start coords and width/height, using the specified char and/or attribute f...
Definition: text.c:1828
int16_t Text_MeasureStringWidth(Font *the_font, char *the_string, int16_t num_chars, int16_t available_width, int16_t fixed_char_width, int16_t *measured_width)
Calculates how many characters of the passed string will fit into the passed pixel width.
Definition: text.c:2128
bool Text_CopyAttrMemToScreen(Screen *the_screen, char *the_source_buffer)
Copy a full screen of attr from an off-screen buffer.
Definition: text.c:615
bool Text_FillBox(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, unsigned char the_char, uint8_t fore_color, uint8_t back_color)
Fill character and attribute memory for a specific box area.
Definition: text.c:972
bool Text_FillBoxCharOnly(Screen *the_screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, unsigned char the_char)
Fill character memory for a specific box area.
Definition: text.c:1023
bool Text_FillCharMem(Screen *the_screen, unsigned char the_fill)
Fill the entire character memory of the passed screen.
Definition: text.c:894
char * Text_GetMemLocForXY(Screen *the_screen, int16_t x, int16_t y, bool for_attr)
Calculate the VRAM location of the specified coordinate.
Definition: text.c:2176
bool Text_CopyCharMemToScreen(Screen *the_screen, char *the_source_buffer)
Copy a full screen of text from an off-screen buffer.
Definition: text.c:661
bool Text_FillAttrMem(Screen *the_screen, uint8_t the_fill)
Fill the entire attribute memory of the passed screen.
Definition: text.c:878