|
|
|
@ -126,7 +126,8 @@ SceneStruct mainMenuScene;
|
|
|
|
|
std::shared_ptr<SDLPP::TextRenderer> global_test_text{};
|
|
|
|
|
std::string global_test_text_text{};
|
|
|
|
|
|
|
|
|
|
void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene, const std::string &filename);
|
|
|
|
|
void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene,
|
|
|
|
|
const std::string &filename);
|
|
|
|
|
|
|
|
|
|
void setFlag(uint64_t flag) {
|
|
|
|
|
global_vars.flags |= flag;
|
|
|
|
@ -249,7 +250,8 @@ void unsetToolColor() {
|
|
|
|
|
setToolColor("#FFFFFF00");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toolMoveUpdateButtons(Button *left, Button *right, int &cur_page, int &max_page, bool canAdd) {
|
|
|
|
|
void toolMoveUpdateButtons(Button *left, Button *right, int &cur_page,
|
|
|
|
|
int &max_page, bool canAdd) {
|
|
|
|
|
if (cur_page == 0) {
|
|
|
|
|
left->disable();
|
|
|
|
|
} else {
|
|
|
|
@ -289,19 +291,26 @@ void updateToolSelection(int prev_index, ToolType::Value type) {
|
|
|
|
|
cur_page = global_vars.tool.cur_page_tools;
|
|
|
|
|
multiplier = 2 * TOOLS_WIDTH;
|
|
|
|
|
tool_vec = &global_vars.tools;
|
|
|
|
|
toolMoveUpdateButtons(global_vars.tool.button_left_tools.get(), global_vars.tool.button_right_tools.get(), cur_page, global_vars.tool.max_page_tools, false);
|
|
|
|
|
toolMoveUpdateButtons(global_vars.tool.button_left_tools.get(),
|
|
|
|
|
global_vars.tool.button_right_tools.get(),
|
|
|
|
|
cur_page, global_vars.tool.max_page_tools, false);
|
|
|
|
|
break;
|
|
|
|
|
case ToolType::MOD:
|
|
|
|
|
cur_page = global_vars.tool.cur_page_mods;
|
|
|
|
|
multiplier = 2 * MOD_WIDTH;
|
|
|
|
|
tool_vec = &global_vars.mods;
|
|
|
|
|
toolMoveUpdateButtons(global_vars.tool.button_left_mods.get(), global_vars.tool.button_right_mods.get(), cur_page, global_vars.tool.max_page_mods, false);
|
|
|
|
|
toolMoveUpdateButtons(global_vars.tool.button_left_mods.get(),
|
|
|
|
|
global_vars.tool.button_right_mods.get(),
|
|
|
|
|
cur_page, global_vars.tool.max_page_mods, false);
|
|
|
|
|
break;
|
|
|
|
|
case ToolType::CHARACTER:
|
|
|
|
|
cur_page = global_vars.tool.cur_page_characters;
|
|
|
|
|
multiplier = 2 * CHARACTER_WIDTH;
|
|
|
|
|
tool_vec = &global_vars.characters;
|
|
|
|
|
toolMoveUpdateButtons(global_vars.tool.button_left_characters.get(), global_vars.tool.button_right_characters.get(), cur_page, global_vars.tool.max_page_characters, false);
|
|
|
|
|
toolMoveUpdateButtons(global_vars.tool.button_left_characters.get(),
|
|
|
|
|
global_vars.tool.button_right_characters.get(),
|
|
|
|
|
cur_page, global_vars.tool.max_page_characters,
|
|
|
|
|
false);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -568,7 +577,8 @@ void getMousePositionFlags(SDLPP::Scene &scene) {
|
|
|
|
|
scene.visitCollisions(*mouse, visitor);
|
|
|
|
|
if (visitor.getCurButton() != global_vars.mouse.cur_button_index) {
|
|
|
|
|
if (global_vars.mouse.cur_button_index != (uint64_t)-1) {
|
|
|
|
|
global_vars.buttons[global_vars.mouse.cur_button_index]->unsetHighlight();
|
|
|
|
|
global_vars.buttons[global_vars.mouse.cur_button_index]
|
|
|
|
|
->unsetHighlight();
|
|
|
|
|
}
|
|
|
|
|
if (visitor.getCurButton() != (uint64_t)-1) {
|
|
|
|
|
global_vars.buttons[visitor.getCurButton()]->setHighlight();
|
|
|
|
@ -591,11 +601,13 @@ void getMousePositionFlags(SDLPP::Scene &scene) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toolMoveLeft(Button *left, Button *right, int &cur_page, int &max_page, bool canAdd) {
|
|
|
|
|
void toolMoveLeft(Button *left, Button *right, int &cur_page, int &max_page,
|
|
|
|
|
bool canAdd) {
|
|
|
|
|
cur_page--;
|
|
|
|
|
toolMoveUpdateButtons(left, right, cur_page, max_page, canAdd);
|
|
|
|
|
}
|
|
|
|
|
void toolMoveRight(Button *left, Button *right, int &cur_page, int &max_page, bool canAdd) {
|
|
|
|
|
void toolMoveRight(Button *left, Button *right, int &cur_page, int &max_page,
|
|
|
|
|
bool canAdd) {
|
|
|
|
|
cur_page += 1;
|
|
|
|
|
toolMoveUpdateButtons(left, right, cur_page, max_page, canAdd);
|
|
|
|
|
}
|
|
|
|
@ -603,7 +615,8 @@ void toolMoveRight(Button *left, Button *right, int &cur_page, int &max_page, bo
|
|
|
|
|
void moveMapLeft(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
actual_input->scene->moveEverything(BLOCK_SIZE, 0);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(), global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(),
|
|
|
|
|
global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveMapRight(void *input, Button *caller) {
|
|
|
|
@ -612,55 +625,65 @@ void moveMapRight(void *input, Button *caller) {
|
|
|
|
|
global_vars.objects.resize(global_vars.objects.size() + 1);
|
|
|
|
|
global_vars.map.max_page++;
|
|
|
|
|
}
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller, global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller,
|
|
|
|
|
global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
actual_input->scene->moveEverything(-BLOCK_SIZE, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveToolsLeftButton(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(), global_vars.tool.cur_page_tools, global_vars.tool.max_page_tools, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools + 1,
|
|
|
|
|
ToolType::BLOCK);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(),
|
|
|
|
|
global_vars.tool.cur_page_tools,
|
|
|
|
|
global_vars.tool.max_page_tools, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools + 1, ToolType::BLOCK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveToolsRightButton(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller, global_vars.tool.cur_page_tools, global_vars.tool.max_page_tools, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools - 1,
|
|
|
|
|
ToolType::BLOCK);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller,
|
|
|
|
|
global_vars.tool.cur_page_tools,
|
|
|
|
|
global_vars.tool.max_page_tools, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools - 1, ToolType::BLOCK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveModsLeft(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(), global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools + 1,
|
|
|
|
|
ToolType::MOD);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(),
|
|
|
|
|
global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods,
|
|
|
|
|
false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools + 1, ToolType::MOD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveModsRight(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller, global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools - 1,
|
|
|
|
|
ToolType::MOD);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller,
|
|
|
|
|
global_vars.tool.cur_page_mods,
|
|
|
|
|
global_vars.tool.max_page_mods, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools - 1, ToolType::MOD);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveCharsLeft(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(), global_vars.tool.cur_page_characters, global_vars.tool.max_page_characters, false);
|
|
|
|
|
toolMoveLeft(caller, actual_input->other_button.get(),
|
|
|
|
|
global_vars.tool.cur_page_characters,
|
|
|
|
|
global_vars.tool.max_page_characters, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools + 1,
|
|
|
|
|
ToolType::CHARACTER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void moveCharsRight(void *input, Button *caller) {
|
|
|
|
|
auto actual_input = static_cast<moveStruct *>(input);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller, global_vars.tool.cur_page_characters, global_vars.tool.max_page_characters, false);
|
|
|
|
|
toolMoveRight(actual_input->other_button.get(), caller,
|
|
|
|
|
global_vars.tool.cur_page_characters,
|
|
|
|
|
global_vars.tool.max_page_characters, false);
|
|
|
|
|
updateToolSelection(global_vars.tool.cur_page_tools - 1,
|
|
|
|
|
ToolType::CHARACTER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mouseUpAction(uint64_t flags) {
|
|
|
|
|
if (MouseVisitor::button(flags)) {
|
|
|
|
|
global_vars.buttons[global_vars.mouse.cur_button_index]->performFunction();
|
|
|
|
|
global_vars.buttons[global_vars.mouse.cur_button_index]
|
|
|
|
|
->performFunction();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -782,7 +805,8 @@ void pollEvents(std::shared_ptr<SDLPP::Scene> &scene) {
|
|
|
|
|
if (!getFlag(TEXT_INPUT_FLAG)) {
|
|
|
|
|
handleKeyUp(event.key.keysym.sym, *scene);
|
|
|
|
|
} else {
|
|
|
|
|
if ( event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_RETURN ) {
|
|
|
|
|
if (event.key.keysym.sym == SDLK_ESCAPE ||
|
|
|
|
|
event.key.keysym.sym == SDLK_RETURN) {
|
|
|
|
|
SDL_StopTextInput();
|
|
|
|
|
unsetFlag(TEXT_INPUT_FLAG);
|
|
|
|
|
}
|
|
|
|
@ -790,13 +814,16 @@ void pollEvents(std::shared_ptr<SDLPP::Scene> &scene) {
|
|
|
|
|
break;
|
|
|
|
|
case SDL_KEYDOWN:
|
|
|
|
|
if (getFlag(TEXT_INPUT_FLAG)) {
|
|
|
|
|
if( event.key.keysym.sym == SDLK_BACKSPACE && !global_test_text_text.empty() ) {
|
|
|
|
|
if (event.key.keysym.sym == SDLK_BACKSPACE &&
|
|
|
|
|
!global_test_text_text.empty()) {
|
|
|
|
|
global_test_text_text.pop_back();
|
|
|
|
|
setFlag(TEXT_UPDATE_FLAG);
|
|
|
|
|
} else if( event.key.keysym.sym == SDLK_c && SDL_GetModState() & KMOD_CTRL ) {
|
|
|
|
|
} else if (event.key.keysym.sym == SDLK_c &&
|
|
|
|
|
SDL_GetModState() & KMOD_CTRL) {
|
|
|
|
|
// handle copy
|
|
|
|
|
SDL_SetClipboardText(global_test_text_text.c_str());
|
|
|
|
|
} else if( event.key.keysym.sym == SDLK_v && SDL_GetModState() & KMOD_CTRL ) {
|
|
|
|
|
} else if (event.key.keysym.sym == SDLK_v &&
|
|
|
|
|
SDL_GetModState() & KMOD_CTRL) {
|
|
|
|
|
// handle paste
|
|
|
|
|
global_test_text_text += SDL_GetClipboardText();
|
|
|
|
|
setFlag(TEXT_UPDATE_FLAG);
|
|
|
|
@ -1003,7 +1030,8 @@ void testButtonFunc(void */*UNUSED*/, Button */*UNUSED*/) {
|
|
|
|
|
SDL_StartTextInput();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene, const std::string &filename) {
|
|
|
|
|
void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene,
|
|
|
|
|
const std::string &filename) {
|
|
|
|
|
auto renderer = scene->getRendererShared();
|
|
|
|
|
auto font = std::make_shared<SDLPP::Font>("testfont.ttf", 36);
|
|
|
|
|
auto font_config = std::make_shared<SDLPP::FontConfiguration>(
|
|
|
|
@ -1019,8 +1047,8 @@ void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file
|
|
|
|
|
if (filename.empty()) {
|
|
|
|
|
loadEmptyMap(global_vars.objects, MAP_WIDTH);
|
|
|
|
|
} else {
|
|
|
|
|
loadMap(scene, global_vars.mario, "test_binary.bin", global_vars.objects,
|
|
|
|
|
true, MAP_WIDTH);
|
|
|
|
|
loadMap(scene, global_vars.mario, "test_binary.bin",
|
|
|
|
|
global_vars.objects, true, MAP_WIDTH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// map
|
|
|
|
@ -1064,15 +1092,17 @@ void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file
|
|
|
|
|
2, scene);
|
|
|
|
|
|
|
|
|
|
global_test_text = std::make_shared<SDLPP::TextRenderer>(
|
|
|
|
|
0.3, 0.05, BLOCK_SIZE*4, BLOCK_SIZE*2,
|
|
|
|
|
renderer, "TEST TEXT", font_config, SDLPP_TEXT_CENTER);
|
|
|
|
|
0.3, 0.05, BLOCK_SIZE * 4, BLOCK_SIZE * 2, renderer, "TEST TEXT",
|
|
|
|
|
font_config, SDLPP_TEXT_CENTER);
|
|
|
|
|
global_test_text->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
global_test_text->setPermanent();
|
|
|
|
|
scene->addObject(global_test_text);
|
|
|
|
|
|
|
|
|
|
global_vars.map.max_page = global_vars.objects.size() - MAP_WIDTH;
|
|
|
|
|
// arrowInputs[1] - rightMapInput, arrowInputs[0] - leftMapInput
|
|
|
|
|
toolMoveUpdateButtons(arrowInputs[1].other_button.get(), arrowInputs[0].other_button.get(), global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
toolMoveUpdateButtons(
|
|
|
|
|
arrowInputs[1].other_button.get(), arrowInputs[0].other_button.get(),
|
|
|
|
|
global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
|
|
|
|
|
auto mouse =
|
|
|
|
|
std::make_shared<SDLPP::RectangleRender>(0.01, 0.01, 0, 0, renderer);
|
|
|
|
@ -1129,7 +1159,8 @@ void openMapEditor(std::shared_ptr<SDLPP::Scene> &scene, const std::string &file
|
|
|
|
|
global_vars.tool.cur_page_characters = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<SDLPP::Scene> createEditorMainScene(std::shared_ptr<SDLPP::Renderer> &renderer) {
|
|
|
|
|
std::shared_ptr<SDLPP::Scene>
|
|
|
|
|
createEditorMainScene(std::shared_ptr<SDLPP::Renderer> &renderer) {
|
|
|
|
|
auto scene = std::make_shared<SDLPP::Scene>(renderer);
|
|
|
|
|
|
|
|
|
|
global_vars.tool.max_page_tools =
|
|
|
|
@ -1160,7 +1191,8 @@ std::shared_ptr<SDLPP::Scene> createEditorMainScene(std::shared_ptr<SDLPP::Rende
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
0, 1 - MAP_HEIGHT * BLOCK_SIZE, BLOCK_SIZE, MAP_HEIGHT * BLOCK_SIZE,
|
|
|
|
|
renderer, "<", default_button_theme, moveMapLeft, &left_map_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
// right map arrow
|
|
|
|
@ -1168,23 +1200,29 @@ std::shared_ptr<SDLPP::Scene> createEditorMainScene(std::shared_ptr<SDLPP::Rende
|
|
|
|
|
right_map_input.scene = scene;
|
|
|
|
|
right_map_input.other_button = global_vars.buttons.back();
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
(MAP_WIDTH + 1) * BLOCK_SIZE, 1 - MAP_HEIGHT * BLOCK_SIZE, BLOCK_SIZE, MAP_HEIGHT * BLOCK_SIZE,
|
|
|
|
|
renderer, ">", default_button_theme, moveMapRight, &right_map_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
(MAP_WIDTH + 1) * BLOCK_SIZE, 1 - MAP_HEIGHT * BLOCK_SIZE, BLOCK_SIZE,
|
|
|
|
|
MAP_HEIGHT * BLOCK_SIZE, renderer, ">", default_button_theme,
|
|
|
|
|
moveMapRight, &right_map_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
left_map_input.other_button = global_vars.buttons.back();
|
|
|
|
|
// ensure disabled/enabled properly
|
|
|
|
|
toolMoveUpdateButtons(right_map_input.other_button.get(), global_vars.buttons.back().get(), global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
toolMoveUpdateButtons(
|
|
|
|
|
right_map_input.other_button.get(), global_vars.buttons.back().get(),
|
|
|
|
|
global_vars.map.cur_page, global_vars.map.max_page, true);
|
|
|
|
|
|
|
|
|
|
// left tool arrow
|
|
|
|
|
auto &left_tool_input = arrowInputs[2];
|
|
|
|
|
left_tool_input.scene = scene;
|
|
|
|
|
left_tool_input.other_button = nullptr;
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
(MAP_WIDTH - TOOLS_WIDTH - 1) * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
|
|
|
|
renderer, "<", default_button_theme, moveToolsLeftButton, &left_tool_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
(MAP_WIDTH - TOOLS_WIDTH - 1) * BLOCK_SIZE,
|
|
|
|
|
1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, renderer,
|
|
|
|
|
"<", default_button_theme, moveToolsLeftButton, &left_tool_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
global_vars.tool.button_left_tools = global_vars.buttons.back();
|
|
|
|
@ -1193,24 +1231,31 @@ std::shared_ptr<SDLPP::Scene> createEditorMainScene(std::shared_ptr<SDLPP::Rende
|
|
|
|
|
right_tool_input.scene = scene;
|
|
|
|
|
right_tool_input.other_button = global_vars.buttons.back();
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
MAP_WIDTH * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
|
|
|
|
renderer, ">", default_button_theme, moveToolsRightButton, &right_tool_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
MAP_WIDTH * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE,
|
|
|
|
|
2 * BLOCK_SIZE, renderer, ">", default_button_theme,
|
|
|
|
|
moveToolsRightButton, &right_tool_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
left_tool_input.other_button = global_vars.buttons.back();
|
|
|
|
|
global_vars.tool.button_right_tools = global_vars.buttons.back();
|
|
|
|
|
// ensure disabled/enabled properly
|
|
|
|
|
toolMoveUpdateButtons(right_tool_input.other_button.get(), global_vars.buttons.back().get(), global_vars.tool.cur_page_tools, global_vars.tool.max_page_tools, false);
|
|
|
|
|
toolMoveUpdateButtons(right_tool_input.other_button.get(),
|
|
|
|
|
global_vars.buttons.back().get(),
|
|
|
|
|
global_vars.tool.cur_page_tools,
|
|
|
|
|
global_vars.tool.max_page_tools, false);
|
|
|
|
|
|
|
|
|
|
// left mod arrow
|
|
|
|
|
auto &left_mod_input = arrowInputs[4];
|
|
|
|
|
left_mod_input.scene = scene;
|
|
|
|
|
left_mod_input.other_button = nullptr;
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
4 * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
|
|
|
|
renderer, "<", default_button_theme, moveModsLeft, &left_mod_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
4 * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE,
|
|
|
|
|
2 * BLOCK_SIZE, renderer, "<", default_button_theme, moveModsLeft,
|
|
|
|
|
&left_mod_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
global_vars.tool.button_left_mods = global_vars.buttons.back();
|
|
|
|
@ -1219,24 +1264,30 @@ std::shared_ptr<SDLPP::Scene> createEditorMainScene(std::shared_ptr<SDLPP::Rende
|
|
|
|
|
right_mod_input.scene = scene;
|
|
|
|
|
right_mod_input.other_button = global_vars.buttons.back();
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
(MOD_WIDTH + 5) * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
|
|
|
|
renderer, ">", default_button_theme, moveModsRight, &right_mod_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
(MOD_WIDTH + 5) * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE,
|
|
|
|
|
BLOCK_SIZE, 2 * BLOCK_SIZE, renderer, ">", default_button_theme,
|
|
|
|
|
moveModsRight, &right_mod_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
left_mod_input.other_button = global_vars.buttons.back();
|
|
|
|
|
global_vars.tool.button_right_mods = global_vars.buttons.back();
|
|
|
|
|
// ensure disabled/enabled properly
|
|
|
|
|
toolMoveUpdateButtons(right_mod_input.other_button.get(), global_vars.buttons.back().get(), global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods, false);
|
|
|
|
|
toolMoveUpdateButtons(
|
|
|
|
|
right_mod_input.other_button.get(), global_vars.buttons.back().get(),
|
|
|
|
|
global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods, false);
|
|
|
|
|
|
|
|
|
|
// left character arrow
|
|
|
|
|
auto &left_character_input = arrowInputs[6];
|
|
|
|
|
left_character_input.scene = scene;
|
|
|
|
|
left_character_input.other_button = nullptr;
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
(MOD_WIDTH + 7) * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
|
|
|
|
renderer, "<", default_button_theme, moveCharsLeft, &left_character_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
(MOD_WIDTH + 7) * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE,
|
|
|
|
|
BLOCK_SIZE, 2 * BLOCK_SIZE, renderer, "<", default_button_theme,
|
|
|
|
|
moveCharsLeft, &left_character_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
global_vars.tool.button_left_characters = global_vars.buttons.back();
|
|
|
|
@ -1245,17 +1296,24 @@ std::shared_ptr<SDLPP::Scene> createEditorMainScene(std::shared_ptr<SDLPP::Rende
|
|
|
|
|
right_character_input.scene = scene;
|
|
|
|
|
right_character_input.other_button = global_vars.buttons.back();
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
(MOD_WIDTH + 8 + CHARACTER_WIDTH) * BLOCK_SIZE, 1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
|
|
|
|
renderer, ">", default_button_theme, moveCharsRight, &right_character_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER);
|
|
|
|
|
(MOD_WIDTH + 8 + CHARACTER_WIDTH) * BLOCK_SIZE,
|
|
|
|
|
1 - (MAP_HEIGHT + 3) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, renderer,
|
|
|
|
|
">", default_button_theme, moveCharsRight, &right_character_input));
|
|
|
|
|
global_vars.buttons.back()->setAlignment(SDLPP::OBJ_CENTER,
|
|
|
|
|
SDLPP::OBJ_CENTER);
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
global_vars.tool.button_right_characters = global_vars.buttons.back();
|
|
|
|
|
// ensure disabled/enabled properly
|
|
|
|
|
toolMoveUpdateButtons(right_character_input.other_button.get(), global_vars.buttons.back().get(), global_vars.tool.cur_page_characters, global_vars.tool.max_page_characters, false);
|
|
|
|
|
toolMoveUpdateButtons(right_character_input.other_button.get(),
|
|
|
|
|
global_vars.buttons.back().get(),
|
|
|
|
|
global_vars.tool.cur_page_characters,
|
|
|
|
|
global_vars.tool.max_page_characters, false);
|
|
|
|
|
left_character_input.other_button = global_vars.buttons.back();
|
|
|
|
|
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(0, 0, 0.2, 0.2, renderer, "Write Button", default_button_theme, testButtonFunc, nullptr));
|
|
|
|
|
global_vars.buttons.emplace_back(std::make_shared<Button>(
|
|
|
|
|
0, 0, 0.2, 0.2, renderer, "Write Button", default_button_theme,
|
|
|
|
|
testButtonFunc, nullptr));
|
|
|
|
|
global_vars.buttons.back()->setPermanent();
|
|
|
|
|
global_vars.buttons.back()->setButtonIndex(global_vars.buttons.size() - 1);
|
|
|
|
|
|
|
|
|
|