Made some progress on the refactoring but I need to start getting serious and not reworking this code to death.
This commit is contained in:
parent
6ed57cd4a8
commit
51c1e04f61
5 changed files with 46 additions and 33 deletions
20
texture.hpp
20
texture.hpp
|
@ -5,35 +5,37 @@
|
|||
#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;
|
||||
int texture;
|
||||
sf::Sprite *sprite = nullptr;
|
||||
sf::Texture *sprite_texture = nullptr;
|
||||
SpriteTexture sprite;
|
||||
double elevation=0;
|
||||
int uDiv=1;
|
||||
int vDiv=1;
|
||||
};
|
||||
|
||||
struct SpriteTexture {
|
||||
sf::Sprite *sprite = nullptr;
|
||||
sf::Texture *sprite_texture = nullptr;
|
||||
};
|
||||
|
||||
struct TexturePack {
|
||||
int NUM_SPRITES=1;
|
||||
|
||||
std::vector<sf::Image> images;
|
||||
std::vector<Sprite> sprites;
|
||||
std::unordered_map<std::string, SpriteTexture> sprite_sheets;
|
||||
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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue