-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamehost.go
50 lines (36 loc) · 1016 Bytes
/
gamehost.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
package main
import glfw "github.com/go-gl/glfw3"
import glu "github.com/go-gl/glu"
import gl "github.com/go-gl/gl"
import "fmt"
var gamehost_Window *glfw.Window
var gamehost_world = NewWorld()
func RunGamehost() {
if !glfw.Init() {
panic("Cannot init GLFW")
}
defer glfw.Terminate()
window, err := glfw.CreateWindow(800, 600, "Apollo", nil, nil)
if err != nil {
panic(err)
}
window.MakeContextCurrent()
gamehost_Window = window
gl.ClearColor(1, 1, 1, 1)
glu.LookAt(0, 1.5, 5, 0, 0, 0, 0, 1, 0)
frame := 0
EvaluateString("(trigger GAMEHOST Init!)", MainContext)
gamehost_world.Create(CreateCube(0, 0, 0))
for !gamehost_Window.ShouldClose() {
gl.Clear(gl.COLOR_BUFFER_BIT)
gl.LoadIdentity()
gamehost_Window.SetTitle(fmt.Sprintf("Frame #%v", frame))
frame++
EvaluateString("(gameloop 0.016)", MainContext)
gamehost_world.Render()
graphicsQueue.Process()
gamehost_Window.SwapBuffers()
glfw.PollEvents()
}
EvaluateString("(trigger GAMEHOST Shutdown!)", MainContext)
}