Commit 26512f74 authored by Florian Oetke's avatar Florian Oetke

styled menues

parent 8b9846bb
......@@ -35,7 +35,9 @@ namespace phase_shifter {
, _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))
, _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) {
switch(e.id) {
......@@ -63,49 +65,66 @@ 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::PushStyleColor(ImGuiCol_Button, ImVec4{0.4f, 0.4f, 0.4f, 0.0f});
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),
ImGui::WindowPosition_X::center,
ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover_bg",
auto heading_font = _gui->find_font("heading"_strid);
ui::push_font(heading_font);
ImGui::PositionNextWindow(
glm::vec2(1128, 1110), ImGui::WindowPosition_X::right, ImGui::WindowPosition_Y::top);
if(ImGui::Begin("Credits",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoBringToFrontOnFocus)) {
| ImGuiWindowFlags_NoBackground)) {
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();
auto heading_font = _gui->find_font("heading"_strid);
ui::push_font(heading_font);
ImGui::PositionNextWindow(
glm::vec2(500, 700), ImGui::WindowPosition_X::center, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Gameover",
glm::vec2(900, 1000), ImGui::WindowPosition_X::left, ImGui::WindowPosition_Y::center);
if(ImGui::Begin("Menu",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| 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("", ImVec2(700, 200))) {
_engine.screens().enter<Game_screen>();
}
ImGui::TextUnformatted("");
if(ImGui::Button("Sync (B)")) {
ImGui::SetCursorPos(ImVec2(150, 400));
if(ImGui::Button("", ImVec2(700, 200))) {
_engine.screens().enter<Sync_screen>();
}
ImGui::TextUnformatted("");
if(ImGui::Button("Quit (Start)")) {
ImGui::SetCursorPos(ImVec2(150, 650));
if(ImGui::Button("", ImVec2(700, 200))) {
_engine.screens().leave();
}
}
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);
ImGui::PopStyleColor();
......
......@@ -33,6 +33,8 @@ namespace phase_shifter {
std::unique_ptr<mirrage::renderer::Deferred_renderer> _renderer;
mirrage::gui::Gui* _gui;
std::shared_ptr<void> _background;
std::shared_ptr<void> _options;
std::shared_ptr<void> _credits;
};
} // namespace phase_shifter
......@@ -158,7 +158,7 @@ namespace {
if(argc > 1 && argv[1] == "game"s)
engine->screens().enter<Game_screen>();
else
engine->screens().enter<Gameover_screen>();
engine->screens().enter<Intro_screen>();
}
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