Devlog #035: Options options options
I'm booking nice progress with the options menu.
I have made a reusable dropdown component that supports scrolling though buttons and the mouse wheel.
At first I wanted the text to smoothly scroll in and out of view by partially rendering the text when it's partly outside view, but unfortunately SFML does not really have a good option for that.
I could convert the text to a texture and then partially render it through a sprite, but this just seems like too much effort for a very small detail. I chose to scroll text completely in or completely out, avoiding this situation all together.
My first scroll attempt was pretty hilarious.
But a few adjustments later, scrolling was working like a charm.
Technically the dropdown component reuses my TextInput component used in the save menu (to enter the save file name) and als reuses the SelectionTable component I made for the tile editor.
The TextInput is used for the top part of the dropdown that will show the surrently selected value. The SelectionTable is used for the scrollable options part that also highlights the currently selected option.
The SelectionTable already had the selection colouring implemented. I simply expanded the class to support scroll buttons as well, and voila, a working dropdown!
Thinking about the settings I should add, the amount of work seemed to continuously increase.
I want to implement settings for resolution, language, controls, fullscreen/windowed mode, brightness, and of course music and sound. The language setting is easily implemented because I already finished the base localization code.
The other settings need some more investigation. SFML seems to be able to handle the difficult parts regarding the resolution and fullscreen/windowed settings, which is nice.
The controls however are currently hard coded, so I will have to create some mapping in between for those settings. The brightness setting will introduce me to the world of shaders. I will make a shader that brightens or darkens the whole screen based on this setting. It will be my first shader ever, which is exiting, but also daunting.
I've honestly never worked with shaders, let alone wrote them. They always sounded like this hugely complex magical thing that only wizards could conjure.
All in all, coding these settings is a big task. But I'll probably gloat in pride when it's done!
Leave a comment
Log in with itch.io to leave a comment.