Now have a basic sprite system that uses SFML's sprites, but the algorithm for determining how much of a sprite to display is wrong. Need to use the alternate algorithm from LODE's tutorial that draws sprites after rendering.

This commit is contained in:
Zed A. Shaw 2025-01-23 02:42:43 -05:00
parent 024d5b30e1
commit da7075864b
6 changed files with 38 additions and 36 deletions

View file

@ -3,11 +3,14 @@
#include <cstdint>
#include <vector>
#include <string>
#include <SFML/Graphics.hpp>
struct Sprite {
double x;
double y;
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;
@ -22,7 +25,7 @@ struct TexturePack {
constexpr static const int TEXTURE_HEIGHT=256; // must be power of two
std::vector<Image> images;
std::vector<Sprite> sprites{{4.0, 3.55, 6}};
std::vector<Sprite> sprites;
Image floor;
Image ceiling;