-
Notifications
You must be signed in to change notification settings - Fork 7
/
View.go
70 lines (60 loc) · 1.68 KB
/
View.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
package about
import (
"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/hacked/editor/external"
)
// View handles the about display.
type View struct {
version string
guiScale float32
clipboard external.Clipboard
model viewModel
}
// NewView creates a new instance for the about display.
func NewView(clipboard external.Clipboard, guiScale float32, version string) *View {
return &View{
version: version,
guiScale: guiScale,
clipboard: clipboard,
model: freshViewModel(),
}
}
// Show requests to show the about view.
func (view *View) Show() {
view.model.windowOpen = true
}
// Render requests to render the view.
func (view *View) Render() {
if view.model.windowOpen {
imgui.OpenPopup("About")
view.model.windowOpen = false
}
if imgui.BeginPopupModalV("About", nil, imgui.WindowFlagsAlwaysAutoResize|imgui.WindowFlagsNoMove|imgui.WindowFlagsHorizontalScrollbar) {
view.renderContent()
imgui.EndPopup()
}
}
func (view *View) renderContent() {
projectURL := "https://inkyblackness.github.io"
communityURL := "https://www.systemshock.org"
userguideURL := "https://github.com/inkyblackness/hacked/wiki"
urlLine := func(title, url string) {
imgui.Text(title + ": " + url)
imgui.SameLine()
if imgui.Button("-> Clip##" + title) {
view.clipboard.SetString(url)
}
}
imgui.Text("InkyBlackness - HackEd - " + view.version)
imgui.Separator()
urlLine("User guide", userguideURL)
urlLine("Community", communityURL)
urlLine("Project", projectURL)
imgui.Separator()
imgui.Text("Thanks to: 3RDPlayer: testing, ToxicFrog: name idea.")
imgui.Text("Written in Go. Because I can.")
imgui.Separator()
if imgui.Button("OK") {
imgui.CloseCurrentPopup()
}
}