IGraphicInterface - carenalgas/popochiu GitHub Wiki
Description
Data and functions to work with the graphic interface (a.k.a. UI (but saying User is boring. We're making games, not apps)). Is the shortcut for GraphicInterface.gd, and can be used (from any script) with G (E.g. G.display("I'm the narrator?")).
Some things you can do with it:
- Show messages in the middle of the sceen (like a narrator or a game message).
- Show info about things in the game (this will appear in the screen bottom centered).
- Show, hide and block the graphic interface.
- Show the history of in-game actions (interactions and conversations).
Examples
G.show_info('Click this to open the main menu')
G.display('There are no actions set for this object')
G.hide_interface()
G.connect('inventory_shown', self, '_play_inventory_sfx')
Properties
Signals
-
blocked. Emitted when
block()is called. GraphicInterface.gd connects to this signal in order to block itself. -
continue_clicked. E connects to this signal to make commands in queue to progress. E.g. You could emit this signal in order to make instructions in a run to continue without the players' intervention.
-
freed. Emitted when
done()is called. GraphicInterface.gd connects to this signal in order to unlock itself. -
history_opened. Emitted when
show_history()is called. -
interface_hidden. Emitted when
hide_interface()is called. -
interface_shown. Emitted when
show_interface()is called. -
load_requested. Opens the popup to load saved games.
-
save_requested( String
date). Opens the popup to save the game session. The current date in YYYY/MM/DD HH:MM:SS format is passed to use that as the description of the savefile. -
show_box_requested( String
message). Emitted whendisplay()is called. GraphicInterface.gd connects to this signal in order to displaymessageat the center of the screen. -
show_info_requested( String
info). Emitted whenshow_info()is called. GraphicInterface.gd connects to this signal in order to showinfoat the bottom-center of the screen.
Methods
Public
-
block() void
Makes the Graphic Interface to block. This means that players won't be able to interact with anything until the Graphic Interface is freed. This will make the mouse pointer take the hourglass appearance.
-
display( String
msg: String, boolis_in_queue = true) voidShows
msgin the center of the screen. If you want to use it outside a run, sendis_in_queueasfalse. Can be yield.Can be used as the narrator or to give instructions to players. The visual style of the node that shows this text can be modified in DisplayBox.tscn.
func on_interact() -> void: yield(G.display('Hi. I am the game.', false), 'completed')
-
done() void
Makes the Graphic Interface to unlock.
-
hide_interface() void
Makes the Graphic Interface to hide.
-
show_history() void
Makes the History popup to appear.
-
show_info( String
msg: String = '') voidShows
msgat the bottom-center of the screen. This is what Popochiu uses to show the name of PopochiuClickables when the mouse moves over them.
-
show_interface() void
Makes the Graphic Interface to show.
-
show_load() void
Makes the popup for loading a saved game appear.
-
show_save( String
date) voidMakes the popup for saving the game appear. The
dateis used as the description of the game session, and it is the one that will appear in the selected slot.