Improved naming and cleaned up game struct.

This commit is contained in:
2026-09-10 07:43:01 +02:00
parent 324c4240d7
commit 30c3886afb
+9 -17
View File
@@ -2,19 +2,17 @@ package game
import rl "vendor:raylib" import rl "vendor:raylib"
// good 16:9 internal res, window scales up to 1080/4k clean. // 16:9 internal res, window scales up to 1080/4k etc
VIEWPORT_WIDTH :: 1280 VIEWPORT_W :: 1280
VIEWPORT_HEIGHT :: 720 VIEWPORT_H :: 720
WINDOW_WIDTH :: 2560 WINDOW_W :: 2560
WINDOW_HEIGHT :: 1440 WINDOW_H :: 1440
WINDOW_TITLE :: "Pong" WINDOW_TITLE :: "Pong"
Game :: struct { Game :: struct {
viewport: rl.RenderTexture2D, viewport: rl.RenderTexture2D,
scene: Scene, scene: Scene,
paused: bool, paused: bool,
score_player: int,
score_enemy: int,
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
@@ -23,21 +21,15 @@ Game :: struct {
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
game_init :: proc(game: ^Game) { game_init :: proc(game: ^Game) {
// Window configs // Window configs
rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_TITLE) rl.InitWindow(WINDOW_W, WINDOW_H, WINDOW_TITLE)
rl.SetTargetFPS(60) rl.SetTargetFPS(60)
// initial state // initial state
game.score_player = 0 game.viewport = rl.LoadRenderTexture(VIEWPORT_W, VIEWPORT_H)
game.score_enemy = 0 game.paused = false
game.paused = false
game.viewport = rl.LoadRenderTexture(VIEWPORT_WIDTH, VIEWPORT_HEIGHT)
// initial scene (should be menu when setup) // initial scene (should be menu when setup)
game.scene = init_gameplay_scene() game.scene = init_gameplay_scene()
// init any systems/managers
// game.input_manager = ....
// game.audio_manager = ....
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------