mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-19 22:43:32 +00:00
added needed missing files
This commit is contained in:
21
src/client/KeyMapping.h
Normal file
21
src/client/KeyMapping.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT__KeyMapping_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT__KeyMapping_H__
|
||||||
|
|
||||||
|
//package net.minecraft.client;
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class KeyMapping
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string name;
|
||||||
|
int key;
|
||||||
|
|
||||||
|
KeyMapping() {}
|
||||||
|
|
||||||
|
KeyMapping(const std::string& name_, int key_)
|
||||||
|
: name(name_),
|
||||||
|
key(key_)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT__KeyMapping_H__*/
|
||||||
63
src/client/gui/components/OptionsPane.cpp
Normal file
63
src/client/gui/components/OptionsPane.cpp
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#include "OptionsPane.h"
|
||||||
|
#include "OptionsGroup.h"
|
||||||
|
#include "OptionsItem.h"
|
||||||
|
#include "ImageButton.h"
|
||||||
|
#include "Slider.h"
|
||||||
|
#include "../../Minecraft.h"
|
||||||
|
|
||||||
|
OptionsPane::OptionsPane() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsPane::setupPositions() {
|
||||||
|
int currentHeight = y + 1;
|
||||||
|
for(std::vector<GuiElement*>::iterator it = children.begin(); it != children.end(); ++it ) {
|
||||||
|
(*it)->width = width;
|
||||||
|
(*it)->y = currentHeight;
|
||||||
|
(*it)->x = x;
|
||||||
|
currentHeight += (*it)->height + 1;
|
||||||
|
}
|
||||||
|
height = currentHeight;
|
||||||
|
super::setupPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
OptionsGroup& OptionsPane::createOptionsGroup( std::string label ) {
|
||||||
|
OptionsGroup* newGroup = new OptionsGroup(label);
|
||||||
|
children.push_back(newGroup);
|
||||||
|
// create and return a new group index
|
||||||
|
return *newGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsPane::createToggle( unsigned int group, std::string label, const Options::Option* option ) {
|
||||||
|
if(group > children.size()) return;
|
||||||
|
ImageDef def;
|
||||||
|
def.setSrc(IntRectangle(160, 206, 39, 20));
|
||||||
|
def.name = "gui/touchgui.png";
|
||||||
|
def.width = 39 * 0.7f;
|
||||||
|
def.height = 20 * 0.7f;
|
||||||
|
OptionButton* element = new OptionButton(option);
|
||||||
|
element->setImageDef(def, true);
|
||||||
|
OptionsItem* item = new OptionsItem(label, element);
|
||||||
|
((OptionsGroup*)children[group])->addChild(item);
|
||||||
|
setupPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsPane::createProgressSlider( Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, float progressMin/*=1.0f*/, float progressMax/*=1.0f */ ) {
|
||||||
|
if(group > children.size()) return;
|
||||||
|
Slider* element = new Slider(minecraft, option, progressMin, progressMax);
|
||||||
|
element->width = 100;
|
||||||
|
element->height = 20;
|
||||||
|
OptionsItem* item = new OptionsItem(label, element);
|
||||||
|
((OptionsGroup*)children[group])->addChild(item);
|
||||||
|
setupPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsPane::createStepSlider( Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, const std::vector<int>& stepVec ) {
|
||||||
|
if(group > children.size()) return;
|
||||||
|
Slider* element = new Slider(minecraft, option, stepVec);
|
||||||
|
element->width = 100;
|
||||||
|
element->height = 20;
|
||||||
|
OptionsItem* item = new OptionsItem(label, element);
|
||||||
|
((OptionsGroup*)children[group])->addChild(item);
|
||||||
|
setupPositions();
|
||||||
|
}
|
||||||
30
src/client/gui/components/OptionsPane.h
Normal file
30
src/client/gui/components/OptionsPane.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef ITEMPANE_H__
|
||||||
|
#define ITEMPANE_H__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "GuiElementContainer.h"
|
||||||
|
#include "../../../world/item/ItemInstance.h"
|
||||||
|
#include "../../../client/Options.h"
|
||||||
|
class Font;
|
||||||
|
class Textures;
|
||||||
|
class NinePatchLayer;
|
||||||
|
class ItemPane;
|
||||||
|
class OptionButton;
|
||||||
|
class Button;
|
||||||
|
class OptionsGroup;
|
||||||
|
class Slider;
|
||||||
|
class Minecraft;
|
||||||
|
class OptionsPane: public GuiElementContainer
|
||||||
|
{
|
||||||
|
typedef GuiElementContainer super;
|
||||||
|
public:
|
||||||
|
OptionsPane();
|
||||||
|
OptionsGroup& createOptionsGroup( std::string label );
|
||||||
|
void createToggle( unsigned int group, std::string label, const Options::Option* option );
|
||||||
|
void createProgressSlider(Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, float progressMin=1.0f, float progressMax=1.0f );
|
||||||
|
void createStepSlider(Minecraft* minecraft, unsigned int group, std::string label, const Options::Option* option, const std::vector<int>& stepVec );
|
||||||
|
void setupPositions();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*ITEMPANE_H__*/
|
||||||
24
src/client/gui/components/SmallButton.cpp
Normal file
24
src/client/gui/components/SmallButton.cpp
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#include "SmallButton.h"
|
||||||
|
|
||||||
|
SmallButton::SmallButton( int id, int x, int y, const std::string& msg )
|
||||||
|
: super(id, x, y, 150, 20, msg),
|
||||||
|
option(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SmallButton::SmallButton( int id, int x, int y, int width, int height, const std::string& msg )
|
||||||
|
: super(id, x, y, width, height, msg),
|
||||||
|
option(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
SmallButton::SmallButton( int id, int x, int y, Options::Option* item, const std::string& msg )
|
||||||
|
: super(id, x, y, 150, 20, msg),
|
||||||
|
option(item)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Options::Option* SmallButton::getOption()
|
||||||
|
{
|
||||||
|
return option;
|
||||||
|
}
|
||||||
23
src/client/gui/components/SmallButton.h
Normal file
23
src/client/gui/components/SmallButton.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__
|
||||||
|
|
||||||
|
//package net.minecraft.client.gui;
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "Button.h"
|
||||||
|
#include "../../Options.h"
|
||||||
|
|
||||||
|
class SmallButton: public Button
|
||||||
|
{
|
||||||
|
typedef Button super;
|
||||||
|
public:
|
||||||
|
SmallButton(int id, int x, int y, const std::string& msg);
|
||||||
|
SmallButton(int id, int x, int y, int width, int height, const std::string& msg);
|
||||||
|
SmallButton(int id, int x, int y, Options::Option* item, const std::string& msg);
|
||||||
|
|
||||||
|
Options::Option* getOption();
|
||||||
|
private:
|
||||||
|
Options::Option* option;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT_GUI_COMPONENTS__SmallButton_H__*/
|
||||||
26
src/client/gui/screens/BuyGameScreen.h
Normal file
26
src/client/gui/screens/BuyGameScreen.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__
|
||||||
|
|
||||||
|
#include "../Screen.h"
|
||||||
|
#include "../components/Button.h"
|
||||||
|
|
||||||
|
class BuyGameScreen: public Screen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BuyGameScreen() {}
|
||||||
|
virtual ~BuyGameScreen() {}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
void render(int xm, int ym, float a);
|
||||||
|
|
||||||
|
void buttonClicked(Button* button) {
|
||||||
|
//if (button->id == bQuit.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//Button bQuit;
|
||||||
|
//Button bBuyGame;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__BuyGameScreen_H__*/
|
||||||
107
src/client/gui/screens/InvalidLicenseScreen.h
Normal file
107
src/client/gui/screens/InvalidLicenseScreen.h
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#ifndef NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__
|
||||||
|
#define NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__
|
||||||
|
|
||||||
|
#include "../Screen.h"
|
||||||
|
#include "../components/Button.h"
|
||||||
|
#include "../../Minecraft.h"
|
||||||
|
#include "../../../LicenseCodes.h"
|
||||||
|
|
||||||
|
class InvalidLicenseScreen: public Screen
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
InvalidLicenseScreen(int id, bool hasBuyButton)
|
||||||
|
: _id(id),
|
||||||
|
_hasBuyButton(hasBuyButton),
|
||||||
|
_baseY(0),
|
||||||
|
bOk(0),
|
||||||
|
bBuy(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~InvalidLicenseScreen() {
|
||||||
|
delete bOk;
|
||||||
|
delete bBuy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void init() {
|
||||||
|
if (minecraft->useTouchscreen()) {
|
||||||
|
bOk = new Touch::TButton(1, "Ok");
|
||||||
|
bBuy = new Touch::TButton(2, "Buy");
|
||||||
|
} else {
|
||||||
|
bOk = new Button(1, "Ok");
|
||||||
|
bBuy = new Button(2, "Buy");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_hasBuyButton)
|
||||||
|
bOk->msg = "Quit";
|
||||||
|
|
||||||
|
if (!LicenseCodes::isOk(_id)) {
|
||||||
|
char buf[20] = {0};
|
||||||
|
sprintf(buf, "%d", _id);
|
||||||
|
|
||||||
|
desc1 = "License verification failed (error ";
|
||||||
|
desc1 += buf;
|
||||||
|
desc1 += ")";
|
||||||
|
desc2 = "Try again later.";
|
||||||
|
hint = "You need to be connected to the internet\n";
|
||||||
|
hint += "once while you start the game.";
|
||||||
|
}
|
||||||
|
|
||||||
|
buttons.push_back(bOk);
|
||||||
|
tabButtons.push_back(bOk);
|
||||||
|
|
||||||
|
if (_hasBuyButton) {
|
||||||
|
buttons.push_back(bBuy);
|
||||||
|
tabButtons.push_back(bBuy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setupPositions() {
|
||||||
|
_baseY = height/5 + 6;
|
||||||
|
//if (_hasBuyButton)
|
||||||
|
_baseY -= 24;
|
||||||
|
|
||||||
|
bOk->width = bBuy->width = 200;
|
||||||
|
bOk->x = bBuy->x = (width - bOk->width) / 2;
|
||||||
|
bBuy->y = _baseY + 84;
|
||||||
|
bOk->y = bBuy->y + bBuy->height + 4;
|
||||||
|
|
||||||
|
if (!_hasBuyButton)
|
||||||
|
bOk->y -= 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tick() {}
|
||||||
|
|
||||||
|
//void keyPressed(int eventKey) {}
|
||||||
|
|
||||||
|
void render(int xm, int ym, float a) {
|
||||||
|
renderDirtBackground(0);
|
||||||
|
drawCenteredString(minecraft->font, desc1, width/2, _baseY, 0xffffff);
|
||||||
|
drawCenteredString(minecraft->font, desc2, width/2, _baseY + 24, 0xffffff);
|
||||||
|
|
||||||
|
drawCenteredString(minecraft->font, hint, width/2, _baseY + 60, 0xffffff);
|
||||||
|
|
||||||
|
Screen::render(xm, ym, a);
|
||||||
|
}
|
||||||
|
|
||||||
|
void buttonClicked(Button* button) {
|
||||||
|
if (button->id == bOk->id) {
|
||||||
|
minecraft->quit();
|
||||||
|
}
|
||||||
|
if (button->id == bBuy->id) {
|
||||||
|
minecraft->platform()->buyGame();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private:
|
||||||
|
int _id;
|
||||||
|
std::string desc1;
|
||||||
|
std::string desc2;
|
||||||
|
std::string hint;
|
||||||
|
|
||||||
|
Button* bOk;
|
||||||
|
Button* bBuy;
|
||||||
|
bool _hasBuyButton;
|
||||||
|
int _baseY;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__InvalidLicenseScreen_H__*/
|
||||||
Reference in New Issue
Block a user