summaryrefslogtreecommitdiff
path: root/src/common.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-10-18 00:27:48 +0200
committerPaweł Redman <pawel.redman@gmail.com>2017-10-18 00:27:48 +0200
commitef5273d2c2ab801b11eb435a04bff96f6e778b1c (patch)
tree05c2a2097757a3d920eb3bb10fbf3e1bccceb938 /src/common.hpp
parent7d43c4e7ad6b83a23516b26b4aebf74f398c251b (diff)
Continue refactoring.
Diffstat (limited to 'src/common.hpp')
-rw-r--r--src/common.hpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/common.hpp b/src/common.hpp
index 6798ec8..e135d56 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -48,11 +48,12 @@ namespace world {
typedef vec_t<int64_t, 2> tile_index_t;
class entity_t;
+ class sector_iterator_t;
class sector_t {
public:
sector_index_t index;
- sf::FloatRect bounds;
+ rectf_t bounds;
std::unordered_set<entity_t*> ents;
bool empty = true;
@@ -62,6 +63,7 @@ namespace world {
class world_t {
procgen::prng_t prng;
procgen::perlin_noise_t perlin;
+
std::map<sector_index_t, sector_t> sectors;
void generate_tile(tile_t *tile, tile_index_t index);
@@ -70,12 +72,12 @@ namespace world {
public:
world_t(void);
sector_t *get_sector(sector_index_t index);
- tile_t *get_tile(ssize_t x, ssize_t y);
+ tile_t *get_tile(tile_index_t index);
// FIXME: iterators instead of returning std::lists
- std::list<sector_t*> get_sectors(sf::FloatRect rect);
- std::list<entity_t*> get_entities(sf::FloatRect rect);
- std::list<entity_t*> get_render_entities(sf::FloatRect rect);
+ std::list<sector_t*> get_sectors(rectf_t rect);
+ std::list<entity_t*> get_entities(rectf_t rect);
+ std::list<entity_t*> get_render_entities(rectf_t rect);
void render(sf::RenderWindow *window);
@@ -93,7 +95,7 @@ namespace world {
size_t cookie = 0;
public:
- sf::FloatRect bounds, render_bounds;
+ rectf_t bounds, render_bounds;
void link(world_t *world);
void unlink();
@@ -179,8 +181,8 @@ namespace render {
void begin_frame(double time_);
void end_frame(void);
void render(game::state_t *game);
- void render(animated_texture_t *anim, sf::FloatRect bounds, bool mirror = false);
- void render(oriented_sprite_t *sprite, sf::FloatRect bounds, float angle);
+ void render(animated_texture_t *anim, rectf_t bounds, bool mirror = false);
+ void render(oriented_sprite_t *sprite, rectf_t bounds, float angle);
};
}