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 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
ShellExecuteA(NULL, "open", url.c_str(), NULL, NULL, SW_SHOWNORMAL);
#elif __linux__

View File

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

View File

@@ -18,6 +18,10 @@ OptionBool renderDebug("renderDebug", false);
OptionBool smoothCamera("smoothCamera", false);
OptionBool fixedCamera("fixedCamera", false);
OptionBool isFlying("isflying", false);
OptionBool barOnTop("barOnTop", false);
OptionBool allowSprint("allowSprint", true);
OptionBool autoJump("autoJump", true);
OptionFloat flySpeed("flySpeed", 1.f);
OptionFloat cameraSpeed("cameraSpeed", 1.f);
@@ -149,6 +153,11 @@ void Options::initTable() {
m_options[OPTIONS_KEY_MENU_CANCEL] = &keyMenuCancel;
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) {

View File

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

View File

@@ -12,21 +12,21 @@ public:
IngameBlockSelectionScreen();
virtual ~IngameBlockSelectionScreen() {}
virtual void init();
virtual void removed();
virtual void init() override;
virtual void removed() override;
void render(int xm, int ym, float a);
void render(int xm, int ym, float a) override;
protected:
virtual void mouseClicked(int x, int y, int buttonNum);
virtual void mouseReleased(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) override;
virtual void buttonClicked(Button* button);
virtual void buttonClicked(Button* button) override;
// wheel input for creative inventory scrolling
virtual void mouseWheel(int dx, int dy, int xm, int ym) override;
virtual void keyPressed(int eventKey);
virtual void keyPressed(int eventKey) override;
private:
void renderSlots();
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;
}
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 )
{
renderBackground();
@@ -131,10 +116,4 @@ void JoinByIPScreen::keyPressed(int eventKey)
}
// let base class handle navigation and text box keys
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);
virtual void keyPressed(int eventKey);
virtual void keyboardNewChar(char inputChar);
void buttonClicked(Button* button);
virtual void mouseClicked(int x, int y, int buttonNum);
virtual bool handleBackEvent(bool isDown);
private:
TextBox tIP;

View File

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

View File

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

View File

@@ -21,24 +21,24 @@ public:
IngameBlockSelectionScreen();
virtual ~IngameBlockSelectionScreen();
virtual void init();
virtual void setupPositions();
virtual void removed();
virtual void init() override;
virtual void setupPositions() override;
virtual void removed() override;
void tick();
void render(int xm, int ym, float a);
void tick() override;
void render(int xm, int ym, float a) override;
bool hasClippingArea(IntRectangle& out);
bool hasClippingArea(IntRectangle& out) override;
// IInventoryPaneCallback
bool addItem(const InventoryPane* pane, int itemId);
bool isAllowed(int slot);
std::vector<const ItemInstance*> getItems(const InventoryPane* forPane);
bool addItem(const InventoryPane* pane, int itemId) override;
bool isAllowed(int slot) override;
std::vector<const ItemInstance*> getItems(const InventoryPane* forPane) override;
void buttonClicked(Button* button);
void buttonClicked(Button* button) override;
protected:
virtual void mouseClicked(int x, int y, int buttonNum);
virtual void mouseReleased(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) override;
// also support wheel scrolling
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
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 __APPLE__
version = versionString + " (Lite)";
@@ -162,8 +167,7 @@ void StartMenuScreen::render( int xm, int ym, float a )
renderBackground();
// Show current username in the top-left corner
std::string username = minecraft->options.username.empty() ? "unknown" : minecraft->options.username;
drawString(font, std::string("Username: ") + username, 2, 2, 0xffffffff);
drawString(font, username, 2, 2, 0xffffffff);
glEnable2(GL_BLEND);

View File

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

View File

@@ -445,7 +445,7 @@ void LocalPlayer::aiStep() {
// Sprint: detect W double-tap
{
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
if (sprintDoubleTapTimer > 0)
sprinting = true;
@@ -534,7 +534,7 @@ void LocalPlayer::move(float xa, float ya, float za) {
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
bool jump = false;

View File

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

View File

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