* Fix screwed up formatting.

This commit is contained in:
iProgramInCpp
2024-01-22 18:39:44 +02:00
parent 501a2a8dbd
commit 047fd3120f
6 changed files with 66 additions and 62 deletions

View File

@@ -152,10 +152,10 @@ void AppPlatform::showKeyboard()
void AppPlatform::showKeyboard(bool bShown)
{
if (bShown)
showKeyboard();
else
hideKeyboard();
if (bShown)
showKeyboard();
else
hideKeyboard();
}
void AppPlatform::hideKeyboard()
@@ -175,32 +175,32 @@ int AppPlatform::getKeyboardUpOffset()
void AppPlatform::_fireLowMemory()
{
}
void AppPlatform::_fireAppSuspended()
{
}
void AppPlatform::_fireAppResumed()
{
}
void AppPlatform::_fireAppFocusLost()
{
}
void AppPlatform::_fireAppFocusGained()
{
}
void AppPlatform::_fireAppTerminated()
{
}
bool AppPlatform::hasFileSystemAccess()
@@ -224,13 +224,13 @@ SoundSystem* const AppPlatform::getSoundSystem() const
std::string AppPlatform::getAssetPath(const std::string &path) const
{
std::string realPath = path;
if (realPath.size() && realPath[0] == '/')
{
// trim it off
realPath = realPath.substr(1);
}
realPath = "assets/" + realPath;
return realPath;
std::string realPath = path;
if (realPath.size() && realPath[0] == '/')
{
// trim it off
realPath = realPath.substr(1);
}
realPath = "assets/" + realPath;
return realPath;
}

View File

@@ -59,7 +59,7 @@ public:
virtual void updateFocused(bool focused);
// Also add this to allow proper text input within the game.
virtual bool shiftPressed();
// On-screen keyboard
// On-screen keyboard
virtual void showKeyboard(int x, int y, int w, int h);
virtual void showKeyboard();
virtual void showKeyboard(bool bShown); // @TODO: Why on earth is this here?
@@ -69,13 +69,13 @@ public:
#ifdef USE_NATIVE_ANDROID
virtual int getKeyboardUpOffset();
#endif
void _fireLowMemory();
void _fireAppSuspended();
void _fireAppResumed();
void _fireAppFocusLost();
void _fireAppFocusGained();
void _fireAppTerminated();
void _fireLowMemory();
void _fireAppSuspended();
void _fireAppResumed();
void _fireAppFocusLost();
void _fireAppFocusGained();
void _fireAppTerminated();
virtual bool hasFileSystemAccess();
// Also add this to allow dynamic patching.
@@ -85,7 +85,7 @@ public:
#endif
public:
virtual std::string getAssetPath(const std::string& path) const;
virtual std::string getAssetPath(const std::string& path) const;
private:
virtual void _tick();

View File

@@ -31,10 +31,10 @@
#include "client/renderer/GrassColor.hpp"
#include "client/renderer/FoliageColor.hpp"
// custom:
// custom:
#include "client/renderer/PatchManager.hpp"
int Minecraft::width = C_DEFAULT_SCREEN_WIDTH;
int Minecraft::width = C_DEFAULT_SCREEN_WIDTH;
int Minecraft::height = C_DEFAULT_SCREEN_HEIGHT;
float Minecraft::guiScaleMultiplier = 1.0f;
bool Minecraft::useAmbientOcclusion = false;
@@ -331,13 +331,13 @@ void Minecraft::handleBuildAction(BuildActionIntention* pAction)
{
switch (m_hitResult.m_hitSide)
{
case HitResult::NOHIT: break;
case HitResult::MINY: dy--; break;
case HitResult::MAXY: dy++; break;
case HitResult::MINZ: dz--; break;
case HitResult::MAXZ: dz++; break;
case HitResult::MINX: dx--; break;
case HitResult::MAXX: dx++; break;
case HitResult::NOHIT: break;
case HitResult::MINY: dy--; break;
case HitResult::MAXY: dy++; break;
case HitResult::MINZ: dz--; break;
case HitResult::MAXZ: dz++; break;
case HitResult::MINX: dx--; break;
case HitResult::MAXX: dx++; break;
}
}
else
@@ -538,10 +538,10 @@ void Minecraft::tickInput()
bool flag =
// If we are mouse operated, the LMB is held down and it's not in the GUI
((m_options->field_19 && Mouse::isButtonDown(BUTTON_LEFT) && !bIsInGUI) ||
// We are instead keyboard operated, so check for the KM_DESTROY key being held down
(!m_options->field_19 && Keyboard::isKeyDown(m_options->m_keyMappings[KM_DESTROY].value)) ||
// The build action intention is a remove one
(b && bai.isRemove()));
// We are instead keyboard operated, so check for the KM_DESTROY key being held down
(!m_options->field_19 && Keyboard::isKeyDown(m_options->m_keyMappings[KM_DESTROY].value)) ||
// The build action intention is a remove one
(b && bai.isRemove()));
if (flag && !m_pScreen && (field_DA8 - field_DAC) >= (m_timer.m_ticksPerSecond * 0.25f))
{
@@ -831,7 +831,7 @@ void Minecraft::init()
m_pGameMode = new CreativeMode(this);
#endif
// "Default.png" for the launch image overwrites "default.png" for the font during app packaging
// "Default.png" for the launch image overwrites "default.png" for the font during app packaging
m_pFont = new Font(m_options, "font/default8.png", m_pTextures);
if (GrassColor::isAvailable())
@@ -974,9 +974,13 @@ void Minecraft::sizeUpdate(int newWidth, int newHeight)
// re-calculate the GUI scale.
Gui::InvGuiScale = getBestScaleForThisScreenSize(newWidth, newHeight) / guiScaleMultiplier;
// the ceil prevents under-drawing
// The ceil gives an extra pixel to the screen's width and height, in case the GUI scale doesn't
// divide evenly into width or height, so that none of the game screen is uncovered.
if (m_pScreen)
m_pScreen->setSize(ceil(Minecraft::width * Gui::InvGuiScale), ceil(Minecraft::height * Gui::InvGuiScale));
m_pScreen->setSize(
int(ceilf(Minecraft::width * Gui::InvGuiScale)),
int(ceilf(Minecraft::height * Gui::InvGuiScale))
);
if (m_pInputHolder)
m_pInputHolder->setScreenSize(Minecraft::width, Minecraft::height);

View File

@@ -83,9 +83,9 @@ public:
Options* getOptions() const { return m_options; }
static void setGuiScaleMultiplier(float f);
private:
void _reloadInput();
void _reloadInput();
void _levelGenerated();
public:

View File

@@ -108,9 +108,9 @@ void Gui::renderVignette(float a2, int a3, int a4)
Tesselator& t = Tesselator::instance;
t.begin();
t.vertexUV(0.0f, a4, -90.0f, 0.0f, 1.0f);
t.vertexUV(a3, a4, -90.0f, 1.0f, 1.0f);
t.vertexUV(a3, 0.0f, -90.0f, 1.0f, 0.0f);
t.vertexUV(0.0f, a4, -90.0f, 0.0f, 1.0f);
t.vertexUV(a3, a4, -90.0f, 1.0f, 1.0f);
t.vertexUV(a3, 0.0f, -90.0f, 1.0f, 0.0f);
t.vertexUV(0.0f, 0.0f, -90.0f, 0.0f, 0.0f);
t.draw();
@@ -150,8 +150,8 @@ void Gui::render(float f, bool bHaveScreen, int mouseX, int mouseY)
field_4 = -90.0f;
int width = Minecraft::width * InvGuiScale,
height = Minecraft::height * InvGuiScale;
int width = int(ceilf(Minecraft::width * InvGuiScale)),
height = int(ceilf(Minecraft::height * InvGuiScale));
#ifdef ENH_TRANSPARENT_HOTBAR
glEnable(GL_BLEND);
@@ -298,8 +298,8 @@ void Gui::render(float f, bool bHaveScreen, int mouseX, int mouseY)
if (m->m_pLocalPlayer->isUnderLiquid(Material::water))
{
int breathRaw = m->m_pLocalPlayer->field_BC;
int breathFull = int(ceilf((float(breathRaw - 2) * 10.0f) / 300.0f));
int breathMeter = int(ceilf((float(breathRaw) * 10.0f) / 300.0f)) - breathFull;
int breathFull = int(ceilf((float(breathRaw - 2) * 10.0f) / 300.0f));
int breathMeter = int(ceilf((float(breathRaw) * 10.0f) / 300.0f)) - breathFull;
int bubbleX = cenX - 191;
int bubbleY = height - 19;
@@ -490,7 +490,7 @@ void Gui::handleKeyPressed(int keyCode)
void Gui::renderMessages(bool bShowAll)
{
//int width = Minecraft::width * InvGuiScale,
int height = Minecraft::height * InvGuiScale;
int height = int(ceilf(Minecraft::height * InvGuiScale));
int topEdge = height - 49;

View File

@@ -14,7 +14,7 @@
std::string g_sNotAvailableInDemoVersion = "Not available in the demo version";
IngameBlockSelectionScreen::IngameBlockSelectionScreen() :
m_btnPause(0, "Pause")
m_btnPause(0, "Pause")
{
m_selectedSlot = 0;
}
@@ -75,10 +75,10 @@ void IngameBlockSelectionScreen::init()
m_btnPause.m_xPos = 0;
m_btnPause.m_yPos = 0;
#if TARGET_OS_IPHONE != 0
if (m_pMinecraft->isTouchscreen())
m_buttons.push_back(&m_btnPause);
if (m_pMinecraft->isTouchscreen())
m_buttons.push_back(&m_btnPause);
#endif
Inventory* pInv = getInventory();
int nItems = pInv->getNumItems();
@@ -166,8 +166,8 @@ void IngameBlockSelectionScreen::buttonClicked(Button* pButton)
void IngameBlockSelectionScreen::mouseClicked(int x, int y, int type)
{
Screen::mouseClicked(x, y, type);
Screen::mouseClicked(x, y, type);
// not a left click
if (type != 1)
return;
@@ -179,8 +179,8 @@ void IngameBlockSelectionScreen::mouseClicked(int x, int y, int type)
void IngameBlockSelectionScreen::mouseReleased(int x, int y, int type)
{
Screen::mouseReleased(x, y, type);
Screen::mouseReleased(x, y, type);
// not a left click
if (type != 1)
return;