Este video GUI/UI (interfaz de usuario) se desarrolla usando el motor Godot. El motor del juego Godot proporciona una serie de controles y widgets de interfaz de usuario, de hecho, ¡el editor en sí se crea completamente con ellos! En este video, analizamos todos los aspectos de la creación de una interfaz de usuario, incluidos controles, estilos, temas, contenedores, diálogos y fuentes.
El video
Activos y muestras de código
La fuente utilizada en este ejemplo es Asimov y se puede descargar gratis aquí.
BotónDemo.gd
extends Button func _on_Button_pressed(): self.text = "Clicked!" func _on_Button_mouse_entered(): self.add_color_override("font_color_hover", Color(0,0,0))
DynamicThemeOnButtonScript.gd
extends Button func _ready(): var myTheme = Theme.new() myTheme.set_color("font_color","Button", Color(0,0,1)) self.set_theme(myTheme)
Diálogos.gd
extends Node func _ready(): # The following line wires the cancel button of the dialog to our local function $FileDialog.get_cancel().connect("pressed",self,"_on_Cancel") # The following commented out line of code displays the dialog modally #$FileDialog.show_modal(true) # While this version displays the dialog as a movable popup button #$FileDialog.popup() # The following code would be called if you had a node named AcceptDialog added to your scene already #$AcceptDialog.get_label().text = "You OK with this?" #$AcceptDialog.popup_centered() #This code creates a dialog for displaying text to the end user progammatically var diag = AcceptDialog.new() diag.get_label().text = "You OK with this?" self.add_child(diag) diag.popup_centered() func _on_Cancel(): print("Cancelled") func _on_FileDialog_file_selected( path ): print("File selected at " + path)
LoadBitmapFont.gd
extends Label func _ready(): var font = load("res://myfont.fnt"); self.add_font_override("font",font)
Los activos utilizados en este ejemplo pueden ser descargado aquí.