diff options
author | BoredGuy <osome3717@gmail.com> | 2025-07-31 14:43:06 +0300 |
---|---|---|
committer | BoredGuy <osome3717@gmail.com> | 2025-07-31 14:43:06 +0300 |
commit | ab443b5b552c7aa51ecf98801541c9ca5f76d32d (patch) | |
tree | a3d7dd577bd6d2dbe6fcc4ff73cd3aea22e5ad67 | |
parent | 4740fe22c3fa9f9b029fc1f965d7240f9be40ccb (diff) |
Finished refactor
-rw-r--r-- | src/background.c | 8 |
1 files 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 <raymath.h> +#include <assert.h> 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); |