diff options
Diffstat (limited to 'src/common.hpp')
-rw-r--r-- | src/common.hpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/common.hpp b/src/common.hpp index 06e9d9f..d2b165b 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -33,6 +33,8 @@ namespace procgen { }; } +namespace render { class state_t; } + namespace world { #define SECTOR_SIZE 8 @@ -101,7 +103,7 @@ namespace world { void link(world_t *world); void unlink(); - virtual void render(sf::RenderWindow *window) = 0; + virtual void render(render::state_t *render) = 0; }; } @@ -112,12 +114,7 @@ namespace game { void start(void); void tick(void); - void render(sf::RenderWindow *window_); - }; - - class human_t : public world::entity_t { - public: - void render(sf::RenderWindow *window); + void render(render::state_t *render); }; } @@ -141,6 +138,31 @@ namespace interface { }; } +namespace render { + class animated_texture_t { + friend state_t; + protected: + sf::Texture *frames = NULL; + size_t frame_count; + + public: + ~animated_texture_t(void); + bool load(std::string prefix, size_t frame_count_); + }; + + class state_t { + sf::RenderWindow *window; + double now; + public: + + state_t(sf::RenderWindow *window_); + void begin_frame(double time_); + void end_frame(void); + void render(game::state_t *game); + void render(animated_texture_t *anim, sf::FloatRect bounds); + }; +} + // Divide and round to minus infinity. template <typename T> T divide_rmi(T x, T y, T *rem) |