UI and Options
Finally implemented a basic UI with persistent game options. This took longer than expected as I went down a rabbit-hole of starting to wire up Nuklear before realising that I could simply create a new Selectable
component to complement the existing Text
component.
typedef struct Selectable
{
bool focused;
bool toggle;
bool value;
Rectangle region;
void (*callback)(GameOptions *options, bool value);
} Selectable;
The system that renders the Text
component updates the region
of the Selectable
component (if it exists), and this is used to detect whether the cursor is hovering over the text. A new UI
system simply iterates over Selectable
components to decide which is active, and the relevant callback
is triggered when a selection is made.
I also created a simple Options
component, which is a singleton (similar to Input
), and which is passed to relevant systems (for example, updating the player requires Options
to determine whether the y-axis should be inverted or not). This component is serialised to allow it to persist between game sessions.
Altogether not much fun, but it is functional, and didn’t take too much time (thanks to Flecs). Now on to polishing the controls and fixing a few niggly bugs before moving on to greater things!
Files
Get BLaTTiX
BLaTTiX
Punk-rock vectorball shmup!
Status | Released |
Author | the punk collective |
Genre | Shooter, Action |
Tags | 3D, Arcade, Experimental, Fast-Paced, First-Person, FPS, Retro, Short, Singleplayer |
More posts
- BLaTTiX is on Sale!Sep 03, 2021
- Small QOL UpdateAug 23, 2021
- Diary of a GameAug 06, 2021
- 🚀 BLaTTiX Launches!Aug 02, 2021
- The Home StretchJul 31, 2021
- BeastiesJul 28, 2021
- 🏁 TrailblazerJul 25, 2021
- On a RollJul 21, 2021
- A Healthy Update ❤️Jul 20, 2021
- General TweakageJul 11, 2021
Leave a comment
Log in with itch.io to leave a comment.