-
Notifications
You must be signed in to change notification settings - Fork 3
Gui Fluent API
George Michaelides edited this page May 25, 2015
·
7 revisions
Gem.Gui.Fluent API provides extension methods for chaining the control's initialization.
The following extensions can be used by all controls
AControl extensions
.Sprite("frame",gui.Textures["frame"])
.Color(Color.White)
.Padding(top: 0, bottom: 0, left: 0, right: 0)
.Text(gui.Fonts["segoe-10"], "Extensions")
.TextColor(Color.Black)
.TextHorizontalAlignment(HorizontalAlignment.Center)
.TextVerticalAlignment(VerticalAlignment.Center)
.ScreenAlignment(HorizontalAlignment.Center,
VerticalAlignment.Center)
.OnClick((sender, args) =>
gui.Swap(GuiScreen.MainMenu, GuiScreen.NewGame))
TextField extensions
.OnTextEntry((sender, text) => Console.Write(text))
CheckBox extensions
.OnCheckChanged((sender,value)=> Console.Write("new value: "+value))
Slider extensions
.OnValueChanged((sender,value)=> SoundManager.MusicVolume = value)