Refactored the CameraLOL to be inside the rayview instead of a convolute main_ui->camera->rayview and back. Closes #16.

This commit is contained in:
Zed A. Shaw 2025-06-29 11:11:12 -04:00
parent 75c28cd764
commit ab1a415b55
7 changed files with 83 additions and 89 deletions

View file

@ -5,6 +5,7 @@
#include "spatialmap.hpp"
#include "levelmanager.hpp"
#include "textures.hpp"
#include "camera.hpp"
using matrix::Matrix;
using RGBA = uint32_t;
@ -26,6 +27,7 @@ struct Raycaster {
sf::Texture $view_texture;
sf::Sprite $view_sprite;
DinkyECS::Entity aiming_at = 0;
CameraLOL $camera;
std::unique_ptr<RGBA[]> $pixels = nullptr;
@ -50,8 +52,6 @@ struct Raycaster {
void draw(sf::RenderTarget& target);
void sort_sprites(std::vector<int>& order, std::vector<double>& dist, int amount);
void position_camera(float player_x, float player_y);
void set_position(int x, int y);
inline size_t pixcoord(int x, int y) {
@ -62,4 +62,16 @@ struct Raycaster {
void update_sprite(DinkyECS::Entity ent, components::Sprite& sprite);
void init_shaders();
void apply_sprite_effect(shared_ptr<sf::Shader> effect, float width, float height);
// camera things?
void position_camera(float player_x, float player_y);
Point plan_move(int dir, bool strafe);
void plan_rotate(int dir, float amount);
bool play_rotate();
bool play_move();
void abort_plan();
Point aimed_at();
Point camera_target();
};