mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
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>
This commit is contained in:
58
source/client/gui/screens/DeathScreen.cpp
Normal file
58
source/client/gui/screens/DeathScreen.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "DeathScreen.hpp"
|
||||
|
||||
DeathScreen::DeathScreen() :
|
||||
m_btnRespawn(1, "Respawn!"),
|
||||
m_btnTitle (2, "Main menu")
|
||||
{
|
||||
m_tickCounter = 0;
|
||||
}
|
||||
|
||||
void DeathScreen::init()
|
||||
{
|
||||
m_btnRespawn.m_width = m_btnTitle.m_width = m_width / 4;
|
||||
m_btnRespawn.m_xPos = m_width / 2 - 10 - m_btnRespawn.m_width;
|
||||
m_btnTitle.m_xPos = m_width / 2 + 10;
|
||||
|
||||
m_btnRespawn.m_yPos = m_btnTitle.m_yPos = m_height / 2;
|
||||
|
||||
m_buttons.push_back(&m_btnRespawn);
|
||||
m_buttons.push_back(&m_btnTitle);
|
||||
m_buttonTabList.push_back(&m_btnRespawn);
|
||||
m_buttonTabList.push_back(&m_btnTitle);
|
||||
}
|
||||
|
||||
void DeathScreen::buttonClicked(Button* pButton)
|
||||
{
|
||||
if (pButton->m_buttonId == m_btnRespawn.m_buttonId)
|
||||
{
|
||||
m_pMinecraft->m_pLocalPlayer->respawn();
|
||||
m_pMinecraft->setScreen(nullptr);
|
||||
}
|
||||
if (pButton->m_buttonId == m_btnTitle.m_buttonId)
|
||||
{
|
||||
m_pMinecraft->leaveGame(false);
|
||||
}
|
||||
}
|
||||
|
||||
void DeathScreen::tick()
|
||||
{
|
||||
m_tickCounter++;
|
||||
}
|
||||
|
||||
void DeathScreen::keyPressed(int key)
|
||||
{
|
||||
}
|
||||
|
||||
void DeathScreen::render(int x, int y, float f)
|
||||
{
|
||||
fillGradient(0, 0, m_width, m_height, 0xA0303080, 0x60000050);
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(2.0f, 2.0f, 2.0f);
|
||||
drawCenteredString(m_pFont, "You died!", m_width / 4, m_height / 8, 0xFFFFFF);
|
||||
glPopMatrix();
|
||||
|
||||
// render the buttons after 1.5 seconds
|
||||
if (m_tickCounter >= 30)
|
||||
Screen::render(x, y, f);
|
||||
}
|
||||
Reference in New Issue
Block a user