mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-23 20:09:46 +03:00
Mac OS X 10.6 & More C++03 Support (#68)
* Mac OS X 10.6 & More C++03 Support * Fix SDL2 options.txt loading for C++03 --------- Co-authored-by: Brent Da Mage <BrentDaMage@users.noreply.github.com>
This commit is contained in:
@@ -18,7 +18,7 @@ GuiComponent::GuiComponent() : field_4 (0)
|
||||
|
||||
void GuiComponent::blit(int dx, int dy, int sx, int sy, int tw, int th, int sw, int sh)
|
||||
{
|
||||
auto& t = Tesselator::instance;
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
if (!sh) sh = th;
|
||||
if (!sw) sw = tw;
|
||||
|
||||
@@ -43,7 +43,7 @@ void SelectWorldScreen::init()
|
||||
m_buttons.push_back(&m_btnBack);
|
||||
m_buttons.push_back(&m_btnDelete);
|
||||
|
||||
field_12C = Mouse::getButtonState(Mouse::ButtonType::NONE) == Mouse::ButtonState::UP;
|
||||
field_12C = Mouse::getButtonState(Mouse::NONE) == Mouse::UP;
|
||||
|
||||
m_buttonTabList.push_back(&m_btnUnknown);
|
||||
m_buttonTabList.push_back(&m_btnDelete);
|
||||
@@ -171,7 +171,7 @@ void SelectWorldScreen::render(int mouseX, int mouseY, float f)
|
||||
else
|
||||
{
|
||||
m_pWorldSelectionList->render(0, 0, f);
|
||||
field_12C = Mouse::getButtonState(Mouse::ButtonType::LEFT) == Mouse::ButtonState::UP;
|
||||
field_12C = Mouse::getButtonState(Mouse::LEFT) == Mouse::UP;
|
||||
}
|
||||
|
||||
Screen::render(mouseX, mouseY, f);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include "common/Utils.hpp"
|
||||
#include "client/renderer/VertexPT.hpp"
|
||||
#include "client/renderer/Tesselator.hpp"
|
||||
#include "GameMods.hpp"
|
||||
|
||||
@@ -52,7 +52,7 @@ bool Keyboard::isKeyDown(int keyCode)
|
||||
if (keyCode < 0 || keyCode >= KEYBOARD_STATES_SIZE)
|
||||
return false;
|
||||
|
||||
return _states[keyCode] == KeyState::DOWN;
|
||||
return _states[keyCode] == DOWN;
|
||||
}
|
||||
|
||||
void Keyboard::reset()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <stdint.h>
|
||||
|
||||
#define KEYBOARD_STATES_SIZE (256)
|
||||
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
std::vector<MouseAction> Mouse::_inputs;
|
||||
int Mouse::_index, Mouse::_x, Mouse::_y;
|
||||
int Mouse::_xOld, Mouse::_yOld;
|
||||
Mouse::ButtonState Mouse::_buttonStates[Mouse::ButtonType::COUNT];
|
||||
Mouse::ButtonState Mouse::_buttonStates[Mouse::COUNT];
|
||||
|
||||
void Mouse::feed(ButtonType buttonType, ButtonState buttonState, int posX, int posY)
|
||||
{
|
||||
if (buttonType != ButtonType::NONE)
|
||||
if (buttonType != NONE)
|
||||
_inputs.push_back(MouseAction(buttonType, buttonState, posX, posY));
|
||||
|
||||
// Make sure button type is valid
|
||||
if (buttonType < ButtonType::COUNT)
|
||||
if (buttonType < COUNT)
|
||||
{
|
||||
// Check if we're processing a button-state update
|
||||
if (buttonType != ButtonType::NONE)
|
||||
if (buttonType != NONE)
|
||||
_buttonStates[buttonType] = buttonState;
|
||||
|
||||
_xOld = _x;
|
||||
@@ -75,8 +75,8 @@ MouseAction* Mouse::getEvent()
|
||||
|
||||
Mouse::ButtonState Mouse::getButtonState(ButtonType btn)
|
||||
{
|
||||
if (btn < ButtonType::MIN || btn >= ButtonType::COUNT)
|
||||
return ButtonState::UP;
|
||||
if (btn < MIN || btn >= COUNT)
|
||||
return UP;
|
||||
|
||||
return _buttonStates[btn];
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ private:
|
||||
static int _index;
|
||||
static int _x, _y;
|
||||
static int _xOld, _yOld;
|
||||
static ButtonState _buttonStates[Mouse::ButtonType::COUNT];
|
||||
static ButtonState _buttonStates[Mouse::COUNT];
|
||||
};
|
||||
|
||||
struct MouseAction
|
||||
@@ -67,8 +67,8 @@ struct MouseAction
|
||||
|
||||
MouseAction()
|
||||
{
|
||||
_buttonType = Mouse::ButtonType::NONE;
|
||||
_buttonState = Mouse::ButtonState::UP;
|
||||
_buttonType = Mouse::NONE;
|
||||
_buttonState = Mouse::UP;
|
||||
_posX = 0;
|
||||
_posY = 0;
|
||||
}
|
||||
@@ -84,8 +84,8 @@ struct MouseAction
|
||||
bool isButton()
|
||||
{
|
||||
return
|
||||
_buttonType == Mouse::ButtonType::LEFT ||
|
||||
_buttonType == Mouse::ButtonType::RIGHT ||
|
||||
_buttonType == Mouse::ButtonType::MIDDLE;
|
||||
_buttonType == Mouse::LEFT ||
|
||||
_buttonType == Mouse::RIGHT ||
|
||||
_buttonType == Mouse::MIDDLE;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -530,8 +530,8 @@ void GameRenderer::render(float f)
|
||||
{
|
||||
if (m_pMinecraft->m_pLocalPlayer && m_pMinecraft->m_bGrabbedMouse)
|
||||
{
|
||||
auto pMC = m_pMinecraft;
|
||||
auto delta = pMC->m_pTurnInput->getTurnDelta();
|
||||
Minecraft *pMC = m_pMinecraft;
|
||||
ITurnInput::Delta delta = pMC->m_pTurnInput->getTurnDelta();
|
||||
pMC->field_D20 = delta.x;
|
||||
pMC->field_D24 = delta.y;
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ void LevelRenderer::render(Mob* pMob, int a, float b)
|
||||
if (!pChunk->m_bDirty)
|
||||
continue;
|
||||
|
||||
auto iter = std::find(field_88.begin(), field_88.end(), pChunk);
|
||||
std::vector<Chunk*>::iterator iter = std::find(field_88.begin(), field_88.end(), pChunk);
|
||||
if (iter != field_88.end())
|
||||
continue;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
********************************************************************/
|
||||
|
||||
#include "RenderList.hpp"
|
||||
#include "common/Utils.hpp"
|
||||
#include "Tesselator.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdint.h>
|
||||
#include <map>
|
||||
#include "compat/GL.hpp"
|
||||
#include "RenderChunk.hpp"
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdint.h>
|
||||
#include "common/Utils.hpp"
|
||||
|
||||
struct Texture
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ bool Textures::MIPMAP = false;
|
||||
|
||||
int Textures::loadTexture(const std::string& name, bool b)
|
||||
{
|
||||
auto i = m_textures.find(name);
|
||||
std::map<std::string, GLuint>::iterator i = m_textures.find(name);
|
||||
if (i != m_textures.end())
|
||||
return i->second;
|
||||
|
||||
@@ -83,10 +83,10 @@ void Textures::clear()
|
||||
{
|
||||
// note: Textures::clear() does not touch the dynamic textures vector
|
||||
|
||||
for (auto it = m_textures.begin(); it != m_textures.end(); it++)
|
||||
for (std::map<std::string, GLuint>::iterator it = m_textures.begin(); it != m_textures.end(); it++)
|
||||
glDeleteTextures(1, &it->second);
|
||||
|
||||
for (auto it = m_textureData.begin(); it != m_textureData.end(); it++)
|
||||
for (std::map<GLuint, TextureData>::iterator it = m_textureData.begin(); it != m_textureData.end(); it++)
|
||||
delete[] it->second.textureData.m_pixels;
|
||||
|
||||
m_textures.clear();
|
||||
@@ -107,7 +107,7 @@ Textures::~Textures()
|
||||
{
|
||||
clear();
|
||||
|
||||
for (auto it = m_dynamicTextures.begin(); it != m_dynamicTextures.end(); it++)
|
||||
for (std::vector<DynamicTexture*>::iterator it = m_dynamicTextures.begin(); it != m_dynamicTextures.end(); it++)
|
||||
{
|
||||
DynamicTexture* pDynaTex = *it;
|
||||
SAFE_DELETE(pDynaTex);
|
||||
@@ -119,7 +119,7 @@ Textures::~Textures()
|
||||
void Textures::tick()
|
||||
{
|
||||
// tick dynamic textures here
|
||||
for (auto it = m_dynamicTextures.begin(); it < m_dynamicTextures.end(); it++)
|
||||
for (std::vector<DynamicTexture*>::iterator it = m_dynamicTextures.begin(); it < m_dynamicTextures.end(); it++)
|
||||
{
|
||||
DynamicTexture* pDynaTex = *it;
|
||||
|
||||
@@ -167,7 +167,7 @@ void Textures::addDynamicTexture(DynamicTexture* pTexture)
|
||||
|
||||
Texture* Textures::getTemporaryTextureData(GLuint id)
|
||||
{
|
||||
auto i = m_textureData.find(id);
|
||||
std::map<GLuint, TextureData>::iterator i = m_textureData.find(id);
|
||||
if (i == m_textureData.end())
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ void ItemRenderer::blitRect(Tesselator& t, int x, int y, int w, int h, int color
|
||||
|
||||
void ItemRenderer::blit(int dx, int dy, int sx, int sy, int tw, int th)
|
||||
{
|
||||
auto& t = Tesselator::instance;
|
||||
Tesselator& t = Tesselator::instance;
|
||||
|
||||
float ex = float(dx), ey = float(dy);
|
||||
float uw = float(tw), uh = float(th);
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <stdint.h>
|
||||
#include "common/Utils.hpp"
|
||||
|
||||
struct PCMSoundHeader
|
||||
{
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
void SoundRepository::add(const std::string& name, SoundDesc& sd)
|
||||
{
|
||||
auto iter = m_repo.find(name);
|
||||
std::map<std::string, std::vector<SoundDesc> >::iterator iter = m_repo.find(name);
|
||||
if (iter == m_repo.end())
|
||||
{
|
||||
std::vector<SoundDesc> sdv;
|
||||
sdv.push_back(sd);
|
||||
m_repo.insert(std::pair<std::string, std::vector<SoundDesc>>(name, sdv));
|
||||
m_repo.insert(std::pair<std::string, std::vector<SoundDesc> >(name, sdv));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -27,7 +27,7 @@ void SoundRepository::add(const std::string& name, SoundDesc& sd)
|
||||
|
||||
bool SoundRepository::get(const std::string& name, SoundDesc& sd)
|
||||
{
|
||||
auto iter = m_repo.find(name);
|
||||
std::map<std::string, std::vector<SoundDesc> >::iterator iter = m_repo.find(name);
|
||||
if (iter == m_repo.end())
|
||||
{
|
||||
printf("Couldn't find a sound with id: %s\n", name.c_str());
|
||||
|
||||
@@ -20,6 +20,6 @@ public:
|
||||
bool get(const std::string& name, SoundDesc& sd);
|
||||
|
||||
public:
|
||||
std::map<std::string, std::vector<SoundDesc>> m_repo;
|
||||
std::map<std::string, std::vector<SoundDesc> > m_repo;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user