all repos — engine.git @ 70d5a5f53436c4848616132f2ff47c4036adc224

Unnamed repository; edit this file 'description' to name the repository.

src/main.odin

 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
package main

import rl "vendor:raylib"
import "core:time"
import cm "common"
import sim "simulation"
import clt "client"

appState: struct {
	win: struct {
		height: i32,
		width: i32,
		name: cstring,
	},
	clock: Clock
} = {
		win = {
			height = 2560,
			width = 1440,
			name = "window",
		},
		clock = cm.Clock{
		frames = 0,
		period = 6944444 * time.Nanosecond,
		lastTick = time.tick_now()
	}
}

main :: proc() {
	rl.InitWindow(appState.win.width,appState.win.height,appState.win.name)
	rl.DisableCursor()
	defer rl.CloseWindow()
	sim.StartSimulation()
	clt.InitClient()
	SpawnLevelObjects()

	for !rl.WindowShouldClose() {
		cm.ClockUpdate(&appState.clock,AppLoop)
		cm.ClockUpdate(&sim.worldClock,sim.SimulationUpdate)
	}
}


AppLoop :: proc(clk: ^cm.Clock) {
	clt.ClientUpdate(clk)
}