More cleaning of the Raycaster class to have no #defines for variables. Now it can be arbitrarily sized and positioned.

This commit is contained in:
Zed A. Shaw 2025-01-16 12:19:33 -05:00
parent c9d4b7ed1e
commit 2dfe5417b1
3 changed files with 100 additions and 94 deletions

View file

@ -1,5 +1,10 @@
#include "raycaster.hpp"
#define RAY_VIEW_WIDTH 960
#define RAY_VIEW_HEIGHT 720
#define RAY_VIEW_X (1280 - RAY_VIEW_WIDTH)
#define RAY_VIEW_Y 0
static const int SCREEN_HEIGHT=720;
static const int SCREEN_WIDTH=1280;
@ -24,8 +29,8 @@ int main() {
float player_x = matrix::width(MAP) / 2;
float player_y = matrix::height(MAP) / 2;
Raycaster rayview(window, MAP);
Raycaster rayview(window, MAP, RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT);
rayview.set_position(RAY_VIEW_X, RAY_VIEW_Y);
rayview.position_camera(player_x, player_y);
double moveSpeed = 0.1;