summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/ui/icon_builder_0.pngbin0 -> 1646 bytes
-rw-r--r--assets/ui/icon_fire_0.pngbin0 -> 1363 bytes
-rw-r--r--assets/ui/icon_move_0.pngbin0 -> 732 bytes
-rw-r--r--assets/ui/icon_repair_0.pngbin0 -> 1082 bytes
-rw-r--r--assets/ui/icon_replicator_0.pngbin0 -> 1503 bytes
-rw-r--r--assets/ui/icon_scientist_0.pngbin0 -> 2041 bytes
-rw-r--r--assets/ui/icon_soldier_0.pngbin0 -> 1463 bytes
-rw-r--r--assets/ui/icon_stop_0.pngbin0 -> 1174 bytes
-rw-r--r--assets/ui/icon_teleporter_0.pngbin0 -> 1543 bytes
-rw-r--r--src/game/assets.cpp12
-rw-r--r--src/game/game.cpp32
-rw-r--r--src/game/game.hpp15
-rw-r--r--src/game/interface.cpp9
13 files changed, 48 insertions, 20 deletions
diff --git a/assets/ui/icon_builder_0.png b/assets/ui/icon_builder_0.png
new file mode 100644
index 0000000..7e9a302
--- /dev/null
+++ b/assets/ui/icon_builder_0.png
Binary files differ
diff --git a/assets/ui/icon_fire_0.png b/assets/ui/icon_fire_0.png
new file mode 100644
index 0000000..01247cf
--- /dev/null
+++ b/assets/ui/icon_fire_0.png
Binary files differ
diff --git a/assets/ui/icon_move_0.png b/assets/ui/icon_move_0.png
new file mode 100644
index 0000000..48d46d9
--- /dev/null
+++ b/assets/ui/icon_move_0.png
Binary files differ
diff --git a/assets/ui/icon_repair_0.png b/assets/ui/icon_repair_0.png
new file mode 100644
index 0000000..93a3fb9
--- /dev/null
+++ b/assets/ui/icon_repair_0.png
Binary files differ
diff --git a/assets/ui/icon_replicator_0.png b/assets/ui/icon_replicator_0.png
new file mode 100644
index 0000000..dd58d37
--- /dev/null
+++ b/assets/ui/icon_replicator_0.png
Binary files differ
diff --git a/assets/ui/icon_scientist_0.png b/assets/ui/icon_scientist_0.png
new file mode 100644
index 0000000..d020e35
--- /dev/null
+++ b/assets/ui/icon_scientist_0.png
Binary files differ
diff --git a/assets/ui/icon_soldier_0.png b/assets/ui/icon_soldier_0.png
new file mode 100644
index 0000000..b9d4324
--- /dev/null
+++ b/assets/ui/icon_soldier_0.png
Binary files differ
diff --git a/assets/ui/icon_stop_0.png b/assets/ui/icon_stop_0.png
new file mode 100644
index 0000000..69a5b73
--- /dev/null
+++ b/assets/ui/icon_stop_0.png
Binary files differ
diff --git a/assets/ui/icon_teleporter_0.png b/assets/ui/icon_teleporter_0.png
new file mode 100644
index 0000000..265da0f
--- /dev/null
+++ b/assets/ui/icon_teleporter_0.png
Binary files differ
diff --git a/src/game/assets.cpp b/src/game/assets.cpp
index e2b9664..f2deedf 100644
--- a/src/game/assets.cpp
+++ b/src/game/assets.cpp
@@ -160,9 +160,19 @@ void load(void)
ambients[AMBIENT_WATER].volume = 0.1f;
ui.crystals.load("assets/ui/crystals_", 1);
+
+ ui.icon_builder.load("assets/ui/icon_builder_", 1);
+ ui.icon_fire.load("assets/ui/icon_fire_", 1);
+ ui.icon_grenades.load("assets/ui/icon_grenades_", 1);
ui.icon_health.load("assets/ui/icon_health_", 1);
+ ui.icon_move.load("assets/ui/icon_move_", 1);
+ ui.icon_repair.load("assets/ui/icon_repair_", 1);
+ ui.icon_replicator.load("assets/ui/icon_replicator_", 1);
+ ui.icon_scientist.load("assets/ui/icon_scientist_", 1);
ui.icon_shells.load("assets/ui/icon_shells_", 1);
- ui.icon_grenades.load("assets/ui/icon_grenades_", 1);
+ ui.icon_soldier.load("assets/ui/icon_soldier_", 1);
+ ui.icon_stop.load("assets/ui/icon_stop_", 1);
+ ui.icon_teleporter.load("assets/ui/icon_teleporter_", 1);
ui.crystal_tick.load("assets/ui/crystal_tick.ogg");
ui.crystal_tick.volume = 0.1f;
diff --git a/src/game/game.cpp b/src/game/game.cpp
index 246a222..162a274 100644
--- a/src/game/game.cpp
+++ b/src/game/game.cpp
@@ -207,7 +207,7 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
items.clear();
if (!first_teleporter_placed) {
- items.push_back((interface::pie_item_t){"Place the teleporter", COMMAND_FIRST_TELEPORTER});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_teleporter, "Place the teleporter", COMMAND_FIRST_TELEPORTER});
return true;
}
@@ -250,38 +250,38 @@ bool state_t::populate_pie_menu(std::vector<interface::pie_item_t> &items)
}
if (soldiers || scientists || builders) {
- items.push_back((interface::pie_item_t){"Move", COMMAND_MOVE});
- items.push_back((interface::pie_item_t){"Stop", COMMAND_STOP});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_move, "Move", COMMAND_MOVE});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_stop, "Stop", COMMAND_STOP});
}
if (soldiers) {
- items.push_back((interface::pie_item_t){"Fire", COMMAND_FIRE});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_fire, "Fire", COMMAND_FIRE});
if (grenades)
- items.push_back((interface::pie_item_t){"Throw a grenade", COMMAND_THROW_GRENADE});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_grenades, "Throw a grenade", COMMAND_THROW_GRENADE});
if (restock_shells)
- items.push_back((interface::pie_item_t){"Restock shells", COMMAND_RESTOCK_SHELLS});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_shells, "Restock shells", COMMAND_RESTOCK_SHELLS});
if (restock_grenades)
- items.push_back((interface::pie_item_t){"Restock grenades", COMMAND_RESTOCK_GRENADES});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_grenades, "Restock grenades", COMMAND_RESTOCK_GRENADES});
}
if (scientists)
- items.push_back((interface::pie_item_t){"Gather", COMMAND_GATHER});
+ items.push_back((interface::pie_item_t){&assets::ui.crystals, "Gather", COMMAND_GATHER});
if (builders) {
- items.push_back((interface::pie_item_t){"Repair", COMMAND_REPAIR});
- items.push_back((interface::pie_item_t){"Build a teleporter", COMMAND_BUILD_TELEPORTER});
- items.push_back((interface::pie_item_t){"Build a replicator", COMMAND_BUILD_REPLICATOR});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_repair, "Repair", COMMAND_REPAIR});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_teleporter, "Build a teleporter", COMMAND_BUILD_TELEPORTER});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_replicator, "Build a replicator", COMMAND_BUILD_REPLICATOR});
}
if (teleporters) {
- items.push_back((interface::pie_item_t){"Hire a soldier", COMMAND_HIRE_SOLDIER});
- items.push_back((interface::pie_item_t){"Hire a scientist", COMMAND_HIRE_SCIENTIST});
- items.push_back((interface::pie_item_t){"Hire a builder", COMMAND_HIRE_BUILDER});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_soldier, "Hire a soldier", COMMAND_HIRE_SOLDIER});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_scientist, "Hire a scientist", COMMAND_HIRE_SCIENTIST});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_builder, "Hire a builder", COMMAND_HIRE_BUILDER});
}
if (replicators) {
- items.push_back((interface::pie_item_t){"Replicate shells", COMMAND_REPLICATE_SHELLS});
- items.push_back((interface::pie_item_t){"Replicate grenades", COMMAND_REPLICATE_GRENADES});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_shells, "Replicate shells", COMMAND_REPLICATE_SHELLS});
+ items.push_back((interface::pie_item_t){&assets::ui.icon_grenades, "Replicate grenades", COMMAND_REPLICATE_GRENADES});
}
return true;
diff --git a/src/game/game.hpp b/src/game/game.hpp
index b6cb597..1fd986f 100644
--- a/src/game/game.hpp
+++ b/src/game/game.hpp
@@ -28,6 +28,7 @@ namespace interface {
class state_t;
typedef struct {
+ render::animated_texture_t *icon;
std::string label;
int action;
@@ -268,8 +269,18 @@ namespace game {
typedef struct {
render::animated_texture_t crystals;
audio::sound_t crystal_tick;
-
- render::animated_texture_t icon_health, icon_grenades, icon_shells;
+ render::animated_texture_t icon_builder,
+ icon_fire,
+ icon_grenades,
+ icon_health,
+ icon_move,
+ icon_repair,
+ icon_replicator,
+ icon_scientist,
+ icon_shells,
+ icon_soldier,
+ icon_stop,
+ icon_teleporter;
} ui_assets_t;
extern soldier_assets_t soldier;
diff --git a/src/game/interface.cpp b/src/game/interface.cpp
index 10ab751..ab11f85 100644
--- a/src/game/interface.cpp
+++ b/src/game/interface.cpp
@@ -297,6 +297,8 @@ void state_t::print(std::string str)
void pie_menu_t::render_to(render::state_t *render)
{
+ float r_max = 0.0f;
+
if (!is_open)
return;
@@ -320,8 +322,13 @@ void pie_menu_t::render_to(render::state_t *render)
v2f_t::rad((i.t1 + i.t0) / 2);
}
- render->render_text(center, 15, i.label, render::text_align_t::ALIGN_CENTER_BOTTOM, color);
+ render->render(0.0, i.icon, rectf_t::around(center, 15.0f));
+
+ r_max = i.r1;
}
+
+ if (selected)
+ render->render_text(x + v2f_t(0, r_max + 20.0f), 15, selected->label, render::text_align_t::ALIGN_CENTER_BOTTOM, sf::Color::White);
}
static sf::Color health_to_color(float frac,int alpha)