iOS: fix scaling and resolution

master
Maksim 2020-04-18 17:09:46 +02:00 committed by MoNTE48
parent 2f7440e1c9
commit 2ea6429120
6 changed files with 13 additions and 13 deletions

View File

@ -152,6 +152,7 @@ void ioswrap_size(unsigned int *dest)
CGFloat scale = [[UIScreen mainScreen] scale];
dest[0] = bounds.width * scale;
dest[1] = bounds.height * scale;
dest[2] = scale;
}
/********/

View File

@ -537,7 +537,7 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
bool ClientLauncher::create_engine_device()
{
#if defined(__ANDROID__) || defined(__IOS__)
#ifdef __ANDROID__
// set correct resolution
g_settings->setU16("screenW", porting::getDisplaySize().X);
g_settings->setU16("screenH", porting::getDisplaySize().Y);

View File

@ -114,7 +114,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#elif defined(__ANDROID__)
#define TTF_DEFAULT_FONT_SIZE (15)
#elif defined(__IOS__)
#define TTF_DEFAULT_FONT_SIZE (14)
#define TTF_DEFAULT_FONT_SIZE (13)
#else
#define TTF_DEFAULT_FONT_SIZE (20)
#endif

View File

@ -531,13 +531,9 @@ void set_default_settings(Settings *settings) {
if ([SDVersion deviceVersion] == iPhone4S) {
// 3.5" iPhone
settings->setDefault("hud_scaling", "0.5");
settings->setDefault("font_size", std::to_string(TTF_DEFAULT_FONT_SIZE - 2));
settings->setDefault("font_size", font_size_str);
} else if SDVersion4Inch {
// 4" iPhone and iPod Touch
settings->setDefault("hud_scaling", "0.55");
settings->setDefault("font_size", std::to_string(TTF_DEFAULT_FONT_SIZE - 1));
settings->setDefault("font_size", font_size_str);
settings->setDefault("mouse_sensitivity", "0.33");
} else if SDVersion4and7Inch {
// 4.7" iPhone
@ -562,8 +558,8 @@ void set_default_settings(Settings *settings) {
// Settings for the Rounded Screen and Home Bar
if SDVersionHomeBar {
settings->setDefault("hud_move_upwards", "10");
settings->setDefault("round_screen", "15");
settings->setDefault("hud_move_upwards", "20");
settings->setDefault("round_screen", "35");
}
#endif // iOS

View File

@ -630,13 +630,13 @@ void draw_load_screen(const std::wstring &text, IrrlichtDevice* device,
if (progress_img && progress_img_bg) {
const core::dimension2d<u32> &img_size = progress_img_bg->getSize();
#ifndef __ANDROID__
#if !defined(__ANDROID__) && !defined(__IOS__)
u32 imgW = rangelim(img_size.Width, 256, 1024);
u32 imgH = rangelim(img_size.Height, 32, 128);
float imgR = 1.0f;
#else
float imgRatio = (float) img_size.Height / img_size.Width;
u32 imgW = screensize.X / 2.2f;
u32 imgW = screensize.X / 2.0f;
u32 imgH = floor(imgW * imgRatio);
float imgR = (float) (imgW) / img_size.Width;
#endif

View File

@ -44,11 +44,14 @@ namespace porting {
}
float getDisplayDensity() {
return 1;
unsigned int values[3];
ioswrap_size(values);
return values[2];
}
v2u32 getDisplaySize() {
static bool firstrun = true;
/* static bool firstrun = true;
static v2u32 retval;
if (firstrun) {
@ -59,7 +62,7 @@ namespace porting {
firstrun = false;
}
return retval;
return retval; */
}
void setViewController(void *v) {