-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (33 loc) · 921 Bytes
/
main.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
package main
import (
"math/rand"
"time"
ray "github.com/gen2brain/raylib-go/raylib"
"github.com/jordanbrauer/rpgo/game"
)
var config *game.Configuration
func init() {
config = game.Config()
// storage := game.Storage()
rand.Seed(time.Now().UnixNano())
ray.InitWindow(config.Window.Width, config.Window.Height, config.Window.Title)
ray.SetTargetFPS(config.FPS)
if config.Window.Fullscreen {
width := ray.GetMonitorWidth(ray.GetCurrentMonitor())
height := ray.GetMonitorHeight(ray.GetCurrentMonitor())
ray.SetWindowSize(width, height)
ray.ToggleFullscreen()
}
}
func main() {
defer ray.CloseWindow()
world := game.CreateWorld()
rendering := game.EnableRendering(world)
scripting, script := game.EnableScripting(world)
defer script.Close()
for !ray.WindowShouldClose() {
delta := ray.GetFrameTime()
world.Update(scripting.Name(), delta)
world.Update(rendering.Name(), delta)
}
}