the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "..\Minecraft.World\StringHelpers.h"
3#include "DeathScreen.h"
4#include "Button.h"
5#include "MultiplayerLocalPlayer.h"
6#include "TitleScreen.h"
7
8void DeathScreen::init()
9{
10 buttons.clear();
11 buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 3, L"Respawn"));
12 buttons.push_back(new Button(2, width / 2 - 100, height / 4 + 24 * 4, L"Title menu"));
13
14 if (minecraft->user == NULL)
15 {
16 buttons[1]->active = false;
17 }
18}
19
20void DeathScreen::keyPressed(char eventCharacter, int eventKey)
21{
22}
23
24void DeathScreen::buttonClicked(Button *button)
25{
26 if (button->id == 0)
27 {
28 // minecraft.setScreen(new OptionsScreen(this, minecraft.options));
29 }
30 if (button->id == 1)
31 {
32 minecraft->player->respawn();
33 minecraft->setScreen(NULL);
34 // minecraft.setScreen(new NewLevelScreen(this));
35 }
36 if (button->id == 2)
37 {
38 minecraft->setLevel(NULL);
39 minecraft->setScreen(new TitleScreen());
40 }
41}
42
43void DeathScreen::render(int xm, int ym, float a)
44{
45 fillGradient(0, 0, width, height, 0x60500000, 0xa0803030);
46
47 glPushMatrix();
48 glScalef(2, 2, 2);
49 drawCenteredString(font, L"Game over!", width / 2 / 2, 60 / 2, 0xffffff);
50 glPopMatrix();
51 drawCenteredString(font, L"Score: &e" + _toString( minecraft->player->getScore() ), width / 2, 100, 0xffffff);
52
53 Screen::render(xm, ym, a);
54
55 // 4J - debug code - remove
56 static int count = 0;
57 if( count++ == 100 )
58 {
59 count = 0;
60 buttonClicked(buttons[0]);
61 }
62}
63
64bool DeathScreen::isPauseScreen()
65{
66 return false;
67}