ADD: pause and chat btn

This commit is contained in:
2026-03-20 21:46:43 +03:00
parent 5d415dcca1
commit cda2534c1e
8 changed files with 27 additions and 24 deletions

View File

@@ -11,8 +11,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal") set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal")
endif() endif()
# ## Config options ###
include(CMakeDependentOption)
include(cmake/EnumOption.cmake) include(cmake/EnumOption.cmake)
if(EMSCRIPTEN) if(EMSCRIPTEN)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -216,8 +216,5 @@ void ConsoleScreen::render(int /*xm*/, int /*ym*/, float /*a*/)
displayed += '_'; displayed += '_';
// Placeholder hint when empty // Placeholder hint when empty
if (_input.empty() && (_cursorBlink / 10) % 2 != 0)
font->drawShadow("Type a message or /command", (float)(boxX0 + 2), (float)(boxY + 2), 0xff606060);
else
font->drawShadow(displayed, (float)(boxX0 + 2), (float)(boxY + 2), 0xffffffff); font->drawShadow(displayed, (float)(boxX0 + 2), (float)(boxY + 2), 0xffffffff);
} }

View File

@@ -4,6 +4,7 @@
#include "JoinGameScreen.h" #include "JoinGameScreen.h"
#include "PauseScreen.h" #include "PauseScreen.h"
#include "RenameMPLevelScreen.h" #include "RenameMPLevelScreen.h"
#include "ConsoleScreen.h"
#include "IngameBlockSelectionScreen.h" #include "IngameBlockSelectionScreen.h"
#include "JoinByIPScreen.h" #include "JoinByIPScreen.h"
#include "touch/TouchStartMenuScreen.h" #include "touch/TouchStartMenuScreen.h"
@@ -19,6 +20,7 @@ Screen* ScreenChooser::createScreen( ScreenId id )
{ {
Screen* screen = NULL; Screen* screen = NULL;
// :sob:
if (_mc->useTouchscreen()) { if (_mc->useTouchscreen()) {
switch (id) { switch (id) {
case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break; case SCREEN_STARTMENU: screen = new Touch::StartMenuScreen(); break;
@@ -28,6 +30,7 @@ Screen* ScreenChooser::createScreen( ScreenId id )
case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break; case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break;
case SCREEN_BLOCKSELECTION: screen = new Touch::IngameBlockSelectionScreen(); break; case SCREEN_BLOCKSELECTION: screen = new Touch::IngameBlockSelectionScreen(); break;
case SCREEN_JOINBYIP: screen = new JoinByIPScreen(); break; case SCREEN_JOINBYIP: screen = new JoinByIPScreen(); break;
case SCREEN_CONSOLE: screen = new ConsoleScreen(); break;
case SCREEN_NONE: case SCREEN_NONE:
default: default:
// Do nothing // Do nothing
@@ -42,7 +45,7 @@ Screen* ScreenChooser::createScreen( ScreenId id )
case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break; case SCREEN_PAUSEPREV: screen = new PauseScreen(true); break;
case SCREEN_BLOCKSELECTION: screen = new IngameBlockSelectionScreen(); break; case SCREEN_BLOCKSELECTION: screen = new IngameBlockSelectionScreen(); break;
case SCREEN_JOINBYIP: screen = new JoinByIPScreen(); break; case SCREEN_JOINBYIP: screen = new JoinByIPScreen(); break;
case SCREEN_CONSOLE: screen = new ConsoleScreen(); break;
case SCREEN_NONE: case SCREEN_NONE:
default: default:
// Do nothing // Do nothing

View File

@@ -9,7 +9,8 @@ enum ScreenId {
SCREEN_PAUSEPREV, SCREEN_PAUSEPREV,
SCREEN_SELECTWORLD, SCREEN_SELECTWORLD,
SCREEN_BLOCKSELECTION, SCREEN_BLOCKSELECTION,
SCREEN_JOINBYIP SCREEN_JOINBYIP,
SCREEN_CONSOLE
}; };
class Screen; class Screen;

View File

@@ -426,9 +426,7 @@ public:
virtual void onConfigChanged(const Config& c) { virtual void onConfigChanged(const Config& c) {
_move.onConfigChanged(c); _move.onConfigChanged(c);
_turnBuild.moveArea = _move.getRectangleArea(); _turnBuild.moveArea = _move.getRectangleArea();
#ifdef __APPLE__
_turnBuild.pauseArea = _move.getPauseRectangleArea(); _turnBuild.pauseArea = _move.getPauseRectangleArea();
#endif
_turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.getBooleanValue(OPTIONS_IS_LEFT_HANDED)? 1 : -1 ); _turnBuild.inventoryArea = _mc->gui.getRectangleArea( _mc->options.getBooleanValue(OPTIONS_IS_LEFT_HANDED)? 1 : -1 );
_turnBuild.setSensitivity(c.options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)? 1.8f : 1.0f); _turnBuild.setSensitivity(c.options->getBooleanValue(OPTIONS_IS_JOY_TOUCH_AREA)? 1.8f : 1.0f);
((ITurnInput*)&_turnBuild)->onConfigChanged(c); ((ITurnInput*)&_turnBuild)->onConfigChanged(c);

View File

@@ -9,7 +9,10 @@
#include "../../../../platform/log.h" #include "../../../../platform/log.h"
#include "../../../renderer/Textures.h" #include "../../../renderer/Textures.h"
#include "../../../sound/SoundEngine.h" #include "../../../sound/SoundEngine.h"
#include "client/gui/screens/ScreenChooser.h"
// ARGHHHHHH WHY NOT FUCKING ENUM
static const int AREA_DPAD_FIRST = 100; static const int AREA_DPAD_FIRST = 100;
static const int AREA_DPAD_N = 100; static const int AREA_DPAD_N = 100;
static const int AREA_DPAD_S = 101; static const int AREA_DPAD_S = 101;
@@ -17,6 +20,7 @@ static const int AREA_DPAD_W = 102;
static const int AREA_DPAD_E = 103; static const int AREA_DPAD_E = 103;
static const int AREA_DPAD_C = 104; static const int AREA_DPAD_C = 104;
static const int AREA_PAUSE = 105; static const int AREA_PAUSE = 105;
static const int AREA_CHAT = 106;
static int cPressed = 0; static int cPressed = 0;
static int cReleased = 0; static int cReleased = 0;
@@ -158,14 +162,11 @@ void TouchscreenInput_TestFps::onConfigChanged(const Config& c) {
xx = BaseX + 2 * Bw; yy = BaseY + Bh; xx = BaseX + 2 * Bw; yy = BaseY + Bh;
_model.addArea(AREA_DPAD_E, aRight = new RectangleArea(xx, yy, xx+Bw, yy+Bh)); _model.addArea(AREA_DPAD_E, aRight = new RectangleArea(xx, yy, xx+Bw, yy+Bh));
#ifdef __APPLE__
float maxPixels = _minecraft->pixelCalc.millimetersToPixels(10); float maxPixels = _minecraft->pixelCalc.millimetersToPixels(10);
float btnSize = Mth::Min(18 * Gui::GuiScale, maxPixels); // float btnSize = Mth::Min(18 * Gui::GuiScale, maxPixels);
_model.addArea(AREA_PAUSE, aPause = new RectangleArea(w - 4 - btnSize, float btnSize = pc.millimetersToPixels(50);
4, _model.addArea(AREA_PAUSE, aPause = new RectangleArea(w - 4 - btnSize, 4, w - 4, 4 + btnSize));
w - 4, _model.addArea(AREA_CHAT, aChat = new RectangleArea(w - 8 - btnSize * 2, 4, w - 8 - btnSize, 4 + btnSize));
4 + btnSize));
#endif /* __APPLE__ */
//rebuild(); //rebuild();
} }
@@ -309,14 +310,19 @@ void TouchscreenInput_TestFps::tick( Player* player )
setButton = true; setButton = true;
xa -= 1; xa -= 1;
} }
#ifdef __APPLE__
else if (areaId == AREA_PAUSE) { else if (areaId == AREA_PAUSE) {
if (Multitouch::isReleased(p)) { if (Multitouch::isReleased(p)) {
_minecraft->soundEngine->playUI("random.click", 1, 1); _minecraft->soundEngine->playUI("random.click", 1, 1);
_minecraft->screenChooser.setScreen(SCREEN_PAUSE); _minecraft->screenChooser.setScreen(SCREEN_PAUSE);
} }
} }
#endif /*__APPLE__*/ else if (areaId == AREA_CHAT) {
if (Multitouch::isReleased(p)) {
_minecraft->soundEngine->playUI("random.click", 1, 1);
_minecraft->screenChooser.setScreen(SCREEN_CONSOLE);
}
}
_buttons[areaId - AREA_DPAD_FIRST] = setButton; _buttons[areaId - AREA_DPAD_FIRST] = setButton;
} }
@@ -499,15 +505,14 @@ void TouchscreenInput_TestFps::rebuild() {
drawRectangleArea(t, aJump, imageU + imageSize * 4, imageV, (float)imageSize); drawRectangleArea(t, aJump, imageU + imageSize * 4, imageV, (float)imageSize);
} }
#ifdef __APPLE__
if (!_minecraft->screen) { if (!_minecraft->screen) {
if (isButtonDown(AREA_PAUSE)) t.colorABGR(cPressedPause); t.colorABGR(0xFFFFFFFF);
else t.colorABGR(cReleasedPause); // if (isButtonDown(AREA_PAUSE)) t.colorABGR(cPressedPause);
// else t.colorABGR(cReleasedPause);
drawRectangleArea(t, aPause, 200, 64, 18.0f); drawRectangleArea(t, aPause, 200, 64, 18.0f);
drawRectangleArea(t, aChat, 200, 82, 18.0f);
} }
#endif /*__APPLE__*/
//t.end(true, _bufferId); //t.end(true, _bufferId);
//return; //return;

View File

@@ -61,6 +61,7 @@ private:
RectangleArea* aUp; RectangleArea* aUp;
RectangleArea* aDown; RectangleArea* aDown;
RectangleArea* aPause; RectangleArea* aPause;
RectangleArea* aChat;
//RectangleArea* aUpJump; //RectangleArea* aUpJump;
RectangleArea* aJump; RectangleArea* aJump;
RectangleArea* aUpLeft; RectangleArea* aUpLeft;