Exploring raycasters and possibly make a little "doom like" game based on it.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
|
|
|
struct Sprite {
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
int texture;
|
|
|
|
sf::Sprite *sprite = nullptr;
|
|
|
|
sf::Texture *sprite_texture = nullptr;
|
|
|
|
// ZED: this should be a separate transform parameter
|
|
|
|
double elevation=0;
|
|
|
|
int uDiv=1;
|
|
|
|
int vDiv=1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TexturePack {
|
|
|
|
int NUM_SPRITES=1;
|
|
|
|
|
|
|
|
std::vector<sf::Image> images;
|
|
|
|
std::vector<Sprite> sprites;
|
|
|
|
sf::Image floor;
|
|
|
|
sf::Image ceiling;
|
|
|
|
Sprite sword;
|
|
|
|
|
|
|
|
void load_textures();
|
|
|
|
sf::Image load_image(std::string filename);
|
|
|
|
Sprite& get_sprite(size_t sprite_num);
|
|
|
|
const uint32_t* get_texture(size_t num);
|
|
|
|
};
|