mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-18 17:08:07 +00:00
restructure codebase according to vcproj filters
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#include "../../../../../Minecraft.World/Header Files/stdafx.h"
|
||||
#include "RenameWorldScreen.h"
|
||||
#include "EditBox.h"
|
||||
#include "Button.h"
|
||||
#include "../../../../../Minecraft.World/net/minecraft/locale/net.minecraft.locale.h"
|
||||
#include "../../../../../Minecraft.World/net/minecraft/world/level/net.minecraft.world.level.h"
|
||||
#include "../../../../../Minecraft.World/net/minecraft/world/level/storage/net.minecraft.world.level.storage.h"
|
||||
|
||||
RenameWorldScreen::RenameWorldScreen(Screen* lastScreen,
|
||||
const std::wstring& levelId) {
|
||||
nameEdit = nullptr;
|
||||
this->lastScreen = lastScreen;
|
||||
this->levelId = levelId;
|
||||
}
|
||||
|
||||
void RenameWorldScreen::tick() { nameEdit->tick(); }
|
||||
|
||||
void RenameWorldScreen::init() {
|
||||
// 4J Stu - Removed this as we don't need the screen. Changed to how we pass
|
||||
// save data around stopped this compiling
|
||||
}
|
||||
|
||||
void RenameWorldScreen::removed() { Keyboard::enableRepeatEvents(false); }
|
||||
|
||||
void RenameWorldScreen::buttonClicked(Button* button) {
|
||||
if (!button->active) return;
|
||||
if (button->id == 1) {
|
||||
minecraft->setScreen(lastScreen);
|
||||
} else if (button->id == 0) {
|
||||
LevelStorageSource* levelSource = minecraft->getLevelSource();
|
||||
levelSource->renameLevel(levelId, trimString(nameEdit->getValue()));
|
||||
|
||||
minecraft->setScreen(lastScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void RenameWorldScreen::keyPressed(wchar_t ch, int eventKey) {
|
||||
nameEdit->keyPressed(ch, eventKey);
|
||||
buttons[0]->active = trimString(nameEdit->getValue()).length() > 0;
|
||||
|
||||
if (ch == 13) {
|
||||
buttonClicked(buttons[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void RenameWorldScreen::mouseClicked(int x, int y, int buttonNum) {
|
||||
Screen::mouseClicked(x, y, buttonNum);
|
||||
|
||||
nameEdit->mouseClicked(x, y, buttonNum);
|
||||
}
|
||||
|
||||
void RenameWorldScreen::render(int xm, int ym, float a) {
|
||||
Language* language = Language::getInstance();
|
||||
|
||||
// fill(0, 0, width, height, 0x40000000);
|
||||
renderBackground();
|
||||
|
||||
drawCenteredString(font, language->getElement(L"selectWorld.renameTitle"),
|
||||
width / 2, height / 4 - 60 + 20, 0xffffff);
|
||||
drawString(font, language->getElement(L"selectWorld.enterName"),
|
||||
width / 2 - 100, 47, 0xa0a0a0);
|
||||
|
||||
nameEdit->render();
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
}
|
||||
Reference in New Issue
Block a user