Renderer is now more standalone and doesn't try to protect against small maps, that's the GUI's job.

This commit is contained in:
Zed A. Shaw 2024-11-21 15:51:22 -05:00
parent 19b8bf1850
commit 15a302d133
11 changed files with 65 additions and 90 deletions

View file

@ -13,9 +13,6 @@
#define WALL_VALUE 1
#define SPACE_VALUE 0
constexpr int GAME_MAP_X = 40;
constexpr int GAME_MAP_Y = 40;
struct Room {
size_t x = 0;
size_t y = 0;
@ -101,8 +98,9 @@ public:
int center_x = int(around.x - view_x / 2);
int center_y = int(around.y - view_y / 2);
size_t start_x = std::clamp(center_x, 0, high_x);
size_t start_y = std::clamp(center_y, 0, high_y);
// BUG: is clamp really the best thing here? this seems wrong.
size_t start_x = high_x > 0 ? std::clamp(center_x, 0, high_x) : 0;
size_t start_y = high_y > 0 ? std::clamp(center_y, 0, high_y) : 0;
return {start_x, start_y};
}