diff --git a/mario/CMakeLists.txt b/mario/CMakeLists.txt index 06948d6..e3e2dbb 100644 --- a/mario/CMakeLists.txt +++ b/mario/CMakeLists.txt @@ -89,6 +89,8 @@ target_sources(editor PRIVATE edit_box.cpp PRIVATE tool_box.cpp PRIVATE editor_visitor.cpp + PRIVATE scenes/editor_main.cpp + PRIVATE scenes/editor_main_menu.cpp ) target_compile_definitions(editor PUBLIC EDITOR) diff --git a/mario/editor.cpp b/mario/editor.cpp index 5ca1718..7165556 100644 --- a/mario/editor.cpp +++ b/mario/editor.cpp @@ -1,4 +1,5 @@ #include "../sdlpp/sdlpp.hpp" +#include "global_vars.hpp" #include "gui/gui.hpp" #include "sprites.hpp" #include @@ -14,7 +15,6 @@ #include #include #include -#include "global_vars.hpp" #include "objectids.hpp" #include "blocks.hpp" #include "maploader.hpp" @@ -23,1031 +23,33 @@ #include "editor_visitor.hpp" #include "tool_box.hpp" #include "blocks/coineditorblock.hpp" +#include "scenes/editor_scenes.hpp" -#define MAP_WIDTH 24 -#define MAP_HEIGHT 16 +std::vector game_scenes{}; -#define QUIT_FLAG 0x00000001 -#define UPDATE_FLAG 0x00000002 -#define MAP_LEFT_ENABLED_FLAG 0x00000004 -#define MAP_RIGHT_ENABLED_FLAG 0x00000008 -#define TOOL_LEFT_ENABLED_FLAG 0x00000010 -#define TOOL_RIGHT_ENABLED_FLAG 0x00000020 -#define MOD_LEFT_ENABLED_FLAG 0x00000040 -#define MOD_RIGHT_ENABLED_FLAG 0x00000080 -#define CHARACTER_LEFT_ENABLED_FLAG 0x00000100 -#define CHARACTER_RIGHT_ENABLED_FLAG 0x00000200 - -#define TOOLS_WIDTH 4 -#define CHARACTER_WIDTH 3 -#define MOD_WIDTH 2 -#define OVERWORLD_WIDTH 2 - -struct ToolType { - enum Value { - BLOCK, - MOD, - CHARACTER, - WORLD, - }; -}; - -struct MouseInfo { - uint64_t cur_flags{}; - uint64_t prev_flags{}; - SDLPP::Vec2D edit_box; - SDLPP::Vec2D tool_box; - ToolType::Value tool_type{}; - uint64_t cur_button_index{}; -}; - -struct MapInfo { - int cur_page; - int max_page; -}; - -struct ToolInfo { - ToolType::Value type; - uint64_t index; - SDL_Rect texture_src; - int cur_page_tools; - int max_page_tools; - int cur_page_mods; - int max_page_mods; - int cur_page_characters; - int max_page_characters; - std::shared_ptr