Only render objects on screen

This commit is contained in:
2024-01-23 23:09:08 +01:00
parent 0423a962df
commit 0a4c1fd154
4 changed files with 49 additions and 6 deletions

21
game/utils.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef PIXELDEFENSE_UTILS_H
#define PIXELDEFENSE_UTILS_H
#include <raylib.h>
#include <breeze.h>
static Rectangle getCameraBounds(Camera2D camera) {
Rectangle bounds = {
.x = camera.target.x,
.y = camera.target.y,
.width = GetScreenWidth() / camera.zoom,
.height = GetScreenHeight() / camera.zoom,
};
//bounds.width *= 0.8f;
//bounds.height *= 0.8f;
bounds.x -= bounds.width * 0.5f;
bounds.y -= bounds.height * 0.5f;
return bounds;
}
#endif //PIXELDEFENSE_UTILS_H