Mario editor: started refactoring
This commit is contained in:
parent
7b4c3c9697
commit
b54ba5034c
@ -2,14 +2,15 @@
|
|||||||
#include "global_vars.hpp"
|
#include "global_vars.hpp"
|
||||||
#include "objectids.hpp"
|
#include "objectids.hpp"
|
||||||
#include "sprites.hpp"
|
#include "sprites.hpp"
|
||||||
|
#include "editor_visitor.hpp"
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
MarioBlock::MarioBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> renderer, std::shared_ptr<SDLPP::Texture> texture, SDL_Rect src) : RectangleRender( x * BLOCK_SIZE, 1 - (16-y) * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, texture, src ) {}
|
MarioBlock::MarioBlock(int x, int y, std::shared_ptr<SDLPP::Renderer> renderer, std::shared_ptr<SDLPP::Texture> texture, SDL_Rect src) : RectangleRender( x * BLOCK_SIZE, 1 - (16-y) * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, texture, src ) {}
|
||||||
void MarioBlock::visit( SDLPP::Visitor &visitor ) {
|
void MarioBlock::visit( SDLPP::Visitor &visitor ) {
|
||||||
if(!_tool && _terrain && visitor.getVisitorType() == TOOL_VISITOR_TYPE) {
|
if(!_tool && _terrain && visitor.getVisitorType() == VisitorType::Terrain) {
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
if(!_tool && !_terrain && visitor.getVisitorType() == MODIFIER_VISITOR_TYPE) {
|
if(!_tool && !_terrain && visitor.getVisitorType() == VisitorType::Modifier) {
|
||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
visitor.visit(*this);
|
visitor.visit(*this);
|
||||||
@ -137,56 +138,65 @@ createBlock( std::shared_ptr< SDLPP::Renderer > &renderer, int x, int y,
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Rect getSourceRectByID( uint64_t id, BlockType type ) {
|
SDL_Rect getSourceRectByID( uint64_t id, LandType::Value type ) {
|
||||||
if(block_mapping.find(id) == block_mapping.end())
|
if(block_mapping.find(id) == block_mapping.end())
|
||||||
return {};
|
return {};
|
||||||
SDL_Rect ret_src = *block_mapping.at(id);
|
SDL_Rect ret_src = *block_mapping.at(id);
|
||||||
switch ( type ) {
|
switch ( type ) {
|
||||||
case OVERWORLD:
|
case LandType::OVERWORLD:
|
||||||
ret_src.x += OVERWORLD_SHIFT.getX();
|
ret_src.x += OVERWORLD_SHIFT.getX();
|
||||||
ret_src.y += OVERWORLD_SHIFT.getY();
|
ret_src.y += OVERWORLD_SHIFT.getY();
|
||||||
break;
|
break;
|
||||||
case UNDERWORLD:
|
case LandType::UNDERWORLD:
|
||||||
ret_src.x += UNDERWORLD_SHIFT.getX();
|
ret_src.x += UNDERWORLD_SHIFT.getX();
|
||||||
ret_src.y += UNDERWORLD_SHIFT.getY();
|
ret_src.y += UNDERWORLD_SHIFT.getY();
|
||||||
break;
|
break;
|
||||||
case WATER:
|
case LandType::WATER:
|
||||||
ret_src.x += WATER_SHIFT.getX();
|
ret_src.x += WATER_SHIFT.getX();
|
||||||
ret_src.y += WATER_SHIFT.getY();
|
ret_src.y += WATER_SHIFT.getY();
|
||||||
break;
|
break;
|
||||||
case BOWSER:
|
case LandType::BOWSER:
|
||||||
ret_src.x += BOWSER_SHIFT.getX();
|
ret_src.x += BOWSER_SHIFT.getX();
|
||||||
ret_src.y += BOWSER_SHIFT.getY();
|
ret_src.y += BOWSER_SHIFT.getY();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret_src;
|
return ret_src;
|
||||||
}
|
}
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y, std::shared_ptr<SDLPP::Texture> texture, bool collision ) {
|
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y, std::shared_ptr<SDLPP::Texture> texture, bool collision ) {
|
||||||
return createBlock( renderer, x, y, texture,
|
return createBlock( renderer, x, y, texture,
|
||||||
getSourceRectByID( block_id, type ), block_id,
|
getSourceRectByID( block_id, type ), block_id,
|
||||||
collision );
|
collision );
|
||||||
}
|
}
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, std::shared_ptr<SDLPP::Texture> texture, bool collision ) {
|
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, std::shared_ptr<SDLPP::Texture> texture, bool collision ) {
|
||||||
return createTerrainBlock( block_id, type, renderer, 0, 0, texture, collision );
|
return createTerrainBlock( block_id, type, renderer, 0, 0, texture, collision );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr< SDLPP::RectangleRender >
|
std::shared_ptr< SDLPP::RectangleRender >
|
||||||
createTerrainBlock( uint64_t block_id, BlockType type,
|
createTerrainBlock( uint64_t block_id, LandType::Value type,
|
||||||
std::shared_ptr< SDLPP::Renderer > &renderer, int x,
|
std::shared_ptr< SDLPP::Renderer > &renderer, int x,
|
||||||
int y, bool collision ) {
|
int y, bool collision ) {
|
||||||
return createTerrainBlock(block_id, type, renderer, x, y, g_terrain_texture, collision);
|
return createTerrainBlock(block_id, type, renderer, x, y, g_terrain_texture, collision);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr< SDLPP::RectangleRender >
|
std::shared_ptr< SDLPP::RectangleRender >
|
||||||
createTerrainBlock( uint64_t block_id, BlockType type,
|
createTerrainBlock( uint64_t block_id, LandType::Value type,
|
||||||
std::shared_ptr< SDLPP::Renderer > &renderer,
|
std::shared_ptr< SDLPP::Renderer > &renderer,
|
||||||
bool collision ) {
|
bool collision ) {
|
||||||
return createTerrainBlock(block_id, type, renderer, g_terrain_texture, collision);
|
return createTerrainBlock(block_id, type, renderer, g_terrain_texture, collision);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createMario( BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y ) {
|
std::shared_ptr<SDLPP::RectangleRender> createMario( LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y ) {
|
||||||
//TODO add type additions
|
//TODO add type additions
|
||||||
auto mario = createBlock( renderer, x, y, g_mario_texture, MARIO_STANDING_SRC, MARIO_ID, true );
|
auto mario = createBlock( renderer, x, y, g_mario_texture, MARIO_STANDING_SRC, MARIO_ID, true );
|
||||||
dynamic_cast<MarioBlock&>(*mario).setTerrain(false);
|
dynamic_cast<MarioBlock&>(*mario).setTerrain(false);
|
||||||
return mario;
|
return mario;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum BlockRole::Value getBlockRole(uint64_t id) {
|
||||||
|
if(id >= 0x7000)
|
||||||
|
return BlockRole::TERRAIN;
|
||||||
|
if(id == MARIO_ID)
|
||||||
|
return BlockRole::MARIO;
|
||||||
|
//TODO modifier/character
|
||||||
|
return BlockRole::MODIFIER;
|
||||||
|
}
|
||||||
|
@ -17,19 +17,32 @@ private:
|
|||||||
|
|
||||||
extern const std::vector<uint64_t> possibleBlocks;
|
extern const std::vector<uint64_t> possibleBlocks;
|
||||||
|
|
||||||
enum BlockType {
|
struct LandType {
|
||||||
OVERWORLD = 0,
|
enum Value {
|
||||||
UNDERWORLD = 1,
|
OVERWORLD = 0,
|
||||||
WATER = 2,
|
UNDERWORLD = 1,
|
||||||
BOWSER = 4
|
WATER = 2,
|
||||||
|
BOWSER = 4
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, bool collision = false );
|
struct BlockRole {
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y, bool collision = false );
|
enum Value {
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, std::shared_ptr<SDLPP::Texture> texture, bool collision = false );
|
TERRAIN,
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y, std::shared_ptr<SDLPP::Texture> texture, bool collision = false );
|
MODIFIER,
|
||||||
std::shared_ptr<SDLPP::RectangleRender> createMario( BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y );
|
CHARACTER,
|
||||||
|
MARIO,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
SDL_Rect getSourceRectByID( uint64_t id, BlockType type );
|
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, bool collision = false );
|
||||||
|
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y, bool collision = false );
|
||||||
|
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, std::shared_ptr<SDLPP::Texture> texture, bool collision = false );
|
||||||
|
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y, std::shared_ptr<SDLPP::Texture> texture, bool collision = false );
|
||||||
|
std::shared_ptr<SDLPP::RectangleRender> createMario( LandType::Value type, std::shared_ptr<SDLPP::Renderer> &renderer, int x, int y );
|
||||||
|
|
||||||
|
SDL_Rect getSourceRectByID( uint64_t id, LandType::Value type );
|
||||||
|
|
||||||
|
enum BlockRole::Value getBlockRole(uint64_t id);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
466
mario/editor.cpp
466
mario/editor.cpp
@ -21,24 +21,32 @@
|
|||||||
#include "editor_visitor.hpp"
|
#include "editor_visitor.hpp"
|
||||||
#include "tool_box.hpp"
|
#include "tool_box.hpp"
|
||||||
|
|
||||||
std::shared_ptr< SDLPP::Renderer > renderer = nullptr;
|
struct MouseInfo {
|
||||||
bool quit = false;
|
enum Index {
|
||||||
bool update_size = false;
|
CUR_FLAGS = 0,
|
||||||
std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> objects = {};
|
PREV_FLAGS = 1,
|
||||||
uint64_t current_selected_flags = 0;
|
EDIT_BOX = 2,
|
||||||
uint64_t previous_selected_flags = 0;
|
TOOL_BOX = 3,
|
||||||
std::mutex destruction_mutex;
|
};
|
||||||
|
};
|
||||||
|
|
||||||
int current_start_index = 0;
|
std::shared_ptr< SDLPP::Renderer > g_renderer = nullptr;
|
||||||
int current_max_index = 0;
|
bool g_quit = false;
|
||||||
uint64_t current_block = 0;
|
bool g_update_size = false;
|
||||||
SDLPP::Vec2D<int> current_box = {0, 0};
|
std::vector<mapColumnType> g_objects = {};
|
||||||
SDLPP::Vec2D<int> current_tool_box = {0, 0};
|
std::mutex g_destruction_mutex;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<SDLPP::RenderObject>> tools{};
|
// current mouse flags, previous mouse flags, selected edit box, selected tool box
|
||||||
std::shared_ptr<SDLPP::RenderObject> current_tool = nullptr;
|
std::tuple<uint64_t, uint64_t, SDLPP::Vec2D<int>, SDLPP::Vec2D<int>> g_mouse_info;
|
||||||
int current_tool_index = 0;
|
|
||||||
int max_tool_index = 0;
|
int g_current_start_index = 0;
|
||||||
|
int g_current_max_index = 0;
|
||||||
|
uint64_t g_current_block = 0;
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<SDLPP::RenderObject>> g_tools{};
|
||||||
|
std::shared_ptr<SDLPP::RenderObject> g_current_tool = nullptr;
|
||||||
|
int g_current_tool_index = 0;
|
||||||
|
int g_max_tool_index = 0;
|
||||||
|
|
||||||
std::shared_ptr<SDLPP::Texture> g_placeholder_texture = nullptr;
|
std::shared_ptr<SDLPP::Texture> g_placeholder_texture = nullptr;
|
||||||
std::shared_ptr<SDLPP::Texture> g_placeholder_mario = nullptr;
|
std::shared_ptr<SDLPP::Texture> g_placeholder_mario = nullptr;
|
||||||
@ -46,19 +54,90 @@ std::shared_ptr<SDLPP::Texture> g_placeholder_mario = nullptr;
|
|||||||
std::shared_ptr<SDLPP::RenderObject> g_mario = nullptr;
|
std::shared_ptr<SDLPP::RenderObject> g_mario = nullptr;
|
||||||
SDLPP::Vec2D<int> g_mario_pos = {0,0};
|
SDLPP::Vec2D<int> g_mario_pos = {0,0};
|
||||||
|
|
||||||
void handleKeyDown( SDL_Keycode key, SDLPP::Scene &scene ) {
|
enum LandType::Value g_current_world_type = LandType::OVERWORLD;
|
||||||
|
|
||||||
|
void updateTool() {
|
||||||
|
auto tool_role = getBlockRole(possibleBlocks[g_current_block]);
|
||||||
|
std::shared_ptr<SDLPP::Texture> target_texture = nullptr;
|
||||||
|
switch(tool_role) {
|
||||||
|
case BlockRole::TERRAIN:
|
||||||
|
target_texture = g_placeholder_texture;
|
||||||
|
break;
|
||||||
|
case BlockRole::MARIO:
|
||||||
|
target_texture = g_placeholder_mario;
|
||||||
|
break;
|
||||||
|
case BlockRole::MODIFIER:
|
||||||
|
break;
|
||||||
|
case BlockRole::CHARACTER:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
g_current_tool->setTexture(target_texture, getSourceRectByID(possibleBlocks[g_current_block], g_current_world_type));
|
||||||
|
g_current_tool->setId(possibleBlocks[g_current_block]);
|
||||||
|
g_current_tool->getCollisions()[0]->setId(possibleBlocks[g_current_block]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeMario() {
|
||||||
|
if(!g_mario)
|
||||||
|
return;
|
||||||
|
auto prev = g_objects[g_mario_pos.getX()][g_mario_pos.getY()];
|
||||||
|
// remove character/modifiers
|
||||||
|
g_objects[g_mario_pos.getX()][g_mario_pos.getY()] = {std::get<0>(prev), std::get<1>(prev), 0, 0, 0, 0};
|
||||||
|
g_mario->destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateToolSelection(int prev_index) {
|
||||||
|
size_t prev = prev_index * 8;
|
||||||
|
size_t cur = g_current_tool_index * 8;
|
||||||
|
for(size_t i = prev; i < (g_tools.size() < prev + 8 ? g_tools.size() : prev + 8); i++) {
|
||||||
|
g_tools[i]->setHidden(true);
|
||||||
|
}
|
||||||
|
for(size_t i = cur; i < (g_tools.size() < cur + 8 ? g_tools.size() : cur + 8); i++) {
|
||||||
|
g_tools[i]->setHidden(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveToolsLeft() {
|
||||||
|
g_current_tool_index--;
|
||||||
|
updateToolSelection(g_current_tool_index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void moveToolsRight() {
|
||||||
|
g_current_tool_index++;
|
||||||
|
updateToolSelection(g_current_tool_index - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO add red outline to currently selected tool
|
||||||
|
// add WSAD navigation for the red highlight
|
||||||
|
void selectPrevTool() {
|
||||||
|
if(g_current_block == 0)
|
||||||
|
return;
|
||||||
|
if(g_current_block % 8 == 0) {
|
||||||
|
moveToolsLeft();
|
||||||
|
}
|
||||||
|
g_current_block--;
|
||||||
|
updateTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void selectNextTool() {
|
||||||
|
if(g_current_block == g_tools.size() - 1)
|
||||||
|
return;
|
||||||
|
if(g_current_block % 8 == 7) {
|
||||||
|
moveToolsRight();
|
||||||
|
}
|
||||||
|
g_current_block++;
|
||||||
|
updateTool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleKeyUp( SDL_Keycode key, SDLPP::Scene &scene ) {
|
||||||
switch ( key ) {
|
switch ( key ) {
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
quit = true;
|
g_quit = true;
|
||||||
break;
|
break;
|
||||||
case SDLK_a:
|
case SDLK_a:
|
||||||
|
selectPrevTool();
|
||||||
break;
|
break;
|
||||||
case SDLK_d:
|
case SDLK_d:
|
||||||
break;
|
selectNextTool();
|
||||||
case SDLK_SPACE:
|
|
||||||
case SDLK_w:
|
|
||||||
break;
|
|
||||||
case SDLK_s:
|
|
||||||
break;
|
break;
|
||||||
case SDLK_r:
|
case SDLK_r:
|
||||||
scene.getRenderer().setRenderColiders(
|
scene.getRenderer().setRenderColiders(
|
||||||
@ -68,47 +147,120 @@ void handleKeyDown( SDL_Keycode key, SDLPP::Scene &scene ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTool() {
|
void getMousePositionFlags(SDLPP::Scene &scene) {
|
||||||
if(possibleBlocks[current_block] == MARIO_ID) {
|
auto mouse = scene.getObjects({EDITOR_MOUSE_ID})[0];
|
||||||
current_tool->setTexture(g_placeholder_mario, getSourceRectByID(possibleBlocks[current_block], OVERWORLD));
|
// move mouse colider to mouse position
|
||||||
} else {
|
mouse->setPos(SDLPP::Mouse::getMousePositionDouble(scene.getRenderer(), SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER));
|
||||||
current_tool->setTexture(g_placeholder_texture, getSourceRectByID(possibleBlocks[current_block], OVERWORLD));
|
|
||||||
}
|
|
||||||
current_tool->setId(possibleBlocks[current_block]);
|
|
||||||
current_tool->getCollisions()[0]->setId(possibleBlocks[current_block]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeMario() {
|
MouseVisitor visitor;
|
||||||
auto prev = objects[g_mario_pos.getX()][g_mario_pos.getY()];
|
scene.visitCollisions(*mouse, visitor);
|
||||||
objects[g_mario_pos.getX()][g_mario_pos.getY()] = {std::get<0>(prev), std::get<1>(prev), 0, 0, 0, 0};
|
std::get<MouseInfo::CUR_FLAGS>(g_mouse_info) = visitor.getFlags();
|
||||||
g_mario->destroy();
|
std::get<MouseInfo::EDIT_BOX>(g_mouse_info) = visitor.getEditBoxIndexes();
|
||||||
}
|
std::get<MouseInfo::TOOL_BOX>(g_mouse_info) = visitor.getToolBoxIndexes();
|
||||||
|
// if we found an edit box, move tool icon to that box
|
||||||
void updateToolSelection(int prev_index) {
|
if(visitor.foundEditBox()) {
|
||||||
auto prev = prev_index * 8;
|
const auto &box = std::get<MouseInfo::EDIT_BOX>(g_mouse_info);
|
||||||
auto cur = current_tool_index * 8;
|
g_current_tool->setPos(BLOCK_SIZE + box.getX() * BLOCK_SIZE, 4*BLOCK_SIZE + box.getY() * BLOCK_SIZE);
|
||||||
for(int i = prev; i < (tools.size() < prev + 8 ? tools.size() : prev + 8); i++) {
|
|
||||||
tools[i]->setHidden(true);
|
|
||||||
}
|
|
||||||
for(int i = cur; i < (tools.size() < cur + 8 ? tools.size() : cur + 8); i++) {
|
|
||||||
tools[i]->setHidden(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleKeyUp( SDL_Keycode key ) {
|
void mouseUpAction(uint64_t flags, SDLPP::Scene &scene) {
|
||||||
switch ( key ) {
|
if(MouseVisitor::moveMapLeft(flags) && g_current_start_index != 0) {
|
||||||
case SDLK_a:
|
g_current_start_index -= 1;
|
||||||
// current_block = (current_block + possibleBlocks.size() - 1) % possibleBlocks.size();
|
scene.moveEverything(BLOCK_SIZE, 0);
|
||||||
// updateTool();
|
}
|
||||||
break;
|
if(MouseVisitor::moveMapRight(flags)) {
|
||||||
case SDLK_d:
|
if(g_current_start_index == g_current_max_index) {
|
||||||
// current_block = (current_block + 1) % possibleBlocks.size();
|
// add column
|
||||||
// updateTool();
|
// TODO 18 as constant
|
||||||
break;
|
g_objects.resize(g_current_max_index + 18 + 1);
|
||||||
case SDLK_w:
|
g_current_max_index++;
|
||||||
case SDLK_s:
|
}
|
||||||
default:
|
g_current_start_index += 1;
|
||||||
break;
|
scene.moveEverything(-BLOCK_SIZE,0);
|
||||||
|
}
|
||||||
|
if(MouseVisitor::moveToolsLeft(flags) && g_current_tool_index != 0) {
|
||||||
|
g_current_tool_index -= 1;
|
||||||
|
updateToolSelection(g_current_tool_index + 1);
|
||||||
|
}
|
||||||
|
if(MouseVisitor::moveToolsRight(flags) && g_current_tool_index != g_max_tool_index) {
|
||||||
|
g_current_tool_index += 1;
|
||||||
|
updateToolSelection(g_current_tool_index - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDLPP::Vec2D<int> getSelectedObjectPosition() {
|
||||||
|
return { g_current_start_index + std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getX(), std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getY() };
|
||||||
|
}
|
||||||
|
|
||||||
|
mapObjectType &getSelectedObject() {
|
||||||
|
auto pos = getSelectedObjectPosition();
|
||||||
|
return g_objects[pos.getX()][pos.getY()];
|
||||||
|
}
|
||||||
|
|
||||||
|
void placeTool(SDLPP::Scene &scene) {
|
||||||
|
std::lock_guard<std::mutex> lock(g_destruction_mutex);
|
||||||
|
|
||||||
|
ToolVisitor visitor;
|
||||||
|
auto tool_type = getBlockRole(g_current_tool->getId());
|
||||||
|
switch(tool_type) {
|
||||||
|
case BlockRole::TERRAIN:
|
||||||
|
visitor.setVisitorType(VisitorType::Terrain);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
visitor.setVisitorType(VisitorType::Modifier);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
scene.visitCollisions(*g_current_tool, visitor);
|
||||||
|
if(visitor.removeBlock() && !visitor.addBlock()) {
|
||||||
|
auto &obj = getSelectedObject();
|
||||||
|
switch(visitor.getVisitorType()) {
|
||||||
|
case VisitorType::Terrain:
|
||||||
|
std::get<MapObject::TERRAIN_TYPE>(obj) = LandType::OVERWORLD;
|
||||||
|
std::get<MapObject::TERRAIN_ID>(obj) = 0;
|
||||||
|
break;
|
||||||
|
case VisitorType::Modifier:
|
||||||
|
std::get<MapObject::CHARACTER_TYPE>(obj) = 0;
|
||||||
|
std::get<MapObject::CHARACTER_ID>(obj) = 0;
|
||||||
|
std::get<MapObject::MODIFIER_TYPE>(obj) = 0;
|
||||||
|
std::get<MapObject::MODIFIER_DATA>(obj) = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if(visitor.addBlock()) {
|
||||||
|
auto &obj = getSelectedObject();
|
||||||
|
int z_index = 1;
|
||||||
|
std::shared_ptr<SDLPP::RenderObject> new_obj = nullptr;
|
||||||
|
switch(visitor.getVisitorType()) {
|
||||||
|
case VisitorType::Terrain:
|
||||||
|
std::get<MapObject::TERRAIN_TYPE>(obj) = LandType::OVERWORLD;
|
||||||
|
std::get<MapObject::TERRAIN_ID>(obj) = g_current_tool->getId();
|
||||||
|
// TODO why 1 +?
|
||||||
|
new_obj = createTerrainBlock(g_current_tool->getId(), LandType::OVERWORLD, g_renderer, 1 + std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getX(), std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getY(), true);
|
||||||
|
new_obj->getCollisions()[0]->setId(EDITOR_TERRAIN_ID);
|
||||||
|
break;
|
||||||
|
case VisitorType::Modifier:
|
||||||
|
// TODO check if modifier or character
|
||||||
|
std::get<MapObject::CHARACTER_TYPE>(obj) = LandType::OVERWORLD;
|
||||||
|
// TODO character ID
|
||||||
|
std::get<MapObject::CHARACTER_ID>(obj) = MARIO_ID;
|
||||||
|
std::get<MapObject::MODIFIER_TYPE>(obj) = 0;
|
||||||
|
std::get<MapObject::MODIFIER_DATA>(obj) = 0;
|
||||||
|
new_obj = createMario(LandType::OVERWORLD, g_renderer, 1 + std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getX(), std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getY());
|
||||||
|
// remove mario if exists
|
||||||
|
removeMario();
|
||||||
|
g_mario = new_obj;
|
||||||
|
g_mario_pos = getSelectedObjectPosition();
|
||||||
|
new_obj->getCollisions()[0]->setId(EDITOR_CHARACTER_ID);
|
||||||
|
z_index = scene.getObjects().size() - 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
scene.addObject(new_obj);
|
||||||
|
scene.setZIndex(new_obj, z_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,106 +269,38 @@ void pollEvents( SDLPP::Scene &scene ) {
|
|||||||
while ( SDLPP::getSDLEvent( event ) ) {
|
while ( SDLPP::getSDLEvent( event ) ) {
|
||||||
switch ( event.type ) {
|
switch ( event.type ) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
quit = true;
|
g_quit = true;
|
||||||
break;
|
|
||||||
case SDL_KEYDOWN:
|
|
||||||
if ( !event.key.repeat )
|
|
||||||
handleKeyDown( event.key.keysym.sym, scene );
|
|
||||||
break;
|
break;
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
handleKeyUp( event.key.keysym.sym );
|
handleKeyUp( event.key.keysym.sym, scene );
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
if ( event.window.event == SDL_WINDOWEVENT_RESIZED ) {
|
if ( event.window.event == SDL_WINDOWEVENT_RESIZED ) {
|
||||||
update_size = true;
|
g_update_size = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION: {
|
case SDL_MOUSEMOTION:
|
||||||
auto mouse = scene.getObjects({EDITOR_MOUSE_ID})[0];
|
getMousePositionFlags(scene);
|
||||||
mouse->setPos(SDLPP::Mouse::getMousePositionDouble(scene.getRenderer(), SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER));
|
|
||||||
MouseVisitor visitor;
|
|
||||||
scene.visitCollisions(*mouse, visitor);
|
|
||||||
current_selected_flags = visitor.getFlags();
|
|
||||||
current_box = visitor.getEditBoxIndexes();
|
|
||||||
if(visitor.foundEditBox()) {
|
|
||||||
current_tool->setPos(BLOCK_SIZE + current_box.getX() * BLOCK_SIZE, 4*BLOCK_SIZE + current_box.getY() * BLOCK_SIZE);
|
|
||||||
}
|
|
||||||
current_tool_box = visitor.getToolBoxIndexes();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
if(previous_selected_flags == current_selected_flags && MouseVisitor::moveMapLeft(current_selected_flags) && current_start_index != 0) {
|
if(std::get<MouseInfo::CUR_FLAGS>(g_mouse_info) == std::get<MouseInfo::PREV_FLAGS>(g_mouse_info)) {
|
||||||
current_start_index -= 1;
|
mouseUpAction(std::get<MouseInfo::CUR_FLAGS>(g_mouse_info), scene);
|
||||||
scene.moveEverything(BLOCK_SIZE, 0);
|
|
||||||
}
|
}
|
||||||
if(previous_selected_flags == current_selected_flags && MouseVisitor::moveMapRight(current_selected_flags)) {
|
if(std::get<MouseInfo::EDIT_BOX>(g_mouse_info).getX() != -1) {
|
||||||
if(current_start_index == current_max_index) {
|
placeTool(scene);
|
||||||
objects.resize(current_max_index + 18 + 1);
|
|
||||||
current_max_index++;
|
|
||||||
}
|
|
||||||
current_start_index += 1;
|
|
||||||
scene.moveEverything(-BLOCK_SIZE,0);
|
|
||||||
}
|
}
|
||||||
if(previous_selected_flags == current_selected_flags && MouseVisitor::moveToolsLeft(current_selected_flags) && current_tool_index != 0) {
|
if(std::get<MouseInfo::TOOL_BOX>(g_mouse_info).getX() != -1) {
|
||||||
current_tool_index -= 1;
|
auto &tool_box = std::get<MouseInfo::TOOL_BOX>(g_mouse_info);
|
||||||
updateToolSelection(current_tool_index + 1);
|
size_t index = tool_box.getY() * 4 + tool_box.getX();
|
||||||
}
|
if(index < g_tools.size()) {
|
||||||
if(previous_selected_flags == current_selected_flags && MouseVisitor::moveToolsRight(current_selected_flags) && current_tool_index != max_tool_index) {
|
g_current_block = g_current_tool_index * 8 + index;
|
||||||
current_tool_index += 1;
|
|
||||||
updateToolSelection(current_tool_index - 1);
|
|
||||||
}
|
|
||||||
if(current_box.getX() != -1) {
|
|
||||||
std::lock_guard<std::mutex> lock(destruction_mutex);
|
|
||||||
|
|
||||||
ToolVisitor visitor;
|
|
||||||
if(current_tool->getId() < 0x7000) {
|
|
||||||
visitor.setVisitorType(MODIFIER_VISITOR_TYPE);
|
|
||||||
} else {
|
|
||||||
visitor.setVisitorType(TOOL_VISITOR_TYPE);
|
|
||||||
}
|
|
||||||
// TODO
|
|
||||||
scene.visitCollisions(*current_tool, visitor);
|
|
||||||
if(visitor.removeBlock() && !visitor.addBlock()) {
|
|
||||||
auto prev = objects[current_start_index + current_box.getX()][current_box.getY()];
|
|
||||||
if(visitor.getVisitorType() == TOOL_VISITOR_TYPE) {
|
|
||||||
objects[current_start_index + current_box.getX()][current_box.getY()] = {OVERWORLD, 0, std::get<2>(prev), std::get<3>(prev), std::get<4>(prev), std::get<5>(prev)};
|
|
||||||
} else {
|
|
||||||
objects[current_start_index + current_box.getX()][current_box.getY()] = {std::get<0>(prev), std::get<1>(prev), 0, 0, 0, 0};
|
|
||||||
}
|
|
||||||
} else if(visitor.addBlock()) {
|
|
||||||
auto prev = objects[current_start_index + current_box.getX()][current_box.getY()];
|
|
||||||
int z_index = 1;
|
|
||||||
std::shared_ptr<SDLPP::RenderObject> obj = nullptr;
|
|
||||||
if(visitor.getVisitorType() == TOOL_VISITOR_TYPE) {
|
|
||||||
objects[current_start_index + current_box.getX()][current_box.getY()] = {OVERWORLD, current_tool->getId(), std::get<2>(prev), std::get<3>(prev), std::get<4>(prev), std::get<5>(prev)};
|
|
||||||
obj = createTerrainBlock(current_tool->getId(), OVERWORLD, renderer, 1 + current_box.getX(), current_box.getY(), true);
|
|
||||||
obj->getCollisions()[0]->setId(EDITOR_TERRAIN_ID);
|
|
||||||
} else {
|
|
||||||
// TODO check if modifier or character
|
|
||||||
objects[current_start_index + current_box.getX()][current_box.getY()] = {std::get<0>(prev), std::get<1>(prev), OVERWORLD, MARIO_ID, 0, 0};
|
|
||||||
obj = createMario(OVERWORLD, renderer, 1 + current_box.getX(), current_box.getY());
|
|
||||||
if(g_mario) {
|
|
||||||
removeMario();
|
|
||||||
}
|
|
||||||
g_mario = obj;
|
|
||||||
g_mario_pos = {current_start_index + current_box.getX(), current_box.getY()};
|
|
||||||
obj->getCollisions()[0]->setId(EDITOR_CHARACTER_ID);
|
|
||||||
z_index = scene.getObjects().size() - 1;
|
|
||||||
}
|
|
||||||
scene.addObject(obj);
|
|
||||||
scene.setZIndex(obj, z_index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(current_tool_box.getX() != -1) {
|
|
||||||
auto index = current_tool_box.getY() * 4 + current_tool_box.getX();
|
|
||||||
if(index < tools.size()) {
|
|
||||||
current_block = current_tool_index * 8 + index;
|
|
||||||
updateTool();
|
updateTool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
previous_selected_flags = current_selected_flags;
|
// store current mouse flags in previous mouse flags
|
||||||
|
std::get<MouseInfo::PREV_FLAGS>(g_mouse_info) = std::get<MouseInfo::CUR_FLAGS>(g_mouse_info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -246,35 +330,35 @@ int main() {
|
|||||||
w.setResizable( true );
|
w.setResizable( true );
|
||||||
BLOCK_SIZE = 1.0 / 20;
|
BLOCK_SIZE = 1.0 / 20;
|
||||||
|
|
||||||
renderer = std::make_shared< SDLPP::Renderer >( w );
|
g_renderer = std::make_shared< SDLPP::Renderer >( w );
|
||||||
renderer->setBlendMode( SDL_BLENDMODE_BLEND );
|
g_renderer->setBlendMode( SDL_BLENDMODE_BLEND );
|
||||||
|
|
||||||
// prepare global vars
|
// prepare global vars
|
||||||
g_terrain_texture = std::make_shared< SDLPP::Texture >(
|
g_terrain_texture = std::make_shared< SDLPP::Texture >(
|
||||||
renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
g_renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
||||||
g_mario_texture = std::make_shared< SDLPP::Texture >(
|
g_mario_texture = std::make_shared< SDLPP::Texture >(
|
||||||
renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
g_renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
||||||
|
|
||||||
auto scene = std::make_shared< SDLPP::Scene >( renderer );
|
auto scene = std::make_shared< SDLPP::Scene >( g_renderer );
|
||||||
auto bg = std::make_shared< SDLPP::RectangleRender >(
|
auto bg = std::make_shared< SDLPP::RectangleRender >(
|
||||||
0, 0, 10, 10, renderer, MARIO_OVERWORLD_COLORKEY, true );
|
0, 0, 10, 10, g_renderer, MARIO_OVERWORLD_COLORKEY, true );
|
||||||
bg->setPermanent();
|
bg->setPermanent();
|
||||||
bg->setId( 1 );
|
bg->setId( 1 );
|
||||||
scene->addObject( bg );
|
scene->addObject( bg );
|
||||||
|
|
||||||
loadMap( scene, "test_binary.bin", renderer, objects );
|
loadMap( scene, "test_binary.bin", g_renderer, g_objects );
|
||||||
|
|
||||||
// grid
|
// grid
|
||||||
for ( int i = 1; i < 20; i++ ) {
|
for ( int i = 1; i < 20; i++ ) {
|
||||||
auto line_vertical = std::make_shared< SDLPP::LineRenderer >(
|
auto line_vertical = std::make_shared< SDLPP::LineRenderer >(
|
||||||
i * BLOCK_SIZE, 1 - 16 * BLOCK_SIZE, i * BLOCK_SIZE, 1.0, renderer, "#282828" );
|
i * BLOCK_SIZE, 1 - 16 * BLOCK_SIZE, i * BLOCK_SIZE, 1.0, g_renderer, "#282828" );
|
||||||
line_vertical->setPermanent();
|
line_vertical->setPermanent();
|
||||||
line_vertical->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
line_vertical->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||||
scene->addObject(line_vertical);
|
scene->addObject(line_vertical);
|
||||||
if(i > 2) {
|
if(i > 2) {
|
||||||
auto line_horizontal = std::make_shared< SDLPP::LineRenderer >(
|
auto line_horizontal = std::make_shared< SDLPP::LineRenderer >(
|
||||||
BLOCK_SIZE, ( i + 1 ) * BLOCK_SIZE, 19 * BLOCK_SIZE,
|
BLOCK_SIZE, ( i + 1 ) * BLOCK_SIZE, 19 * BLOCK_SIZE,
|
||||||
( i + 1 ) * BLOCK_SIZE, renderer, "#282828" );
|
( i + 1 ) * BLOCK_SIZE, g_renderer, "#282828" );
|
||||||
line_horizontal->setPermanent();
|
line_horizontal->setPermanent();
|
||||||
line_horizontal->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
line_horizontal->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||||
scene->addObject(line_horizontal);
|
scene->addObject(line_horizontal);
|
||||||
@ -282,7 +366,7 @@ int main() {
|
|||||||
}
|
}
|
||||||
// white rectangles
|
// white rectangles
|
||||||
auto rectangle1 = std::make_shared< SDLPP::RectangleRender >(
|
auto rectangle1 = std::make_shared< SDLPP::RectangleRender >(
|
||||||
0, 4 * BLOCK_SIZE, BLOCK_SIZE, 16 * BLOCK_SIZE, renderer, "#FFFFFF88", true);
|
0, 4 * BLOCK_SIZE, BLOCK_SIZE, 16 * BLOCK_SIZE, g_renderer, "#FFFFFF88", true);
|
||||||
rectangle1->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
rectangle1->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
rectangle1->setId(EDITOR_LEFT_MAP_ID);
|
rectangle1->setId(EDITOR_LEFT_MAP_ID);
|
||||||
rectangle1->setPermanent();
|
rectangle1->setPermanent();
|
||||||
@ -290,7 +374,7 @@ int main() {
|
|||||||
scene->addObject(rectangle1);
|
scene->addObject(rectangle1);
|
||||||
// white rectangles
|
// white rectangles
|
||||||
auto rectangle2 = std::make_shared< SDLPP::RectangleRender >(
|
auto rectangle2 = std::make_shared< SDLPP::RectangleRender >(
|
||||||
19*BLOCK_SIZE, 4 * BLOCK_SIZE, BLOCK_SIZE, 16 * BLOCK_SIZE, renderer, "#FFFFFF88", true);
|
19*BLOCK_SIZE, 4 * BLOCK_SIZE, BLOCK_SIZE, 16 * BLOCK_SIZE, g_renderer, "#FFFFFF88", true);
|
||||||
rectangle2->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
rectangle2->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
rectangle2->setId(EDITOR_RIGHT_MAP_ID);
|
rectangle2->setId(EDITOR_RIGHT_MAP_ID);
|
||||||
rectangle2->setPermanent();
|
rectangle2->setPermanent();
|
||||||
@ -301,13 +385,13 @@ int main() {
|
|||||||
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
|
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
|
||||||
font, "#000000", "#282828", 0.05 );
|
font, "#000000", "#282828", 0.05 );
|
||||||
auto left = std::make_shared< SDLPP::TextRenderer >(
|
auto left = std::make_shared< SDLPP::TextRenderer >(
|
||||||
0, 11.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, "<", font_config);
|
0, 11.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, g_renderer, "<", font_config);
|
||||||
left->setId(0);
|
left->setId(0);
|
||||||
left->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
left->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
left->setPermanent();
|
left->setPermanent();
|
||||||
scene->addObject(left);
|
scene->addObject(left);
|
||||||
auto right = std::make_shared< SDLPP::TextRenderer >(
|
auto right = std::make_shared< SDLPP::TextRenderer >(
|
||||||
19*BLOCK_SIZE, 11.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, ">", font_config);
|
19*BLOCK_SIZE, 11.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, g_renderer, ">", font_config);
|
||||||
right->setId(0);
|
right->setId(0);
|
||||||
right->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
right->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
right->setPermanent();
|
right->setPermanent();
|
||||||
@ -315,12 +399,12 @@ int main() {
|
|||||||
|
|
||||||
for(int i = 0; i < 18; i++) {
|
for(int i = 0; i < 18; i++) {
|
||||||
for(int j = 0; j < 16; j++) {
|
for(int j = 0; j < 16; j++) {
|
||||||
scene->addObject(std::make_shared<EditBox>(i, j, renderer));
|
scene->addObject(std::make_shared<EditBox>(i, j, g_renderer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto mouse =
|
auto mouse =
|
||||||
std::make_shared< SDLPP::RectangleRender >( 0.01, 0.01, 0, 0, renderer );
|
std::make_shared< SDLPP::RectangleRender >( 0.01, 0.01, 0, 0, g_renderer );
|
||||||
mouse->setMinWidth(1);
|
mouse->setMinWidth(1);
|
||||||
mouse->setMinHeight(1);
|
mouse->setMinHeight(1);
|
||||||
mouse->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
mouse->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||||
@ -329,13 +413,13 @@ int main() {
|
|||||||
mouse->addCollision(
|
mouse->addCollision(
|
||||||
SDLPP::RectColider( { 0, 0 }, { 1, 1 } ) );
|
SDLPP::RectColider( { 0, 0 }, { 1, 1 } ) );
|
||||||
scene->addObject( mouse );
|
scene->addObject( mouse );
|
||||||
current_max_index = objects.size() - 18;
|
g_current_max_index = g_objects.size() - 18;
|
||||||
|
|
||||||
// tools
|
// tools
|
||||||
max_tool_index = (possibleBlocks.size() - 1) / 8;
|
g_max_tool_index = (possibleBlocks.size() - 1) / 8;
|
||||||
for(int i = 0; i < 4; i++) {
|
for(int i = 0; i < 4; i++) {
|
||||||
auto tool_box1 = std::make_shared<ToolBox>(i, 0, renderer);
|
auto tool_box1 = std::make_shared<ToolBox>(i, 0, g_renderer);
|
||||||
auto tool_box2 = std::make_shared<ToolBox>(i, 1, renderer);
|
auto tool_box2 = std::make_shared<ToolBox>(i, 1, g_renderer);
|
||||||
scene->addObject(tool_box1);
|
scene->addObject(tool_box1);
|
||||||
scene->addObject(tool_box2);
|
scene->addObject(tool_box2);
|
||||||
// std::cout << "TOOL BOX POS: " << tool_box1->getPos().getX() << ", " << tool_box1->getPos().getY() << std::endl;
|
// std::cout << "TOOL BOX POS: " << tool_box1->getPos().getX() << ", " << tool_box1->getPos().getY() << std::endl;
|
||||||
@ -344,38 +428,38 @@ int main() {
|
|||||||
int tool_index = 0;
|
int tool_index = 0;
|
||||||
for(auto &block : possibleBlocks) {
|
for(auto &block : possibleBlocks) {
|
||||||
if(block == MARIO_ID ) {
|
if(block == MARIO_ID ) {
|
||||||
tools.push_back(createMario(OVERWORLD, renderer, 0, 0));
|
g_tools.push_back(createMario(LandType::OVERWORLD, g_renderer, 0, 0));
|
||||||
} else {
|
} else {
|
||||||
tools.push_back(createTerrainBlock(block, OVERWORLD, renderer, false));
|
g_tools.push_back(createTerrainBlock(block, LandType::OVERWORLD, g_renderer, false));
|
||||||
}
|
}
|
||||||
tools.back()->setHidden(true);
|
g_tools.back()->setHidden(true);
|
||||||
tools.back()->setPermanent();
|
g_tools.back()->setPermanent();
|
||||||
auto x = tool_index % 4;
|
auto x = tool_index % 4;
|
||||||
auto y = tool_index / 4;
|
auto y = tool_index / 4;
|
||||||
// TODO add 14 and 1 as constants somewhere
|
// TODO add 14 and 1 as constants somewhere
|
||||||
// TODO investigate when not permanent requires `-1` on x position
|
// TODO investigate when not permanent requires `-1` on x position
|
||||||
tools.back()->setPos(14*BLOCK_SIZE + x*BLOCK_SIZE, BLOCK_SIZE + y*BLOCK_SIZE);
|
g_tools.back()->setPos(14*BLOCK_SIZE + x*BLOCK_SIZE, BLOCK_SIZE + y*BLOCK_SIZE);
|
||||||
// std::cout << "TOOL POS: " << tools.back()->getPos().getX() << ", " << tools.back()->getPos().getY() << std::endl;
|
// std::cout << "TOOL POS: " << tools.back()->getPos().getX() << ", " << tools.back()->getPos().getY() << std::endl;
|
||||||
scene->addObject(tools.back());
|
scene->addObject(g_tools.back());
|
||||||
tool_index = (tool_index + 1) % 8;
|
tool_index = (tool_index + 1) % 8;
|
||||||
}
|
}
|
||||||
for(int i = 0; i < 5; i++) {
|
for(int i = 0; i < 5; i++) {
|
||||||
auto line = std::make_shared<SDLPP::LineRenderer>(
|
auto line = std::make_shared<SDLPP::LineRenderer>(
|
||||||
14*BLOCK_SIZE + i*BLOCK_SIZE, BLOCK_SIZE, 14 * BLOCK_SIZE + i*BLOCK_SIZE, 3*BLOCK_SIZE, renderer, "#282828");
|
14*BLOCK_SIZE + i*BLOCK_SIZE, BLOCK_SIZE, 14 * BLOCK_SIZE + i*BLOCK_SIZE, 3*BLOCK_SIZE, g_renderer, "#282828");
|
||||||
line->setPermanent();
|
line->setPermanent();
|
||||||
line->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
line->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
scene->addObject(line);
|
scene->addObject(line);
|
||||||
}
|
}
|
||||||
for(int i = 0; i < 3; i++) {
|
for(int i = 0; i < 3; i++) {
|
||||||
auto line = std::make_shared<SDLPP::LineRenderer>(
|
auto line = std::make_shared<SDLPP::LineRenderer>(
|
||||||
14*BLOCK_SIZE, BLOCK_SIZE + i*BLOCK_SIZE, 14 * BLOCK_SIZE + 4*BLOCK_SIZE, BLOCK_SIZE + i*BLOCK_SIZE, renderer, "#282828");
|
14*BLOCK_SIZE, BLOCK_SIZE + i*BLOCK_SIZE, 14 * BLOCK_SIZE + 4*BLOCK_SIZE, BLOCK_SIZE + i*BLOCK_SIZE, g_renderer, "#282828");
|
||||||
line->setPermanent();
|
line->setPermanent();
|
||||||
line->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
line->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
scene->addObject(line);
|
scene->addObject(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto tool_rect1 = std::make_shared< SDLPP::RectangleRender >(
|
auto tool_rect1 = std::make_shared< SDLPP::RectangleRender >(
|
||||||
13*BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, renderer, "#FFFFFF88", true);
|
13*BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, g_renderer, "#FFFFFF88", true);
|
||||||
tool_rect1->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
tool_rect1->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
tool_rect1->setId(EDITOR_LEFT_TOOL_ID);
|
tool_rect1->setId(EDITOR_LEFT_TOOL_ID);
|
||||||
tool_rect1->setPermanent();
|
tool_rect1->setPermanent();
|
||||||
@ -383,36 +467,36 @@ int main() {
|
|||||||
scene->addObject(tool_rect1);
|
scene->addObject(tool_rect1);
|
||||||
// white rectangles
|
// white rectangles
|
||||||
auto tool_rect2 = std::make_shared< SDLPP::RectangleRender >(
|
auto tool_rect2 = std::make_shared< SDLPP::RectangleRender >(
|
||||||
18*BLOCK_SIZE, 1 * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, renderer, "#FFFFFF88", true);
|
18*BLOCK_SIZE, 1 * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, g_renderer, "#FFFFFF88", true);
|
||||||
tool_rect2->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
tool_rect2->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
tool_rect2->setId(EDITOR_RIGHT_TOOL_ID);
|
tool_rect2->setId(EDITOR_RIGHT_TOOL_ID);
|
||||||
tool_rect2->setPermanent();
|
tool_rect2->setPermanent();
|
||||||
tool_rect2->addCollision(SDLPP::RectColider(0, 0, 1, 1));
|
tool_rect2->addCollision(SDLPP::RectColider(0, 0, 1, 1));
|
||||||
scene->addObject(tool_rect2);
|
scene->addObject(tool_rect2);
|
||||||
auto left_tool = std::make_shared< SDLPP::TextRenderer >(
|
auto left_tool = std::make_shared< SDLPP::TextRenderer >(
|
||||||
13*BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, "<", font_config);
|
13*BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, g_renderer, "<", font_config);
|
||||||
left_tool->setId(0);
|
left_tool->setId(0);
|
||||||
left_tool->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
left_tool->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
left_tool->setPermanent();
|
left_tool->setPermanent();
|
||||||
scene->addObject(left_tool);
|
scene->addObject(left_tool);
|
||||||
auto right_tool = std::make_shared< SDLPP::TextRenderer >(
|
auto right_tool = std::make_shared< SDLPP::TextRenderer >(
|
||||||
18*BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, ">", font_config);
|
18*BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, g_renderer, ">", font_config);
|
||||||
right_tool->setId(0);
|
right_tool->setId(0);
|
||||||
right_tool->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
right_tool->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
||||||
right_tool->setPermanent();
|
right_tool->setPermanent();
|
||||||
scene->addObject(right_tool);
|
scene->addObject(right_tool);
|
||||||
|
|
||||||
g_placeholder_texture = std::make_shared< SDLPP::Texture >(
|
g_placeholder_texture = std::make_shared< SDLPP::Texture >(
|
||||||
renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
g_renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
||||||
g_placeholder_texture->setAlpha(100);
|
g_placeholder_texture->setAlpha(100);
|
||||||
g_placeholder_mario = std::make_shared< SDLPP::Texture >(
|
g_placeholder_mario = std::make_shared< SDLPP::Texture >(
|
||||||
renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
g_renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
||||||
g_placeholder_mario->setAlpha(100);
|
g_placeholder_mario->setAlpha(100);
|
||||||
current_tool = createTerrainBlock(possibleBlocks[current_block], OVERWORLD, renderer, g_placeholder_texture, false);
|
g_current_tool = createTerrainBlock(possibleBlocks[g_current_block], LandType::OVERWORLD, g_renderer, g_placeholder_texture, false);
|
||||||
current_tool->addCollision(SDLPP::RectColider(0.1, 0.1, 0.8, 0.8));
|
g_current_tool->addCollision(SDLPP::RectColider(0.1, 0.1, 0.8, 0.8));
|
||||||
dynamic_cast<MarioBlock&>(*current_tool).setTool();
|
dynamic_cast<MarioBlock&>(*g_current_tool).setTool();
|
||||||
scene->addObject(current_tool);
|
scene->addObject(g_current_tool);
|
||||||
scene->moveZTop(current_tool);
|
scene->moveZTop(g_current_tool);
|
||||||
|
|
||||||
scene->moveEverything(BLOCK_SIZE, 0);
|
scene->moveEverything(BLOCK_SIZE, 0);
|
||||||
FPSmanager gFPS;
|
FPSmanager gFPS;
|
||||||
@ -425,45 +509,45 @@ int main() {
|
|||||||
int frames = 0;
|
int frames = 0;
|
||||||
std::thread inputThread( doInput, scene );
|
std::thread inputThread( doInput, scene );
|
||||||
inputThread.detach();
|
inputThread.detach();
|
||||||
while ( !quit ) {
|
while ( !g_quit ) {
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
SDL_framerateDelay( &gFPS );
|
SDL_framerateDelay( &gFPS );
|
||||||
std::lock_guard<std::mutex> lock(destruction_mutex);
|
std::lock_guard<std::mutex> lock(g_destruction_mutex);
|
||||||
scene->renderScene();
|
scene->renderScene();
|
||||||
renderer->presentRenderer();
|
g_renderer->presentRenderer();
|
||||||
frames++;
|
frames++;
|
||||||
if ( SDL_GetTicks() - base >= 1000 ) {
|
if ( SDL_GetTicks() - base >= 1000 ) {
|
||||||
std::cout << "FPS: " << frames << std::endl;
|
std::cout << "FPS: " << frames << std::endl;
|
||||||
frames = 0;
|
frames = 0;
|
||||||
base = SDL_GetTicks();
|
base = SDL_GetTicks();
|
||||||
}
|
}
|
||||||
if(current_start_index == 0) {
|
if(g_current_start_index == 0) {
|
||||||
left->setTextColor(font, "#CCCCCC", "#CCCCCC", 0.05);
|
left->setTextColor(font, "#CCCCCC", "#CCCCCC", 0.05);
|
||||||
} else {
|
} else {
|
||||||
left->setTextColor(font, "#000000", "#282828", 0.05);
|
left->setTextColor(font, "#000000", "#282828", 0.05);
|
||||||
}
|
}
|
||||||
if(current_start_index == current_max_index) {
|
if(g_current_start_index == g_current_max_index) {
|
||||||
right->setTextColor(font, "#00FF00", "#000000", 0.1);
|
right->setTextColor(font, "#00FF00", "#000000", 0.1);
|
||||||
right->changeText("+");
|
right->changeText("+");
|
||||||
} else {
|
} else {
|
||||||
right->setTextColor(font, "#000000", "#282828", 0.05);
|
right->setTextColor(font, "#000000", "#282828", 0.05);
|
||||||
right->changeText(">");
|
right->changeText(">");
|
||||||
}
|
}
|
||||||
if(current_tool_index == 0) {
|
if(g_current_tool_index == 0) {
|
||||||
left_tool->setTextColor(font, "#CCCCCC", "#CCCCCC", 0.05);
|
left_tool->setTextColor(font, "#CCCCCC", "#CCCCCC", 0.05);
|
||||||
} else {
|
} else {
|
||||||
left_tool->setTextColor(font, "#000000", "#282828", 0.05);
|
left_tool->setTextColor(font, "#000000", "#282828", 0.05);
|
||||||
}
|
}
|
||||||
if(current_tool_index == max_tool_index) {
|
if(g_current_tool_index == g_max_tool_index) {
|
||||||
right_tool->setTextColor(font, "#CCCCCC", "#CCCCCC", 0.05);
|
right_tool->setTextColor(font, "#CCCCCC", "#CCCCCC", 0.05);
|
||||||
} else {
|
} else {
|
||||||
right_tool->setTextColor(font, "#000000", "#282828", 0.05);
|
right_tool->setTextColor(font, "#000000", "#282828", 0.05);
|
||||||
}
|
}
|
||||||
if(update_size) {
|
if(g_update_size) {
|
||||||
scene->updateSizeAndPosition();
|
scene->updateSizeAndPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
saveMap("test_binary2.bin", objects);
|
saveMap("test_binary2.bin", g_objects);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -62,12 +62,12 @@ void ToolVisitor::visit( const SDLPP::RenderObject &obj ) {
|
|||||||
switch ( id ) {
|
switch ( id ) {
|
||||||
case EDITOR_TERRAIN_ID:
|
case EDITOR_TERRAIN_ID:
|
||||||
remove_block = true;
|
remove_block = true;
|
||||||
if(obj.getId() == source_id && getVisitorType() == TOOL_VISITOR_TYPE) {
|
if(obj.getId() == source_id && getVisitorType() == VisitorType::Terrain) {
|
||||||
add_block = false;
|
add_block = false;
|
||||||
}
|
}
|
||||||
case EDITOR_CHARACTER_ID:
|
case EDITOR_CHARACTER_ID:
|
||||||
remove_block = true;
|
remove_block = true;
|
||||||
if(obj.getId() == source_id && getVisitorType() == MODIFIER_VISITOR_TYPE) {
|
if(obj.getId() == source_id && getVisitorType() == VisitorType::Modifier) {
|
||||||
add_block = false;
|
add_block = false;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -5,6 +5,13 @@
|
|||||||
#include "../sdlpp/sdlpp_geometry.hpp"
|
#include "../sdlpp/sdlpp_geometry.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
struct VisitorType {
|
||||||
|
enum Value {
|
||||||
|
Terrain = 0xE001,
|
||||||
|
Modifier = 0xE002,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
class MouseVisitor : public SDLPP::Visitor {
|
class MouseVisitor : public SDLPP::Visitor {
|
||||||
public:
|
public:
|
||||||
MouseVisitor() {}
|
MouseVisitor() {}
|
||||||
@ -17,13 +24,13 @@ public:
|
|||||||
bool foundEditBox() {
|
bool foundEditBox() {
|
||||||
return edit_box;
|
return edit_box;
|
||||||
}
|
}
|
||||||
SDLPP::Vec2D<int> getEditBoxIndexes() {
|
const SDLPP::Vec2D<int> &getEditBoxIndexes() {
|
||||||
return edit_box_location;
|
return edit_box_location;
|
||||||
}
|
}
|
||||||
bool foundToolBox() {
|
bool foundToolBox() {
|
||||||
return tool_box;
|
return tool_box;
|
||||||
}
|
}
|
||||||
SDLPP::Vec2D<int> getToolBoxIndexes() {
|
const SDLPP::Vec2D<int> &getToolBoxIndexes() {
|
||||||
return tool_box_location;
|
return tool_box_location;
|
||||||
}
|
}
|
||||||
virtual void setVisitorType( uint64_t type ) override {
|
virtual void setVisitorType( uint64_t type ) override {
|
||||||
|
@ -39,7 +39,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::Rectan
|
|||||||
collision = true;
|
collision = true;
|
||||||
}
|
}
|
||||||
// TODO add modifiers to createTerrainBlock
|
// TODO add modifiers to createTerrainBlock
|
||||||
auto obj = createTerrainBlock(id, static_cast<BlockType>(type), renderer, i, j, collision);
|
auto obj = createTerrainBlock(id, static_cast<LandType::Value>(type), renderer, i, j, collision);
|
||||||
if(obj != nullptr)
|
if(obj != nullptr)
|
||||||
scene->addObject(obj);
|
scene->addObject(obj);
|
||||||
if(character) {
|
if(character) {
|
||||||
@ -53,7 +53,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::Rectan
|
|||||||
}
|
}
|
||||||
|
|
||||||
// editor loader
|
// editor loader
|
||||||
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects) {
|
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<mapColumnType> &objects) {
|
||||||
std::ifstream map_file;
|
std::ifstream map_file;
|
||||||
map_file.open(file, std::ios::in | std::ios::binary);
|
map_file.open(file, std::ios::in | std::ios::binary);
|
||||||
uint16_t cols;
|
uint16_t cols;
|
||||||
@ -84,12 +84,12 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std:
|
|||||||
}
|
}
|
||||||
col[j] = {type, id, character_type, character, modifier_type, modifier_data};
|
col[j] = {type, id, character_type, character, modifier_type, modifier_data};
|
||||||
// TODO add modifiers to createTerrainBlock
|
// TODO add modifiers to createTerrainBlock
|
||||||
auto obj = createTerrainBlock(id, static_cast<BlockType>(type), renderer, i, j, true);
|
auto obj = createTerrainBlock(id, static_cast<LandType::Value>(type), renderer, i, j, true);
|
||||||
obj->getCollisions()[0]->setId(EDITOR_TERRAIN_ID);
|
obj->getCollisions()[0]->setId(EDITOR_TERRAIN_ID);
|
||||||
scene->addObject(obj);
|
scene->addObject(obj);
|
||||||
if(character) {
|
if(character) {
|
||||||
if(character == MARIO_ID) {
|
if(character == MARIO_ID) {
|
||||||
scene->addObject(createMario(static_cast<BlockType>(character_type), renderer, i, j));
|
scene->addObject(createMario(static_cast<LandType::Value>(character_type), renderer, i, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tuple - world object type, object, world character type, character, modifier type, modifier data
|
// tuple - world object type, object, world character type, character, modifier type, modifier data
|
||||||
void saveMap(const std::string &file, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects) {
|
void saveMap(const std::string &file, std::vector<mapColumnType> &objects) {
|
||||||
std::ofstream output_file;
|
std::ofstream output_file;
|
||||||
output_file.open(file, std::ios::out | std::ios::binary);
|
output_file.open(file, std::ios::out | std::ios::binary);
|
||||||
uint16_t cols = objects.size();
|
uint16_t cols = objects.size();
|
||||||
|
@ -4,8 +4,22 @@
|
|||||||
#include "../sdlpp/sdlpp_scene.hpp"
|
#include "../sdlpp/sdlpp_scene.hpp"
|
||||||
#include "../sdlpp/sdlpp_rectrenderer.hpp"
|
#include "../sdlpp/sdlpp_rectrenderer.hpp"
|
||||||
|
|
||||||
|
struct MapObject {
|
||||||
|
enum Index {
|
||||||
|
TERRAIN_TYPE = 0,
|
||||||
|
TERRAIN_ID = 1,
|
||||||
|
CHARACTER_TYPE = 2,
|
||||||
|
CHARACTER_ID = 3,
|
||||||
|
MODIFIER_TYPE = 4,
|
||||||
|
MODIFIER_DATA = 5,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t> mapObjectType;
|
||||||
|
typedef std::array<mapObjectType,16> mapColumnType;
|
||||||
|
|
||||||
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer);
|
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer);
|
||||||
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects);
|
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer, std::vector<mapColumnType> &objects);
|
||||||
void saveMap(const std::string &file, std::vector<std::array<std::tuple<uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t>,16>> &objects);
|
void saveMap(const std::string &file, std::vector<mapColumnType> &objects);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -85,8 +85,6 @@
|
|||||||
#define EDITOR_RIGHT_TOOL_ID 0xF008
|
#define EDITOR_RIGHT_TOOL_ID 0xF008
|
||||||
#define EDITOR_CHARACTER_ID 0xF009
|
#define EDITOR_CHARACTER_ID 0xF009
|
||||||
|
|
||||||
#define TOOL_VISITOR_TYPE 0xE001
|
|
||||||
#define MODIFIER_VISITOR_TYPE 0xE002
|
|
||||||
#define MOUSE_VISITOR_TYPE 0xE003
|
#define MOUSE_VISITOR_TYPE 0xE003
|
||||||
#define MARIO_VISITOR_TYPE 0xE004
|
#define MARIO_VISITOR_TYPE 0xE004
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user