Add padding to some gui elements for iPhone X

This commit is contained in:
Benau 2019-12-20 14:08:01 +08:00
parent be77b5f294
commit 31562ba067
3 changed files with 21 additions and 4 deletions

View File

@ -308,8 +308,14 @@ void LayoutManager::applyCoords(Widget* self, AbstractTopLevelContainer* topLeve
//parent_w = frame_size.Width;
//parent_h = frame_size.Height;
parent_w = topLevelContainer->getWidth();
int total_padding = irr_driver->getDevice()->getLeftPadding() +
irr_driver->getDevice()->getRightPadding();
if (parent_w - total_padding > 0)
parent_w -= total_padding;
parent_h = topLevelContainer->getHeight();
parent_x = 0;
if (irr_driver->getDevice()->getLeftPadding() > 0)
parent_x = irr_driver->getDevice()->getLeftPadding();
parent_y = 0;
}
else

View File

@ -756,6 +756,8 @@ void RaceGUIBase::drawGlobalPlayerIcons(int bottom_margin)
return;
int x_base = 10;
if (irr_driver->getDevice()->getLeftPadding() > 0)
x_base += irr_driver->getDevice()->getLeftPadding();
int y_base = 25;
unsigned int y_space = irr_driver->getActualScreenSize().Height - bottom_margin - y_base;
// Special case : when 3 players play, use 4th window to display such stuff

View File

@ -199,7 +199,10 @@ void RaceGUIMultitouch::createRaceGUI()
const float scale = UserConfigParams::m_multitouch_scale;
const int w = irr_driver->getActualScreenSize().Width;
int w = irr_driver->getActualScreenSize().Width;
if (w - irr_driver->getDevice()->getRightPadding() > 0)
w -= irr_driver->getDevice()->getRightPadding();
const int h = irr_driver->getActualScreenSize().Height;
const float btn_size = 0.125f * h * scale;
const float btn2_size = 0.35f * h * scale;
@ -212,19 +215,25 @@ void RaceGUIMultitouch::createRaceGUI()
const float margin_small = small_ratio * margin;
const float col_small_size = small_ratio * col_size;
float left_padding = 0.0f;
if (irr_driver->getDevice()->getLeftPadding() > 0)
left_padding = irr_driver->getDevice()->getLeftPadding();
float first_column_x = w - 2 * col_size;
float second_column_x = w - 1 * col_size;
float steering_wheel_margin = 0.6f * margin;
float steering_wheel_x = steering_wheel_margin;
steering_wheel_x += left_padding;
float steering_wheel_y = h - steering_wheel_margin - btn2_size;
float steering_accel_margin = margin;
float steering_accel_x = steering_accel_margin;
steering_accel_x += left_padding;
float steering_accel_y = h - steering_accel_margin - btn2_size;
if (UserConfigParams::m_multitouch_inverted)
{
first_column_x = margin + 1 * col_size;
second_column_x = margin;
first_column_x = margin + 1 * col_size + left_padding;
second_column_x = margin + left_padding;
steering_wheel_x = w - btn2_size - steering_wheel_margin;
steering_accel_x = w - btn2_size / 2 - steering_accel_margin;
}