Share more ifdef with android and iOS
This commit is contained in:
parent
5537959b19
commit
009bac7802
@ -46,8 +46,8 @@ Explosion::Explosion(const Vec3& coord, const char* explosion_sound, const char
|
||||
#ifndef SERVER_ONLY
|
||||
std::string filename = particle_file;
|
||||
|
||||
#ifdef ANDROID
|
||||
// Use a lower quality effect on Android for better performance
|
||||
#ifdef MOBILE_STK
|
||||
// Use a lower quality effect on mobile for better performance
|
||||
if (filename == "explosion.xml" ||
|
||||
filename == "explosion_bomb.xml" ||
|
||||
filename == "explosion_cake.xml")
|
||||
|
@ -29,14 +29,14 @@
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
||||
#include <squish.h>
|
||||
static_assert(squish::kColourClusterFit == (1 << 5), "Wrong header");
|
||||
static_assert(squish::kColourRangeFit == (1 << 6), "Wrong header");
|
||||
static_assert(squish::kColourIterativeClusterFit == (1 << 8), "Wrong header");
|
||||
#endif
|
||||
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
||||
extern "C"
|
||||
{
|
||||
#include <mipmap/img.h>
|
||||
@ -46,7 +46,7 @@ extern "C"
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#if !defined(ANDROID)
|
||||
#if !defined(MOBILE_STK)
|
||||
static const uint8_t CACHE_VERSION = 1;
|
||||
#endif
|
||||
|
||||
@ -233,7 +233,7 @@ bool SPTexture::compressedTexImage2d(std::shared_ptr<video::IImage> texture,
|
||||
<core::dimension2du, unsigned> >&
|
||||
mipmap_sizes)
|
||||
{
|
||||
#if !defined(SERVER_ONLY) && !defined(ANDROID)
|
||||
#if !defined(SERVER_ONLY) && !defined(MOBILE_STK)
|
||||
unsigned format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
||||
if (m_undo_srgb && CVS->isEXTTextureCompressionS3TCSRGBUsable())
|
||||
{
|
||||
@ -331,7 +331,7 @@ bool SPTexture::saveCompressedTexture(std::shared_ptr<video::IImage> texture,
|
||||
<core::dimension2du, unsigned> >& sizes,
|
||||
const std::string& cache_location)
|
||||
{
|
||||
#if !defined(SERVER_ONLY) && !defined(ANDROID)
|
||||
#if !defined(SERVER_ONLY) && !defined(MOBILE_STK)
|
||||
const unsigned total_size = std::accumulate(sizes.begin(), sizes.end(), 0,
|
||||
[] (const unsigned int previous, const std::pair
|
||||
<core::dimension2du, unsigned>& cur_sizes)
|
||||
@ -396,7 +396,7 @@ std::shared_ptr<video::IImage> SPTexture::getTextureCache(const std::string& p,
|
||||
std::vector<std::pair<core::dimension2du, unsigned> >* sizes)
|
||||
{
|
||||
std::shared_ptr<video::IImage> cache;
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
||||
io::IReadFile* file = irr::io::createReadFile(p.c_str());
|
||||
if (file == NULL)
|
||||
{
|
||||
@ -486,7 +486,7 @@ bool SPTexture::threadedLoad()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef ANDROID
|
||||
#ifndef MOBILE_STK
|
||||
if (UserConfigParams::m_hq_mipmap && image->getDimension().Width > 1 &&
|
||||
image->getDimension().Height > 1)
|
||||
{
|
||||
@ -684,7 +684,7 @@ void SPTexture::generateHQMipmap(void* in,
|
||||
<core::dimension2du, unsigned> >& mms,
|
||||
uint8_t* out)
|
||||
{
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
||||
imMipmapCascade cascade;
|
||||
imReduceOptions options;
|
||||
imReduceSetOptions(&options,
|
||||
@ -716,7 +716,7 @@ void SPTexture::generateHQMipmap(void* in,
|
||||
void SPTexture::squishCompressImage(uint8_t* rgba, int width, int height,
|
||||
int pitch, void* blocks, unsigned flags)
|
||||
{
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
||||
// This function is copied from CompressImage in libsquish to avoid omp
|
||||
// if enabled by shared libsquish, because we are already using
|
||||
// multiple thread
|
||||
@ -766,7 +766,7 @@ std::vector<std::pair<core::dimension2du, unsigned> >
|
||||
{
|
||||
std::vector<std::pair<core::dimension2du, unsigned> > mipmap_sizes;
|
||||
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
#if !(defined(SERVER_ONLY) || defined(MOBILE_STK))
|
||||
unsigned width = image->getDimension().Width;
|
||||
unsigned height = image->getDimension().Height;
|
||||
mipmap_sizes.emplace_back(core::dimension2du(width, height), 0);
|
||||
|
@ -2093,18 +2093,21 @@ int main(int argc, char *argv[])
|
||||
Log::warn("main", "Screen size is too small!");
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef MOBILE_STK
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_UNDEFINED)
|
||||
{
|
||||
#ifdef ANDROID
|
||||
int32_t touch = AConfiguration_getTouchscreen(
|
||||
global_android_app->config);
|
||||
|
||||
if (touch != ACONFIGURATION_TOUCHSCREEN_NOTOUCH)
|
||||
{
|
||||
#endif
|
||||
InitAndroidDialog* init_android = new InitAndroidDialog(
|
||||
0.6f, 0.6f);
|
||||
GUIEngine::DialogQueue::get()->pushDialog(init_android);
|
||||
#ifdef ANDROID
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -2123,7 +2126,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else if (!CVS->isGLSL())
|
||||
{
|
||||
#if !defined(ANDROID)
|
||||
#if !defined(MOBILE_STK)
|
||||
if (UserConfigParams::m_old_driver_popup)
|
||||
{
|
||||
#ifdef USE_GLES2
|
||||
|
@ -255,8 +255,8 @@ void OverWorld::onFirePressed(Controller* who)
|
||||
}
|
||||
|
||||
const unsigned int val = challenge->getNumTrophies();
|
||||
// Android may have less challenges available than the main version
|
||||
#ifdef ANDROID
|
||||
// Mobile STK may have less challenges available than the main version
|
||||
#ifdef MOBILE_STK
|
||||
bool enough_challenges = true;
|
||||
#else
|
||||
const unsigned int val2 = challenge->getNumChallenges();
|
||||
|
@ -274,7 +274,7 @@ void WorldStatus::updateTime(int ticks)
|
||||
auto cl = LobbyProtocol::get<ClientLobby>();
|
||||
assert(cl);
|
||||
cl->finishedLoadingWorld();
|
||||
#ifndef ANDROID
|
||||
#ifndef MOBILE_STK
|
||||
static bool helper_msg_shown = false;
|
||||
if (!helper_msg_shown && cl->isSpectator())
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ namespace Scripting
|
||||
|
||||
const unsigned int val = challenge->getNumTrophies();
|
||||
// Android may have less challenges available than the main version
|
||||
#ifdef ANDROID
|
||||
#ifdef MOBILE_STK
|
||||
bool enough_challenges = true;
|
||||
#else
|
||||
const unsigned int val2 = challenge->getNumChallenges();
|
||||
|
@ -27,10 +27,6 @@
|
||||
#include "input/multitouch_device.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "../../../lib/irrlicht/source/Irrlicht/CIrrDeviceAndroid.h"
|
||||
#endif
|
||||
|
||||
#include <IGUIEnvironment.h>
|
||||
|
||||
|
||||
@ -66,13 +62,9 @@ void InitAndroidDialog::beforeAddingWidgets()
|
||||
bool accelerometer_available = false;
|
||||
bool gyroscope_available = false;
|
||||
|
||||
#ifdef ANDROID
|
||||
CIrrDeviceAndroid* android_device = dynamic_cast<CIrrDeviceAndroid*>(
|
||||
irr_driver->getDevice());
|
||||
assert(android_device != NULL);
|
||||
accelerometer_available = android_device->isAccelerometerAvailable();
|
||||
gyroscope_available = android_device->isGyroscopeAvailable() && accelerometer_available;
|
||||
#endif
|
||||
IrrlichtDevice* irrlicht_device = irr_driver->getDevice();
|
||||
accelerometer_available = irrlicht_device->isAccelerometerAvailable();
|
||||
gyroscope_available = irrlicht_device->isGyroscopeAvailable() && accelerometer_available;
|
||||
|
||||
if (!accelerometer_available)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth,
|
||||
World::getWorld()->schedulePause(WorldStatus::IN_GAME_MENU_PHASE);
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef MOBILE_STK
|
||||
if (m_text_box && UserConfigParams::m_lobby_chat)
|
||||
m_text_box->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
|
||||
#endif
|
||||
|
@ -272,7 +272,7 @@ void OptionsScreenVideo::init()
|
||||
}
|
||||
} // next found resolution
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifndef MOBILE_STK
|
||||
// Add default resolutions that were not found by irrlicht
|
||||
if (!found_1024_768)
|
||||
{
|
||||
@ -356,7 +356,7 @@ void OptionsScreenVideo::init()
|
||||
gfx->setActive(!in_game);
|
||||
getWidget<ButtonWidget>("custom")->setActive(!in_game);
|
||||
|
||||
#if defined(ANDROID)
|
||||
#if defined(MOBILE_STK)
|
||||
applyBtn->setVisible(false);
|
||||
full->setVisible(false);
|
||||
getWidget<LabelWidget>("fullscreenText")->setVisible(false);
|
||||
|
@ -881,7 +881,7 @@ bool onEvent(const SEvent &event)
|
||||
return true;
|
||||
|
||||
// Create the menu (only one menu at a time)
|
||||
#ifdef ANDROID
|
||||
#ifdef MOBILE_STK
|
||||
if (event.MouseInput.X < 30 && event.MouseInput.Y < 30 &&
|
||||
#else
|
||||
if (event.MouseInput.Event == EMIE_RMOUSE_PRESSED_DOWN &&
|
||||
|
Loading…
Reference in New Issue
Block a user