Initial commit for game init/shutdown code.
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
package game
|
||||||
|
|
||||||
|
import rl "vendor:raylib"
|
||||||
|
|
||||||
|
WINDOW_WIDTH :: 1280
|
||||||
|
WINDOW_HEIGHT :: 720
|
||||||
|
WINDOW_TITLE :: "Graveyard"
|
||||||
|
|
||||||
|
Game :: struct {
|
||||||
|
// Game state lives here. Empty for now.
|
||||||
|
}
|
||||||
|
|
||||||
|
game_init :: proc() -> Game {
|
||||||
|
game := Game{}
|
||||||
|
|
||||||
|
rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE)
|
||||||
|
rl.SetTargetFPS(60)
|
||||||
|
|
||||||
|
return game
|
||||||
|
}
|
||||||
|
|
||||||
|
game_should_run :: proc(game: ^Game) -> bool {
|
||||||
|
return !rl.WindowShouldClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
game_update :: proc(game: ^Game) {
|
||||||
|
if rl.IsMouseButtonPressed(.LEFT) {
|
||||||
|
rl.TraceLog(.INFO, "Mouse clicked!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
game_draw :: proc(game: ^Game) {
|
||||||
|
rl.BeginDrawing()
|
||||||
|
|
||||||
|
// Do Draw Calls here
|
||||||
|
rl.ClearBackground(rl.WHITE)
|
||||||
|
|
||||||
|
rl.EndDrawing()
|
||||||
|
}
|
||||||
|
|
||||||
|
game_close :: proc(game: ^Game) {
|
||||||
|
rl.CloseWindow()
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package game
|
||||||
|
|
||||||
|
main :: proc() {
|
||||||
|
game := game_init()
|
||||||
|
|
||||||
|
for game_should_run(&game) {
|
||||||
|
game_update(&game)
|
||||||
|
game_draw(&game)
|
||||||
|
}
|
||||||
|
|
||||||
|
game_close(&game)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user