• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-c誰得cocoaqtpythonrubywindowsphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

Commit MetaInfo

Revisión21a632d2dabd80e2c4b6b91abca2b80be4e36373 (tree)
Tiempo2021-04-29 20:51:43
Autorsebastian_bugiu
Commitersebastian_bugiu

Log Message

Menus now take into account notch height and move out of its way.

Cambiar Resumen

Diferencia incremental

diff -r 6a6760d527db -r 21a632d2dabd core/src/headwayent/blackholedarksun/APP_Game.java
--- a/core/src/headwayent/blackholedarksun/APP_Game.java Tue Apr 27 22:31:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/APP_Game.java Thu Apr 29 14:51:43 2021 +0300
@@ -2,6 +2,7 @@
22
33 import com.badlogic.gdx.Application;
44 import com.badlogic.gdx.Gdx;
5+import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
56 import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
67 import com.badlogic.gdx.files.FileHandle;
78 import com.badlogic.gdx.physics.bullet.Bullet;
@@ -16,6 +17,8 @@
1617 import com.google.gson.Gson;
1718 import com.google.gson.GsonBuilder;
1819
20+import org.robovm.apple.coregraphics.CGRect;
21+
1922 import headwayent.blackholedarksun.entitydata.AsteroidData;
2023 import headwayent.blackholedarksun.entitydata.WeaponData;
2124 import headwayent.blackholedarksun.exception.GameDataException;
@@ -60,6 +63,9 @@
6063 //import org.openintents.sensorsimulator.hardware.SensorManagerSimulator;
6164
6265 import java.io.*;
66+import java.lang.reflect.Field;
67+import java.lang.reflect.InvocationTargetException;
68+import java.lang.reflect.Method;
6369 import java.net.HttpURLConnection;
6470 import java.net.MalformedURLException;
6571 import java.text.SimpleDateFormat;
@@ -73,6 +79,7 @@
7379 public abstract class APP_Game extends ENG_GameDescription {
7480
7581 public static final boolean REDIRECT_PRINTLN_OUTPUT = true;
82+ public static final boolean NOTCH_SIMULATE = true;
7683 protected HudManager hudManager;
7784 protected SimpleViewMenuManager simpleViewMenuManager;
7885 protected NetManager netManager;
@@ -91,6 +98,7 @@
9198 // protected WorldManager worldManager;
9299 protected ENG_CompositorWorkspaceNativeWrapper compositorWorkspace;
93100 private EntityContactListener entityContactListener;
101+ private Double notchHeight;
94102
95103 protected static void redirectPrintlnOutput() {
96104 if (REDIRECT_PRINTLN_OUTPUT) {
@@ -1562,6 +1570,31 @@
15621570 entityContactListener = new EntityContactListener();
15631571 }
15641572
1573+ public void initializeNotchHeight() {
1574+ IOSApplication app = (IOSApplication) Gdx.app;
1575+
1576+ try {
1577+ Field lastScreenBoundsField = IOSApplication.class.getDeclaredField("lastScreenBounds");
1578+ lastScreenBoundsField.setAccessible(true);
1579+ CGRect lastScreenBounds = (CGRect) lastScreenBoundsField.get(app);
1580+ Method getYMethod = CGRect.class.getDeclaredMethod("getY", null);
1581+ notchHeight = (Double) getYMethod.invoke(lastScreenBounds, null);
1582+ System.out.println("notchHeight: " + notchHeight);
1583+ } catch (NoSuchFieldException e) {
1584+ e.printStackTrace();
1585+ } catch (IllegalAccessException e) {
1586+ e.printStackTrace();
1587+ } catch (NoSuchMethodException e) {
1588+ e.printStackTrace();
1589+ } catch (InvocationTargetException e) {
1590+ e.printStackTrace();
1591+ }
1592+ }
1593+
1594+ public double getNotchHeight() {
1595+ return NOTCH_SIMULATE ? 100.0 : notchHeight;
1596+ }
1597+
15651598 public abstract WorldManagerBase getWorldManager();
15661599
15671600 public ENG_ResourceLoaderBlock getResourceLoaderBlock() {
diff -r 6a6760d527db -r 21a632d2dabd core/src/headwayent/blackholedarksun/APP_SinglePlayerGame.java
--- a/core/src/headwayent/blackholedarksun/APP_SinglePlayerGame.java Tue Apr 27 22:31:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/APP_SinglePlayerGame.java Thu Apr 29 14:51:43 2021 +0300
@@ -8,12 +8,9 @@
88 import com.artemis.managers.TagManager;
99 import com.artemis.managers.TeamManager;
1010 import com.badlogic.gdx.Gdx;
11-import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
1211 import com.badlogic.gdx.files.FileHandle;
1312 import com.google.common.eventbus.EventBus;
1413
15-import org.robovm.apple.coregraphics.CGRect;
16-
1714 import headwayent.blackholedarksun.automationframework.MultiPlayerCreateSessionWithFriendsAutomation;
1815 import headwayent.blackholedarksun.automationframework.MultiPlayerJoinSessionWithFriendsAutomation;
1916 import headwayent.blackholedarksun.automationframework.SinglePlayerMenuAutomation;
@@ -60,9 +57,6 @@
6057 import headwayent.hotshotengine.statedebugger.ENG_Frame;
6158
6259 import java.io.File;
63-import java.lang.reflect.Field;
64-import java.lang.reflect.InvocationTargetException;
65-import java.lang.reflect.Method;
6660 import java.util.TreeMap;
6761
6862 /**
@@ -747,7 +741,6 @@
747741 width = Gdx.graphics.getWidth();
748742 height = Gdx.graphics.getHeight();
749743 }
750- double notchHeight = 0;
751744
752745 TreeMap<String, String> miscParams = new TreeMap<>();
753746 if (MainApp.PLATFORM == MainApp.Platform.ANDROID) {
@@ -769,24 +762,11 @@
769762 miscParams.put("FSAA", "");
770763 miscParams.put("vsync", "");
771764
772- IOSApplication app = (IOSApplication) Gdx.app;
765+ initializeNotchHeight();
766+ }
773767
774- try {
775- Field lastScreenBoundsField = IOSApplication.class.getDeclaredField("lastScreenBounds");
776- lastScreenBoundsField.setAccessible(true);
777- CGRect lastScreenBounds = (CGRect) lastScreenBoundsField.get(app);
778- Method getYMethod = CGRect.class.getDeclaredMethod("getY", null);
779- notchHeight = (Double) getYMethod.invoke(lastScreenBounds, null);
780- System.out.println("notchHeight: " + notchHeight);
781- } catch (NoSuchFieldException e) {
782- e.printStackTrace();
783- } catch (IllegalAccessException e) {
784- e.printStackTrace();
785- } catch (NoSuchMethodException e) {
786- e.printStackTrace();
787- } catch (InvocationTargetException e) {
788- e.printStackTrace();
789- }
768+ if (getNotchHeight() > 0.0) {
769+
790770 }
791771 // com.badlogic.gdx.Graphics iosGraphics = (com.badlogic.gdx.Graphics) Gdx.graphics;
792772 // long iosViewHandler = iosGraphics.getViewHandle();
diff -r 6a6760d527db -r 21a632d2dabd core/src/headwayent/blackholedarksun/menus/GenericMenu.java
--- a/core/src/headwayent/blackholedarksun/menus/GenericMenu.java Tue Apr 27 22:31:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/menus/GenericMenu.java Thu Apr 29 14:51:43 2021 +0300
@@ -1,6 +1,7 @@
11 package headwayent.blackholedarksun.menus;
22
33 import headwayent.blackholedarksun.APP_Game;
4+import headwayent.blackholedarksun.MainApp;
45 import headwayent.blackholedarksun.menuresource.Menu;
56 import headwayent.blackholedarksun.menuresource.MenuSelection;
67 import headwayent.blackholedarksun.menusystemsimpleview.SimpleViewGameMenuManager;
@@ -29,8 +30,8 @@
2930 public static final String BUNDLE_TITLE_HEIGHT = "title_height";
3031 public static final String BUNDLE_BOTTOM_BUTTONS_HEIGHT = "bottom_buttons_height";
3132
32- private static final float BUTTON_DIFF_DISTANCE = 2.0f;
33- private static final float TITLE_HEIGHT = 20.0f;
33+ private static final float BUTTON_DIFF_DISTANCE = 1.0f;
34+ private static final float TITLE_HEIGHT = 15.0f;
3435 private static final float BUTTON_HEIGHT = 100.0f - TITLE_HEIGHT;
3536 public static final String BUNDLE_MENU = "menu";
3637
@@ -58,7 +59,7 @@
5859 private final ENG_ColorValue textColor = new ENG_ColorValue(ENG_ColorValue.WHITE);
5960
6061
61- private final float titleHeight;
62+ private float titleHeight;
6263 private float bottomButtonsHeight;
6364 private float buttonsHeight;
6465 private float buttonsDiffDistance;
@@ -74,27 +75,32 @@
7475 // TODO Auto-generated constructor stub
7576 Menu menu = (Menu) bundle.get(BUNDLE_MENU);
7677
78+ boolean shouldOffset = MainApp.getGame().getNotchHeight() > 0.0;
79+
80+ float titleTop = (shouldOffset ? NOTCH_VERTICAL_OFFSET : 0.0f);
7781 if (bundle.getBoolean(BUNDLE_SPECIFIC_HEIGHTS)) {
7882 titleHeight = bundle.getFloat(BUNDLE_TITLE_HEIGHT, -1.0f);
7983 if (titleHeight == -1.0f) {
8084 throw new IllegalArgumentException("title height not specified");
8185 }
86+ titleHeight += (shouldOffset ? NOTCH_VERTICAL_OFFSET : 0.0f);
8287 bottomButtonsHeight = bundle.getFloat(BUNDLE_BOTTOM_BUTTONS_HEIGHT, -1.0f);
8388 if (bottomButtonsHeight == -1.0f) {
8489 throw new IllegalArgumentException("bottoms buttons height not specified");
8590 }
91+ bottomButtonsHeight -= (shouldOffset ? NOTCH_VERTICAL_OFFSET : 0.0f);
8692 buttonsDiffDistance = bundle.getFloat(BUNDLE_BUTTON_DIFF_DISTANCE, -1.0f);
8793 if (buttonsDiffDistance == -1.0f) {
8894 throw new IllegalArgumentException("buttons diff distance not specified");
8995 }
90- buttonsHeight = 100.0f - titleHeight - bottomButtonsHeight;
96+ buttonsHeight = 100.0f - titleHeight - titleTop - bottomButtonsHeight - (shouldOffset ? NOTCH_VERTICAL_OFFSET : 0.0f);
9197 } else {
92- titleHeight = TITLE_HEIGHT;
93- buttonsHeight = BUTTON_HEIGHT;
98+ titleHeight = TITLE_HEIGHT + (shouldOffset ? NOTCH_VERTICAL_OFFSET : 0.0f);
99+ buttonsHeight = BUTTON_HEIGHT - titleTop - (shouldOffset ? NOTCH_VERTICAL_OFFSET : 0.0f);
94100 buttonsDiffDistance = BUTTON_DIFF_DISTANCE;
95101 }
96102
97- ENG_TextView titleView = (ENG_TextView) createView("title", "textview", 0.0f, 0.0f, 100.0f, TITLE_HEIGHT);
103+ ENG_TextView titleView = (ENG_TextView) createView("title", "textview", 0.0f, titleTop, 100.0f, titleHeight, false, false);
98104
99105 titleView.setText(menu.menuTitle);
100106
@@ -113,9 +119,9 @@
113119 float currentTop = titleHeight;
114120 for (MenuSelection menuSelection : validSelections) {
115121 ENG_Button button = (ENG_Button) createView(
116- menuSelection.name, "button", 0.0f,
122+ menuSelection.name, "button", (shouldOffset ? NOTCH_HORIZONTAL_OFFSET : 0.0f),
117123 currentTop + buttonsDiffDistance,
118- 100.0f, currentTop + buttonHeight);
124+ (shouldOffset ? 100.0f - NOTCH_HORIZONTAL_OFFSET : 100.0f), currentTop + buttonHeight, false, false);
119125 button.setText(menuSelection.name);
120126 button.setTextSize(APP_Game.GORILLA_DEJAVU_LARGE);
121127 buttonMap.put(menuSelection.name, button);
@@ -124,9 +130,9 @@
124130 }
125131 for (MenuSelection menuSelection : previousMenuSelections) {
126132 ENG_Button button = (ENG_Button) createView(
127- menuSelection.name, "button", 0.0f,
133+ menuSelection.name, "button", (shouldOffset ? NOTCH_HORIZONTAL_OFFSET : 0.0f),
128134 currentTop + buttonsDiffDistance,
129- 100.0f, currentTop + buttonHeight);
135+ (shouldOffset ? 100.0f - NOTCH_HORIZONTAL_OFFSET : 100.0f), currentTop + buttonHeight, false, false);
130136 button.setText(menuSelection.name);
131137 button.setTextSize(APP_Game.GORILLA_DEJAVU_LARGE);
132138 button.setTextColor(ENG_ColorValue.WHITE);
diff -r 6a6760d527db -r 21a632d2dabd core/src/headwayent/hotshotengine/gui/simpleview/ENG_Container.java
--- a/core/src/headwayent/hotshotengine/gui/simpleview/ENG_Container.java Tue Apr 27 22:31:48 2021 +0300
+++ b/core/src/headwayent/hotshotengine/gui/simpleview/ENG_Container.java Thu Apr 29 14:51:43 2021 +0300
@@ -60,6 +60,26 @@
6060 public static final String TOAST_BACKGROUND_COLOR_HEX = "#48413d";
6161 public static final int FADE_OUT_TOAST_ANIMATION_DURATION = 2000;
6262 public static final float TOAST_MARGIN_WIDTH = 15.0f;
63+ public static final float NOTCH_HORIZONTAL_OFFSET = 10.0f;
64+ public static final float NOTCH_VERTICAL_OFFSET = 5.0f;
65+
66+ public enum RelativePositionInContainer {
67+ LEFT(0x1),
68+ TOP(0x2),
69+ RIGHT(0x4),
70+ BOTTOM(0x8),
71+ MIDDLE(0x10);
72+
73+ private int pos;
74+
75+ RelativePositionInContainer(int pos) {
76+ this.pos = pos;
77+ }
78+
79+ public int getPos() {
80+ return pos;
81+ }
82+ }
6383
6484
6585 public abstract static class ViewFactory {
@@ -151,6 +171,7 @@
151171 private boolean progressBarShowing;
152172 private boolean visible;
153173 private boolean showKeyboardContainerListenerAdded;
174+ private boolean finalViewsPositionsCalculated;
154175
155176 static {
156177 viewFactoryList.put(TEXTVIEW, new ENG_TextView.TextViewFactory());
@@ -383,6 +404,7 @@
383404 screenWidth = viewport.getActualWidth();
384405 screenHeight = viewport.getActualHeight();
385406 ArrayList<ENG_View> list = new ArrayList<>(viewList.values());
407+ calculateFinalViewsPositions(list);
386408 for (ENG_View view : list) {
387409 if (!view.isUpdateManually()) {
388410 view.draw(screenWidth, screenHeight);
@@ -399,6 +421,94 @@
399421 }
400422 }
401423
424+ private void calculateFinalViewsPositions(ArrayList<ENG_View> list) {
425+ if (!finalViewsPositionsCalculated) {
426+ finalViewsPositionsCalculated = true;
427+ if (MainApp.getGame().getNotchHeight() > 0.0) {
428+ ArrayList<ENG_View> leftViews = new ArrayList<>();
429+ ArrayList<ENG_View> topViews = new ArrayList<>();
430+ ArrayList<ENG_View> rightViews = new ArrayList<>();
431+ ArrayList<ENG_View> bottomViews = new ArrayList<>();
432+ float leftestViewPos = 100.0f;
433+ float topViewPos = 100.0f;
434+ float rightestViewPos = 0.0f;
435+ float bottomViewPos = 0.0f;
436+ // Get the view limits.
437+ for (ENG_View view : list) {
438+ if (!view.isAutoOffsetByNotchSize()) {
439+ continue;
440+ }
441+ if (view.getLeft() < 20.1f && leftestViewPos > view.getLeft()) {
442+ leftestViewPos = view.getLeft();
443+ }
444+ if (view.getTop() < 20.1f && topViewPos > view.getTop()) {
445+ topViewPos = view.getTop();
446+ }
447+ if (view.getRight() > 79.9f && rightestViewPos < view.getRight()) {
448+ rightestViewPos = view.getRight();
449+ }
450+ if (view.getBottom() > 79.9f && bottomViewPos < view.getBottom()) {
451+ bottomViewPos = view.getBottom();
452+ }
453+ }
454+ // Get the limits which should be taken into account when offsetting the notch.
455+ for (ENG_View view : list) {
456+ if (!view.isAutoOffsetByNotchSize()) {
457+ continue;
458+ }
459+ if (ENG_Math.nearlyEqual(leftestViewPos, view.getLeft())) {
460+ view.setRelativePositionInContainer(view.getRelativePositionInContainer() | RelativePositionInContainer.LEFT.getPos());
461+ }
462+ if (ENG_Math.nearlyEqual(topViewPos, view.getTop())) {
463+ view.setRelativePositionInContainer(view.getRelativePositionInContainer() | RelativePositionInContainer.TOP.getPos());
464+ }
465+ if (ENG_Math.nearlyEqual(rightestViewPos, view.getRight())) {
466+ view.setRelativePositionInContainer(view.getRelativePositionInContainer() | RelativePositionInContainer.RIGHT.getPos());
467+ }
468+ if (ENG_Math.nearlyEqual(bottomViewPos, view.getBottom())) {
469+ view.setRelativePositionInContainer(view.getRelativePositionInContainer() | RelativePositionInContainer.BOTTOM.getPos());
470+ }
471+ }
472+ for (ENG_View view : list) {
473+ if (!view.isAutoOffsetByNotchSize()) {
474+ continue;
475+ }
476+ // TODO HACK when we finally get the notch height in pixels or percentage
477+ // we will be able to know exactly how much to offset.
478+ // For now just offset by fixed percentage.
479+ if ((view.getRelativePositionInContainer() & RelativePositionInContainer.LEFT.getPos()) != 0) {
480+ float prevPos = view.getRight();
481+ view.setLeft(view.getLeft() + NOTCH_HORIZONTAL_OFFSET);
482+ if (view.getRight() - view.getLeft() < 10.0f) {
483+ view.setRight(prevPos + NOTCH_HORIZONTAL_OFFSET);
484+ }
485+ }
486+ if ((view.getRelativePositionInContainer() & RelativePositionInContainer.TOP.getPos()) != 0) {
487+ float prevPos = view.getBottom();
488+ view.setTop(view.getTop() + NOTCH_VERTICAL_OFFSET);
489+ if (view.getBottom() - view.getTop() < 10.0f) {
490+ view.setBottom(prevPos + NOTCH_VERTICAL_OFFSET);
491+ }
492+ }
493+ if ((view.getRelativePositionInContainer() & RelativePositionInContainer.RIGHT.getPos()) != 0) {
494+ float prevPos = view.getLeft();
495+ view.setRight(view.getRight() - NOTCH_HORIZONTAL_OFFSET);
496+ if (view.getRight() - view.getLeft() < 10.0f) {
497+ view.setLeft(prevPos - NOTCH_HORIZONTAL_OFFSET);
498+ }
499+ }
500+ if ((view.getRelativePositionInContainer() & RelativePositionInContainer.BOTTOM.getPos()) != 0) {
501+ float prevPos = view.getTop();
502+ view.setBottom(view.getBottom() - NOTCH_VERTICAL_OFFSET);
503+ if (view.getBottom() - view.getTop() < 10.0f) {
504+ view.setTop(prevPos - NOTCH_VERTICAL_OFFSET);
505+ }
506+ }
507+ }
508+ }
509+ }
510+ }
511+
402512 public void destroy() {
403513 destroy(false, false);
404514 }
@@ -460,36 +570,59 @@
460570 public ENG_View createView(String name, String type, float left, float top,
461571 float right, float bottom, ENG_Layer layer) {
462572 return createView(name, type, left, top, right, bottom,
463- null, false, null, layer);
573+ null, false, null, layer, true);
464574 }
465575
466576 public ENG_View createView(String name, String type, float left, float top,
467577 float right, float bottom, ENG_View parentView) {
468578 return createView(name, type, left, top, right, bottom,
469- null, false, parentView, layer);
579+ null, false, parentView, layer, true);
470580 }
471581
472582 public ENG_View createView(String name, String type, float left, float top,
473583 float right, float bottom, boolean updateManually) {
474584 return createView(name, type, left, top, right, bottom, null,
475- updateManually, null, layer);
585+ updateManually, null, layer, true);
476586 }
477587
478588 public ENG_View createView(String name, String type, float left, float top,
479589 float right, float bottom) {
590+ return createView(name, type, left, top, right, bottom, false, true);
591+ }
592+
593+ public ENG_View createView(String name, String type, float left, float top,
594+ float right, float bottom, boolean updateManually, boolean useNotchOffset) {
595+// if (useNotchOffset && MainApp.getGame().getNotchHeight() > 0.0) {
596+// // TODO HACK when we finally get the notch height in pixels or percentage
597+// // we will be able to know exactly how much to offset.
598+// // For now just offset by fixed percentage.
599+// left += NOTCH_OFFSET;
600+// top += NOTCH_OFFSET;
601+// right -= NOTCH_OFFSET;
602+// bottom -= NOTCH_OFFSET;
603+// }
480604 return createView(name, type, left, top, right, bottom, null, false,
481- null, layer);
605+ null, layer, useNotchOffset);
482606 }
483607
484608 public ENG_View createView(String name, String type, float left, float top,
485609 float right, float bottom, Bundle bundle) {
610+// if (MainApp.getGame().getNotchHeight() > 0.0) {
611+// // TODO HACK when we finally get the notch height in pixels or percentage
612+// // we will be able to know exactly how much to offset.
613+// // For now just offset by fixed percentage.
614+// left += NOTCH_OFFSET;
615+// top += NOTCH_OFFSET;
616+// right -= NOTCH_OFFSET;
617+// bottom -= NOTCH_OFFSET;
618+// }
486619 return createView(name, type, left, top, right, bottom, bundle, false,
487- null, layer);
620+ null, layer, true);
488621 }
489622
490623 public ENG_View createView(String name, String type, float left, float top,
491624 float right, float bottom, Bundle bundle, boolean updateManually,
492- ENG_View parentView, ENG_Layer layer) {
625+ ENG_View parentView, ENG_Layer layer, boolean useNotchOffset) {
493626 ViewFactory viewFactory = viewFactoryList.get(type.toLowerCase(Locale.US));
494627 if (viewFactory == null) {
495628 throw new IllegalArgumentException(type + " is not a valid " +
@@ -498,6 +631,7 @@
498631 ENG_View view = viewFactory.createView(name, layer, this, bundle, parentView);
499632 view.setCorners(left, top, right, bottom);
500633 view.setUpdateManually(updateManually);
634+ view.setAutoOffsetByNotchSize(useNotchOffset);
501635 ENG_View put = viewList.put(name, view);
502636 if (put != null) {
503637 throw new IllegalArgumentException(name + " already exists in " +
diff -r 6a6760d527db -r 21a632d2dabd core/src/headwayent/hotshotengine/gui/simpleview/ENG_View.java
--- a/core/src/headwayent/hotshotengine/gui/simpleview/ENG_View.java Tue Apr 27 22:31:48 2021 +0300
+++ b/core/src/headwayent/hotshotengine/gui/simpleview/ENG_View.java Thu Apr 29 14:51:43 2021 +0300
@@ -1,5 +1,6 @@
11 package headwayent.hotshotengine.gui.simpleview;
22
3+import headwayent.hotshotengine.ENG_Math;
34 import headwayent.hotshotengine.android.graphics.Rect;
45 import headwayent.hotshotengine.ENG_RealRect;
56 import headwayent.hotshotengine.ENG_Utility;
@@ -81,10 +82,12 @@
8182 private boolean updateManually;
8283 private final ENG_View parentView;
8384 private OnChildChangedListener childChangedListener;
85+ private int relativePositionInContainer = ENG_Container.RelativePositionInContainer.MIDDLE.getPos();
8486 private boolean clickListenerEnabled = true;
8587 private boolean keyCodeListenerEnabled = true;
8688 private boolean characterListenerEnabled = true;
8789 private boolean focusListenerEnabled = true;
90+ private boolean autoOffsetByNotchSize = true;
8891
8992 // background data
9093 private ENG_Rectangle rect;
@@ -292,6 +295,7 @@
292295 }
293296
294297 public void setLeft(float left) {
298+ left = ENG_Math.clamp(left, 0.0f, 100.0f);
295299 this.left = left;
296300 }
297301
@@ -300,6 +304,7 @@
300304 }
301305
302306 public void setTop(float top) {
307+ top = ENG_Math.clamp(top, 0.0f, 100.0f);
303308 this.top = top;
304309 }
305310
@@ -308,6 +313,7 @@
308313 }
309314
310315 public void setRight(float right) {
316+ right = ENG_Math.clamp(right, 0.0f, 100.0f);
311317 this.right = right;
312318 }
313319
@@ -316,6 +322,7 @@
316322 }
317323
318324 public void setBottom(float bottom) {
325+ bottom = ENG_Math.clamp(bottom, 0.0f, 100.0f);
319326 this.bottom = bottom;
320327 }
321328
@@ -546,6 +553,26 @@
546553 this.ignoreDirty = ignoreDirty;
547554 }
548555
556+ public int getRelativePositionInContainer() {
557+ return relativePositionInContainer;
558+ }
559+
560+ public void setRelativePositionInContainer(int relativePositionInContainer) {
561+ this.relativePositionInContainer = relativePositionInContainer;
562+ // If anything different from middle then make sure we get rid of previous middle setting.
563+ if ((relativePositionInContainer | ENG_Container.RelativePositionInContainer.MIDDLE.getPos()) != ENG_Container.RelativePositionInContainer.MIDDLE.getPos()) {
564+ this.relativePositionInContainer &= ~ENG_Container.RelativePositionInContainer.MIDDLE.getPos();
565+ }
566+ }
567+
568+ public boolean isAutoOffsetByNotchSize() {
569+ return autoOffsetByNotchSize;
570+ }
571+
572+ public void setAutoOffsetByNotchSize(boolean autoOffsetByNotchSize) {
573+ this.autoOffsetByNotchSize = autoOffsetByNotchSize;
574+ }
575+
549576 /**
550577 * This is needed for when checking the focus using an ENG_TextField in ENG_TableView
551578 * with viewToRowParameters map.
diff -r 6a6760d527db -r 21a632d2dabd desktop/raw/hotshot_gamedata/overlay.overlay
--- a/desktop/raw/hotshot_gamedata/overlay.overlay Tue Apr 27 22:31:48 2021 +0300
+++ b/desktop/raw/hotshot_gamedata/overlay.overlay Thu Apr 29 14:51:43 2021 +0300
@@ -19,7 +19,7 @@
1919 }
2020 container Panel FireButton
2121 {
22- left 0.15
22+ left 0.2
2323 top 0.75
2424 width 0.2
2525 height 0.24
diff -r 6a6760d527db -r 21a632d2dabd ios/data/Default@2x.png
Binary file ios/data/Default@2x.png has changed