mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-19 22:43:32 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main'
This commit is contained in:
@@ -130,6 +130,9 @@ public:
|
|||||||
virtual void openURL(const std::string& url) {
|
virtual void openURL(const std::string& url) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
#elif __linux__
|
||||||
|
std::string command = "xdg-open " + url;
|
||||||
|
system(command.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -864,6 +864,10 @@ void Minecraft::tickInput() {
|
|||||||
|
|
||||||
static bool prevMouseDownLeft = false;
|
static bool prevMouseDownLeft = false;
|
||||||
|
|
||||||
|
if (Mouse::getButtonState(MouseAction::ACTION_LEFT) == 0) {
|
||||||
|
gameMode->stopDestroyBlock();
|
||||||
|
}
|
||||||
|
|
||||||
if (useTouchscreen()) {
|
if (useTouchscreen()) {
|
||||||
// Touch: gesture recognizer classifies the action type (turn/destroy/build)
|
// Touch: gesture recognizer classifies the action type (turn/destroy/build)
|
||||||
BuildActionIntention bai;
|
BuildActionIntention bai;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "../../Minecraft.h"
|
#include "../../Minecraft.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
#include "../components/ImageButton.h"
|
#include "../components/ImageButton.h"
|
||||||
|
#include "platform/input/Mouse.h"
|
||||||
|
|
||||||
CreditsScreen::CreditsScreen()
|
CreditsScreen::CreditsScreen()
|
||||||
: bHeader(NULL), btnBack(NULL)
|
: bHeader(NULL), btnBack(NULL)
|
||||||
@@ -65,11 +66,16 @@ void CreditsScreen::tick() {
|
|||||||
if (_scrollY + totalHeight < 0) {
|
if (_scrollY + totalHeight < 0) {
|
||||||
_scrollY = height;
|
_scrollY = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Mouse::isButtonDown(MouseAction::ACTION_LEFT)) {
|
||||||
|
_scrollSpeed = 1.5f;
|
||||||
|
} else {
|
||||||
|
_scrollSpeed = 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreditsScreen::render(int xm, int ym, float a) {
|
void CreditsScreen::render(int xm, int ym, float a) {
|
||||||
renderBackground();
|
renderBackground();
|
||||||
super::render(xm, ym, a);
|
|
||||||
int w = width;
|
int w = width;
|
||||||
Font* font = minecraft->font;
|
Font* font = minecraft->font;
|
||||||
float y = _scrollY;
|
float y = _scrollY;
|
||||||
@@ -87,6 +93,8 @@ void CreditsScreen::render(int xm, int ym, float a) {
|
|||||||
}
|
}
|
||||||
y += lineHeight;
|
y += lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super::render(xm, ym, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreditsScreen::buttonClicked(Button* button) {
|
void CreditsScreen::buttonClicked(Button* button) {
|
||||||
|
|||||||
0
src/client/gui/screens/JoinByIPScreen.h
Normal file
0
src/client/gui/screens/JoinByIPScreen.h
Normal file
@@ -77,8 +77,8 @@ void OptionsScreen::init() {
|
|||||||
categoryButtons.push_back(new Touch::TButton(4, "Controls"));
|
categoryButtons.push_back(new Touch::TButton(4, "Controls"));
|
||||||
categoryButtons.push_back(new Touch::TButton(5, "Graphics"));
|
categoryButtons.push_back(new Touch::TButton(5, "Graphics"));
|
||||||
|
|
||||||
btnChangeUsername = new Button(10, "Username");
|
btnChangeUsername = new Touch::TButton(10, "Username");
|
||||||
btnCredits = new Button(11, "Credits");
|
btnCredits = new Touch::TButton(11, "Credits");
|
||||||
|
|
||||||
buttons.push_back(bHeader);
|
buttons.push_back(bHeader);
|
||||||
buttons.push_back(btnClose);
|
buttons.push_back(btnClose);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
UsernameScreen::UsernameScreen()
|
UsernameScreen::UsernameScreen()
|
||||||
: _btnDone(0, "Done"),
|
: _btnDone(0, "Done"),
|
||||||
_input(""),
|
tUsername(0, "Username"),
|
||||||
_cursorBlink(0)
|
_cursorBlink(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -23,54 +23,64 @@ void UsernameScreen::init()
|
|||||||
_input = "";
|
_input = "";
|
||||||
_btnDone.active = false; // disabled until name typed
|
_btnDone.active = false; // disabled until name typed
|
||||||
buttons.push_back(&_btnDone);
|
buttons.push_back(&_btnDone);
|
||||||
|
tabButtons.push_back(&_btnDone);
|
||||||
|
textBoxes.push_back(&tUsername);
|
||||||
setupPositions();
|
setupPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameScreen::setupPositions()
|
void UsernameScreen::setupPositions()
|
||||||
{
|
{
|
||||||
|
int cx = width / 2;
|
||||||
|
int cy = height / 2;
|
||||||
|
|
||||||
_btnDone.width = 120;
|
_btnDone.width = 120;
|
||||||
_btnDone.height = 20;
|
_btnDone.height = 20;
|
||||||
_btnDone.x = (width - _btnDone.width) / 2;
|
_btnDone.x = (width - _btnDone.width) / 2;
|
||||||
_btnDone.y = height / 2 + 52;
|
_btnDone.y = height / 2 + 52;
|
||||||
|
|
||||||
|
tUsername.x = _btnDone.x;
|
||||||
|
tUsername.y = _btnDone.y - 60;
|
||||||
|
tUsername.width = 120;
|
||||||
|
tUsername.height = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameScreen::tick()
|
void UsernameScreen::tick()
|
||||||
{
|
{
|
||||||
_cursorBlink++;
|
for (auto* tb : textBoxes)
|
||||||
|
tb->tick(minecraft);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameScreen::keyPressed(int eventKey)
|
void UsernameScreen::keyPressed(int eventKey)
|
||||||
{
|
{
|
||||||
if (eventKey == Keyboard::KEY_BACKSPACE) {
|
if (eventKey == Keyboard::KEY_RETURN) {
|
||||||
if (!_input.empty())
|
if (!tUsername.text.empty())
|
||||||
_input.erase(_input.size() - 1, 1);
|
|
||||||
} else if (eventKey == Keyboard::KEY_RETURN) {
|
|
||||||
if (!_input.empty())
|
|
||||||
buttonClicked(&_btnDone);
|
buttonClicked(&_btnDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
// deliberately do NOT call super::keyPressed — that would close the screen on Escape
|
// deliberately do NOT call super::keyPressed — that would close the screen on Escape
|
||||||
_btnDone.active = !_input.empty();
|
_btnDone.active = !tUsername.text.empty();
|
||||||
|
|
||||||
|
Screen::keyPressed(eventKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameScreen::keyboardNewChar(char inputChar)
|
void UsernameScreen::keyboardNewChar(char inputChar)
|
||||||
{
|
{
|
||||||
if (_input.size() < 16 && inputChar >= 32 && inputChar < 127)
|
for (auto* tb : textBoxes) tb->handleChar(inputChar);
|
||||||
_input += inputChar;
|
|
||||||
_btnDone.active = !_input.empty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameScreen::mouseClicked(int x, int y, int button)
|
void UsernameScreen::mouseClicked(int x, int y, int button)
|
||||||
{
|
{
|
||||||
int cx = width / 2;
|
int lvlTop = tUsername.y - (Font::DefaultLineHeight + 4);
|
||||||
int cy = height / 2;
|
int lvlBottom = tUsername.y + tUsername.height;
|
||||||
int boxW = 160;
|
int lvlLeft = tUsername.x;
|
||||||
int boxH = 18;
|
int lvlRight = tUsername.x + tUsername.width;
|
||||||
int boxX = cx - boxW / 2;
|
bool clickedLevel = x >= lvlLeft && x < lvlRight && y >= lvlTop && y < lvlBottom;
|
||||||
int boxY = cy - 5;
|
|
||||||
if (x >= boxX && x <= boxX + boxW && y >= boxY && y <= boxY + boxH) {
|
if (clickedLevel) {
|
||||||
minecraft->platform()->showKeyboard();
|
tUsername.setFocus(minecraft);
|
||||||
} else {
|
} else {
|
||||||
super::mouseClicked(x, y, button);
|
// click outside both fields -> blur both
|
||||||
|
tUsername.loseFocus(minecraft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,10 +91,10 @@ void UsernameScreen::removed()
|
|||||||
|
|
||||||
void UsernameScreen::buttonClicked(Button* button)
|
void UsernameScreen::buttonClicked(Button* button)
|
||||||
{
|
{
|
||||||
if (button == &_btnDone && !_input.empty()) {
|
if (button == &_btnDone && !tUsername.text.empty()) {
|
||||||
minecraft->options.username = _input;
|
minecraft->options.username = tUsername.text;
|
||||||
minecraft->options.save();
|
minecraft->options.save();
|
||||||
minecraft->user->name = _input;
|
minecraft->user->name = tUsername.text;
|
||||||
minecraft->setScreen(NULL); // goes to StartMenuScreen
|
minecraft->setScreen(NULL); // goes to StartMenuScreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,23 +115,8 @@ void UsernameScreen::render(int xm, int ym, float a)
|
|||||||
drawCenteredString(font, "identify you in chat. Don't worry, you can", cx, cy - 40, 0xffaaaaaa);
|
drawCenteredString(font, "identify you in chat. Don't worry, you can", cx, cy - 40, 0xffaaaaaa);
|
||||||
drawCenteredString(font, "change it anytime.", cx, cy - 28, 0xffaaaaaa);
|
drawCenteredString(font, "change it anytime.", cx, cy - 28, 0xffaaaaaa);
|
||||||
|
|
||||||
// Input box background
|
// // Hint below box
|
||||||
int boxW = 160;
|
// drawCenteredString(font, "Max 16 characters", cx, cy + 20, 0xff808080);
|
||||||
int boxH = 18;
|
|
||||||
int boxX = cx - boxW / 2;
|
|
||||||
int boxY = cy - 5;
|
|
||||||
fill(boxX - 1, boxY - 1, boxX + boxW + 1, boxY + boxH + 1, 0xff000000);
|
|
||||||
fill(boxX, boxY, boxX + boxW, boxY + boxH, 0xff202020);
|
|
||||||
|
|
||||||
// Build display string with cursor
|
|
||||||
std::string display = _input;
|
|
||||||
if ((_cursorBlink / 10) % 2 == 0)
|
|
||||||
display += '|';
|
|
||||||
|
|
||||||
font->draw(display, (float)(boxX + 4), (float)(boxY + (boxH - 8) / 2 + 1), 0xffffffff, false);
|
|
||||||
|
|
||||||
// Hint below box
|
|
||||||
drawCenteredString(font, "Max 16 characters", cx, cy + 20, 0xff808080);
|
|
||||||
|
|
||||||
// Buttons (Done)
|
// Buttons (Done)
|
||||||
super::render(xm, ym, a);
|
super::render(xm, ym, a);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "../Screen.h"
|
#include "../Screen.h"
|
||||||
#include "../components/Button.h"
|
#include "../components/Button.h"
|
||||||
|
#include "client/gui/components/TextBox.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class UsernameScreen : public Screen
|
class UsernameScreen : public Screen
|
||||||
@@ -30,6 +31,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Button _btnDone;
|
Button _btnDone;
|
||||||
|
TextBox tUsername;
|
||||||
std::string _input;
|
std::string _input;
|
||||||
int _cursorBlink;
|
int _cursorBlink;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ void AvailableGamesList::renderItem( int i, int x, int y, int h, Tesselator& t )
|
|||||||
JoinGameScreen::JoinGameScreen()
|
JoinGameScreen::JoinGameScreen()
|
||||||
: bJoin( 2, "Join Game"),
|
: bJoin( 2, "Join Game"),
|
||||||
bBack( 3, "Back"),
|
bBack( 3, "Back"),
|
||||||
|
bJoinByIp(4, "Join By IP"),
|
||||||
bHeader(0, ""),
|
bHeader(0, ""),
|
||||||
gamesList(NULL)
|
gamesList(NULL)
|
||||||
{
|
{
|
||||||
@@ -80,6 +81,7 @@ void JoinGameScreen::init()
|
|||||||
{
|
{
|
||||||
//buttons.push_back(&bJoin);
|
//buttons.push_back(&bJoin);
|
||||||
buttons.push_back(&bBack);
|
buttons.push_back(&bBack);
|
||||||
|
buttons.push_back(&bJoinByIp);
|
||||||
buttons.push_back(&bHeader);
|
buttons.push_back(&bHeader);
|
||||||
|
|
||||||
minecraft->raknetInstance->clearServerList();
|
minecraft->raknetInstance->clearServerList();
|
||||||
@@ -88,6 +90,7 @@ void JoinGameScreen::init()
|
|||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
//tabButtons.push_back(&bJoin);
|
//tabButtons.push_back(&bJoin);
|
||||||
tabButtons.push_back(&bBack);
|
tabButtons.push_back(&bBack);
|
||||||
|
tabButtons.push_back(&bJoinByIp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,16 +98,18 @@ void JoinGameScreen::setupPositions() {
|
|||||||
//int yBase = height - 26;
|
//int yBase = height - 26;
|
||||||
|
|
||||||
//#ifdef ANDROID
|
//#ifdef ANDROID
|
||||||
bJoin.y = 0;
|
bJoin.y = 0;
|
||||||
bBack.y = 0;
|
bBack.y = 0;
|
||||||
bHeader.y = 0;
|
bJoinByIp.y = 0;
|
||||||
|
bHeader.y = 0;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
// Center buttons
|
// Center buttons
|
||||||
//bJoin.x = width / 2 - 4 - bJoin.w;
|
//bJoin.x = width / 2 - 4 - bJoin.w;
|
||||||
bBack.x = 0;//width / 2 + 4;
|
bBack.x = 0;//width / 2 + 4;
|
||||||
bHeader.x = bBack.width;
|
bJoinByIp.x = width - bJoinByIp.width;;
|
||||||
bHeader.width = width - bHeader.x;
|
bHeader.x = bJoinByIp.width;
|
||||||
|
bHeader.width = width - (bBack.width + bJoinByIp.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoinGameScreen::buttonClicked(Button* button)
|
void JoinGameScreen::buttonClicked(Button* button)
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
Button bJoin;
|
Button bJoin;
|
||||||
TButton bBack;
|
TButton bBack;
|
||||||
|
TButton bJoinByIp;
|
||||||
THeader bHeader;
|
THeader bHeader;
|
||||||
AvailableGamesList* gamesList;
|
AvailableGamesList* gamesList;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user