iOS: scaling improvements

This commit is contained in:
MoNTE48 2019-05-22 21:31:37 +02:00
parent 941b980850
commit 4957add21f
6 changed files with 21 additions and 46 deletions

View File

@ -1912,7 +1912,7 @@
"\"${PODS_ROOT}/Headers/Public/SDVersion\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/SSZipArchive\"",
"-flto=thin",
"-flto",
"-fvisibility=hidden",
"-fdata-sections",
"-ffunction-sections",
@ -1995,7 +1995,7 @@
"\"${PODS_ROOT}/Headers/Public/SDVersion\"",
"-isystem",
"\"${PODS_ROOT}/Headers/Public/SSZipArchive\"",
"-flto=thin",
"-flto",
"-fvisibility=hidden",
"-fdata-sections",
"-ffunction-sections",

View File

@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.10</string>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>44</string>
<key>LSRequiresIPhoneOS</key>

View File

@ -6,30 +6,14 @@
// returns the app version as an integer
static uint32_t parse_version()
{
struct {
uint8_t major, minor, patch, revision;
} version;
NSString *fullver = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *revstr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
if([fullver length] != 3 + 2 + 1)
goto err;
version.major = [fullver characterAtIndex:0] - '0';
if([fullver characterAtIndex:1] != '.')
goto err;
version.minor = [fullver characterAtIndex:2] - '0';
if([fullver characterAtIndex:3] != '.')
goto err;
version.patch = [fullver characterAtIndex:4] - '0';
version.revision = [revstr intValue];
uint32_t ret = version.revision | (version.patch << 8) | (version.minor << 16) | (version.major << 24);
NSLog(@"App version %@-%@ -> %u", fullver, revstr, ret);
uint8_t revision = [revstr intValue];
// compatibility with old versions, DON'T CHANGE
uint32_t ret = revision | (2 << 24);
NSLog(@"App revision %@ -> %u", revstr, ret);
return ret;
err:
NSLog(@"VERSION PARSING ERROR: Only versions in the format x.x.x can be used");
exit(1);
}
static uint32_t read_version(NSString *path)

View File

@ -388,7 +388,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("abm_interval", "2.0");
settings->setDefault("client_unload_unused_data_timeout", "60");
settings->setDefault("curl_verify_cert", "false");
settings->setDefault("mapgens_available", "v6, v7p, flat");
settings->setDefault("mapgens_available", "v7p, v6, flat");
#endif
// Android Settings
@ -440,9 +440,9 @@ void set_default_settings(Settings *settings)
// iOS Settings
#ifdef __IOS__
settings->setDefault("mg_name", "v7p");
settings->setDefault("emergequeue_limit_diskonly", "16");
settings->setDefault("emergequeue_limit_generate", "16");
settings->setDefault("gui_scaling_filter_txr2img", "false");
// set font_path
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "retrovillenc.ttf"));
settings->setDefault("fallback_font_path", porting::getDataPath("fonts" DIR_DELIM "retrovillenc.ttf"));
@ -451,26 +451,21 @@ void set_default_settings(Settings *settings)
if ([SDVersion deviceSize] == Screen3Dot5inch) {
// 3.5" (old iPhone's)
settings->setDefault("hud_scaling", "0.5");
settings->setDefault("gui_scaling", "1.0");
} else if ([SDVersion deviceSize] == Screen4inch) {
// 4" (iPhone 5)
settings->setDefault("hud_scaling", "0.5");
settings->setDefault("gui_scaling", "1.1");
settings->setDefault("mouse_sensitivity", "0.24");
settings->setDefault("mouse_sensitivity", "0.25");
} else if ([SDVersion deviceSize] == Screen4Dot7inch) {
// 4.7" (iPhone)
settings->setDefault("hud_scaling", "0.6");
settings->setDefault("gui_scaling", "1.1");
settings->setDefault("mouse_sensitivity", "0.25");
} else if ([SDVersion deviceSize] == Screen5Dot5inch) {
// 5.5" (iPhone Plus)
settings->setDefault("hud_scaling", "0.7");
settings->setDefault("gui_scaling", "1.2");
settings->setDefault("mouse_sensitivity", "0.3");
} else if (([SDVersion deviceSize] == Screen5Dot8inch) || ([SDVersion deviceSize] == Screen6Dot1inch) || ([SDVersion deviceSize] == Screen6Dot5inch)) {
// 5.8+" (iPhone X-series)
settings->setDefault("hud_scaling", "0.8");
settings->setDefault("gui_scaling", "1.3");
settings->setDefault("mouse_sensitivity", "0.35");
} else {
// iPad

View File

@ -548,7 +548,7 @@ public:
static void playerDamage(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5), false);
sm->m_sound->playSound(SimpleSoundSpec("player_damage", 1.0), false);
}
static void playerFallingDamage(MtEvent *e, void *data)
@ -965,11 +965,7 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec,
}
#if defined(__ANDROID__) || defined(__IOS__)
#define SIZE_TAG "size[11,5.5]"
#else
#define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop
#endif
#define SIZE_TAG "size[11,5.5,true]"
/******************************************************************************/
static void updateChat(Client &client, f32 dtime, bool show_debug,
@ -4759,12 +4755,12 @@ void Game::showPauseMenu()
<< strgettext("Change Keys") << "]";
#endif
os << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_exit_menu;"
<< strgettext("Save and Exit") << "]"
<< strgettext("Save and Exit") << "]";
#ifndef __IOS__
; // LoL
os << "button_exit[3.5," << (ypos++) << ";4,0.5;btn_exit_os;"
<< strgettext("Close game") << "]"
<< strgettext("Close game") << "]";
#endif
/* << "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]
<< "textarea[0.4,0.25;3.9,6.25;;" << PROJECT_NAME_C " " VERSION_STRING "\n"
<< "\n"

View File

@ -2126,10 +2126,10 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
// different and forms should always use the
// maximum screen space available.
double prefer_imgsize = mydata.screensize.Y / 10 * gui_scaling;
double fitx_imgsize = mydata.screensize.X /
((12.0 / 8.0) * (0.5 + mydata.invsize.X));
double fity_imgsize = mydata.screensize.Y /
((15.0 / 11.0) * (0.85 + mydata.invsize.Y));
double fitx_imgsize = floor(mydata.screensize.X /
(1.5 * (0.5 + mydata.invsize.X)));
double fity_imgsize = floor(mydata.screensize.Y /
(1.15 * (0.85 + mydata.invsize.Y)));
use_imgsize = MYMIN(prefer_imgsize,
MYMIN(fitx_imgsize, fity_imgsize));
#else