the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 99 lines 2.7 kB view raw
1#include "stdafx.h" 2#include "PauseScreen.h" 3#include "Button.h" 4#include "StatsCounter.h" 5#include "OptionsScreen.h" 6#include "TitleScreen.h" 7#include "MultiPlayerLevel.h" 8#include "..\Minecraft.World\net.minecraft.locale.h" 9#include "..\Minecraft.World\net.minecraft.world.level.h" 10#include "..\Minecraft.World\net.minecraft.stats.h" 11#include "..\Minecraft.Client\LocalPlayer.h" 12 13PauseScreen::PauseScreen() 14{ 15 saveStep = 0; 16 visibleTime = 0; 17} 18 19void PauseScreen::init() 20{ 21 saveStep = 0; 22 buttons.clear(); 23 int yo = -16; 24 buttons.push_back(new Button(1, width / 2 - 100, height / 4 + 24 * 5 + yo, L"Save and quit to title")); 25 if (minecraft->isClientSide()) 26 { 27 buttons[0]->msg = L"Disconnect"; 28 } 29 30 31 buttons.push_back(new Button(4, width / 2 - 100, height / 4 + 24 * 1 + yo, L"LBack to game")); 32 buttons.push_back(new Button(0, width / 2 - 100, height / 4 + 24 * 4 + yo, L"LOptions...")); 33 34 buttons.push_back(new Button(5, width / 2 - 100, height / 4 + 24 * 2 + yo, 98, 20, I18n::get(L"gui.achievements"))); 35 buttons.push_back(new Button(6, width / 2 + 2, height / 4 + 24 * 2 + yo, 98, 20, I18n::get(L"gui.stats"))); 36 /* 37 * if (minecraft->serverConnection!=null) { buttons.get(1).active = 38 * false; buttons.get(2).active = false; buttons.get(3).active = false; 39 * } 40 */ 41 42} 43 44void PauseScreen::buttonClicked(Button button) 45{ 46 if (button.id == 0) 47 { 48 minecraft->setScreen(new OptionsScreen(this, minecraft->options)); 49 } 50 if (button.id == 1) 51 { 52 if (minecraft->isClientSide()) 53 { 54 minecraft->level->disconnect(); 55 } 56 57 minecraft->setLevel(NULL); 58 minecraft->setScreen(new TitleScreen()); 59 } 60 if (button.id == 4) 61 { 62 minecraft->setScreen(NULL); 63 // minecraft->grabMouse(); // 4J - removed 64 } 65 66 if (button.id == 5) 67 { 68// minecraft->setScreen(new AchievementScreen(minecraft->stats)); // 4J TODO - put back 69 } 70 if (button.id == 6) 71 { 72// minecraft->setScreen(new StatsScreen(this, minecraft->stats)); // 4J TODO - put back 73 } 74} 75 76void PauseScreen::tick() 77{ 78 Screen::tick(); 79 visibleTime++; 80} 81 82void PauseScreen::render(int xm, int ym, float a) 83{ 84 renderBackground(); 85 86 bool isSaving = false; //!minecraft->level->pauseSave(saveStep++); 87 if (isSaving || visibleTime < 20) 88 { 89 float col = ((visibleTime % 10) + a) / 10.0f; 90 col = Mth::sin(col * PI * 2) * 0.2f + 0.8f; 91 int br = (int) (255 * col); 92 93 drawString(font, L"Saving level..", 8, height - 16, br << 16 | br << 8 | br); 94 } 95 96 drawCenteredString(font, L"Game menu", width / 2, 40, 0xffffff); 97 98 Screen::render(xm, ym, a); 99}