#include "SDL2/SDL_keyboard.h" #include "editor_scenes.hpp" #include "../../sdlpp/sdlpp.hpp" #include "../gui/gui.hpp" #include "../sprites.hpp" #include "../global_vars.hpp" #include "../objectids.hpp" #include "../blocks.hpp" #include "../maploader.hpp" #include "../../sdlpp/sdlpp_mouse.hpp" #include "../edit_box.hpp" #include "../editor_visitor.hpp" #include "../tool_box.hpp" #include "../blocks/coineditorblock.hpp" #include #include #include "../filesystem.hpp" #include "shared_scenes.hpp" #ifdef _WIN32 #include "../sdlpp/SDL2/SDL2_framerate.h" #include #include #include #else #include #endif // UNIX #define MAP_WIDTH 24 #define MAP_HEIGHT 16 bool quit_editor = false; #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 LOAD_MAP_FLAG 0x00000400 #define TEXT_UPDATE_FLAG 0x00000800 #define TEXT_INPUT_FLAG 0x00001000 #define STOP_TEXT_FLAG 0x00002000 #define TOOLS_WIDTH 4 #define CHARACTER_WIDTH 3 #define MOD_WIDTH 2 #define OVERWORLD_WIDTH 2 const std::string levelsDir = "levels"; bool map_changed = false; MapObject *current_obj = nullptr; std::shared_ptr current_modifier = nullptr; 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