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

@@ -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;
};
};