Files
MinecraftConsoles/Minecraft.Client/DisconnectedScreen.cpp
ModMaker101 a9be52c41a Project modernization (#630)
* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
2026-03-08 09:56:03 +07:00

56 lines
1.3 KiB
C++

#include "stdafx.h"
#include "DisconnectedScreen.h"
#include "TitleScreen.h"
#include "Button.h"
#include "..\Minecraft.World\net.minecraft.locale.h"
DisconnectedScreen::DisconnectedScreen(const wstring& title, const wstring reason, void *reasonObjects, ...)
{
Language *language = Language::getInstance();
this->title = language->getElement(title);
if (reasonObjects != nullptr)
{
this->reason = language->getElement(reason, reasonObjects);
}
else
{
this->reason = language->getElement(reason);
}
}
void DisconnectedScreen::tick()
{
}
void DisconnectedScreen::keyPressed(char eventCharacter, int eventKey)
{
}
void DisconnectedScreen::init()
{
Language *language = Language::getInstance();
buttons.clear();
buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 5 + 12, language->getElement(L"gui.toMenu")));
}
void DisconnectedScreen::buttonClicked(Button *button)
{
if (button->id == 0)
{
minecraft->setScreen(new TitleScreen());
}
}
void DisconnectedScreen::render(int xm, int ym, float a)
{
renderBackground();
drawCenteredString(font, title, width / 2, height / 2 - 50, 0xffffff);
drawCenteredString(font, reason, width / 2, height / 2 - 10, 0xffffff);
Screen::render(xm, ym, a);
}