Skip to content

Commit 6bc072e

Browse files
committed
Clarified docs
1 parent 6587014 commit 6bc072e

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

docs/en/manuals/gui.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,41 +58,66 @@ Selecting the root "Gui" node in the *Outline* shows the *Properties* for the GU
5858

5959
## Runtime manipulation
6060

61-
You can manipulate GUI properties in runtime using `go.get()` and `go.set()`:
61+
You can manipulate GUI properties in runtime from a script component using `go.get()` and `go.set()`:
6262

6363
Fonts
6464
: Get or set a font used in a GUI.
6565

66+
![get_set_font](images/gui/get_set_font.png)
67+
6668
```lua
6769
go.property("mybigfont", resource.font("/assets/mybig.font"))
6870

6971
function init(self)
70-
local current_font = go.get("#gui", "bigfont")
71-
go.set("#gui", "bigfont", self.mybigfont)
72+
-- get the font currently assigned to the font property 'default'
73+
print(go.get("#gui", "default")) -- /builtins/fonts/default.font
74+
75+
-- set the font property 'default' to the font assigned to the resource property 'mybigfont'
76+
go.set("#gui", "default", self.mybigfont)
77+
78+
-- get the new font assigned to the font property 'default'
79+
print(go.get("#gui", "default")) -- /assets/mybig.font
7280
end
7381
```
7482

7583
Materials
7684
: Get or set a material used in a GUI.
7785

86+
![get_set_material](images/gui/get_set_material.png)
87+
7888
```lua
79-
go.property("mymaterial", resource.font("/assets/my.material"))
89+
go.property("myeffect", resource.font("/assets/myeffect.material"))
8090

8191
function init(self)
82-
local current_material = go.get("#gui", "specialmaterial")
83-
go.set("#gui", "specialmaterial", self.mymaterial)
92+
-- get the material currently assigned to the material property 'effect'
93+
print(go.get("#gui", "effect")) -- /effect.material
94+
95+
-- set the material property 'effect' to the material assigned to the resource property 'myeffect'
96+
go.set("#gui", "effect", self.myeffect)
97+
98+
-- get the new material assigned to the material property 'effect'
99+
print(go.get("#gui", "effect")) -- /assets/myeffect.material
84100
end
85101
```
86102

87103
Textures
88104
: Get or set a texture (atlas) used in a GUI.
89105

106+
![get_set_texture](images/gui/get_set_texture.png)
107+
90108
```lua
91-
go.property("myatlas", resource.font("/assets/my.atlas"))
109+
go.property("mytheme", resource.font("/assets/mytheme.atlas"))
92110

93111
function init(self)
94-
local current_atlas = go.get("#gui", "theme")
95-
go.set("#gui", "theme", self.myatlas)
112+
-- get the texture currently assigned to the texture property 'theme'
113+
print(go.get("#gui", "theme")) -- /theme.atlas
114+
115+
-- set the texture property 'theme' to the texture assigned to the resource property 'mytheme'
116+
go.set("#gui", "theme", self.mytheme)
117+
118+
-- get the new texture assigned to the texture property 'theme'
119+
print(go.get("#gui", "theme")) -- /assets/mytheme.atlas
120+
96121
end
97122
```
98123

25.8 KB
Loading
24.1 KB
Loading
Loading

0 commit comments

Comments
 (0)