From 28f790bade311689abed9bf8e6486673f6f14f6e Mon Sep 17 00:00:00 2001 From: lephe Date: Sun, 1 Jan 2017 17:41:16 +0100 Subject: [PATCH] Fixed some font formats. Minor changes in README, headers. --- README.md | 7 ++++--- TODO | 2 +- include/keyboard.h | 42 ++++++++++++++++++------------------- src/tales/tales_internals.c | 4 ++-- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 8511870..64a94c6 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,14 @@ access to the low-level MPU features, among which: office applications and event-driven decisions for games * Hardware timers running at over 10 MHz, allowing microsecond-level control * Unlimited mappings of callbacks to Real-Time Clock events (requires build) -* Access to processor register for debugging information, determination of +* Access to processor registers for debugging information, determination of processor speed (overclock is on the TODO list), backlight management... The library also offers powerful higher-level features: * A gray engine that works by rapidly swapping monochrome images -* Blazingly fast drawing functions when working with the fxSDK -* C Standard functions such as the `printf()` family. +* Blazingly fast drawing functions when working with the fxSDK (10 times faster + image rendering that MonochromeLib) +* C Standard functions such as the `printf()` family Interrupt handler diff --git a/TODO b/TODO index 348f9cc..637225a 100644 --- a/TODO +++ b/TODO @@ -5,9 +5,9 @@ Bugs to fix: Simple improvements: - demo: Try 284x124 at (-60, -28) (all disadvantages) - display: Rectangle-based drawing functions -- tales: Test all font encodings - time: Compute CLOCKS_PER_SEC - core: Add VBR handlers debugging information (if possible) +- events: Introduce KeyRepeat events Larger improvements: - errno: Introduce errno and use it more or less everywhere - bopti: Monochrome bitmaps blending modes diff --git a/include/keyboard.h b/include/keyboard.h index 278d0d9..d90ea1d 100644 --- a/include/keyboard.h +++ b/include/keyboard.h @@ -161,24 +161,6 @@ enum GetkeyOpt Getkey_RepeatAllKeys = 0xf0, }; -/* - keylast() - Returns the matrix code of the last pressed key. If repeat_count is - non-NULL, it is set to the number of repetitions. -*/ -int keylast(int *repeat_count); - -/* - keystate() - Returns the address of the keyboard state array. The keyboard state - consists in 10 bytes, in which every key is represented as a bit. - The returned address is the original buffer address. You should avoid - editing the array. It wouldn't influence the behavior of the keyboard - functions, but the buffer data is very volatile. Therefore, data - written to the buffer could be replaced anytime. -*/ -volatile unsigned char *keystate(void); - /* getkey() Blocking function with auto-repeat and SHIFT modifying functionalities. @@ -190,10 +172,10 @@ int getkey(void); /* getkey_opt() Enhances getkey() with most general functionalities. An OR-combination - of options may be given as second argument. + of options may be given as first argument. If max_cycles is non-zero and positive, getkey_opt() will return - KEY_NOEVENT if no event occurs during max_cycle analysis. - As getkey(), returns the pressed key matrix code, possibly with + KEY_NOEVENT if no event occurs during max_cycle analyzes. + Like getkey(), returns the pressed key matrix code, possibly with modifiers depending on the options. */ int getkey_opt(enum GetkeyOpt options, int max_cycles); @@ -231,6 +213,24 @@ int getkey_opt(enum GetkeyOpt options, int max_cycles); */ void multigetkey(int *keys, int count, int max_cycles); +/* + keylast() + Returns the matrix code of the last pressed key. If repeat_count is + non-NULL, it is set to the number of repetitions. +*/ +int keylast(int *repeat_count); + +/* + keystate() + Returns the address of the keyboard state array. The keyboard state + consists in 10 bytes, in which every key is represented as a bit. + The returned address is the original buffer address. You should avoid + editing the array. It wouldn't influence the behavior of the keyboard + functions, but the buffer data is very volatile. Therefore, data + written to the buffer could be replaced anytime. +*/ +volatile unsigned char *keystate(void); + //--- diff --git a/src/tales/tales_internals.c b/src/tales/tales_internals.c index 838291e..d0a2483 100644 --- a/src/tales/tales_internals.c +++ b/src/tales/tales_internals.c @@ -55,12 +55,12 @@ int getCharacterIndex(int c) break; case FontFormat_Letters: if(!isalpha(c)) return -1; - index = c - 'A' - ('a' - 'z') * (c >= 'a'); + index = c - 'A' - ('a' - 'Z') * (c >= 'a'); break; case FontFormat_Common: if(!isalnum(c)) return -1; index = c - '0' - ('A' - '9') * (c >= 'A') - - ('a' - 'z') * (c >= 'a'); + ('a' - 'Z') * (c >= 'a'); break; case FontFormat_Unknown: default: