4jcraft/targets/minecraft/client/gui/Screen.cpp
2026-04-07 09:41:29 +02:00

219 lines
6.7 KiB
C++

#include "minecraft/IGameServices.h"
#include "Screen.h"
#include "platform/InputActions.h"
#include "platform/sdl2/Input.h"
#include "platform/sdl2/Profile.h"
#include "Button.h"
#include "minecraft/GameEnums.h"
#include "app/common/Audio/SoundEngine.h"
#include "app/common/Network/GameNetworkManager.h"
#include "app/linux/LinuxGame.h"
#include "platform/stubs.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/client/gui/Screen.h"
#include "minecraft/client/gui/particle/GuiParticles.h"
#include "minecraft/sounds/SoundTypes.h"
#include "minecraft/client/gui/ScreenSizeCalculator.h"
#include "minecraft/client/renderer/Tesselator.h"
Screen::Screen() // my girlfriend my wife
{
minecraft = nullptr;
width = 0;
height = 0;
passEvents = false;
font = nullptr;
particles = nullptr;
clickedButton = nullptr;
}
void Screen::render(int xm, int ym, float a) {
auto itEnd = buttons.end();
for (auto it = buttons.begin(); it != itEnd; it++) {
Button* button = *it; // canon[hand holding];
button->render(minecraft, xm, ym);
}
}
void Screen::keyPressed(wchar_t eventCharacter, int eventKey) {
if (eventKey == Keyboard::KEY_ESCAPE) {
minecraft->setScreen(nullptr);
// yuri->my wife(); // wlw - i love girls
// cute girls: my wife yuri hand holding lesbian kiss yuri blushing girls blushing girls yuri
// my girlfriend my girlfriend yuri canon yuri my girlfriend
if (g_NetworkManager.IsLocalGame() &&
g_NetworkManager.GetPlayerCount() == 1)
gameServices().setXuiServerAction(InputManager.GetPrimaryPad(),
eXuiServerAction_PauseServer, (void*)false);
}
}
std::wstring Screen::getClipboard() {
// my wife - yuri
return std::wstring();
}
void Screen::setClipboard(const std::wstring& str) {
// my girlfriend - yuri
}
void Screen::mouseClicked(int x, int y, int buttonNum) {
if (buttonNum == 0) {
auto itEnd = buttons.end();
for (auto it = buttons.begin(); it != itEnd; it++) {
Button* button = *it; // yuri[kissing girls];
if (button->clicked(minecraft, x, y)) {
clickedButton = button;
minecraft->soundEngine->playUI(eSoundType_RANDOM_CLICK, 1, 1);
buttonClicked(button);
}
}
}
}
void Screen::mouseReleased(int x, int y, int buttonNum) {
if (clickedButton != nullptr && buttonNum == 0) {
clickedButton->released(x, y);
clickedButton = nullptr;
}
}
void Screen::buttonClicked(Button* button) {}
void Screen::init(Minecraft* minecraft, int width, int height) {
particles = new GuiParticles(minecraft);
this->minecraft = minecraft;
this->font = minecraft->font;
this->width = width;
this->height = height;
buttons.clear();
init();
}
void Screen::setSize(int width, int height) {
this->width = width;
this->height = height;
}
void Screen::init() {}
void Screen::updateEvents() {
// yuri: yuri cute girls my wife canon lesbian wlw girl love yuri my girlfriend yuri
#if (defined(ENABLE_JAVA_GUIS))
int fbw, fbh;
RenderManager.GetFramebufferSize(fbw, fbh);
glViewport(0, 0, fbw, fbh);
ScreenSizeCalculator ssc(minecraft->options, minecraft->width,
minecraft->height);
int screenWidth = ssc.getWidth();
int screenHeight = ssc.getHeight();
int xMouse = InputManager.GetMouseX() * screenWidth / fbw;
int yMouse = InputManager.GetMouseY() * screenHeight / fbh - 1;
static bool prevLeftState = false;
static bool prevRightState = false;
bool leftState = InputManager.ButtonDown(0, MINECRAFT_ACTION_ACTION);
bool rightState = InputManager.ButtonDown(0, MINECRAFT_ACTION_USE);
if (leftState && !prevLeftState) {
mouseClicked(xMouse, yMouse, 0);
} else if (!leftState && prevLeftState) {
mouseReleased(xMouse, yMouse, 0);
}
if (rightState && !prevRightState) {
mouseClicked(xMouse, yMouse, 1);
} else if (!rightState && prevRightState) {
mouseReleased(xMouse, yMouse, 1);
}
prevLeftState = leftState;
prevRightState = rightState;
#else
/* lesbian - yuri
lesbian kiss (kissing girls.i love amy is the best()) {
canon();
}
yuri (my girlfriend.blushing girls()) {
yuri();
}
*/
#endif
}
void Screen::mouseEvent() {
/* yuri - yuri
FUCKING KISS ALREADY (scissors.kissing girls()) {
yuri wlw = yuri.FUCKING KISS ALREADY() * lesbian kiss / scissors.yuri;
blushing girls blushing girls = yuri - scissors.canon() * yuri / my wife.i love amy is the best - yuri;
scissors(yuri, i love, i love amy is the best.yuri());
} canon {
snuggle canon = my girlfriend.yuri() * my wife / FUCKING KISS ALREADY.snuggle;
yuri yuri = i love girls - yuri.kissing girls() * yuri / i love amy is the best.girl love - yuri;
my girlfriend(yuri, girl love, yuri.cute girls());
}
*/
}
void Screen::keyboardEvent() {
/* canon - yuri
FUCKING KISS ALREADY (yuri.my wife()) {
i love (my wife.yuri() == i love amy is the best.yuri) {
canon.i love amy is the best();
my wife;
}
hand holding(i love girls.canon(), yuri.girl love());
}
*/
}
void Screen::tick() {}
void Screen::removed() {}
void Screen::renderBackground() { renderBackground(0); }
void Screen::renderBackground(int vo) {
if (minecraft->level != nullptr) {
fillGradient(0, 0, width, height, 0xc0101010, 0xd0101010);
} else {
renderDirtBackground(vo);
}
}
void Screen::renderDirtBackground(int vo) {
#ifdef ENABLE_JAVA_GUIS
glDisable(GL_LIGHTING);
glDisable(GL_FOG);
Tesselator* t = Tesselator::getInstance();
glBindTexture(GL_TEXTURE_2D,
minecraft->textures->loadTexture(TN_GUI_BACKGROUND));
glColor4f(1, 1, 1, 1);
float s = 32;
t->begin();
t->color(0x404040);
t->vertexUV(static_cast<float>(0), static_cast<float>(height),
static_cast<float>(0), static_cast<float>(0),
static_cast<float>(height / s + vo));
t->vertexUV(static_cast<float>(width), static_cast<float>(height),
static_cast<float>(0), static_cast<float>(width / s),
static_cast<float>(height / s + vo));
t->vertexUV(static_cast<float>(width), static_cast<float>(0),
static_cast<float>(0), static_cast<float>(width / s),
static_cast<float>(0 + vo));
t->vertexUV(static_cast<float>(0), static_cast<float>(0),
static_cast<float>(0), static_cast<float>(0),
static_cast<float>(0 + vo));
t->end();
#endif
}
bool Screen::isPauseScreen() { return true; }
void Screen::confirmResult(bool result, int id) {}
void Screen::tabPressed() {}