diff options
Diffstat (limited to 'src/background.c')
-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); |