Makes PopochiuSettings.scale_gui to be taken into account by the plugin to scale the GUI. It also makes this scaling work on the 3 templates available so far.
Here are the some assets you can use to create the scene to test creating a game in HD (1280x720).
How the scaling works (open to discussion):
If scaling is enabled, Popochiu sets the size of the GUI (the root node in the res://game/graphic_interface/graphic_interface.tscn) to its original size (320x180) during runtime, and then scales that node to the value calculated in the Setup window.
Some GUI components take this scale value into account to change the way elements are rendered:
InventoryBar and InventoryGrid make the texture of items to expand (using TextureRect.EXPAND_FIT_WIDTH) so they fit the height of the inventory slot. I made this to assure devs don't have to design their assets (in this case the PNGs of each inventory item) in a smaller size. E.j. if the image of each inventory item is 64x64, it will be scaled up during runtime because the whole GUI is scaled up.
Cursor scales the texture of selected inventory items (this affects the Sierra and 2-click Context-sensitive GUIs) to match the height of the texture used in by the main cursor (this is the cursor used by default, when no inventory item is selected). Similar to the previous point, this ensures that the texture used by the secondary cursor (the one used to render selected inventory items) doesn't look bigger than the one used by the main cursor.
Known issues with this approach
Devs will have to know that the images for the inventory items will be scaled down by Popochiu during runtime.
It is hard to know the right amount of space occupied by the GUI when editing the .tscn files inside res://game/graphic_interface. Since the scaling is done during runtime, this is how the GUI looks in the Editor:
☝️ This is the one that concerns me the most at the moment 🙈 .
Godot has some issues rendering fonts. So, not all of them will look good. Most are readable, but others look weird. Here's an example of how the Settings window in the 9 Verb GUI is rendered in a Full HD (1280x720) game (look how "Resume Game" is rendered):
Other approaches I've been thinking of
More than scaling, is having a different theme for each GUI template in which the font and the assets are designed for HD (or Full HD) games and beyond.
Instead of scaling the GUI at runtime, we could scale the components (I'm referring to the root nodes inside the .tscn files) that are copied to the res://game/graphic_interface/ folder. This way, developers will see that the scenes are scaled in the Editor itself.
Makes
PopochiuSettings.scale_gui
to be taken into account by the plugin to scale the GUI. It also makes this scaling work on the 3 templates available so far.Here are the some assets you can use to create the scene to test creating a game in HD (1280x720).
How the scaling works (open to discussion):
res://game/graphic_interface/graphic_interface.tscn
) to its original size (320x180) during runtime, and then scales that node to the value calculated in the Setup window.TextureRect.EXPAND_FIT_WIDTH
) so they fit the height of the inventory slot. I made this to assure devs don't have to design their assets (in this case the PNGs of each inventory item) in a smaller size. E.j. if the image of each inventory item is 64x64, it will be scaled up during runtime because the whole GUI is scaled up.Known issues with this approach
Devs will have to know that the images for the inventory items will be scaled down by Popochiu during runtime.
It is hard to know the right amount of space occupied by the GUI when editing the
.tscn
files insideres://game/graphic_interface
. Since the scaling is done during runtime, this is how the GUI looks in the Editor:☝️ This is the one that concerns me the most at the moment 🙈 .
Godot has some issues rendering fonts. So, not all of them will look good. Most are readable, but others look weird. Here's an example of how the Settings window in the 9 Verb GUI is rendered in a Full HD (1280x720) game (look how "Resume Game" is rendered):
Other approaches I've been thinking of
res://game/graphic_interface/
folder. This way, developers will see that the scenes are scaled in the Editor itself.