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.
 
 
 
 
 
 
raycaster/textures.hpp

39 lines
854 B

#pragma once
#include <cstdint>
#include <vector>
#include <string>
#include <SFML/Graphics.hpp>
#include <unordered_map>
#include <memory>
#include "matrix.hpp"
namespace textures {
struct SpriteTexture {
std::string name;
std::shared_ptr<sf::Sprite> sprite = nullptr;
std::shared_ptr<sf::Texture> texture = nullptr;
};
struct TextureManager {
std::vector<sf::Image> surfaces;
std::unordered_map<std::string, SpriteTexture> sprite_textures;
std::unordered_map<wchar_t, int> char_to_texture;
sf::Image floor;
sf::Image ceiling;
};
void init();
SpriteTexture get(std::string name);
sf::Image load_image(std::string filename);
const uint32_t* get_surface(size_t num);
matrix::Matrix convert_char_to_texture(matrix::Matrix &from);
const uint32_t* get_floor();
const uint32_t* get_ceiling();
}