Skip to content

Commit

Permalink
Improve preferred FPS setting logic and documentation on iOS backend (l…
Browse files Browse the repository at this point in the history
…ibgdx#7382)

* Generate MobiVM MetalANGLE backend

* Generate updated MobiVM MetalANGLE backend (libgdx#7377)

* Generate MobiVM MetalANGLE backend

* feat: Add CHANGES for iOS AudioDevice

---------

Co-authored-by: GitHub Action <[email protected]>

* Improved preferred FPS setting logic and coumentation on iOS backend

* Generate MobiVM MetalANGLE backend

---------

Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Berstanio <[email protected]>
  • Loading branch information
3 people authored Apr 20, 2024
1 parent 8a2504f commit 57c8ce1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public class IOSApplicationConfiguration {
/** the multisample format, None is default * */
public MGLDrawableMultisample multisample = MGLDrawableMultisample.None;

/** preferred/max number of frames per second. Set to "0" to indicate max supported by screen (on standard OpenGL backend (non
* MetalANGLE) Apple has a 60fps cap on most devices). * */
/** preferred/max number of frames per second. Set to "0" to indicate max supported by screen. Important: On standard OpenGL
* backend FPS is capped to 60. Make sure to use MetalANGLE to support higher FPS. * */
public int preferredFramesPerSecond = 0;

/** whether to use the accelerometer, default true * */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,11 @@ public void draw (CGRect rect) {
viewController.setView(view);
viewController.setDelegate(viewDelegate);
int preferredFps;
int maxSupportedFPS = (int)(UIScreen.getMainScreen().getMaximumFramesPerSecond());
if (config.preferredFramesPerSecond == 0) {
preferredFps = (int)(UIScreen.getMainScreen().getMaximumFramesPerSecond());
preferredFps = maxSupportedFPS;
} else {
preferredFps = config.preferredFramesPerSecond;
preferredFps = Math.min(config.preferredFramesPerSecond, maxSupportedFPS);
}
viewController.setPreferredFramesPerSecond(preferredFps);
this.app = app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class IOSApplicationConfiguration {
/** the multisample format, None is default **/
public GLKViewDrawableMultisample multisample = GLKViewDrawableMultisample.None;

/** preferred/max number of frames per second. Set to "0" to indicate max supported by screen (on standard OpenGL backend (non
* MetalANGLE) Apple has a 60fps cap on most devices). **/
/** preferred/max number of frames per second. Set to "0" to indicate max supported by screen. Important: On standard OpenGL
* backend FPS is capped to 60. Make sure to use MetalANGLE to support higher FPS. **/
public int preferredFramesPerSecond = 0;

/** whether to use the accelerometer, default true **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ public void draw (CGRect rect) {
viewController.setDelegate(viewDelegate);

int preferredFps;
int maxSupportedFPS = (int)(UIScreen.getMainScreen().getMaximumFramesPerSecond());
if (config.preferredFramesPerSecond == 0) {
preferredFps = (int)(UIScreen.getMainScreen().getMaximumFramesPerSecond());
preferredFps = maxSupportedFPS;
} else {
preferredFps = config.preferredFramesPerSecond;
preferredFps = Math.min(config.preferredFramesPerSecond, maxSupportedFPS);
}
viewController.setPreferredFramesPerSecond(preferredFps);

Expand Down

0 comments on commit 57c8ce1

Please sign in to comment.