Raycaster now controls the sprite locations with SpatialMap rather than the old way. Quick hack job in main.cpp that shows how they can move too.

This commit is contained in:
Zed A. Shaw 2025-02-01 14:39:08 -05:00
parent a67d25ee10
commit cbf0955786
11 changed files with 93 additions and 65 deletions

View file

@ -13,6 +13,7 @@
#include "texture.hpp"
#include <SFML/System/Clock.hpp>
#include "animator.hpp"
#include "spatialmap.hpp"
using matrix::Matrix;
using RGBA = uint32_t;
@ -41,8 +42,8 @@ struct Raycaster {
int $height;
sf::RenderWindow& $window;
Matrix& $map;
std::vector<int> spriteOrder;
std::vector<double> spriteDistance;
SpatialMap $collision;
std::vector<Sprite> $sprites;
std::vector<double> ZBuffer; // width
Animator $anim;
sf::Shader $paused;
@ -66,6 +67,7 @@ struct Raycaster {
void set_position(int x, int y);
void init_shaders();
DinkyECS::Entity position_sprite(Point pos, string name);
inline size_t pixcoord(int x, int y) {
if(!(x >=0 && x < $width)) {