Tiles now record their textures and this is loaded from the map then converted to an indexed integer on the fly.

This commit is contained in:
Zed A. Shaw 2025-01-31 13:37:01 -05:00
parent 9e3e347e4a
commit a67d25ee10
10 changed files with 64 additions and 66 deletions

View file

@ -6,6 +6,7 @@
#include <SFML/Graphics.hpp>
#include <unordered_map>
#include <memory>
#include "matrix.hpp"
struct SpriteTexture {
std::shared_ptr<sf::Sprite> sprite = nullptr;
@ -22,15 +23,19 @@ struct TexturePack {
std::vector<sf::Image> surfaces;
std::vector<Sprite> sprites;
std::unordered_map<std::string, SpriteTexture> sprite_textures;
std::unordered_map<wchar_t, int> char_to_texture;
sf::Image floor;
sf::Image ceiling;
SpriteTexture sword;
void load_textures();
void load_tiles();
void load_sprites();
sf::Image load_image(std::string filename);
Sprite& get_sprite(size_t sprite_num);
const uint32_t* get_surface(size_t num);
// this needs to go into a map place
void position_sprite(double x, double y, std::string name);
// ZED: this is ugly so maybe you should like rewrite it or something
matrix::Matrix convert_char_to_texture(matrix::Matrix &from);
};