carenalgas / popochiu

Godot plugin to make point n' click games in a similar way to tools like Adventure Game Studio and Power Quest.
MIT License
159 stars 17 forks source link

GUI Scaling (fix for #188) #193

Closed mapedorr closed 3 months ago

mapedorr commented 3 months ago

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):

  1. 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.
  2. 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

Other approaches I've been thinking of