summaryrefslogtreecommitdiff
path: root/engine/main.go
blob: de8ff341d2bd2824ae07a2e8ad67e594946a6144 (plain)
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
78
79
80
81
82
package main

import (
	"log"

	components "github.com/DegustatorPonos/RuinesOfRafdolon/Components"
	coreobjects "github.com/DegustatorPonos/RuinesOfRafdolon/CoreObjects"
	dynamic "github.com/DegustatorPonos/RuinesOfRafdolon/Dynamic"
	render "github.com/DegustatorPonos/RuinesOfRafdolon/Render"
	settings "github.com/DegustatorPonos/RuinesOfRafdolon/Settings"
	ui "github.com/DegustatorPonos/RuinesOfRafdolon/UI"
	rl "github.com/gen2brain/raylib-go/raylib"
)

func main() {
	settings.ReadSettings()
	components.InitManager()
	dynamic.Init()
	render.InitWindow()
	defer render.DeinitWindow()

	// TEMPORARY SECTION
	for _, v := range dynamic.Manager.AvaliablePackages {
		// log.Printf("%s: %s", k, &v)
		v.LoadTextures()
		v.LoadObjects()
		v.LoadWorlds()
	}
	log.Printf("Resource manager: %s", &components.Resources)

	// var field = descriptor.GenerateMap()


	var manager = coreobjects.InitSceneManager()
	// render.StartLoop(manager, components.Resources.Worlds["MainWorld"])
	var menu = menu_test()
	render.StartLoop(manager, menu)
}

func menu_test() *ui.Menu {
	return &ui.Menu {
		PaddingX: 0.05,
		PaddingY: 0.1,
		Contents: &ui.GridColumn{ 
			Spacing: 0.025,
			Objects: []ui.UIElement {
				&ui.GridRow {
					HeightWeight: 1,
					Spacing: 0.01,
					Objects: []ui.UIElement {
						&ui.Label{ Text: "First piece" },
						&ui.Label{ Text: "Wide piece", WidthWeight: 2 },
						&ui.Label{ Text: "Another piece" },
					},
				},
				&ui.GridRow {
					HeightWeight: 2,
					Objects: []ui.UIElement {
						&ui.Button {
							EventType: ui.OnClick,
							DisplayElement: &ui.Label {
								Text: "Center button",
								Alignment: ui.Center,
								Style: ui.Style {
									BacgroundColor: &rl.Pink,
								},
							},
						},
					},
				},
				&ui.GridRow {
					HeightWeight: 1,
					Objects: []ui.UIElement {
						&ui.Label{ Text: "A very very long text that is bigger than a window" },
					},
				},
			},
		},
		// Rows: []ui.UIElement {
		// },
	}
}