summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editor.cpp15
-rw-r--r--src/level.cpp13
-rw-r--r--src/level.hpp2
3 files changed, 30 insertions, 0 deletions
diff --git a/src/editor.cpp b/src/editor.cpp
index 3b36285..d59cd64 100644
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -254,6 +254,21 @@ namespace silly::editor {
}
}
+ ImGui::SameLine(ImGui::GetContentRegionAvail().x - 200);
+
+ // Current level and floor info
+ if (!pkg.get_levels().empty() &&
+ !pkg.get_current_level().get_floors().empty()) {
+ TileLevel &level = this->package.get_current_level();
+ TileFloor &floor = level.get_current_floor();
+
+ ImGui::Text("Level %s%d | Floor %s%d | Tiles: %d",
+ (this->package.get_current_level_index() < 10 ? "0" : ""),
+ this->package.get_current_level_index(),
+ (level.get_current_floor_index() < 10 ? "0" : ""),
+ level.get_current_floor_index(), floor.get_tile_count());
+ }
+
ImGui::EndMainMenuBar();
}
}
diff --git a/src/level.cpp b/src/level.cpp
index 8e9ba81..efc2038 100644
--- a/src/level.cpp
+++ b/src/level.cpp
@@ -72,6 +72,15 @@ namespace silly::editor {
const int TileFloor::get_width() const { return this->width; }
const int TileFloor::get_height() const { return this->height; }
+ const int TileFloor::get_tile_count() const {
+ int count = 0;
+
+ std::for_each(this->layers.begin(), this->layers.end(),
+ [&count](const TileLayer &l) { count += l.tiles.size(); });
+
+ return count;
+ }
+
void TileLevel::add_floor(TileFloor floor) { this->floors.push_back(floor); }
void TileLevel::move_to_floor(int floor_id) {
@@ -82,6 +91,10 @@ namespace silly::editor {
return this->floors.at(this->current_floor);
}
+ const int &TileLevel::get_current_floor_index() const {
+ return this->current_floor;
+ }
+
const std::vector<TileFloor> &TileLevel::get_floors() const {
return this->floors;
}
diff --git a/src/level.hpp b/src/level.hpp
index c5eb1ea..5fbb19b 100644
--- a/src/level.hpp
+++ b/src/level.hpp
@@ -38,6 +38,7 @@ namespace silly::editor {
const int get_width() const;
const int get_height() const;
+ const int get_tile_count() const;
private:
int width, height;
@@ -54,6 +55,7 @@ namespace silly::editor {
void move_to_floor(int floor_id);
TileFloor &get_current_floor();
+ const int &get_current_floor_index() const;
const std::vector<TileFloor> &get_floors() const;
const std::string &get_name() const;