Trying to replace pointers with references :v

This commit is contained in:
Kolyah35 2026-04-04 14:33:56 +03:00
parent 7418263193
commit 12f5013ddb
126 changed files with 1343 additions and 2068 deletions

View file

@ -13,7 +13,7 @@
#include "client/gui/Font.hpp"
#include "client/gui/components/ScrolledSelectionList.hpp"
#include "client/Minecraft.hpp"
#include <MinecraftClient.hpp>
#include "client/renderer/Tesselator.hpp"
#include "AppPlatform.hpp"
#include "LicenseCodes.hpp"
@ -38,7 +38,7 @@ void StartMenuScreen::init()
{
bJoin.active = bHost.active = bOptions.active = true;
if (minecraft->options.getStringValue(OPTIONS_USERNAME).empty()) {
if (minecraft.options().getStringValue(OPTIONS_USERNAME).empty()) {
return; // tick() will redirect to UsernameScreen
}
@ -72,7 +72,7 @@ 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);
std::string _username = minecraft.options().getStringValue(OPTIONS_USERNAME);
if (_username.empty()) _username = "unknown";
username = "Username: " + _username;
@ -117,23 +117,23 @@ void StartMenuScreen::buttonClicked(Button* button) {
if (button->id == bHost.id)
{
#if defined(DEMO_MODE) || defined(APPLE_DEMO_PROMOTION)
minecraft->setScreen( new SimpleChooseLevelScreen("_DemoLevel") );
minecraft.setScreen( new SimpleChooseLevelScreen("_DemoLevel") );
#else
minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD);
minecraft.screenChooser.setScreen(SCREEN_SELECTWORLD);
#endif
}
if (button->id == bJoin.id)
{
minecraft->locateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_JOINGAME);
minecraft.locateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_JOINGAME);
}
if (button->id == bOptions.id)
{
minecraft->setScreen(new OptionsScreen());
minecraft.setScreen(new OptionsScreen());
}
if (button == &bQuit)
{
minecraft->quit();
minecraft.quit();
}
}
@ -147,14 +147,14 @@ void StartMenuScreen::render( int xm, int ym, float a )
drawString(font, username, 2, 2, 0xffffffff);
#if defined(RPI)
TextureId id = minecraft->textures->loadTexture("gui/pi_title.png");
TextureId id = minecraft.textures().loadTexture("gui/pi_title.png");
#else
TextureId id = minecraft->textures->loadTexture("gui/title.png");
TextureId id = minecraft.textures().loadTexture("gui/title.png");
#endif
const TextureData* data = minecraft->textures->getTemporaryTextureData(id);
const TextureData* data = minecraft.textures().getTemporaryTextureData(id);
if (data) {
minecraft->textures->bind(id);
minecraft.textures().bind(id);
const float x = (float)width / 2;
const float y = height/16;
@ -175,23 +175,23 @@ void StartMenuScreen::render( int xm, int ym, float a )
}
#if defined(RPI)
if (Textures::isTextureIdValid(minecraft->textures->loadAndBindTexture("gui/logo/raknet_high_72.png")))
if (Textures::isTextureIdValid(minecraft.textures().loadAndBindTexture("gui/logo/raknet_high_72.png")))
blit(0, height - 12, 0, 0, 43, 12, 256, 72+72);
#endif
drawString(font, version, width - font->width(version) - 2, height - 10, 0xffcccccc);//0x666666);
drawString(font, version, width - font.width(version) - 2, height - 10, 0xffcccccc);//0x666666);
drawString(font, copyright, 2, height - 20, 0xffffff);
glEnable2(GL_BLEND);
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f2(1, 1, 1, 1);
if (Textures::isTextureIdValid(minecraft->textures->loadAndBindTexture("gui/logo/github.png")))
if (Textures::isTextureIdValid(minecraft.textures().loadAndBindTexture("gui/logo/github.png")))
blit(2, height - 10, 0, 0, 8, 8, 256, 256);
{
std::string txt = "Kolyah35/minecraft-pe-0.6.1";
float wtxt = font->width(txt);
float wtxt = font.width(txt);
Gui::drawColoredString(font, txt, 12, height - 10, 255);
// underline link
float y0 = height - 10 + font->lineHeight - 1;
float y0 = height - 10 + font.lineHeight - 1;
this->fill(12, (int)y0, 12 + (int)wtxt, (int)(y0 + 1), 0xffffffff);
}
@ -201,16 +201,16 @@ void StartMenuScreen::render( int xm, int ym, float a )
void StartMenuScreen::mouseClicked(int x, int y, int buttonNum) {
const int logoX = 2;
const int logoW = 8 + 2 + font->width("Kolyah35/minecraft-pe-0.6.1");
const int logoW = 8 + 2 + font.width("Kolyah35/minecraft-pe-0.6.1");
const int logoY = height - 10;
const int logoH = 10;
if (x >= logoX && x <= logoX + logoW && y >= logoY && y <= logoY + logoH)
minecraft->platform()->openURL("https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1");
minecraft.platform()->openURL("https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1");
else
Screen::mouseClicked(x, y, buttonNum);
}
bool StartMenuScreen::handleBackEvent( bool isDown ) {
minecraft->quit();
minecraft.quit();
return true;
}