From 2ccc0f5edd5f8e61bd0760f30b2d66f2d977b2bf Mon Sep 17 00:00:00 2001 From: Xavier ASUS Date: Sun, 18 Nov 2018 20:03:35 +0100 Subject: Added "const" qualifier to some functions. "cdrom:\ and ;1" are automatically inserted into file name, in order to save memory space. Some minor optimizations. --- Source/Font.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Source/Font.c') diff --git a/Source/Font.c b/Source/Font.c index a639acb..0eef357 100644 --- a/Source/Font.c +++ b/Source/Font.c @@ -20,14 +20,14 @@ * *************************************/ enum -{ +{ // We will use the most significant bit // for internal purposes. SQUARE_BTN_8BIT = 128, CROSS_BTN_8BIT, CIRCLE_BTN_8BIT, - TRIANGLE_BTN_8BIT + TRIANGLE_BTN_8BIT }; /* ************************************* @@ -41,7 +41,7 @@ enum static char _internal_text[FONT_INTERNAL_TEXT_BUFFER_MAX_SIZE]; static volatile unsigned char _blend_effect_lum; -bool FontLoadImage(char* strPath, TYPE_FONT * ptrFont) +bool FontLoadImage(const char* strPath, TYPE_FONT * ptrFont) { if (GfxSpriteFromFile(strPath, &ptrFont->spr) == false) { @@ -104,8 +104,8 @@ void FontSetSize(TYPE_FONT * ptrFont, short size) } void FontSetMaxCharPerLine(TYPE_FONT* ptrFont, uint8_t max) -{ - ptrFont->max_ch_wrap = max; +{ + ptrFont->max_ch_wrap = max; } void FontSetSpacing(TYPE_FONT* ptrFont, short spacing) @@ -118,7 +118,7 @@ void FontCyclic(void) _blend_effect_lum -= 8; } -void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...) +void FontPrintText(TYPE_FONT * ptrFont, short x, short y, const char* str, ...) { uint16_t i; uint8_t line_count = 0; @@ -176,7 +176,7 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...) for (j = i + 1; j < result; j++) { if (_internal_text[j] != ' ') - { + { if (++aux_line_count >= ptrFont->max_ch_wrap) { line_count = 0; @@ -184,18 +184,18 @@ void FontPrintText(TYPE_FONT * ptrFont, short x, short y, char* str, ...) y += ptrFont->char_h; linefeed_needed = true; break; - } + } } else - { - break; - } + { + break; + } } } if (linefeed_needed == false) - { - x += ptrFont->char_w; + { + x += ptrFont->char_w; } continue; -- cgit v1.2.3