Split inits into their respective group.

This commit is contained in:
2026-07-21 06:21:59 +02:00
parent 275975f7fb
commit 48612116ec
+8 -5
View File
@@ -18,22 +18,25 @@ Asset_Manager :: struct {
asset_manager_init :: proc() -> Asset_Manager { asset_manager_init :: proc() -> Asset_Manager {
assets := Asset_Manager{} assets := Asset_Manager{}
init_player_assets(&assets.player.clips);
return assets
}
init_player_assets :: proc(clip_array: ^[Player_State]AnimationClip) {
idle_tex := rl.LoadTexture("assets/textures/player/player_idle.png") idle_tex := rl.LoadTexture("assets/textures/player/player_idle.png")
walk_tex := rl.LoadTexture("assets/textures/player/player_walk.png") walk_tex := rl.LoadTexture("assets/textures/player/player_walk.png")
assets.player.clips[.IDLE] = AnimationClip { clip_array[.IDLE] = AnimationClip {
texture = idle_tex, frame_count = 6, frame_width = 32, frame_height = 32, frame_time = 0.14, looping = true, texture = idle_tex, frame_count = 6, frame_width = 32, frame_height = 32, frame_time = 0.14, looping = true,
} }
assets.player.clips[.WALK] = AnimationClip { clip_array[.WALK] = AnimationClip {
texture = walk_tex, frame_count = 8, frame_width = 32, frame_height = 32, frame_time = 0.14, looping = true, texture = walk_tex, frame_count = 8, frame_width = 32, frame_height = 32, frame_time = 0.14, looping = true,
} }
return assets
} }
asset_manager_destroy :: proc(assets: ^Asset_Manager) { asset_manager_destroy :: proc(assets: ^Asset_Manager) {
for clip in assets.player.clips { for clip in assets.player.clips {
rl.UnloadTexture(clip.texture) rl.UnloadTexture(clip.texture)
} }
} }