|
Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
TextEntry serves as a method to create strings for a multitude of cases. It should be easy to see, easy to customize and as intuitive to use as possible. Several customization options are available.
Initialize text entry with textEntryInit(), where the settings, string pointer and the desired font are provided. By default, a blank, black background is used with white text and red as the emphasis color. textEntryInit() can be called once during initialization or just before the text entry is required, but cannot be inside the loop or it will not function.
Settings:
After all of the initialization is done, use textEntryDraw() to draw the current text entry box and textEntryInput() to send inputs to the tent entry. The text entry is re-drawn from scratch every cycle. textEntryInput() returns false until enter/okay is selected.
The controls are as follows:
Go to the source code of this file.
Data Structures | |
| struct | textEntrySettings_t |
Enumerations | |
| enum | keyModifier_t { TE_NO_SHIFT , TE_SHIFT , TE_CAPS_LOCK , TE_PROPER_NOUN , TE_SPECIAL_DONE } |
Functions | |
| void | textEntryInit (const textEntrySettings_t *settings, char *entryText, font_t *font) |
| void | textEntryDeinit (void) |
| Deletes the memory used by the text entry system. | |
| bool | textEntryInput (buttonEvt_t evt) |
| Handle button input for text entry. | |
| bool | textEntryDraw (int64_t elapsedUs) |
| Draws the text entry screen. | |
| void | textEntrySoftReset (void) |
| Resets the textEntry object. | |
| struct textEntrySettings_t |
| Data Fields | ||
|---|---|---|
| const char * | textPrompt | Prompt for the player. Set to NULL to not draw. |
| int | maxLen | The max length of the string. |
| keyModifier_t | startKMod | Sets default capitalization mode. |
| bool | useMultiLine | Use multiple lines. |
| bool | useOKEnterStyle | Use the "OK" instead of the arrow. |
| bool | useNewCapsStyle | Use new style instead of old style. |
| bool | blink | If the cursor should blink. |
| paletteColor_t | textColor | Color of the text to use. |
| paletteColor_t | emphasisColor | Color of the emphasis, used to highlight certain parts of the UI. |
| paletteColor_t | bgColor |
Color of the background. Set to cTransparent to not draw a background. |
| paletteColor_t | shadowboxColor |
Color of the shadowboxes. Set to cTransparent to not draw shadowboxes. |
| enum keyModifier_t |
| void textEntryInit | ( | const textEntrySettings_t * | settings, |
| char * | entryText, | ||
| font_t * | font ) |
| void textEntryDeinit | ( | void | ) |
Deletes the memory used by the text entry system.
| bool textEntryInput | ( | buttonEvt_t | evt | ) |
Handle button input for text entry.
| evt | button event to run |
| bool textEntryDraw | ( | int64_t | elapsedUs | ) |
Draws the text entry screen.
| elapsedUs | TIme for cursor blink |
| void textEntrySoftReset | ( | void | ) |
Resets the textEntry object.