mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-17 20:10:23 +03:00
migrate ALMOST everything from source tree into client
This commit is contained in:
38
source/client/gui/screens/RenameMPLevelScreen.cpp
Normal file
38
source/client/gui/screens/RenameMPLevelScreen.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/********************************************************************
|
||||
Minecraft: Pocket Edition - Decompilation Project
|
||||
Copyright (C) 2023 iProgramInCpp
|
||||
|
||||
The following code is licensed under the BSD 1 clause license.
|
||||
SPDX-License-Identifier: BSD-1-Clause
|
||||
********************************************************************/
|
||||
|
||||
#include "RenameMPLevelScreen.hpp"
|
||||
#include "StartMenuScreen.hpp"
|
||||
|
||||
RenameMPLevelScreen::RenameMPLevelScreen(const std::string& levelName) : m_levelName(levelName)
|
||||
{
|
||||
}
|
||||
|
||||
void RenameMPLevelScreen::init()
|
||||
{
|
||||
m_pMinecraft->platform()->showDialog(AppPlatform::DLG_RENAME_MP_WORLD);
|
||||
m_pMinecraft->platform()->createUserInput();
|
||||
}
|
||||
|
||||
void RenameMPLevelScreen::render(int mouseX, int mouseY, float f)
|
||||
{
|
||||
int userInputStatus = m_pMinecraft->platform()->getUserInputStatus();
|
||||
if (userInputStatus < 0)
|
||||
return;
|
||||
|
||||
if (userInputStatus == 1)
|
||||
{
|
||||
std::vector<std::string> input = m_pMinecraft->platform()->getUserInput();
|
||||
if (input.size() > 0 && !input[0].empty())
|
||||
{
|
||||
m_pMinecraft->getLevelSource()->renameLevel(m_levelName, input[0]);
|
||||
}
|
||||
}
|
||||
|
||||
m_pMinecraft->setScreen(new StartMenuScreen);
|
||||
}
|
||||
Reference in New Issue
Block a user