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

@@ -10,7 +10,7 @@
#include "client/renderer/entity/ItemRenderer.hpp"
#include "client/renderer/Tesselator.hpp"
#include "client/renderer/Textures.hpp"
#include "client/Minecraft.hpp"
#include <MinecraftClient.hpp>
#include "client/sound/SoundEngine.hpp"
#include "world/entity/player/Inventory.hpp"
#include "platform/input/Mouse.hpp"
@@ -69,7 +69,7 @@ IngameBlockSelectionScreen::~IngameBlockSelectionScreen()
void IngameBlockSelectionScreen::init()
{
Inventory* inventory = minecraft->player->inventory;
Inventory* inventory = minecraft.player()->inventory;
//const int itemWidth = 2 * BorderPixels +
@@ -110,7 +110,7 @@ void IngameBlockSelectionScreen::init()
buttons.push_back(&bHeader);
buttons.push_back(&bDone);
if (!minecraft->isCreativeMode()) {
if (!minecraft.isCreativeMode()) {
buttons.push_back(&bCraft);
buttons.push_back(&bArmor);
}
@@ -123,7 +123,7 @@ void IngameBlockSelectionScreen::setupPositions() {
bCraft.width = bArmor.width = 48;
bArmor.x = bCraft.width;
if (minecraft->isCreativeMode()) {
if (minecraft.isCreativeMode()) {
bHeader.x = 0;
bHeader.width = width;// - bDone.w;
bHeader.xText = width/2; // Center of the screen
@@ -134,14 +134,14 @@ void IngameBlockSelectionScreen::setupPositions() {
}
clippingArea.x = 0;
clippingArea.w = minecraft->width;
clippingArea.w = minecraft.getScreenWidth();
clippingArea.y = 0;
clippingArea.h = (int)(Gui::GuiScale * 24);
}
void IngameBlockSelectionScreen::removed()
{
minecraft->gui.inventoryUpdated();
minecraft.gui().inventoryUpdated();
}
int IngameBlockSelectionScreen::getSlotPosX(int slotX) {
@@ -166,7 +166,7 @@ void IngameBlockSelectionScreen::mouseClicked(int x, int y, int buttonNum) {
void IngameBlockSelectionScreen::mouseReleased(int x, int y, int buttonNum) {
if (_pendingClose && _blockList->_clickArea->isInside((float)x, (float)y))
minecraft->setScreen(NULL);
minecraft.setScreen(NULL);
else
super::mouseReleased(x, y, buttonNum);
}
@@ -191,7 +191,7 @@ void IngameBlockSelectionScreen::mouseWheel(int dx, int dy, int xm, int ym)
bool IngameBlockSelectionScreen::addItem(const InventoryPane* pane, int itemId)
{
Inventory* inventory = minecraft->player->inventory;
Inventory* inventory = minecraft.player()->inventory;
itemId += Inventory::MAX_SELECTION_SIZE;
if (!inventory->getItem(itemId))
@@ -201,13 +201,13 @@ bool IngameBlockSelectionScreen::addItem(const InventoryPane* pane, int itemId)
inventory->selectSlot(0);
#ifdef __APPLE__
minecraft->soundEngine->playUI("random.pop", 0.3f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random()));
minecraft.soundEngine()->playUI("random.pop", 0.3f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random()));
#else
minecraft->soundEngine->playUI("random.pop2", 1.0f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random()));
minecraft.soundEngine()->playUI("random.pop2", 1.0f, 0.3f);//1.0f + 0.2f*(Mth::random()-Mth::random()));
#endif
// Flash the selected gui item
minecraft->gui.flashSlot(inventory->selected);
minecraft.gui().flashSlot(inventory->selected);
return true;
}
@@ -228,7 +228,7 @@ void IngameBlockSelectionScreen::render( int xm, int ym, float a )
// render frame
IntRectangle& bbox = _blockList->rect;
Tesselator::instance.colorABGR(0xffffffff);
minecraft->textures->loadAndBindTexture("gui/itemframe.png");
minecraft.textures().loadAndBindTexture("gui/itemframe.png");
glEnable2(GL_BLEND);
glColor4f2(1, 1, 1, 1);
glBlendFunc2(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -245,31 +245,31 @@ void IngameBlockSelectionScreen::renderDemoOverlay() {
const int centerX = (getSlotPosX(4) + getSlotPosX(5)) / 2;
const int centerY = (getSlotPosY(0) + getSlotPosY(1)) / 2 + 5;
drawCenteredString(minecraft->font, demoVersionString, centerX, centerY, 0xffffffff);
drawCenteredString(minecraft.font(), demoVersionString, centerX, centerY, 0xffffffff);
#endif /*DEMO_MODE*/
}
void IngameBlockSelectionScreen::buttonClicked(Button* button) {
if (button->id == bDone.id)
minecraft->setScreen(NULL);
minecraft.setScreen(NULL);
if (button->id == bMenu.id)
minecraft->screenChooser.setScreen(SCREEN_PAUSE);
minecraft.screenChooser.setScreen(SCREEN_PAUSE);
if (button->id == bCraft.id)
minecraft->setScreen(new WorkbenchScreen(Recipe::SIZE_2X2));
minecraft.setScreen(new WorkbenchScreen(Recipe::SIZE_2X2));
if (button == &bArmor)
minecraft->setScreen(new ArmorScreen());
minecraft.setScreen(new ArmorScreen());
}
bool IngameBlockSelectionScreen::isAllowed( int slot )
{
if (slot < 0 || slot >= minecraft->player->inventory->getContainerSize())
if (slot < 0 || slot >= minecraft.player()->inventory->getContainerSize())
return false;
#ifdef DEMO_MODE
if (slot >= (minecraft->isCreativeMode()? 28 : 27)) return false;
if (slot >= (minecraft.isCreativeMode()? 28 : 27)) return false;
#endif
return true;
}
@@ -283,8 +283,8 @@ bool IngameBlockSelectionScreen::hasClippingArea( IntRectangle& out )
std::vector<const ItemInstance*> IngameBlockSelectionScreen::getItems( const InventoryPane* forPane )
{
std::vector<const ItemInstance*> out;
for (int i = Inventory::MAX_SELECTION_SIZE; i < minecraft->player->inventory->getContainerSize(); ++i)
out.push_back(minecraft->player->inventory->getItem(i));
for (int i = Inventory::MAX_SELECTION_SIZE; i < minecraft.player()->inventory->getContainerSize(); ++i)
out.push_back(minecraft.player()->inventory->getItem(i));
return out;
}

View File

@@ -2,7 +2,7 @@
#include "client/gui/screens/StartMenuScreen.hpp"
#include "client/gui/screens/ProgressScreen.hpp"
#include "client/gui/Font.hpp"
#include "client/Minecraft.hpp"
#include <MinecraftClient.hpp>
#include "client/renderer/Textures.hpp"
namespace Touch {
@@ -44,16 +44,16 @@ void AvailableGamesList::renderItem( int i, int x, int y, int h, Tesselator& t )
glEnable2(GL_TEXTURE_2D);
glColor4f2(1,1,1,1);
glEnable2(GL_BLEND);
minecraft->textures->loadAndBindTexture("gui/badge/minecon140.png");
minecraft.textures().loadAndBindTexture("gui/badge/minecon140.png");
blit(xx2, y + 6, 0, 0, 37, 8, 140, 240);
}
drawString(minecraft->font, s.name.C_String(), xx1, y + 4 + 2, color);
drawString(minecraft->font, s.address.ToString(false), xx2, y + 18, color2);
drawString(minecraft.font(), s.name.C_String(), xx1, y + 4 + 2, color);
drawString(minecraft.font(), s.address.ToString(false), xx2, y + 18, color2);
/*
drawString(minecraft->font, copiedServerList[i].name.C_String(), (int)x0 + 24, y + 4, color);
drawString(minecraft->font, copiedServerList[i].address.ToString(false), (int)x0 + 24, y + 18, color);
drawString(minecraft.font(), copiedServerList[i].name.C_String(), (int)x0 + 24, y + 4, color);
drawString(minecraft.font(), copiedServerList[i].address.ToString(false), (int)x0 + 24, y + 18, color);
*/
}
@@ -84,7 +84,7 @@ void JoinGameScreen::init()
buttons.push_back(&bJoinByIp);
buttons.push_back(&bHeader);
minecraft->raknetInstance->clearServerList();
minecraft.raknetInstance->clearServerList();
gamesList = new AvailableGamesList(minecraft, width, height);
#ifdef ANDROID
@@ -119,25 +119,25 @@ void JoinGameScreen::buttonClicked(Button* button)
if (isIndexValid(gamesList->selectedItem))
{
PingedCompatibleServer selectedServer = gamesList->copiedServerList[gamesList->selectedItem];
minecraft->joinMultiplayer(selectedServer);
minecraft.joinMultiplayer(selectedServer);
{
bJoin.active = false;
bBack.active = false;
minecraft->setScreen(new ProgressScreen());
minecraft.setScreen(new ProgressScreen());
}
}
//minecraft->locateMultiplayer();
//minecraft->setScreen(new JoinGameScreen());
//minecraft.locateMultiplayer();
//minecraft.setScreen(new JoinGameScreen());
}
if(button->id == bJoinByIp.id) {
minecraft->cancelLocateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_JOINBYIP);
minecraft.cancelLocateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_JOINBYIP);
}
if (button->id == bBack.id)
{
minecraft->cancelLocateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
minecraft.cancelLocateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_STARTMENU);
}
}
@@ -145,8 +145,8 @@ bool JoinGameScreen::handleBackEvent(bool isDown)
{
if (!isDown)
{
minecraft->cancelLocateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
minecraft.cancelLocateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_STARTMENU);
}
return true;
}
@@ -166,7 +166,7 @@ void JoinGameScreen::tick()
//gamesList->tick();
const ServerList& orgServerList = minecraft->raknetInstance->getServerList();
const ServerList& orgServerList = minecraft.raknetInstance->getServerList();
ServerList serverList;
for (unsigned int i = 0; i < orgServerList.size(); ++i)
if (orgServerList[i].name.GetLength() > 0)
@@ -211,7 +211,7 @@ void JoinGameScreen::tick()
void JoinGameScreen::render( int xm, int ym, float a )
{
bool hasNetwork = minecraft->platform()->isNetworkEnabled(true);
bool hasNetwork = minecraft.platform()->isNetworkEnabled(true);
#ifdef WIN32
hasNetwork = hasNetwork && !GetAsyncKeyState(VK_TAB);
#endif
@@ -225,16 +225,16 @@ void JoinGameScreen::render( int xm, int ym, float a )
if (hasNetwork) {
std::string s = "Scanning for WiFi Games...";
drawCenteredString(minecraft->font, s, baseX, 8, 0xffffffff);
drawCenteredString(minecraft.font(), s, baseX, 8, 0xffffffff);
const int textWidth = minecraft->font->width(s);
const int textWidth = minecraft.font()->width(s);
const int spinnerX = baseX + textWidth / 2 + 6;
static const char* spinnerTexts[] = {"-", "\\", "|", "/"};
int n = ((int)(5.5f * getTimeS()) % 4);
drawCenteredString(minecraft->font, spinnerTexts[n], spinnerX, 8, 0xffffffff);
drawCenteredString(minecraft.font(), spinnerTexts[n], spinnerX, 8, 0xffffffff);
} else {
drawCenteredString(minecraft->font, "WiFi is disabled", baseX, 8, 0xffffffff);
drawCenteredString(minecraft.font(), "WiFi is disabled", baseX, 8, 0xffffffff);
}
}

View File

@@ -3,7 +3,7 @@
#include "client/gui/Screen.hpp"
#include "client/gui/components/Button.hpp"
#include "client/gui/components/RolledSelectionListV.hpp"
#include "client/Minecraft.hpp"
#include <MinecraftClient.hpp>
#include "platform/input/Multitouch.hpp"
#include "network/RakNetInstance.hpp"
@@ -20,7 +20,7 @@ class AvailableGamesList : public RolledSelectionListV
friend class JoinGameScreen;
public:
AvailableGamesList(Minecraft* _minecraft, int _width, int _height)
AvailableGamesList(MinecraftClient& _minecraft, int _width, int _height)
: RolledSelectionListV(_minecraft, _width, _height, 0, _width, 24, _height, 34),
selectedItem(-1),
startSelected(-1)

View File

@@ -21,7 +21,7 @@ namespace Touch {
//
// World Selection List
//
TouchWorldSelectionList::TouchWorldSelectionList( Minecraft* minecraft, int width, int height )
TouchWorldSelectionList::TouchWorldSelectionList( MinecraftClient& minecraft, int width, int height )
: _height(height),
hasPickedLevel(false),
pickedIndex(-1),
@@ -85,12 +85,12 @@ void TouchWorldSelectionList::renderItem( int i, int x, int y, int h, Tesselator
if (i < (int)levels.size()) {
// Draw the worlds
StringVector v = _descriptions[i];
drawString(minecraft->font, v[0].c_str(), TX, TY + 0, textColor);
drawString(minecraft->font, v[1].c_str(), TX, TY + 10, textColor2);
drawString(minecraft->font, v[2].c_str(), TX, TY + 20, textColor2);
drawString(minecraft->font, v[3].c_str(), TX, TY + 30, textColor2);
drawString(minecraft.font(), v[0].c_str(), TX, TY + 0, textColor);
drawString(minecraft.font(), v[1].c_str(), TX, TY + 10, textColor2);
drawString(minecraft.font(), v[2].c_str(), TX, TY + 20, textColor2);
drawString(minecraft.font(), v[3].c_str(), TX, TY + 30, textColor2);
minecraft->textures->loadAndBindTexture(_imageNames[i]);
minecraft.textures().loadAndBindTexture(_imageNames[i]);
t.color(0.3f, 1.0f, 0.2f);
//float x0 = (float)x;
@@ -106,9 +106,9 @@ void TouchWorldSelectionList::renderItem( int i, int x, int y, int h, Tesselator
t.draw();
} else {
// Draw the "Create new world" icon
drawCenteredString(minecraft->font, "Create new", centerx, TY + 12, textColor);
drawCenteredString(minecraft.font(), "Create new", centerx, TY + 12, textColor);
minecraft->textures->loadAndBindTexture("gui/touchgui.png");
minecraft.textures().loadAndBindTexture("gui/touchgui.png");
const bool selected = _newWorldSelected;
@@ -164,7 +164,7 @@ void TouchWorldSelectionList::commit() {
std::stringstream ss;
ss << level.name << "/preview.png";
TextureId id = Textures::InvalidId;//minecraft->textures->loadTexture(ss.str(), false);
TextureId id = Textures::InvalidId;//minecraft.textures().loadTexture(ss.str(), false);
if (id != Textures::InvalidId) {
_imageNames.push_back( ss.str() );
@@ -174,7 +174,7 @@ void TouchWorldSelectionList::commit() {
StringVector lines;
lines.push_back(levels[i].name);
lines.push_back(minecraft->platform()->getDateString(levels[i].lastPlayed));
lines.push_back(minecraft.platform()->getDateString(levels[i].lastPlayed));
lines.push_back(levels[i].id);
lines.push_back(LevelSettings::gameTypeToString(level.gameType));
_descriptions.push_back(lines);
@@ -350,19 +350,19 @@ void SelectWorldScreen::buttonClicked(Button* button)
if (button->id == bCreate.id) {
if (!_hasStartedLevel) {
std::string name = getUniqueLevelName("World");
minecraft->setScreen(new SimpleChooseLevelScreen(name));
minecraft.setScreen(new SimpleChooseLevelScreen(name));
}
}
if (button->id == bDelete.id) {
if (isIndexValid(worldsList->selectedItem)) {
LevelSummary level = worldsList->levels[worldsList->selectedItem];
LOGI("level: %s, %s\n", level.id.c_str(), level.name.c_str());
minecraft->setScreen( new TouchDeleteWorldScreen(level) );
minecraft.setScreen( new TouchDeleteWorldScreen(level) );
}
}
if (button->id == bBack.id) {
minecraft->cancelLocateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
minecraft.cancelLocateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_STARTMENU);
}
if (button->id == bWorldView.id) {
// Try to "click" the item in the middle
@@ -374,8 +374,8 @@ bool SelectWorldScreen::handleBackEvent(bool isDown)
{
if (!isDown)
{
minecraft->cancelLocateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_STARTMENU);
minecraft.cancelLocateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_STARTMENU);
}
return true;
}
@@ -417,19 +417,19 @@ void SelectWorldScreen::tick()
std::string levelId = getUniqueLevelName("World");
//int seed = Util::hashCode("/r/Minecraft");
LevelSettings settings(getEpochTimeS(), GameType::Creative);
minecraft->selectLevel(levelId, levelId, settings);
minecraft->hostMultiplayer();
minecraft->setScreen(new ProgressScreen());
minecraft.selectLevel(levelId, levelId, settings);
minecraft.hostMultiplayer();
minecraft.setScreen(new ProgressScreen());
_hasStartedLevel = true;
#elif defined(PLATFORM_DESKTOP)
std::string name = getUniqueLevelName("World");
minecraft->setScreen(new SimpleChooseLevelScreen(name));
minecraft.setScreen(new SimpleChooseLevelScreen(name));
#else
int status = minecraft->platform()->getUserInputStatus();
int status = minecraft.platform()->getUserInputStatus();
//LOGI("Status is: %d\n", status);
if (status > -1) {
if (status == 1) {
StringVector sv = minecraft->platform()->getUserInput();
StringVector sv = minecraft.platform()->getUserInput();
// Read the level name.
// 1) Trim name 2) Remove all bad chars 3) Append '-' chars 'til the name is unique
@@ -466,9 +466,9 @@ void SelectWorldScreen::tick()
// Start a new level with the given name and seed
LOGI("Creating a level with id '%s', name '%s' and seed '%d'\n", levelId.c_str(), levelName.c_str(), seed);
LevelSettings settings(seed, isCreative? GameType::Creative : GameType::Survival);
minecraft->selectLevel(levelId, levelName, settings);
minecraft->hostMultiplayer();
minecraft->setScreen(new ProgressScreen());
minecraft.selectLevel(levelId, levelName, settings);
minecraft.hostMultiplayer();
minecraft.setScreen(new ProgressScreen());
_hasStartedLevel = true;
}
_state = _STATE_DEFAULT;
@@ -489,11 +489,11 @@ void SelectWorldScreen::tick()
if (worldsList->pickedIndex == worldsList->levels.size()) {
worldsList->hasPickedLevel = false;
std::string name = getUniqueLevelName("World");
minecraft->setScreen(new SimpleChooseLevelScreen(name));
minecraft.setScreen(new SimpleChooseLevelScreen(name));
} else {
minecraft->selectLevel(worldsList->pickedLevel.id, worldsList->pickedLevel.name, LevelSettings::None());
minecraft->hostMultiplayer();
minecraft->setScreen(new ProgressScreen());
minecraft.selectLevel(worldsList->pickedLevel.id, worldsList->pickedLevel.name, LevelSettings::None());
minecraft.hostMultiplayer();
minecraft.setScreen(new ProgressScreen());
_hasStartedLevel = true;
return;
}
@@ -533,7 +533,7 @@ void SelectWorldScreen::render( int xm, int ym, float a )
Screen::render(xm, ym, a);
//Performance::watches.get("sws-screen").stop();
//minecraft->textures->loadAndBindTexture("gui/selectworld/trash.png");
//minecraft.textures().loadAndBindTexture("gui/selectworld/trash.png");
//Performance::watches.get("sws-string").start();
//Performance::watches.get("sws-string").stop();
@@ -544,7 +544,7 @@ void SelectWorldScreen::render( int xm, int ym, float a )
void SelectWorldScreen::loadLevelSource()
{
LevelStorageSource* levelSource = minecraft->getLevelSource();
LevelStorageSource* levelSource = minecraft.getLevelSource();
levelSource->getLevelList(levels);
std::sort(levels.begin(), levels.end());
@@ -572,9 +572,9 @@ bool SelectWorldScreen::isInGameScreen() { return true; }
void SelectWorldScreen::keyPressed( int eventKey )
{
if (bWorldView.selected) {
if (eventKey == minecraft->options.getIntValue(OPTIONS_KEY_LEFT))
if (eventKey == minecraft.options().getIntValue(OPTIONS_KEY_LEFT))
worldsList->stepLeft();
if (eventKey == minecraft->options.getIntValue(OPTIONS_KEY_RIGHT))
if (eventKey == minecraft.options().getIntValue(OPTIONS_KEY_RIGHT))
worldsList->stepRight();
}
@@ -596,10 +596,10 @@ TouchDeleteWorldScreen::TouchDeleteWorldScreen(const LevelSummary& level)
void TouchDeleteWorldScreen::postResult( bool isOk )
{
if (isOk) {
LevelStorageSource* storageSource = minecraft->getLevelSource();
LevelStorageSource* storageSource = minecraft.getLevelSource();
storageSource->deleteLevel(_level.id);
}
minecraft->screenChooser.setScreen(SCREEN_SELECTWORLD);
minecraft.screenChooser.setScreen(SCREEN_SELECTWORLD);
}
};

View File

@@ -6,7 +6,7 @@
#include "client/gui/components/ImageButton.hpp"
#include "client/gui/components/Button.hpp"
#include "client/gui/components/RolledSelectionListH.hpp"
#include "client/Minecraft.hpp"
#include <MinecraftClient.hpp>
#include "world/level/storage/LevelStorageSource.hpp"
@@ -20,7 +20,7 @@ class SelectWorldScreen;
class TouchWorldSelectionList : public RolledSelectionListH
{
public:
TouchWorldSelectionList(Minecraft* _minecraft, int _width, int _height);
TouchWorldSelectionList(MinecraftClient& _minecraft, int _width, int _height);
virtual void tick();
void stepLeft();
void stepRight();

View File

@@ -7,7 +7,7 @@
#include "client/gui/components/ScrolledSelectionList.hpp"
#include "client/gui/components/GuiElement.hpp"
#include "client/Minecraft.hpp"
#include <MinecraftClient.hpp>
#include "client/renderer/Tesselator.hpp"
#include "client/renderer/Textures.hpp"
#include "client/renderer/TextureData.hpp"
@@ -85,7 +85,7 @@ void StartMenuScreen::init()
// always show base version string
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;
@@ -127,8 +127,8 @@ void StartMenuScreen::setupPositions() {
bQuit.x = width - bQuit.width;
bQuit.y = 0;
copyrightPosX = width - minecraft->font->width(copyright) - 1;
versionPosX = (width - minecraft->font->width(version)) / 2;// - minecraft->font->width(version) - 2;
copyrightPosX = width - minecraft.font()->width(copyright) - 1;
versionPosX = (width - minecraft.font()->width(version)) / 2;// - minecraft.font()->width(version) - 2;
}
void StartMenuScreen::buttonClicked(::Button* button) {
@@ -136,27 +136,27 @@ 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)
{
#ifdef APPLE_DEMO_PROMOTION
minecraft->platform()->createUserInput(DialogDefinitions::DIALOG_DEMO_FEATURE_DISABLED);
minecraft.platform()->createUserInput(DialogDefinitions::DIALOG_DEMO_FEATURE_DISABLED);
#else
minecraft->locateMultiplayer();
minecraft->screenChooser.setScreen(SCREEN_JOINGAME);
minecraft.locateMultiplayer();
minecraft.screenChooser.setScreen(SCREEN_JOINGAME);
#endif
}
if (button->id == bOptions.id)
{
minecraft->setScreen(new OptionsScreen());
minecraft.setScreen(new OptionsScreen());
}
if (button == &bQuit)
{
minecraft->quit();
minecraft.quit();
}
}
@@ -172,14 +172,14 @@ void StartMenuScreen::render( int xm, int ym, float a )
glEnable2(GL_BLEND);
#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 = 4;
@@ -200,7 +200,7 @@ void StartMenuScreen::render( int xm, int ym, float a )
drawString(font, version, versionPosX, (int)(y+h)+2, /*50,*/ 0xffcccccc);//0x666666);
drawString(font, copyright, copyrightPosX, height - 10, 0xffffff);
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);
drawString(font, "Kolyah35/minecraft-pe-0.6.1", 12, height - 10, 0xffcccccc);
//patch->draw(t, 0, 20);
@@ -212,17 +212,17 @@ 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;
}