Move to c++23 and clean up of raycaster.
This commit is contained in:
parent
403d2bd7ce
commit
ea791270b3
3 changed files with 9 additions and 12 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
project('raycaster', 'cpp',
|
project('raycaster', 'cpp',
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
default_options: [
|
default_options: [
|
||||||
'cpp_std=c++20',
|
'cpp_std=c++23',
|
||||||
'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1',
|
'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,16 @@
|
||||||
#include "graphics/raycaster.hpp"
|
|
||||||
#include "dbc.hpp"
|
#include "dbc.hpp"
|
||||||
#include "algos/matrix.hpp"
|
#include "game/components.hpp"
|
||||||
|
#include "game/systems.hpp"
|
||||||
|
#include "graphics/animation.hpp"
|
||||||
|
#include "graphics/raycaster.hpp"
|
||||||
|
#include "graphics/shaders.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <numbers>
|
#include <numbers>
|
||||||
#include "game/components.hpp"
|
|
||||||
#include "graphics/textures.hpp"
|
|
||||||
#include "game/systems.hpp"
|
|
||||||
#include "graphics/shaders.hpp"
|
|
||||||
#include "graphics/animation.hpp"
|
|
||||||
|
|
||||||
using namespace fmt;
|
|
||||||
using std::make_unique, std::shared_ptr;
|
using std::make_unique, std::shared_ptr;
|
||||||
|
|
||||||
union ColorConv {
|
union ColorConv {
|
||||||
|
|
@ -92,6 +89,7 @@ void Raycaster::draw_pixel_buffer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Raycaster::apply_sprite_effect(shared_ptr<sf::Shader> effect, float width, float height) {
|
void Raycaster::apply_sprite_effect(shared_ptr<sf::Shader> effect, float width, float height) {
|
||||||
|
// BUG: should I use the clock in the animation?
|
||||||
effect->setUniform("u_time", $clock.getElapsedTime().asSeconds());
|
effect->setUniform("u_time", $clock.getElapsedTime().asSeconds());
|
||||||
sf::Vector2f u_resolution{width, height};
|
sf::Vector2f u_resolution{width, height};
|
||||||
effect->setUniform("u_resolution", u_resolution);
|
effect->setUniform("u_resolution", u_resolution);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <SFML/Graphics.hpp>
|
#include "algos/matrix.hpp"
|
||||||
#include <SFML/System/Clock.hpp>
|
|
||||||
#include "algos/spatialmap.hpp"
|
#include "algos/spatialmap.hpp"
|
||||||
#include "game/level.hpp"
|
#include "game/level.hpp"
|
||||||
#include "graphics/textures.hpp"
|
#include "graphics/textures.hpp"
|
||||||
|
#include <SFML/System/Clock.hpp>
|
||||||
|
|
||||||
using matrix::Matrix;
|
using matrix::Matrix;
|
||||||
using RGBA = uint32_t;
|
using RGBA = uint32_t;
|
||||||
|
|
@ -79,7 +79,6 @@ struct Raycaster {
|
||||||
void update_sprite(DinkyECS::Entity ent, components::Sprite& sprite);
|
void update_sprite(DinkyECS::Entity ent, components::Sprite& sprite);
|
||||||
void init_shaders();
|
void init_shaders();
|
||||||
|
|
||||||
// camera things?
|
|
||||||
void position_camera(float player_x, float player_y);
|
void position_camera(float player_x, float player_y);
|
||||||
Point plan_move(int dir, bool strafe);
|
Point plan_move(int dir, bool strafe);
|
||||||
void plan_rotate(int dir, float amount);
|
void plan_rotate(int dir, float amount);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue