#include "editor_scenes.hpp" #include "../../sdlpp/sdlpp.hpp" #include "../../sdlpp/sdlpp_mouse.hpp" #include "../global_vars.hpp" #include "../objectids.hpp" #include "../editor_visitor.hpp" bool __update_scenes_main_menu = false; bool __quit_scenes_main_menu = false; bool __started_main_menu = false; uint64_t __cur_button_index_main_menu = -1; uint64_t __cur_button_index_main_menu_down = -1; std::vector> __buttons_main_menu{}; std::shared_ptr __mouse_main_menu{}; void quitMainMenu() { g_quit = true; } void resumeMainMenu() { __quit_scenes_main_menu = true; } void quitMainMenuCallback(void */*UNUSED*/, Button */*UNUSED*/) { quitMainMenu(); } void resumeMainMenuCallback(void */*UNUSED*/, Button */*UNUSED*/) { resumeMainMenu(); } void resetGlobals() { __update_scenes_main_menu = false; __quit_scenes_main_menu = false; __cur_button_index_main_menu = -1; __cur_button_index_main_menu_down = -1; __mouse_main_menu->setPos(0, 0); for(auto &button : __buttons_main_menu) { button->unsetHighlight(); } } void handleKeyUpMainMenu(SDL_Keycode key, SDLPP::Scene &/*UNUSED*/) { switch (key) { case SDLK_ESCAPE: resumeMainMenu(); break; default: break; } } std::shared_ptr createSceneMainMenu(std::shared_ptr &renderer) { auto scene = std::make_shared(renderer); auto bg = std::make_shared( 0, 0, 10, 10, renderer, "#00000088", true); bg->setPermanent(); bg->setId(1); scene->addObject(bg); __mouse_main_menu = std::make_shared(0.01, 0.01, 0, 0, renderer); __mouse_main_menu->setMinWidth(1); __mouse_main_menu->setMinHeight(1); __mouse_main_menu->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER); __mouse_main_menu->setId(EDITOR_MOUSE_ID); __mouse_main_menu->setColiderColor("#00FF00"); __mouse_main_menu->addCollision(SDLPP::RectColider({ 0, 0 }, { 1, 1 })); scene->addObject(__mouse_main_menu); ButtonConfig default_button_theme{}; default_button_theme.bg_color = "#FFFFFF88"; default_button_theme.bg_color_highlight = "#FFFFFFBB"; default_button_theme.bg_color_disabled = "#AAAAAA88"; default_button_theme.font_color = "#000000"; default_button_theme.font_color_highlight = "#000000"; default_button_theme.font_color_disabled = "#555555"; default_button_theme.font_outline_color = "#FFFFFF88"; default_button_theme.font_outline_color_highlight = "#FFFFFFAA"; default_button_theme.font_outline_color_disabled = "#787878"; default_button_theme.outline = 0.1; // buttons __buttons_main_menu.emplace_back(std::make_shared