-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.go
77 lines (71 loc) · 1.8 KB
/
ui.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/widget"
"golang.org/x/exp/slog"
)
// ui runs the game with the expectation that configuration is provided by the GUI
func ui(s *steam) error {
app := app.New()
// Expose the modPath flag to the UI
modPath := widget.NewEntryWithData(binding.BindString(&flagModPath))
modPath.SetPlaceHolder("Path to Mod")
// Build it!
w := app.NewWindow("HWRM Launcher")
content := container.NewVBox(
widget.NewLabel("Homeworld Remastered Launcher"),
widget.NewCard("Classic", "",
container.NewHBox(
widget.NewButton("Homeworld 1", func() {
flagModPath = modPath.Text
if err := s.run(hw1cla); err != nil {
slog.Error(err.Error())
}
}),
widget.NewButton("Homeworld 2", func() {
flagModPath = modPath.Text
if err := s.run(hw2cla); err != nil {
slog.Error(err.Error())
}
}),
),
),
widget.NewCard("Remastered", "",
container.NewHBox(
widget.NewButton("Homeworld 1", func() {
flagModPath = modPath.Text
if err := s.run(hw1rem); err != nil {
slog.Error(err.Error())
}
}),
widget.NewButton("Homeworld 2", func() {
flagModPath = modPath.Text
if err := s.run(hw2rem); err != nil {
slog.Error(err.Error())
}
}),
),
),
widget.NewCard("Multiplayer", "",
widget.NewButton("Homeworld Remastered", func() {
flagModPath = modPath.Text
if err := s.run(hwmp); err != nil {
slog.Error(err.Error())
}
}),
),
widget.NewCard("Options", "",
container.NewVBox(
widget.NewCheckWithData("Windowed", binding.BindBool(&flagWindowed)),
widget.NewForm(
widget.NewFormItem("Mod Path", modPath),
),
),
),
)
w.SetContent(content)
w.ShowAndRun()
return nil
}