FIX: override warnings

This commit is contained in:
Kolyah35
2026-03-14 14:51:42 +03:00
parent bb95e75c47
commit e49fe348e3
15 changed files with 62 additions and 61 deletions

View File

@@ -137,9 +137,9 @@ public:
virtual float getPixelsPerMillimeter(); virtual float getPixelsPerMillimeter();
virtual bool supportsTouchscreen() { return true; } virtual bool supportsTouchscreen() override { return true; }
virtual void openURL(const std::string& url) { virtual void openURL(const std::string& url) override {
#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__ #elif __linux__

View File

@@ -746,11 +746,8 @@ void Minecraft::tickInput() {
releaseMouse(); releaseMouse();
} }
if (key == Keyboard::KEY_F)
options.viewDistance = (options.viewDistance + 1) % 4;
if (key == Keyboard::KEY_F3) { if (key == Keyboard::KEY_F3) {
options.renderDebug = !options.renderDebug; options.toggle(OPTIONS_RENDER_DEBUG);
} }
if (key == Keyboard::KEY_F5) { if (key == Keyboard::KEY_F5) {
@@ -763,8 +760,10 @@ void Minecraft::tickInput() {
} }
if (key == Keyboard::KEY_L) if (key == Keyboard::KEY_L) {
options.viewDistance = (options.viewDistance + 1) % 4; int dst = options.getIntValue(OPTIONS_VIEW_DISTANCE);
options.set(OPTIONS_VIEW_DISTANCE, (dst + 1) % 4);
}
if (key == Keyboard::KEY_U) { if (key == Keyboard::KEY_U) {
onGraphicsReset(); onGraphicsReset();
@@ -835,12 +834,13 @@ void Minecraft::tickInput() {
player->inventory->dropSlot(i, false); player->inventory->dropSlot(i, false);
} }
if (key == Keyboard::KEY_M) { if (key == Keyboard::KEY_M) {
options.difficulty = (options.difficulty == Difficulty::PEACEFUL)? Difficulty difficulty = (Difficulty)options.getIntValue(OPTIONS_DIFFICULTY);
Difficulty::NORMAL : Difficulty::PEACEFUL; options.set(OPTIONS_DIFFICULTY, (difficulty == Difficulty::PEACEFUL)?
Difficulty::NORMAL : Difficulty::PEACEFUL);
//setIsCreativeMode( !isCreativeMode() ); //setIsCreativeMode( !isCreativeMode() );
} }
if (options.renderDebug) { if (options.getBooleanValue(OPTIONS_RENDER_DEBUG)) {
if (key >= '0' && key <= '9') { if (key >= '0' && key <= '9') {
_perfRenderer->debugFpsMeterKeyPress(key - '0'); _perfRenderer->debugFpsMeterKeyPress(key - '0');
} }

View File

@@ -18,6 +18,10 @@ OptionBool renderDebug("renderDebug", false);
OptionBool smoothCamera("smoothCamera", false); OptionBool smoothCamera("smoothCamera", false);
OptionBool fixedCamera("fixedCamera", false); OptionBool fixedCamera("fixedCamera", false);
OptionBool isFlying("isflying", false); OptionBool isFlying("isflying", false);
OptionBool barOnTop("barOnTop", false);
OptionBool allowSprint("allowSprint", true);
OptionBool autoJump("autoJump", true);
OptionFloat flySpeed("flySpeed", 1.f); OptionFloat flySpeed("flySpeed", 1.f);
OptionFloat cameraSpeed("cameraSpeed", 1.f); OptionFloat cameraSpeed("cameraSpeed", 1.f);
@@ -149,6 +153,11 @@ void Options::initTable() {
m_options[OPTIONS_KEY_MENU_CANCEL] = &keyMenuCancel; m_options[OPTIONS_KEY_MENU_CANCEL] = &keyMenuCancel;
m_options[OPTIONS_FIRST_LAUNCH] = &firstLaunch; m_options[OPTIONS_FIRST_LAUNCH] = &firstLaunch;
m_options[OPTIONS_BAR_ON_TOP] = &barOnTop;
m_options[OPTIONS_ALLOW_SPRINT] = &allowSprint;
m_options[OPTIONS_AUTOJUMP] = &autoJump;
} }
void Options::set(OptionId key, const std::string& value) { void Options::set(OptionId key, const std::string& value) {

View File

@@ -34,6 +34,9 @@ enum OptionId {
OPTIONS_SKIN, OPTIONS_SKIN,
OPTIONS_USERNAME, OPTIONS_USERNAME,
OPTIONS_SERVER_VISIBLE, OPTIONS_SERVER_VISIBLE,
OPTIONS_BAR_ON_TOP,
OPTIONS_ALLOW_SPRINT,
OPTIONS_AUTOJUMP,
// Graphics // Graphics
OPTIONS_RENDER_DEBUG, OPTIONS_RENDER_DEBUG,

View File

@@ -12,21 +12,21 @@ public:
IngameBlockSelectionScreen(); IngameBlockSelectionScreen();
virtual ~IngameBlockSelectionScreen() {} virtual ~IngameBlockSelectionScreen() {}
virtual void init(); virtual void init() override;
virtual void removed(); virtual void removed() override;
void render(int xm, int ym, float a); void render(int xm, int ym, float a) override;
protected: protected:
virtual void mouseClicked(int x, int y, int buttonNum); virtual void mouseClicked(int x, int y, int buttonNum) override;
virtual void mouseReleased(int x, int y, int buttonNum); virtual void mouseReleased(int x, int y, int buttonNum) override;
virtual void buttonClicked(Button* button); virtual void buttonClicked(Button* button) override;
// wheel input for creative inventory scrolling // wheel input for creative inventory scrolling
virtual void mouseWheel(int dx, int dy, int xm, int ym) override; virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
virtual void keyPressed(int eventKey); virtual void keyPressed(int eventKey) override;
private: private:
void renderSlots(); void renderSlots();
void renderSlot(int slot, int x, int y, float a); void renderSlot(int slot, int x, int y, float a);

View File

@@ -102,21 +102,6 @@ void JoinByIPScreen::setupPositions() {
tIP.y = ((height - bJoin.height) / 2) - tIP.height - 4; tIP.y = ((height - bJoin.height) / 2) - tIP.height - 4;
} }
void JoinByIPScreen::mouseClicked(int x, int y, int buttonNum) {
int lvlTop = tIP.y - (Font::DefaultLineHeight + 4);
int lvlBottom = tIP.y + tIP.height;
int lvlLeft = tIP.x;
int lvlRight = tIP.x + tIP.width;
bool clickedIP = x >= lvlLeft && x < lvlRight && y >= lvlTop && y < lvlBottom;
if (clickedIP) {
tIP.setFocus(minecraft);
} else {
tIP.loseFocus(minecraft);
}
Screen::mouseClicked(x, y, buttonNum);
}
void JoinByIPScreen::render( int xm, int ym, float a ) void JoinByIPScreen::render( int xm, int ym, float a )
{ {
renderBackground(); renderBackground();
@@ -132,9 +117,3 @@ void JoinByIPScreen::keyPressed(int eventKey)
// let base class handle navigation and text box keys // let base class handle navigation and text box keys
Screen::keyPressed(eventKey); Screen::keyPressed(eventKey);
} }
void JoinByIPScreen::keyboardNewChar(char inputChar)
{
// forward character input to focused textbox(s)
for (auto* tb : textBoxes) tb->handleChar(inputChar);
}

View File

@@ -18,9 +18,7 @@ public:
void render(int xm, int ym, float a); void render(int xm, int ym, float a);
virtual void keyPressed(int eventKey); virtual void keyPressed(int eventKey);
virtual void keyboardNewChar(char inputChar);
void buttonClicked(Button* button); void buttonClicked(Button* button);
virtual void mouseClicked(int x, int y, int buttonNum);
virtual bool handleBackEvent(bool isDown); virtual bool handleBackEvent(bool isDown);
private: private:
TextBox tIP; TextBox tIP;

View File

@@ -73,6 +73,11 @@ void StartMenuScreen::init()
// always show base version string, suffix was previously added for Android builds // always show base version string, suffix was previously added for Android builds
std::string versionString = Common::getGameVersionString(); std::string versionString = Common::getGameVersionString();
std::string _username = minecraft->options.getStringValue(OPTIONS_USERNAME);
if (_username.empty()) _username = "unknown";
username = "Username: " + _username;
#ifdef DEMO_MODE #ifdef DEMO_MODE
#ifdef __APPLE__ #ifdef __APPLE__
version = versionString + " (Lite)"; version = versionString + " (Lite)";
@@ -153,8 +158,7 @@ void StartMenuScreen::render( int xm, int ym, float a )
renderBackground(); renderBackground();
// Show current username in the top-left corner // Show current username in the top-left corner
std::string username = minecraft->options.username.empty() ? "unknown" : minecraft->options.username; drawString(font, username, 2, 2, 0xffffffff);
drawString(font, std::string("Username: ") + username, 2, 2, 0xffffffff);
#if defined(RPI) #if defined(RPI)
TextureId id = minecraft->textures->loadTexture("gui/pi_title.png"); TextureId id = minecraft->textures->loadTexture("gui/pi_title.png");

View File

@@ -33,6 +33,8 @@ private:
std::string version; std::string version;
int versionPosX; int versionPosX;
std::string username;
}; };
#endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__StartMenuScreen_H__*/ #endif /*NET_MINECRAFT_CLIENT_GUI_SCREENS__StartMenuScreen_H__*/

View File

@@ -21,24 +21,24 @@ public:
IngameBlockSelectionScreen(); IngameBlockSelectionScreen();
virtual ~IngameBlockSelectionScreen(); virtual ~IngameBlockSelectionScreen();
virtual void init(); virtual void init() override;
virtual void setupPositions(); virtual void setupPositions() override;
virtual void removed(); virtual void removed() override;
void tick(); void tick() override;
void render(int xm, int ym, float a); void render(int xm, int ym, float a) override;
bool hasClippingArea(IntRectangle& out); bool hasClippingArea(IntRectangle& out) override;
// IInventoryPaneCallback // IInventoryPaneCallback
bool addItem(const InventoryPane* pane, int itemId); bool addItem(const InventoryPane* pane, int itemId) override;
bool isAllowed(int slot); bool isAllowed(int slot) override;
std::vector<const ItemInstance*> getItems(const InventoryPane* forPane); std::vector<const ItemInstance*> getItems(const InventoryPane* forPane) override;
void buttonClicked(Button* button); void buttonClicked(Button* button) override;
protected: protected:
virtual void mouseClicked(int x, int y, int buttonNum); virtual void mouseClicked(int x, int y, int buttonNum) override;
virtual void mouseReleased(int x, int y, int buttonNum); virtual void mouseReleased(int x, int y, int buttonNum) override;
// also support wheel scrolling // also support wheel scrolling
virtual void mouseWheel(int dx, int dy, int xm, int ym) override; virtual void mouseWheel(int dx, int dy, int xm, int ym) override;

View File

@@ -85,6 +85,11 @@ void StartMenuScreen::init()
// always show base version string // always show base version string
std::string versionString = Common::getGameVersionString(); std::string versionString = Common::getGameVersionString();
std::string _username = minecraft->options.getStringValue(OPTIONS_USERNAME);
if (_username.empty()) _username = "unknown";
username = "Username: " + _username;
#ifdef DEMO_MODE #ifdef DEMO_MODE
#ifdef __APPLE__ #ifdef __APPLE__
version = versionString + " (Lite)"; version = versionString + " (Lite)";
@@ -162,8 +167,7 @@ void StartMenuScreen::render( int xm, int ym, float a )
renderBackground(); renderBackground();
// Show current username in the top-left corner // Show current username in the top-left corner
std::string username = minecraft->options.username.empty() ? "unknown" : minecraft->options.username; drawString(font, username, 2, 2, 0xffffffff);
drawString(font, std::string("Username: ") + username, 2, 2, 0xffffffff);
glEnable2(GL_BLEND); glEnable2(GL_BLEND);

View File

@@ -35,6 +35,8 @@ private:
std::string version; std::string version;
int versionPosX; int versionPosX;
std::string username;
}; };
}; };

View File

@@ -445,7 +445,7 @@ void LocalPlayer::aiStep() {
// Sprint: detect W double-tap // Sprint: detect W double-tap
{ {
bool forwardHeld = (input->ya > 0); bool forwardHeld = (input->ya > 0);
if (forwardHeld && !prevForwardHeld && minecraft->options.useSprinting) { if (forwardHeld && !prevForwardHeld && minecraft->options.getBooleanValue(OPTIONS_ALLOW_SPRINT)) {
// leading edge of W press // leading edge of W press
if (sprintDoubleTapTimer > 0) if (sprintDoubleTapTimer > 0)
sprinting = true; sprinting = true;
@@ -534,7 +534,7 @@ void LocalPlayer::move(float xa, float ya, float za) {
float newX = x, newZ = z; float newX = x, newZ = z;
if (autoJumpTime <= 0 && minecraft->options.autoJump) if (autoJumpTime <= 0 && minecraft->options.getBooleanValue(OPTIONS_AUTOJUMP))
{ {
// auto-jump when crossing the middle of a tile, and the tile in the front is blocked // auto-jump when crossing the middle of a tile, and the tile in the front is blocked
bool jump = false; bool jump = false;

View File

@@ -373,7 +373,7 @@ void GameRenderer::renderLevel(float a) {
// glDisable2(GL_FOG); // glDisable2(GL_FOG);
setupFog(1); setupFog(1);
if (zoom == 1 && !mc->options.F1) { if (zoom == 1 && !mc->options.getBooleanValue(OPTIONS_HIDEGUI)) {
TIMER_POP_PUSH("hand"); TIMER_POP_PUSH("hand");
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
renderItemInHand(a, i); renderItemInHand(a, i);

View File

@@ -54,6 +54,6 @@ const char* Keyboard::getKeyName(int key) {
case KEY_ESCAPE: return "Esc"; case KEY_ESCAPE: return "Esc";
case KEY_SPACE: return "Space"; case KEY_SPACE: return "Space";
case KEY_LSHIFT: return "Left Shift"; case KEY_LSHIFT: return "Left Shift";
default: "Unknown"; default: return "Unknown";
} }
} }