Commit 44eb5260 authored by Georg Schäfer's avatar Georg Schäfer

Merge branch 'develop' of...

Merge branch 'develop' of gitlab.fsi.hochschule-trier.de:GameDevWeek/sommersemester-2019/cpp/phaseshifter into develop
parents 4bf1058a b523f452
Pipeline #3456 passed with stage
in 4 minutes and 25 seconds
{ {
// Informationen zu dieser Datei finden Sie unter https://go.microsoft.com//fwlink//?linkid=834763.
"configurations": [ "configurations": [
{ {
"name": "x64-Debug", "name": "x64-Debug",
...@@ -10,7 +9,20 @@ ...@@ -10,7 +9,20 @@
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "-v", "buildCommandArgs": "-v",
"ctestCommandArgs": "" "ctestCommandArgs": "",
"variables": []
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
} }
] ]
} }
\ No newline at end of file
...@@ -3,14 +3,14 @@ tileset ...@@ -3,14 +3,14 @@ tileset
###########################################-############# ###########################################-#############
##########################################|!|############ ##########################################|!|############
########################################--} {--########## ########################################--} {--##########
#######################################| hbh |######### #######################################| b |#########
#######################################|3 7|######### #######################################|3 7|#########
#######################################| h |######### #######################################| |#########
#######################################| |######### #######################################| |#########
#######################################| c |######### #######################################| c |#########
#######################################| ~ |######### #######################################| ~ |#########
#######################################| |######### #######################################| |#########
########################################--]@[--########## ########################################--] [--##########
##########################################| |############ ##########################################| |############
###################################-------} |############ ###################################-------} |############
##################################| |############ ##################################| |############
...@@ -20,7 +20,7 @@ tileset ...@@ -20,7 +20,7 @@ tileset
####################-----#########| |############ ####################-----#########| |############
######---####-----#|> >|########| [-------############# ######---####-----#|> >|########| [-------#############
##---} 7{--} 5 {} |######--} {--################## ##---} 7{--} 5 {} |######--} {--##################
#| 5 |#####| |################# #|@ 5 |#####| |#################
##---] 7[--] 1 [] |#####| |################# ##---] 7[--] 1 [] |#####| |#################
######---####-----#|> >|#####| h i |################# ######---####-----#|> >|#####| h i |#################
####################-] [-######| |################# ####################-] [-######| |#################
......
Subproject commit 57bcafb5c858c315b9b8cfc00624505d46ea91a0 Subproject commit 3f7bceb13b0b5d29ab2b0d6fdd44f078365b4097
...@@ -36,11 +36,11 @@ namespace phase_shifter::gameplay { ...@@ -36,11 +36,11 @@ namespace phase_shifter::gameplay {
float spawn_offset = 0; // offset of the bullet spawn point in meters float spawn_offset = 0; // offset of the bullet spawn point in meters
float attack_radius = 0; // radius in which the turret targets the target float attack_radius = 0; // radius in which the turret targets the target
unsigned int pause_between_shots = 0; // number of beats the turret waits between shots unsigned int pause_between_shots = 0; // number of beats the turret waits between shots
unsigned int wait_beats = 0; // number of beats the turret waits before shooting again
float target_direction = 0; // angular direction towards the target in degrees with 0° beeing North (-Z) float target_direction = 0; // angular direction towards the target in degrees with 0° beeing North (-Z)
std::vector<Bulletpattern> patterns; // sequence of bullet patterns that are looped through std::vector<Bulletpattern> patterns; // sequence of bullet patterns that are looped through
float rotation = 0; // current rotation from default_orientation in degrees float rotation = 0; // current rotation from default_orientation in degrees
unsigned int wait_beats = 0; // number of beats the turret waits before shooting again
bool rotate = false; //flag whether the turret will rotate next beat bool rotate = false; //flag whether the turret will rotate next beat
bool idle = true; // if false, the turret targets the target bool idle = true; // if false, the turret targets the target
...@@ -48,6 +48,6 @@ namespace phase_shifter::gameplay { ...@@ -48,6 +48,6 @@ namespace phase_shifter::gameplay {
unsigned int i_next_pattern = 0; unsigned int i_next_pattern = 0;
}; };
sf2_structDef(Shooting_comp, default_orientation, rotation_per_step, max_rotation, spawn_offset, attack_radius, pause_between_shots); sf2_structDef(Shooting_comp, default_orientation, rotation_per_step, max_rotation, spawn_offset, attack_radius, pause_between_shots, wait_beats);
} }
\ No newline at end of file
...@@ -35,11 +35,13 @@ namespace phase_shifter { ...@@ -35,11 +35,13 @@ namespace phase_shifter {
, _renderer(dynamic_cast<Game_engine&>(engine).renderer_factory().create_renderer( , _renderer(dynamic_cast<Game_engine&>(engine).renderer_factory().create_renderer(
mirrage::util::nothing, {renderer::render_pass_id_of<renderer::Clear_pass_factory>()})) mirrage::util::nothing, {renderer::render_pass_id_of<renderer::Clear_pass_factory>()}))
, _gui(&engine.gui()) , _gui(&engine.gui())
, _background(_gui->load_texture("tex:textures/loading_screen.ktx"_aid)) , _background(_gui->load_texture("tex:textures/menu_background.ktx"_aid))
, _options(_gui->load_texture("tex:textures/menu_options.ktx"_aid))
, _credits(_gui->load_texture("tex:textures/menu_credits.ktx"_aid))
{ {
_mailbox.subscribe_to([&](Once_action& e) { _mailbox.subscribe_to([&](Once_action& e) {
switch(e.id) { switch(e.id) {
case "quit"_strid: _engine.screens().leave(); break; case "quit"_strid: _engine.exit(); break;
case "the_button"_strid: _engine.screens().enter<Game_screen>(); break; case "the_button"_strid: _engine.screens().enter<Game_screen>(); break;
case "b"_strid: _engine.screens().enter<Sync_screen>(); break; case "b"_strid: _engine.screens().enter<Sync_screen>(); break;
} }
...@@ -63,49 +65,66 @@ namespace phase_shifter { ...@@ -63,49 +65,66 @@ namespace phase_shifter {
_renderer->draw(); //< clear screen _renderer->draw(); //< clear screen
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{0, 0, 0, 1}); 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_Button, ImVec4{0.4f, 0.4f, 0.4f, 0.0f});
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{0.4f, 0.4f, 0.4f, 0.8f}); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4{0.4f, 0.4f, 0.4f, 0.0f});
ImGui::PositionNextWindow(glm::vec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y), auto heading_font = _gui->find_font("heading"_strid);
ImGui::WindowPosition_X::center, ui::push_font(heading_font);
ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover_bg", ImGui::PositionNextWindow(
glm::vec2(1128, 1110), ImGui::WindowPosition_X::right, ImGui::WindowPosition_Y::top);
if(ImGui::Begin("Credits",
nullptr, nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus)) { | ImGuiWindowFlags_NoBackground)) {
ImDrawList* drawList = ImGui::GetWindowDrawList(); ImDrawList* drawList = ImGui::GetWindowDrawList();
drawList->AddImage(_background.get(), ImVec2(0, 0), ImGui::GetIO().DisplaySize); ImVec2 p = ImGui::GetCursorScreenPos();
drawList->AddImage(_credits.get(), ImVec2(p.x, 0), ImVec2(p.x + 1128, 1110));
} }
ImGui::End(); ImGui::End();
auto heading_font = _gui->find_font("heading"_strid);
ui::push_font(heading_font);
ImGui::PositionNextWindow( ImGui::PositionNextWindow(
glm::vec2(500, 700), ImGui::WindowPosition_X::center, ImGui::WindowPosition_Y::center); glm::vec2(900, 1000), ImGui::WindowPosition_X::left, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover", if(ImGui::Begin("Menu",
nullptr, nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground)) { | ImGuiWindowFlags_NoBackground)) {
if(ImGui::Button("Start Game (X)")) { ImDrawList* drawList = ImGui::GetWindowDrawList();
ImVec2 p = ImGui::GetCursorScreenPos();
drawList->AddImage(_options.get(), p, ImVec2(p.x + 900, p.y + 1000));
ImGui::SetCursorPos(ImVec2(150, 190));
if(ImGui::Button("##enter", ImVec2(700, 200))) {
_engine.screens().enter<Game_screen>(); _engine.screens().enter<Game_screen>();
} }
ImGui::TextUnformatted(""); ImGui::SetCursorPos(ImVec2(150, 400));
if(ImGui::Button("##sync", ImVec2(700, 200))) {
if(ImGui::Button("Sync (B)")) {
_engine.screens().enter<Sync_screen>(); _engine.screens().enter<Sync_screen>();
} }
ImGui::TextUnformatted(""); ImGui::SetCursorPos(ImVec2(150, 650));
if(ImGui::Button("##exit", ImVec2(700, 200))) {
if(ImGui::Button("Quit (Start)")) { _engine.exit();
_engine.screens().leave();
} }
} }
ImGui::End(); ImGui::End();
ImGui::PositionNextWindow(glm::vec2(ImGui::GetIO().DisplaySize.x, ImGui::GetIO().DisplaySize.y),
ImGui::WindowPosition_X::center,
ImGui::WindowPosition_Y::center);
if(ImGui::Begin("a_Menu_bg",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus
| ImGuiWindowFlags_NoFocusOnAppearing)) {
ImDrawList* drawList = ImGui::GetWindowDrawList();
drawList->AddImage(_background.get(), ImVec2(0, 0), ImGui::GetIO().DisplaySize);
}
ImGui::End();
ui::pop_font(heading_font); ui::pop_font(heading_font);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
......
...@@ -33,6 +33,8 @@ namespace phase_shifter { ...@@ -33,6 +33,8 @@ namespace phase_shifter {
std::unique_ptr<mirrage::renderer::Deferred_renderer> _renderer; std::unique_ptr<mirrage::renderer::Deferred_renderer> _renderer;
mirrage::gui::Gui* _gui; mirrage::gui::Gui* _gui;
std::shared_ptr<void> _background; std::shared_ptr<void> _background;
std::shared_ptr<void> _options;
std::shared_ptr<void> _credits;
}; };
} // namespace phase_shifter } // namespace phase_shifter
...@@ -299,8 +299,9 @@ namespace phase_shifter::level { ...@@ -299,8 +299,9 @@ namespace phase_shifter::level {
.post_create([=](auto entity) { .post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) { entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 180; shooting.default_orientation = 180;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern( shooting.set_patterns({gameplay::Bulletpattern(
{{0, 0}, {25, -8}, {-25, 8}, {50, -8}, {-50, 8}})}); {{0, 0}, {30, -7}, {-30, 7}, {60, -5}, {-60, 5}})});
}); });
}) })
.create(); .create();
...@@ -312,9 +313,8 @@ namespace phase_shifter::level { ...@@ -312,9 +313,8 @@ namespace phase_shifter::level {
.post_create([=](auto entity) { .post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) { entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 0; shooting.default_orientation = 0;
shooting.rotation_per_step = 15; shooting.pause_between_shots = 2;
shooting.max_rotation = 30; shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {10, 5}, {-10, 5}})});
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {20, 0}, {-20, 0}})});
}); });
}) })
.create(); .create();
...@@ -346,6 +346,7 @@ namespace phase_shifter::level { ...@@ -346,6 +346,7 @@ namespace phase_shifter::level {
.post_create([=](auto entity) { .post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) { entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 135; shooting.default_orientation = 135;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {25, 0}, {-25, 0}})}); shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {25, 0}, {-25, 0}})});
}); });
}) })
...@@ -358,6 +359,7 @@ namespace phase_shifter::level { ...@@ -358,6 +359,7 @@ namespace phase_shifter::level {
.post_create([=](auto entity) { .post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) { entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.default_orientation = 225; shooting.default_orientation = 225;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {25, 0}, {-25, 0}})}); shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, {25, 0}, {-25, 0}})});
}); });
}) })
...@@ -385,6 +387,7 @@ namespace phase_shifter::level { ...@@ -385,6 +387,7 @@ namespace phase_shifter::level {
entity.process([&](gameplay::Shooting_comp& shooting) { entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.rotation_per_step = 360.f / 16.f; shooting.rotation_per_step = 360.f / 16.f;
shooting.max_rotation = -1; shooting.max_rotation = -1;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, shooting.set_patterns({gameplay::Bulletpattern({{0, 0},
{20, 0}, {20, 0},
{-20, 0}, {-20, 0},
...@@ -405,7 +408,8 @@ namespace phase_shifter::level { ...@@ -405,7 +408,8 @@ namespace phase_shifter::level {
.post_create([=](auto entity) { .post_create([=](auto entity) {
entity.process([&](gameplay::Shooting_comp& shooting) { entity.process([&](gameplay::Shooting_comp& shooting) {
shooting.rotation_per_step = -360.f / 16.f; shooting.rotation_per_step = -360.f / 16.f;
shooting.max_rotation = -1; shooting.max_rotation = -1;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, shooting.set_patterns({gameplay::Bulletpattern({{0, 0},
{20, 0}, {20, 0},
{-20, 0}, {-20, 0},
...@@ -428,6 +432,7 @@ namespace phase_shifter::level { ...@@ -428,6 +432,7 @@ namespace phase_shifter::level {
shooting.default_orientation = 0; shooting.default_orientation = 0;
shooting.rotation_per_step = -360.f / 16.f; shooting.rotation_per_step = -360.f / 16.f;
shooting.max_rotation = -1; shooting.max_rotation = -1;
shooting.pause_between_shots = 2;
shooting.set_patterns({gameplay::Bulletpattern({{0, 0}, shooting.set_patterns({gameplay::Bulletpattern({{0, 0},
{45, 0}, {45, 0},
{90, 0}, {90, 0},
......
...@@ -158,7 +158,7 @@ namespace { ...@@ -158,7 +158,7 @@ namespace {
if(argc > 1 && argv[1] == "game"s) if(argc > 1 && argv[1] == "game"s)
engine->screens().enter<Game_screen>(); engine->screens().enter<Game_screen>();
else else
engine->screens().enter<Gameover_screen>(); engine->screens().enter<Intro_screen>();
} }
void onFrame() { engine->on_frame(); } void onFrame() { engine->on_frame(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment