From ab443b5b552c7aa51ecf98801541c9ca5f76d32d Mon Sep 17 00:00:00 2001 From: BoredGuy Date: Thu, 31 Jul 2025 14:43:06 +0300 Subject: Finished refactor --- src/background.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/background.c b/src/background.c index 060ce6a..49b5e0c 100644 --- a/src/background.c +++ b/src/background.c @@ -1,6 +1,7 @@ #include "background.h" #include "constants.h" #include +#include void AddBackground(const char* backgroundTextureName) { Entity e = {0}; @@ -11,10 +12,13 @@ void AddBackground(const char* backgroundTextureName) { e.position = (Vector2) {0.0f, 0.0f}; - Texture2D backgroundTexture = - GetMatchingAssetWithType(backgroundTextureName, Texture_Asset)->texture; + Asset* backgroundTextureAsset = + GetMatchingAssetWithType(backgroundTextureName, Texture_Asset); + assert(backgroundTextureAsset); + Texture2D backgroundTexture = backgroundTextureAsset->texture; const float backgroundSizeScale = (float)WINDOW_HEIGHT / backgroundTexture.height; + Vector2 backgroundBounds = Vector2Scale((Vector2) {backgroundTexture.width, backgroundTexture.height}, backgroundSizeScale); -- cgit v1.2.3