Closer to what I want for sprite loading but still needs more work.
This commit is contained in:
parent
51858ea399
commit
6ed57cd4a8
4 changed files with 23 additions and 17 deletions
10
texture.hpp
10
texture.hpp
|
@ -4,6 +4,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include <unordered_map>
|
||||
|
||||
struct Sprite {
|
||||
double x;
|
||||
|
@ -11,20 +12,25 @@ struct Sprite {
|
|||
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 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;
|
||||
sf::Image floor;
|
||||
sf::Image ceiling;
|
||||
Sprite sword;
|
||||
SpriteTexture sword;
|
||||
|
||||
void load_textures();
|
||||
sf::Image load_image(std::string filename);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue