iOS changed files (#41)

master
sfan5 2016-11-05 23:14:16 +01:00 committed by Maksim Gamarnik
parent e2265c8e5f
commit d525673848
28 changed files with 208 additions and 75 deletions

13
.gitignore vendored
View File

@ -21,6 +21,8 @@
tags
!tags/
gtags.files
# OS X
.DS_Store
# GNU Patch reject file
*.rej
@ -72,3 +74,14 @@ build/android/local.properties
build/android/.gradle
timestamp
## iOS build files
build/iOS/MultiCraft/MultiCraft.xcodeproj/xcuserdata
build/iOS/MultiCraft/MultiCraft.xcodeproj/project.xcworkspace
build/iOS/MultiCraft/MultiCraft/Assets.xcassets/AppIcon.appiconset/*.png
build/iOS/MultiCraft.xcworkspace
build/iOS/Pods
build/iOS/Podfile.lock
build/iOS/deps/*
!build/iOS/deps/*.sh
build/iOS/assets.zip
build/iOS/worlds.zip

0
buildwin32.sh Normal file → Executable file
View File

0
buildwin64.sh Normal file → Executable file
View File

View File

@ -25,6 +25,7 @@ mt_color_dark_green = "#003300"
local menupath = core.get_mainmenu_path()
local basepath = core.get_builtin_path()
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" .. DIR_DELIM
local use_simple_menu = (PLATFORM == "Android" or PLATFORM == "iOS")
dofile(basepath .. DIR_DELIM .. "common" .. DIR_DELIM .. "async_event.lua")
dofile(basepath .. DIR_DELIM .. "common" .. DIR_DELIM .. "filterlist.lua")
@ -40,7 +41,7 @@ dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
--dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
if PLATFORM ~= "Android" then
if not use_simple_menu then
dofile(menupath .. DIR_DELIM .. "modmgr.lua")
-- dofile(menupath .. DIR_DELIM .. "store.lua")
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
@ -53,7 +54,7 @@ tabs.credits = dofile(menupath .. DIR_DELIM .. "tab_credits.lua")
tabs.singleplayer = dofile(menupath .. DIR_DELIM .. "tab_singleplayer.lua")
tabs.multiplayer = dofile(menupath .. DIR_DELIM .. "tab_multiplayer.lua")
tabs.server = dofile(menupath .. DIR_DELIM .. "tab_server.lua")
if PLATFORM ~= "Android" then
if not use_simple_menu then
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
tabs.texturepacks = dofile(menupath .. DIR_DELIM .. "tab_texturepacks.lua")
end
@ -99,7 +100,7 @@ local function init_globals()
tv_main:add(tabs.multiplayer)
tv_main:add(tabs.server)
if PLATFORM ~= "Android" then
if not use_simple_menu then
tv_main:add(tabs.settings)
tv_main:add(tabs.texturepacks)
end

View File

@ -38,7 +38,7 @@ local function get_formspec(tabview, name, tabdata)
core.formspec_escape(core.setting_get("name")) .. "]" ..
"pwdfield[0.55,4;3.5,0.5;te_passwd;]"
if PLATFORM ~= "Android" then
if PLATFORM ~= "Android" and PLATFORM ~= "iOS" then
retval = retval ..
"checkbox[0.25,1.15;cb_server_announce;" .. fgettext("Public") .. ";"
return retval

View File

@ -203,7 +203,7 @@ local function formspec(tabview, name, tabdata)
"checkbox[8,0;cb_shaders;" .. fgettext("Shaders") .. ";"
.. dump(core.setting_getbool("enable_shaders")) .. "]"
if PLATFORM == "Android" then
if PLATFORM == "Android" or PLATFORM == "iOS" then
tab_string = tab_string ..
"button[8,4.75;3.75,0.5;btn_reset_singleplayer;"
.. fgettext("Reset singleplayer world") .. "]"

View File

@ -494,7 +494,7 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
infostream << "Waited for other menus" << std::endl;
// Cursor can be non-visible when coming from the game
#ifndef ANDROID
#if !defined(ANDROID) && !defined(__IOS__)
device->getCursorControl()->setVisible(true);
#endif

View File

@ -40,6 +40,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifdef __ANDROID__
#include <GLES/gl.h>
#elif defined(__IOS__)
#include <OpenGLES/ES1/gl.h>
#endif
/*
@ -620,7 +622,7 @@ u32 TextureSource::generateTexture(const std::string &name)
video::ITexture *tex = NULL;
if (img != NULL) {
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
img = Align2Npot2(img, driver);
#endif
// Create texture from resulting image
@ -723,7 +725,7 @@ void TextureSource::rebuildImagesAndTextures()
for (u32 i=0; i<m_textureinfo_cache.size(); i++){
TextureInfo *ti = &m_textureinfo_cache[i];
video::IImage *img = generateImage(ti->name);
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
img = Align2Npot2(img, driver);
sanity_check(img->getDimension().Height == npot2(img->getDimension().Height));
sanity_check(img->getDimension().Width == npot2(img->getDimension().Width));
@ -939,7 +941,7 @@ video::ITexture* TextureSource::generateTextureFromMesh(
// Unset render target
//#if ((IRRLICHT_VERSION_MAJOR == 1) && (IRRLICHT_VERSION_MINOR < 9))
driver->setRenderTarget(0, false, true, 0);
driver->setRenderTarget(0, false, true, video::SColor(0,0,0,0));
//#else
// driver->setRenderTarget(0, video::ECBF_COLOR, 0);
//#endif
@ -1052,7 +1054,7 @@ video::IImage* TextureSource::generateImage(const std::string &name)
return baseimg;
}
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
/**
* Check and align image to npot2 if required by hardware
* @param image image to check for npot2 alignment
@ -1112,7 +1114,7 @@ bool TextureSource::generateImagePart(std::string part_of_name,
if (part_of_name.size() == 0 || part_of_name[0] != '[')
{
video::IImage *image = m_sourcecache.getOrLoad(part_of_name, m_device);
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
image = Align2Npot2(image, driver);
#endif
if (image == NULL) {
@ -1241,7 +1243,7 @@ bool TextureSource::generateImagePart(std::string part_of_name,
It is an image with a number of cracking stages
horizontally tiled.
*/
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
video::IImage *img_crack = m_sourcecache.getOrLoad(
"crack_anylength_android.png", m_device);
#else
@ -1458,7 +1460,7 @@ bool TextureSource::generateImagePart(std::string part_of_name,
return true;
}
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
assert(img_top->getDimension().Height == npot2(img_top->getDimension().Height));
assert(img_top->getDimension().Width == npot2(img_top->getDimension().Width));

View File

@ -140,7 +140,7 @@ public:
IWritableTextureSource* createTextureSource(IrrlichtDevice *device);
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
video::IImage * Align2Npot2(video::IImage * image, video::IVideoDriver* driver);
#endif

View File

@ -247,7 +247,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
block->mesh->updateCameraOffset(m_camera_offset);
float range = 100000 * BS;
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
range = m_control.wanted_range * 4 * BS;
#endif

View File

@ -22,6 +22,19 @@
#else
#define BUILD_TYPE "Debug"
#endif
#elif defined (__IOS__)
#define PROJECT_NAME "MultiCraft"
#define PROJECT_NAME_C "MultiCraft"
#define STATIC_SHAREDIR ""
#define VERSION_MAJOR 1
#define VERSION_MINOR 1
#define VERSION_PATCH 4
#define VERSION_STRING "1.1.4"
#ifdef NDEBUG
#define BUILD_TYPE "Release"
#else
#define BUILD_TYPE "Debug"
#endif
#else
#ifdef NDEBUG
#define BUILD_TYPE "Release"

View File

@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "config.h"
#include "constants.h"
#include "porting.h"
#import "SDVersion.h"
void set_default_settings(Settings *settings)
{
@ -334,21 +335,10 @@ void set_default_settings(Settings *settings)
settings->setDefault("high_precision_fpu", "true");
#ifdef __ANDROID__
// Auto-detect language on Android
// FIXME: this code should be in init_gettext() ideally
char lang[3] = {0};
AConfiguration_getLanguage(porting::app_global->config, lang);
if (!lang[0])
errorstream << "Language auto-detection failed!" << std::endl;
settings->setDefault("language", lang);
#else
settings->setDefault("language", "");
#endif
settings->setDefault("mainmenu_last_selected_world", "1");
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
settings->setDefault("screenW", "0");
settings->setDefault("screenH", "0");
settings->setDefault("enable_shaders", "false");
@ -356,32 +346,38 @@ void set_default_settings(Settings *settings)
settings->setDefault("video_driver", "ogles1");
settings->setDefault("touchtarget", "false");
settings->setDefault("touchscreen_threshold", "20");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("emergequeue_limit_diskonly", "8");
settings->setDefault("emergequeue_limit_generate", "8");
settings->setDefault("max_block_generate_distance", "3");
// settings->setDefault("enable_3d_clouds", "false");
settings->setDefault("fps_max", "35");
settings->setDefault("pause_fps_max", "5");
settings->setDefault("sqlite_synchronous", "0");
settings->setDefault("gui_scaling", "1.2");
settings->setDefault("doubletap_jump", "true");
settings->setDefault("client_mapblock_limit", "250");
settings->setDefault("active_block_range", "1");
settings->setDefault("chunksize", "3");
settings->setDefault("gui_scaling_filter_txr2img", "false");
settings->setDefault("max_simultaneous_block_sends_per_client", "5");
settings->setDefault("abm_interval", "2.0");
settings->setDefault("selectionbox_width", "6");
settings->setDefault("cloud_radius", "6");
settings->setDefault("client_unload_unused_data_timeout", "120");
#endif
#ifdef __ANDROID__
settings->setDefault("fps_max", "35");
settings->setDefault("viewing_range", "30");
settings->setDefault("inventory_image_hack", "false");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("client_mapblock_limit", "250");
settings->setDefault("selectionbox_width", "6");
settings->setDefault("emergequeue_limit_diskonly", "8");
settings->setDefault("emergequeue_limit_generate", "8");
// check for device with small screen
settings->setDefault("mono_font_path", "/system/fonts/DroidSansMono.ttf");
settings->setDefault("fallback_font_path", "/system/fonts/DroidSans.ttf");
settings->setDefault("curl_verify_cert","false");
//For other devices
settings->setDefault("gui_scaling", "1.2");
// check for screen
float x_inches = ((double) porting::getDisplaySize().X /
(160 * porting::getDisplayDensity()));
(160 * porting::getDisplayDensity()));
if (x_inches < 5) {
// all phones
settings->setDefault("hud_scaling", "0.6");
@ -398,11 +394,52 @@ void set_default_settings(Settings *settings)
settings->setDefault("hud_scaling", "0.85");
settings->setDefault("mouse_sensitivity", "0.2");
}
settings->setDefault("mono_font_path", "/system/fonts/DroidSansMono.ttf");
settings->setDefault("fallback_font_path", "/system/fonts/DroidSans.ttf");
settings->setDefault("curl_verify_cert","false");
// Auto-detect language on Android
// FIXME: this code should be in init_gettext() ideally
char lang[3] = {0};
AConfiguration_getLanguage(porting::app_global->config, lang);
if (!lang[0])
errorstream << "Language auto-detection failed!" << std::endl;
settings->setDefault("language", lang);
#endif
#ifdef __IOS__
settings->setDefault("fps_max", "35");
settings->setDefault("viewing_range", "50");
settings->setDefault("selectionbox_width", "3");
settings->setDefault("smooth_lighting", "true");
// For iPad =)
settings->setDefault("hud_scaling", "0.8");
settings->setDefault("gui_scaling", "1.2");
settings->setDefault("mouse_sensitivity", "0.15");
// 3.5" (old iPhone's)
if ([SDVersion deviceSize] == Screen3Dot5inch) {
settings->setDefault("hud_scaling", "0.4");
settings->setDefault("gui_scaling", "0.8");
settings->setDefault("mouse_sensitivity", "0.1");
};
// 4" (iPhone 5)
if ([SDVersion deviceSize] == Screen4inch) {
settings->setDefault("hud_scaling", "0.5");
settings->setDefault("gui_scaling", "0.9");
settings->setDefault("mouse_sensitivity", "0.15");
};
// 4.7" (iPhone)
if ([SDVersion deviceSize] == Screen4Dot7inch) {
settings->setDefault("hud_scaling", "0.6");
settings->setDefault("gui_scaling", "1.1");
settings->setDefault("mouse_sensitivity", "0.2");
}
// 5.5" (iPhone Plus)
if ([SDVersion deviceSize] == Screen5Dot5inch) {
settings->setDefault("hud_scaling", "0.7");
settings->setDefault("gui_scaling", "1.3");
settings->setDefault("mouse_sensitivity", "0.25");
};
#endif
}

View File

@ -1162,7 +1162,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
bool singleplayermode)
{
#ifndef __ANDROID__
#if !defined(__ANDROID__) && !defined(__IOS__)
float ypos = singleplayermode ? 0.5 : 0.1;
#else
float ypos = 1.0;
@ -1173,7 +1173,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
<< "bgcolor[#00000060;true]"
<< "button_exit[3.5," << (ypos++) << ";4,0.5;btn_continue;"
<< strgettext("Continue") << "]";
#ifndef __ANDROID__
#if !defined(__ANDROID__) && !defined(__IOS__)
if (!singleplayermode) {
os << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_change_password;"
<< strgettext("Change Password") << "]";
@ -1685,8 +1685,10 @@ private:
f32 m_cache_mouse_sensitivity;
f32 m_repeat_right_click_time;
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
bool m_cache_hold_aux1;
#endif
#ifdef __ANDROID__
bool m_android_chat_open;
#endif
};
@ -1729,7 +1731,7 @@ Game::Game() :
readSettings();
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
m_cache_hold_aux1 = false; // This is initialised properly later
#endif
@ -1853,7 +1855,7 @@ void Game::run()
set_light_table(g_settings->getFloat("display_gamma"));
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
m_cache_hold_aux1 = g_settings->getBool("fast_move")
&& client->checkPrivilege("fast");
#endif
@ -2059,7 +2061,7 @@ bool Game::autoMigrateSingleplayerWorld(const std::string map_dir)
{
const std::string new_backend = "leveldb";
#ifndef __ANDROID__
#if !defined(__ANDROID__) && !defined(__IOS__)
infostream << "Auto-migration disabled on this platform..." << std::endl;
return false;
#endif
@ -2674,7 +2676,7 @@ void Game::processUserInput(VolatileRunFlags *flags,
|| noMenuActive() == false
|| guienv->hasFocus(gui_chat_console)) {
input->clear();
#ifdef HAVE_TOUCHSCREENGUI
#if defined(HAVE_TOUCHSCREENGUI) && !defined(__IOS__)
g_touchscreengui->hide();
#endif
}
@ -2947,7 +2949,7 @@ void Game::toggleFast(float *statustext_time)
if (fast_move && !has_fast_privs)
statustext += L" (note: no 'fast' privilege)";
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
m_cache_hold_aux1 = fast_move && has_fast_privs;
#endif
}
@ -3138,7 +3140,7 @@ void Game::decreaseViewRange(float *statustext_time)
void Game::toggleFullViewRange(float *statustext_time)
{
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
static const wchar_t *msg[] = {
L"Disabled far viewing range",
L"Enabled far viewing range"
@ -3162,7 +3164,7 @@ void Game::updateCameraDirection(CameraOrientation *cam,
{
if ((device->isWindowActive() && noMenuActive()) || random_input) {
#ifndef __ANDROID__
#if !defined(__ANDROID__) && !defined(__IOS__)
if (!random_input) {
// Mac OSX gets upset if this is set every frame
if (device->getCursorControl()->isVisible())
@ -3179,7 +3181,7 @@ void Game::updateCameraDirection(CameraOrientation *cam,
(driver->getScreenSize().Height / 2));
} else {
#ifndef ANDROID
#if !defined(__ANDROID__) && !defined(__IOS__)
// Mac OSX gets upset if this is set every frame
if (device->getCursorControl()->isVisible() == false)
device->getCursorControl()->setVisible(true);
@ -3250,7 +3252,7 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
( (u32)(input->getRightState() & 0x1) << 8
);
#ifdef ANDROID
#if defined(__ANDROID__) || defined(__IOS__)
/* For Android, simulate holding down AUX1 (fast move) if the user has
* the fast_move setting toggled on. If there is an aux1 key defined for
* Android then its meaning is inverted (i.e. holding aux1 means walk and
@ -4034,7 +4036,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats,
if (draw_control->range_all) {
runData->fog_range = 100000 * BS;
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
runData->fog_range = 0.9 * draw_control->wanted_range * 4 * BS;
#endif
} else {
@ -4398,7 +4400,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
if (!statustext.empty()) {
s32 status_width = guitext_status->getTextWidth();
s32 status_height = guitext_status->getTextHeight();
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
s32 status_y = screensize.Y - 320 * g_settings->getFloat("hud_scaling");
#else
s32 status_y = screensize.Y - 150;

View File

@ -91,7 +91,7 @@ video::ITexture* MenuTextureSource::getTexture(const std::string &name, u32 *id)
return NULL;
m_to_delete.insert(name);
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
video::IImage *image = m_driver->createImageFromFile(name.c_str());
if (image) {
image = Align2Npot2(image, m_driver);

View File

@ -2938,7 +2938,9 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event)
return retval;
}
}
#endif
#if defined(__ANDROID__) || defined(__IOS__)
if (event.EventType == EET_TOUCH_INPUT_EVENT)
{
SEvent translated;
@ -3689,4 +3691,4 @@ std::wstring GUIFormSpecMenu::getLabelByID(s32 id)
}
}
return L"";
}
}

View File

@ -508,8 +508,10 @@ private:
std::wstring getLabelByID(s32 id);
std::string getNameByID(s32 id);
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
v2s32 m_down_pos;
#endif
#ifdef __ANDROID__
std::string m_JavaDialogFieldName;
#endif

View File

@ -484,7 +484,7 @@ void Hud::drawCrosshair()
core::rect<s32>(0, 0, size.X, size.Y),
0, crosshair_argb, true);
} else {
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
driver->draw2DLine(m_displaycenter - v2s32(35, 0),
m_displaycenter + v2s32(35, 0), crosshair_argb);
driver->draw2DLine(m_displaycenter - v2s32(0, 35),
@ -730,4 +730,4 @@ void drawItemStack(video::IVideoDriver *driver,
video::SColor color(255,255,255,255);
font->draw(text.c_str(), rect2, color, false, false, clip);
}
}
}

View File

@ -210,7 +210,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
// this shouldn't be hardcoded but transmitted from server
float player_stepheight = touching_ground ? (BS*0.6) : (BS*0.2);
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
player_stepheight += (0.6 * BS);
#endif

View File

@ -33,6 +33,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <algorithm>
#include <cerrno>
#include <cstring>
#ifdef __IOS__
#include "ioswrap.h"
#endif
const int BUFFER_LENGTH = 256;
@ -151,6 +154,29 @@ AndroidSystemLogOutput g_android_log_output;
#endif
// iOS
#ifdef __IOS__
class IosSystemLogOutput : public ICombinedLogOutput {
public:
IosSystemLogOutput()
{
g_logger.addOutput(this);
}
~IosSystemLogOutput()
{
g_logger.removeOutput(this);
}
void logRaw(LogLevel lev, const std::string &line)
{
ioswrap_log(line.c_str());
}
};
IosSystemLogOutput g_ios_log_output;
#endif
///////////////////////////////////////////////////////////////////////////////

View File

@ -138,7 +138,11 @@ FileLogOutput file_log_output;
static OptionList allowed_options;
#ifdef __IOS__
int real_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
{
int retval;
@ -168,6 +172,9 @@ int main(int argc, char *argv[])
#ifdef __ANDROID__
porting::initAndroid();
porting::initializePathsAndroid();
#elif defined(__IOS__)
porting::initializePathsiOS();
porting::copyAssets();
#else
porting::initializePaths();
#endif
@ -426,7 +433,7 @@ static void setup_log_params(const Settings &cmd_args)
static bool create_userdata_path()
{
#ifdef __ANDROID__
#if defined(__ANDROID__) || defined(__IOS__)
if (fs::PathExists(porting::path_user))
return true;
#endif

View File

@ -372,7 +372,7 @@ void Mapper::blitMinimapPixelsToImageSurface(
map_image->setPixel(x, data->map_size - z - 1, c);
u32 h = mmpixel->height;
const u32 h = 255; // full bright
heightmap_image->setPixel(x,data->map_size - z - 1,
video::SColor(255, h, h, h));
}
@ -407,7 +407,12 @@ video::ITexture *Mapper::getMinimapTexture()
for (s16 y = 0; y < MINIMAP_MAX_SY; y++)
for (s16 x = 0; x < MINIMAP_MAX_SX; x++) {
video::SColor mask_col = minimap_mask->getPixel(x, y);
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 9
// Irrlicht 1.9 has some problem with alpha
if (mask_col.getRed() != 255)
#else
if (!mask_col.getAlpha())
#endif
minimap_image->setPixel(x, y, video::SColor(0,0,0,0));
}
}

View File

@ -42,7 +42,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <sys/pstat.h>
#endif
#if !defined(_WIN32) && !defined(__APPLE__) && \
!defined(__ANDROID__) && !defined(SERVER)
!defined(__ANDROID__) && !defined(__IOS__) && \
!defined(SERVER)
#define XORG_USED
#endif
#ifdef XORG_USED
@ -668,7 +669,7 @@ const char *getVideoDriverFriendlyName(irr::video::E_DRIVER_TYPE type)
return driver_names[type];
}
# ifndef __ANDROID__
# if !defined(__ANDROID__) && !defined(__IOS__)
# ifdef XORG_USED
static float calcDisplayDensity()
@ -719,7 +720,7 @@ v2u32 getDisplaySize()
return deskres;
}
# endif // __ANDROID__
# endif // __ANDROID__/__IOS__
#endif // SERVER

View File

@ -324,10 +324,10 @@ inline const char *getPlatformName()
defined(__NetBSD__) || defined(__OpenBSD__)
"BSD"
#elif defined(__APPLE__) && defined(__MACH__)
#if TARGET_OS_MAC
"OSX"
#elif TARGET_OS_IPHONE
#if TARGET_OS_IPHONE
"iOS"
#elif TARGET_OS_MAC
"OSX"
#else
"Apple"
#endif
@ -369,5 +369,9 @@ bool secure_rand_fill_buf(void *buf, size_t len);
#include "porting_android.h"
#endif
#ifdef __IOS__
#include "porting_ios.h"
#endif
#endif // PORTING_HEADER

View File

@ -387,7 +387,7 @@ bool Thread::bindToProcessor(unsigned int proc_number)
return pthread_processor_bind_np(PTHREAD_BIND_ADVISORY_NP,
&answer, proc_number, getThreadHandle()) == 0;
#elif defined(__APPLE__)
#elif defined(__APPLE__) || defined(__IOS__)
struct thread_affinity_policy tapol;

View File

@ -61,7 +61,8 @@ const char* touchgui_button_imagenames[] = {
"chat.png",
// "camera.png",
"rangeview.png",
"empty.png"
"empty.png",
"escape.png",
};
static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
@ -133,6 +134,8 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
case empty_id:
key = "forward";
break;
case escape_id:
return irr::KEY_ESCAPE;
}
assert(key != "");
return keyname_to_keycode(g_settings->get("keymap_" + key).c_str());
@ -362,12 +365,20 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc)
L"minimap", false, SLOW_BUTTON_REPEAT);
/* init chat button */
#ifdef __IOS__
initButton(escape_id,
rect<s32>(m_screensize.X / 2 + (button_size * 0.375), 0,
m_screensize.X / 2 + (button_size * 1.125),
(button_size * 0.75)),
L"Exit", false, SLOW_BUTTON_REPEAT);
#else
initButton(chat_id,
rect<s32>(m_screensize.X / 2 + (button_size * 0.375), 0,
m_screensize.X / 2 + (button_size * 1.125),
(button_size * 0.75)),
L"Chat", false, SLOW_BUTTON_REPEAT);
#endif
/* init camera button
initButton(camera_id,
rect<s32>(0, 0,

View File

@ -59,6 +59,7 @@ typedef enum {
// camera_id,
range_id,
empty_id,
escape_id,
after_last_element_id
} touch_gui_button_id;

View File

@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <istream>
#include "util/container.h"
#include "util/numeric.h"
#ifndef ANDROID
#if !defined(ANDROID) && !defined(__IOS__)
#include "cmake_config.h"
#endif
#if USE_SPATIAL

View File

@ -157,7 +157,13 @@ u64 murmur_hash_64_ua(const void *key, int len, unsigned int seed)
while (data != end) {
u64 k;
#ifndef __IOS__
memcpy(&k, data, sizeof(u64));
#else
k = 0; // strange workaround for iOS
for (u8 i = 0; i < sizeof(u64); i++)
((char*) &k)[i] = data[i];
#endif
data++;
k *= m;