mirror of
https://github.com/celisej567/mcpe.git
synced 2025-12-31 17:49:17 +03:00
* Add option to split controls
This commit is contained in:
@@ -221,6 +221,11 @@ bool Minecraft::isTouchscreen()
|
||||
return m_bIsTouchscreen;
|
||||
}
|
||||
|
||||
bool Minecraft::useSplitControls()
|
||||
{
|
||||
return !m_bIsTouchscreen || m_options->m_bSplitControls;
|
||||
}
|
||||
|
||||
void Minecraft::setGuiScaleMultiplier(float f)
|
||||
{
|
||||
guiScaleMultiplier = f;
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
void respawnPlayer(Player* player);
|
||||
std::string getVersionString();
|
||||
bool isTouchscreen();
|
||||
bool useSplitControls();
|
||||
|
||||
virtual void update() override;
|
||||
virtual void init() override;
|
||||
|
||||
@@ -170,13 +170,16 @@ void Gui::render(float f, bool bHaveScreen, int mouseX, int mouseY)
|
||||
|
||||
m->m_pTextures->loadAndBindTexture("gui/icons.png");
|
||||
|
||||
if (!isTouchscreen)
|
||||
if (m->useSplitControls())
|
||||
{
|
||||
#ifndef ENH_TRANSPARENT_HOTBAR
|
||||
glEnable(GL_BLEND);
|
||||
#endif
|
||||
|
||||
// draw crosshair
|
||||
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||
blit(cenX - 8, height / 2 - 8, 0, 0, 16, 16, 0, 0);
|
||||
|
||||
#ifndef ENH_TRANSPARENT_HOTBAR
|
||||
glDisable(GL_BLEND);
|
||||
#endif
|
||||
|
||||
@@ -306,28 +306,28 @@ void OptionList::initDefaultMenu()
|
||||
#define HEADER(text) do { m_items.push_back(new HeaderOptionItem(text)); currentIndex++; } while (0)
|
||||
#define OPTION(type, name, text) do { m_items.push_back(new type ## OptionItem(&pOptions->name, text)); currentIndex++; } while (0)
|
||||
|
||||
int idxLM = -1;
|
||||
int idxGrass = -1, idxBiome = -1;
|
||||
int idxLM = -1, idxGrass = -1, idxBiome = -1, idxSplit = -1;
|
||||
|
||||
HEADER("Video");
|
||||
{
|
||||
OPTION(Distance, m_iViewDistance, "View distance");
|
||||
OPTION(AORender, m_bAmbientOcclusion, "Smooth lighting");
|
||||
OPTION(Render, m_bFancyGraphics, "Fancy graphics");
|
||||
OPTION(Boolean, m_bAnaglyphs, "3d Anaglyphs");
|
||||
OPTION(Boolean, m_bDebugText, "Debug text");
|
||||
OPTION(Boolean, m_bFlyCheat, "Flight hax");
|
||||
OPTION(Boolean, m_bDontRenderGui, "Hide GUI");
|
||||
OPTION(Boolean, m_bBlockOutlines, "Block outlines");
|
||||
OPTION(Boolean, m_bViewBobbing, "View bobbing");
|
||||
OPTION(Boolean, m_bAnaglyphs, "3d Anaglyphs");
|
||||
OPTION(Boolean, m_bBlockOutlines, "Block outlines");
|
||||
OPTION(Render, m_bFancyGrass, "Fancy grass"); idxGrass = currentIndex; // renders colored grass side overlay
|
||||
OPTION(Render, m_bBiomeColors, "Biome colors"); idxBiome = currentIndex; // colors the grass based on the current biome
|
||||
OPTION(Boolean, m_bDontRenderGui, "Hide GUI");
|
||||
OPTION(Boolean, m_bDebugText, "Debug text");
|
||||
}
|
||||
|
||||
HEADER("Controls");
|
||||
{
|
||||
OPTION(Boolean, m_bAutoJump, "Auto jump");
|
||||
OPTION(Boolean, m_bInvertMouse, "Invert Y-axis");
|
||||
OPTION(Boolean, m_bSplitControls, "Split controls"); idxSplit = currentIndex;
|
||||
OPTION(Boolean, m_bFlyCheat, "Flight hax");
|
||||
}
|
||||
|
||||
HEADER("Multiplayer");
|
||||
@@ -344,4 +344,7 @@ void OptionList::initDefaultMenu()
|
||||
|
||||
if (!GrassColor::isAvailable() || !FoliageColor::isAvailable())
|
||||
m_items[idxBiome]->setDisabled(true);
|
||||
|
||||
if (!m_pMinecraft->isTouchscreen())
|
||||
m_items[idxSplit]->setDisabled(true);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ void Options::_initDefaultValues()
|
||||
m_bBlockOutlines = false;
|
||||
m_bFancyGrass = false;
|
||||
m_bBiomeColors = false;
|
||||
m_bSplitControls = false;
|
||||
field_19 = 1;
|
||||
|
||||
// Win32 key codes are being used by default
|
||||
|
||||
@@ -128,6 +128,7 @@ public:
|
||||
bool m_bBlockOutlines;
|
||||
bool m_bFancyGrass;
|
||||
bool m_bBiomeColors;
|
||||
bool m_bSplitControls;
|
||||
|
||||
public:
|
||||
struct Option
|
||||
|
||||
@@ -824,7 +824,7 @@ void GameRenderer::pick(float f)
|
||||
float dist = m_pMinecraft->m_pGameMode->getPickRange();
|
||||
bool isFirstPerson = !m_pMinecraft->getOptions()->m_bThirdPerson;
|
||||
|
||||
if (m_pMinecraft->isTouchscreen())
|
||||
if (!m_pMinecraft->useSplitControls())
|
||||
{
|
||||
Vec3 mobPos = pMob->getPos(f);
|
||||
Vec3 foundPosNear, foundPosFar;
|
||||
|
||||
Reference in New Issue
Block a user