-
Notifications
You must be signed in to change notification settings - Fork 2
/
Engine.go
71 lines (54 loc) · 1.49 KB
/
Engine.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
package GT
import (
"GT/Graphics/Font"
"GT/Graphics/Image"
"GT/Graphics/Opengl"
"GT/Logging"
"GT/Window"
"flag"
"os"
"path/filepath"
)
var (
Assets = flag.String("Assets", "./Assets", "Location of Assets folder")
OGL_VERSION = flag.String("OGL_VERSION", "130", "OpenGL version used. The actual version in shaders")
AssetsFonts string
AssetsImages string
AssetsModels string
)
func getAbsPath(folder string) string {
path, _ := filepath.Abs(*Assets + folder)
if _, err := os.Stat(path); err != nil {
Logging.Info("Please specify the correct Assets path with the -Assets flag")
panic(err)
}
return path
}
func readFlags() {
flag.Parse()
imgsPath := getAbsPath("/Images")
fontsPath := getAbsPath("/Fonts")
modelsPath := getAbsPath("/Models")
AssetsFonts = fontsPath
AssetsImages = imgsPath + string(os.PathSeparator)
AssetsModels = modelsPath + string(os.PathSeparator)
Logging.Info("Assets Path: ", *Assets)
Logging.Info("Images Path: ", AssetsImages)
Logging.Info("Fonts Path: ", AssetsFonts)
Logging.Info("Models Path: ", AssetsModels)
Logging.Info("OGL Version Used: ", *OGL_VERSION)
}
// EngineStart initializes everything in order within the engine. Should be called first
func EngineStart() {
readFlags()
Window.Start()
Opengl.OGL_VERSION = *OGL_VERSION
Opengl.Start()
Font.LoadFonts(AssetsFonts)
Image.LoadImages(AssetsImages)
Opengl.CreateBuffers()
Logging.Info("Engine initialization finished.")
// Image.AggrImg.Print("aggr.png")
}
func main() {
}