GUI: Fix mobile controls

This commit is contained in:
Er2
2023-12-09 21:14:41 +03:00
parent b6bf9d616a
commit bb11bf0825
8 changed files with 37 additions and 25 deletions

View File

@@ -12,7 +12,7 @@
#include "client/options/Options.hpp"
TouchInputHolder::TouchInputHolder(Minecraft* pMinecraft, Options* pOptions) :
m_touchScreenInput(pMinecraft, pOptions),
m_touchScreenInput(nullptr),
m_unifiedTurnBuild(2, Minecraft::width, Minecraft::height, 200.0f, 1.05f, this),
m_pMinecraft(pMinecraft)
{
@@ -41,7 +41,7 @@ bool TouchInputHolder::allowPicking()
IMoveInput* TouchInputHolder::getMoveInput()
{
return &m_touchScreenInput;
return m_touchScreenInput;
}
ITurnInput* TouchInputHolder::getTurnInput()
@@ -56,8 +56,8 @@ IBuildInput* TouchInputHolder::getBuildInput()
void TouchInputHolder::setScreenSize(int width, int height)
{
m_touchScreenInput.setScreenSize(width, height);
m_unifiedTurnBuild.field_40 = m_touchScreenInput.getRectangleArea();
m_touchScreenInput->setScreenSize(width, height);
m_unifiedTurnBuild.field_40 = m_touchScreenInput->getRectangleArea();
m_unifiedTurnBuild.field_58 = getRectangleArea(m_pMinecraft->m_pGui, false);
m_unifiedTurnBuild.setScreenSize(width, height);
}

View File

@@ -41,7 +41,7 @@ public:
return m_rectArea;
}
private:
protected:
Minecraft* m_pMinecraft;
Options* m_pOptions;
RectangleArea m_rectArea;
@@ -58,7 +58,7 @@ public:
void setScreenSize(int width, int height) override;
public:
TouchInput m_touchScreenInput;
TouchInput *m_touchScreenInput;
UnifiedTurnBuild m_unifiedTurnBuild;
Minecraft* m_pMinecraft;
};