the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 55 lines 1.5 kB view raw
1#include "stdafx.h" 2#include "ConfirmScreen.h" 3#include "SmallButton.h" 4#include "..\Minecraft.World\net.minecraft.locale.h" 5 6ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, int id) 7{ 8 this->parent = parent; 9 this->title1 = title1; 10 this->title2 = title2; 11 this->id = id; 12 13 Language *language = Language::getInstance(); 14 yesButton = language->getElement(L"gui.yes"); 15 noButton = language->getElement(L"gui.no"); 16} 17 18ConfirmScreen::ConfirmScreen(Screen *parent, const wstring& title1, const wstring& title2, const wstring& yesButton, const wstring& noButton, int id) 19{ 20 this->parent = parent; 21 this->title1 = title1; 22 this->title2 = title2; 23 this->yesButton = yesButton; 24 this->noButton = noButton; 25 this->id = id; 26} 27 28void ConfirmScreen::init() 29{ 30 buttons.push_back(new SmallButton(0, width / 2 - 155 + 0 % 2 * 160, height / 6 + 24 * 4, yesButton)); 31 buttons.push_back(new SmallButton(1, width / 2 - 155 + 1 % 2 * 160, height / 6 + 24 * 4, noButton)); 32} 33 34void ConfirmScreen::buttonClicked(Button *button) 35{ 36 parent->confirmResult(button->id == 0, id); 37} 38 39void ConfirmScreen::render(int xm, int ym, float a) 40{ 41 renderBackground(); 42 43 drawCenteredString(font, title1, width / 2, 70, 0xffffff); 44 drawCenteredString(font, title2, width / 2, 90, 0xffffff); 45 46 Screen::render(xm, ym, a); 47 48 // 4J - debug code - remove 49 static int count = 0; 50 if( count++ == 100 ) 51 { 52 count = 0; 53 buttonClicked(buttons[0]); 54 } 55}