|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
struct SpriteTexture {
|
|
|
|
std::shared_ptr<sf::Sprite> sprite = nullptr;
|
|
|
|
std::shared_ptr<sf::Texture> texture = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Sprite {
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
SpriteTexture sprite;
|
|
|
|
double elevation=0;
|
|
|
|
int uDiv=1;
|
|
|
|
int vDiv=1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TexturePack {
|
|
|
|
int NUM_SPRITES=1;
|
|
|
|
|
|
|
|
std::vector<sf::Image> images;
|
|
|
|
std::vector<Sprite> sprites;
|
|
|
|
std::unordered_map<std::string, SpriteTexture> sprite_textures;
|
|
|
|
sf::Image floor;
|
|
|
|
sf::Image ceiling;
|
|
|
|
SpriteTexture sword;
|
|
|
|
|
|
|
|
void load_textures();
|
|
|
|
void load_sprites();
|
|
|
|
sf::Image load_image(std::string filename);
|
|
|
|
Sprite& get_sprite(size_t sprite_num);
|
|
|
|
const uint32_t* get_texture(size_t num);
|
|
|
|
// this needs to go into a map place
|
|
|
|
void position_sprite(double x, double y, std::string name);
|
|
|
|
};
|