feat: add actions to set max and min FPS at runtime
Summary
This PR adds two new actions under Game scene (Events) in GDevelop that allow developers to dynamically configure the game's maximum and minimum frames per second (FPS) during runtime.
These settings are useful for:
-
Reducing FPS during non-interactive scenes (e.g., cutscenes).
-
Exposing FPS settings in a game’s graphics or performance menu.
Implementation Details
-
Actions are declared in TimeExtension.cpp using .AddAction(...).
-
Mapped to new JS runtime functions:
- gdjs.evtTools.runtimeScene.setMaximumFPS
- gdjs.evtTools.runtimeScene.setMinimumFPS
-
FPS values are applied to RuntimeGame._maxFPS and _minFPS, which affect the main game loop behavior.
Demo
https://github.com/user-attachments/assets/17b036c3-9840-4078-aab8-11cf2fb9e0da
Related issue
Closes #5362
Hi! Thanks for this PR :) I think it would be nice to add:
- methods to runtimeGame to avoid modifying a "private" property (starting with underscores) (this will be helpful in the future if changing these values imply other operations to be done)
- validation in these new functions of the value (basically: not negative. 0 is considered unlimited already for maximum FPS).
Add a small info icon next to the FPS settings that explains what they do