Improved naming and cleaned up game struct.

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