Files
mcpe/source/client/gui/screens/InvalidLicenseScreen.cpp
iProgramInCpp 9a24abc603 Improve Survival Mode + others (#56)
* * Undo some of the changes done in the "* Work on survival mode." commit.
* TEST_SURVIVAL_MODE is now on by default.

* * Dying no longer crashes the game.

* * Death seems to work ok.

* * Improve some of the damage code.

* x

* work

* Fixed the Makefile (#54)

* * Finally fix the crack texture appearing to flicker/restart

* * Add VS2010 as an optional target.

Fix build with VS2010 (both windows_vs and xenon_vs).

* * Disable survival mode. Getting ready to merge now!

---------

Co-authored-by: Alexander Argentakis <38327951+MFDGaming@users.noreply.github.com>
2023-08-16 22:32:09 +03:00

71 lines
1.7 KiB
C++

/********************************************************************
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 "InvalidLicenseScreen.hpp"
InvalidLicenseScreen::InvalidLicenseScreen(int error, bool bHasQuitButton) :
m_error(error),
m_btnOk (1, "Ok"),
m_btnBuy(2, "Buy"),
m_bHasQuitButton(bHasQuitButton),
field_E4(0)
{
if (bHasQuitButton)
m_btnOk.m_text = "Quit";
}
void InvalidLicenseScreen::buttonClicked(Button* pButton)
{
if (pButton->m_buttonId == m_btnOk.m_buttonId)
{
m_pMinecraft->quit();
}
if (pButton->m_buttonId == m_btnBuy.m_buttonId)
{
m_pMinecraft->platform()->buyGame();
}
}
void InvalidLicenseScreen::init()
{
field_E4 = m_height / 3;
if (m_bHasQuitButton)
field_E4 -= 24;
if (m_error > 1)
{
char str[20] = { 0 };
sprintf(str, "%d", m_error);
m_textLine1 = "License verification failed (error " + std::string(str) + ")";
m_textLine2 = "Try again later.";
}
m_btnOk.m_xPos = m_btnBuy.m_xPos = (m_width - m_btnOk.m_width) / 2;
m_btnOk.m_yPos = field_E4 + 60;
m_btnBuy.m_yPos = field_E4 + 88;
m_buttons.push_back(&m_btnOk);
m_buttons.push_back(&m_btnBuy);
m_buttonTabList.push_back(&m_btnOk);
m_buttonTabList.push_back(&m_btnBuy);
}
void InvalidLicenseScreen::tick()
{
}
void InvalidLicenseScreen::render(int mouseX, int mouseY, float f)
{
renderDirtBackground(0);
drawCenteredString(m_pMinecraft->m_pFont, m_textLine1, m_width / 2, field_E4, 0xFFFFFF);
drawCenteredString(m_pMinecraft->m_pFont, m_textLine2, m_width / 2, field_E4 + 24, 0xFFFFFF);
Screen::render(mouseX, mouseY, f);
}