Commit eefbfea5 authored by Tim Scheiber's avatar Tim Scheiber

Merge branch 'develop' of...

Merge branch 'develop' of gitlab.fsi.hochschule-trier.de:GameDevWeek/sommersemester-2019/cpp/phaseshifter into develop
parents 2e3c686b db32890e
{
"Transform": {
"scale": {
"x": 0.3,
"y": 0.3,
"z": 0.3
"x": 0.6,
"y": 0.6,
"z": 0.6
}
},
"Model": {
"aid": "model:drone"
},
"Shadowcaster": {
},
"Shadowcaster": {},
"Movement": {
"beats_per_step": 1,
"distance_per_step": 1,
"step_time_percentage": 0.2,
"off_beat_threshold": 0.0
},
"FixedPath": {
"pause_between_steps": 1,
"wait_beats": 1
},
"Shooting": {
"default_orientation": 270,
"rotation_per_step": 15,
"max_rotation": 30,
"spawn_offset": 1,
"attack_radius": 5,
"pause_between_shots": 1
},
"Killable": {
"radius": 1
}
"FixedPath": {
"pause_between_steps": 1,
"wait_beats": 1
},
"Shooting": {
"default_orientation": 270,
"rotation_per_step": 15,
"max_rotation": 30,
"spawn_offset": 1,
"attack_radius": 5,
"pause_between_shots": 1
},
"Killable": {
"radius": 1
},
"Material_property": {
"emissive_color": {
"a": 20000
}
}
}
......@@ -31,7 +31,7 @@
"r": 1.0,
"g": 0.0,
"b": 1.0,
"a": 20000
"a": 8000
}
}
}
{
"Transform": {
"scale": {
"x": 0.3,
"y": 0.3,
"z": 0.3
"x": 0.6,
"y": 0.6,
"z": 0.6
}
},
"Model": {
"aid": "model:drone"
},
"Shadowcaster": {
},
"Shadowcaster": {},
"Movement": {
"beats_per_step": 1,
"distance_per_step": 1,
"step_time_percentage": 0.2,
"off_beat_threshold": 0.0
},
"FollowTarget": {
},
"FollowTarget": {},
"Killable": {
"radius": 1
"radius": 1
},
"Material_property": {
"emissive_color": {
"a": 20000
}
}
}
{
"Transform": {
"scale": {
"x": 0.3,
"y": 0.3,
"z": 0.3
"x": 0.45,
"y": 0.45,
"z": 0.45
}
},
"Model": {
"aid": "model:drone"
},
"Shadowcaster": {
},
"Shadowcaster": {},
"Movement": {
"beats_per_step": 1,
"distance_per_step": 1,
......@@ -27,5 +26,11 @@
},
"Killable": {
"radius": 1
},
"Material_property": {
"emissive_color": {
"r": 10,
"a": 20000
}
}
}
{
"Transform": {
"scale": {
"x": 1.0,
"y": 1.0,
"z": 1.0
}
},
"Model": {
"aid": "model:pillar"
},
"Shadowcaster": {}
}
{
"Transform": {
"scale": {
"x": 0.3,
"y": 0.3,
"z": 0.3
"x": 0.45,
"y": 0.45,
"z": 0.45
}
},
"Model": {
"aid": "model:drone"
},
"Shadowcaster": {
},
"Shadowcaster": {},
"Movement": {
"beats_per_step": 1,
"distance_per_step": 1,
......@@ -23,5 +22,11 @@
},
"Killable": {
"radius": 1
},
"Material_property": {
"emissive_color": {
"r": 10,
"a": 10000
}
}
}
......@@ -50,4 +50,4 @@ tileset
##############| [-] [--------##
###############----------###-]><[]><[]><[]><[-###########
##############################--##--##--##--#############
#########################################################
\ No newline at end of file
#########################################################
......@@ -3,5 +3,5 @@
"albedo_aid": "drone_lambert1_albedo.ktx",
"normal_aid": "drone_lambert1_normal.ktx",
"brdf_aid": "drone_lambert1_brdf.ktx",
"emission_aid": ""
"emission_aid": "drone_lambert1_emission.ktx"
}
{
"substance_id": "default",
"albedo_aid": "pillar_glow1_albedo.ktx",
"normal_aid": "pillar_glow1_normal.ktx",
"brdf_aid": "pillar_glow1_brdf.ktx",
"emission_aid": "white"
}
{
"substance_id": "default",
"albedo_aid": "pillar_glow2_albedo.ktx",
"normal_aid": "pillar_glow2_normal.ktx",
"brdf_aid": "pillar_glow2_brdf.ktx",
"emission_aid": "white"
}
{
"substance_id": "default",
"albedo_aid": "pillar_wall_inner_albedo.ktx",
"normal_aid": "pillar_wall_inner_normal.ktx",
"brdf_aid": "pillar_wall_inner_brdf.ktx",
"emission_aid": ""
}
{
"substance_id": "default",
"albedo_aid": "pillar_wall_outer_albedo.ktx",
"normal_aid": "pillar_wall_outer_normal.ktx",
"brdf_aid": "pillar_wall_outer_brdf.ktx",
"emission_aid": ""
}
......@@ -33,9 +33,9 @@
"left_shoulder": {"type":"once_down", "action":"the_button"},
"right_shoulder": {"type":"once_down", "action":"the_button"},
"a": {"type":"once_down", "action":"the_button"},
"b": {"type":"once_down", "action":"the_button"},
"b": {"type":"once_down", "action":"b"},
"x": {"type":"once_down", "action":"the_button"},
"y": {"type":"once_down", "action":"the_button"},
"y": {"type":"once_down", "action":"b"},
"back": {"type":"once", "action":"quit"},
"start": {"type":"once", "action":"quit"}
},
......
......@@ -7,6 +7,7 @@
"enemy_hit": ["enemy_hit_1", "enemy_hit_2", "enemy_hit_3", "enemy_hit_4", "enemy_hit_5"],
"gameover": ["gameover"],
"damaged": ["player_damaged"],
"win": ["win", "win2"]
"win": [ "win", "win2" ],
"beat_missed": ["beat_missed"]
}
}
......@@ -34,7 +34,7 @@
"solid": true
},
"~": {
"blueprint": "wall_vertical",
"blueprint": "pillar",
"solid": true
},
"@": {
......
# Blender MTL File: 'Drone.blend'
# Material Count: 1
newmtl lambert1
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.400000 0.400000 0.400000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Kd Drone Material/Drone2_lambert1_BaseColor.png
map_Bump Drone Material/Drone2_lambert1_Normal.png
map_Ka Drone Material/Drone2_lambert1_Metallic.png
map_Ke Drone Material/Drone2_lambert1_Emissive.png
# Blender MTL File: 'pillar.blend'
# Material Count: 4
newmtl Glow1
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.582240 0.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Bump Walls Tex 1/Wall_straight_Glow1_Normal.png
map_Ka Walls Tex 1/Wall_straight_Glow1_Metallic.png
map_Kd Walls Tex 1/Wall_straight_Glow1_BaseColor.png
map_Ks Walls Tex 1/Wall_straight_Glow1_Roughness.png
newmtl Glow2
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.754160 0.800000 0.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Bump Walls Tex 1/Wall_straight_Glow2_Normal.png
map_Ka Walls Tex 1/Wall_straight_Glow2_Metallic.png
map_Kd Walls Tex 1/Wall_straight_Glow2_BaseColor.png
map_Ks Walls Tex 1/Wall_straight_Glow2_Roughness.png
newmtl Wall_Inner
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.144480 0.144480 0.144480
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Bump Walls Tex 1/Wall_straight_Wall_Inner_Normal.png
map_Ka Walls Tex 1/Wall_straight_Wall_Inner_Metallic.png
map_Kd Walls Tex 1/Wall_straight_Wall_Inner_BaseColor.png
map_Ks Walls Tex 1/Wall_straight_Wall_Inner_Roughness.png
newmtl Wall_Outer
Ns 94.117647
Ka 1.000000 1.000000 1.000000
Kd 0.069280 0.069280 0.069280
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2
map_Bump Walls Tex 1/Wall_straight_Wall_Outer_Normal.png
map_Ka Walls Tex 1/Wall_straight_Wall_Outer_Metallic.png
map_Kd Walls Tex 1/Wall_straight_Wall_Outer_BaseColor.png
map_Ks Walls Tex 1/Wall_straight_Wall_Outer_Roughness.png
Subproject commit d997d0e29bbbbe10a5eb9c211f8131a8e46135b0
Subproject commit 57bcafb5c858c315b9b8cfc00624505d46ea91a0
......@@ -2,9 +2,9 @@
#include "game_engine.hpp"
#include "gameover_screen.hpp"
#include "intro_screen.hpp"
#include "messages.hpp"
#include "meta_system.hpp"
#include "win_screen.hpp"
#include <mirrage/renderer/animation_comp.hpp>
#include <mirrage/renderer/light_comp.hpp>
......@@ -42,20 +42,17 @@ namespace phase_shifter {
{
_mailbox.subscribe_to([&](Once_action& e) {
switch(e.id) {
case "quit"_strid:
// TODO: show pause menu, instead
_engine.screens().leave();
break;
case "quit"_strid: _engine.screens().enter<Intro_screen>(); break;
}
});
_mailbox.subscribe_to([&](Win_msg& e) {
// TODO: fade out...
_engine.screens().enter<Win_screen>();
defer(0.5_s, [&] { _engine.screens().enter<Gameover_screen>(true, _meta_system.score()); });
});
_mailbox.subscribe_to([&](Lose_msg& e) {
// TODO: fade out...
_engine.screens().enter<Gameover_screen>();
defer(0.5_s, [&] { _engine.screens().enter<Gameover_screen>(); });
});
}
Game_screen::~Game_screen() noexcept = default;
......
......@@ -2,8 +2,11 @@
#include "game_engine.hpp"
#include "game_screen.hpp"
#include "intro_screen.hpp"
#include "sync_screen.hpp"
#include "ui/util.hpp"
#include <mirrage/gui/gui.hpp>
#include <mirrage/input/input_manager.hpp>
#include <mirrage/renderer/pass/clear_pass.hpp>
......@@ -29,18 +32,21 @@ namespace phase_shifter {
using namespace graphic;
Gameover_screen::Gameover_screen(Engine& engine)
Gameover_screen::Gameover_screen(Engine& engine, bool win, int score)
: Screen(engine)
, _mailbox(engine.bus())
, _renderer(dynamic_cast<Game_engine&>(engine).renderer_factory().create_renderer(
mirrage::util::nothing, {renderer::render_pass_id_of<renderer::Clear_pass_factory>()}))
, _gui(&engine.gui())
, _win(win)
, _score(score)
, _background(_gui->load_texture("tex:textures/loading_screen.ktx"_aid))
{
_mailbox.subscribe_to([&](Once_action& e) {
switch(e.id) {
case "quit"_strid:
// TODO: show pause menu, instead
_engine.screens().leave();
break;
case "quit"_strid: _engine.screens().enter<Intro_screen>(); break;
case "the_button"_strid: _engine.screens().enter<Game_screen>(); break;
}
});
}
......@@ -61,21 +67,57 @@ namespace phase_shifter {
{
_renderer->draw(); //< clear screen
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{0, 0, 0, 1});
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{0.4f, 0.4f, 0.4f, 0.3f});
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{0.4f, 0.4f, 0.4f, 0.8f});
ImGui::PositionNextWindow(glm::vec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y),
ImGui::WindowPosition_X::center,
ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover_bg",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus)) {
ImDrawList* drawList = ImGui::GetWindowDrawList();
drawList->AddImage(_background.get(), ImVec2(0, 0), ImGui::GetIO().DisplaySize);
}
ImGui::End();
auto heading_font = _gui->find_font("heading"_strid);
ui::push_font(heading_font);
ImGui::PositionNextWindow(
glm::vec2(500, 500), ImGui::WindowPosition_X::center, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover")) {
ImGui::TextUnformatted("TODO");
if(ImGui::Button("Start")) {
glm::vec2(700, 500), ImGui::WindowPosition_X::left, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground)) {
if(_win) {
ImGui::TextColored(ImVec4{0, 0, 0, 1}, "You have Won");
auto score_msg = "Score: " + std::to_string(_score);
ImGui::TextUnformatted("");
ImGui::TextColored(ImVec4{0, 0, 0, 1}, score_msg.c_str());
} else
ImGui::TextColored(ImVec4{0, 0, 0, 1}, "Game Over");
ImGui::TextUnformatted("");
if(ImGui::Button(_win ? "Replay (x)" : "Retry (X)")) {
_engine.screens().enter<Game_screen>();
}
if(ImGui::Button("Sync")) {
_engine.screens().enter<Sync_screen>();
}
if(ImGui::Button("Quit")) {
_engine.screens().leave();
if(ImGui::Button("Menu (Start)")) {
_engine.screens().enter<Intro_screen>();
}
}
ImGui::End();
ui::pop_font(heading_font);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
}
} // namespace phase_shifter
......@@ -11,7 +11,7 @@ namespace phase_shifter {
class Gameover_screen : public mirrage::Screen {
public:
Gameover_screen(mirrage::Engine& engine);
Gameover_screen(mirrage::Engine& engine, bool win = false, int score = 0);
~Gameover_screen() noexcept override;
auto name() const -> std::string override { return "Gameover"; }
......@@ -31,6 +31,10 @@ namespace phase_shifter {
protected:
mirrage::util::Mailbox_collection _mailbox;
std::unique_ptr<mirrage::renderer::Deferred_renderer> _renderer;
mirrage::gui::Gui* _gui;
bool _win;
int _score;
std::shared_ptr<void> _background;
};
} // namespace phase_shifter
......@@ -34,13 +34,14 @@ namespace phase_shifter {
, _mailbox(engine.bus())
, _renderer(dynamic_cast<Game_engine&>(engine).renderer_factory().create_renderer(
mirrage::util::nothing, {renderer::render_pass_id_of<renderer::Clear_pass_factory>()}))
, _gui(&engine.gui())
, _background(_gui->load_texture("tex:textures/loading_screen.ktx"_aid))
{
_mailbox.subscribe_to([&](Once_action& e) {
switch(e.id) {
case "quit"_strid:
// TODO: show pause menu, instead
_engine.screens().leave();
break;
case "quit"_strid: _engine.screens().leave(); break;
case "the_button"_strid: _engine.screens().enter<Game_screen>(); break;
case "b"_strid: _engine.screens().enter<Sync_screen>(); break;
}
});
}
......@@ -61,21 +62,55 @@ namespace phase_shifter {
{
_renderer->draw(); //< clear screen
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{0, 0, 0, 1});
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{0.4f, 0.4f, 0.4f, 0.3f});
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{0.4f, 0.4f, 0.4f, 0.8f});
ImGui::PositionNextWindow(glm::vec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y),
ImGui::WindowPosition_X::center,
ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover_bg",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus)) {
ImDrawList* drawList = ImGui::GetWindowDrawList();
drawList->AddImage(_background.get(), ImVec2(0, 0), ImGui::GetIO().DisplaySize);
}
ImGui::End();
auto heading_font = _gui->find_font("heading"_strid);
ui::push_font(heading_font);
ImGui::PositionNextWindow(
glm::vec2(500, 500), ImGui::WindowPosition_X::center, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Intro")) {
ImGui::TextUnformatted("TODO");
if(ImGui::Button("Start")) {
glm::vec2(500, 700), ImGui::WindowPosition_X::center, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground)) {
if(ImGui::Button("Start Game (X)")) {
_engine.screens().enter<Game_screen>();
}
if(ImGui::Button("Sync")) {
ImGui::TextUnformatted("");
if(ImGui::Button("Sync (B)")) {
_engine.screens().enter<Sync_screen>();
}
if(ImGui::Button("Quit")) {
ImGui::TextUnformatted("");
if(ImGui::Button("Quit (Start)")) {
_engine.screens().leave();
}
}
ImGui::End();
ui::pop_font(heading_font);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
}
} // namespace phase_shifter
......@@ -31,6 +31,8 @@ namespace phase_shifter {
protected:
mirrage::util::Mailbox_collection _mailbox;
std::unique_ptr<mirrage::renderer::Deferred_renderer> _renderer;
mirrage::gui::Gui* _gui;
std::shared_ptr<void> _background;
};
} // namespace phase_shifter
......@@ -12,7 +12,6 @@
#include "gameover_screen.hpp"
#include "intro_screen.hpp"
#include "sync_screen.hpp"
#include "win_screen.hpp"
#include <mirrage/info.hpp>
......@@ -155,13 +154,11 @@ namespace {
[&]() { engine->screens().enter<Intro_screen>(); });
global_commands->add("screen.enter.sync | Enters the sync screen",
[&]() { engine->screens().enter<Sync_screen>(); });
global_commands->add("screen.enter.win | Enters the win screen",
[&]() { engine->screens().enter<Win_screen>(); });
if(argc > 1 && argv[1] == "game"s)
engine->screens().enter<Game_screen>();
else
engine->screens().enter<Game_screen>();
engine->screens().enter<Gameover_screen>();
}
void onFrame() { engine->on_frame(); }
......
......@@ -159,4 +159,6 @@ namespace phase_shifter {