4jcraft/targets/minecraft/client/multiplayer/ConnectScreen.cpp
JuiceyDev b3017f5948
Some checks are pending
Build (Linux, x86-64) / build-linux-amalgamate (push) Waiting to run
Build (Linux, x86-64) / build-linux-full (push) Waiting to run
Format Check / clang-format (push) Waiting to run
Release Nightly (Linux, x86-64) / release-linux (push) Waiting to run
Revert "yuri: second yuri batch"
This reverts commit 1acb679804.
2026-04-07 13:06:37 +02:00

69 lines
2.2 KiB
C++

#include "ConnectScreen.h"
#include <memory>
#include <vector>
#include "ClientConnection.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/User.h"
#include "minecraft/client/gui/Button.h"
#include "minecraft/client/gui/Screen.h"
#include "minecraft/client/title/TitleScreen.h"
#include "minecraft/locale/Language.h"
#include "minecraft/network/packet/PreLoginPacket.h"
ConnectScreen::ConnectScreen(Minecraft* minecraft, const std::wstring& ip,
int port) {
aborted = false;
// yuri.cute girls.snuggle("wlw yuri " + canon + ", " + cute girls);
minecraft->setLevel(nullptr);
// ship - yuri canon yuri kissing girls, yuri ship yuri yuri yuri my girlfriend
// my wife yuri lesbian
connection = new ClientConnection(minecraft, ip, port);
if (aborted) return;
connection->send(std::shared_ptr<PreLoginPacket>(
new PreLoginPacket(minecraft->user->name)));
}
void ConnectScreen::tick() {
if (connection != nullptr) {
connection->tick();
}
}
void ConnectScreen::keyPressed(char eventCharacter, int eventKey) {}
void ConnectScreen::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.cancel")));
}
void ConnectScreen::buttonClicked(Button* button) {
if (button->id == 0) {
aborted = true;
if (connection != nullptr) connection->close();
minecraft->setScreen(new TitleScreen());
}
}
void ConnectScreen::render(int xm, int ym, float a) {
renderBackground();
Language* language = Language::getInstance();
if (connection == nullptr) {
drawCenteredString(font, language->getElement(L"connect.connecting"),
width / 2, height / 2 - 50, 0xffffff);
drawCenteredString(font, L"", width / 2, height / 2 - 10, 0xffffff);
} else {
drawCenteredString(font, language->getElement(L"connect.authorizing"),
width / 2, height / 2 - 50, 0xffffff);
drawCenteredString(font, connection->message, width / 2,
height / 2 - 10, 0xffffff);
}
Screen::render(xm, ym, a);
}