-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dynamic values in the Device context #20
base: main
Are you sure you want to change the base?
Conversation
@@ -73,6 +73,7 @@ Dictionary make_device_context(const Ref<RuntimeConfig> &p_runtime_config) { | |||
device_context["model"] = model; | |||
} | |||
|
|||
// Note: Godot Engine doesn't support changing screen resolution. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like, ever? How do Godot games support different screens?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Godot doesn't change the physical resolution of your desktop environment, it changes resolution scale instead. I.e., projects 720p on 1080p resolution, for example, like consoles do. Most modern games do the same, some also support changing the real resolution. But this way it makes Alt-Tab
faster, and fewer issues with it. Upscaling is cheap these days.
device_context["free_memory"] = double(meminfo["free"]); | ||
device_context["usable_memory"] = double(meminfo["available"]); | ||
|
||
auto dir = DirAccess::open("user://"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need permissions for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's guaranteed to be writable, judging by the docs: https://docs.godotengine.org/en/stable/tutorials/io/data_paths.html#accessing-persistent-user-data-user
Also, some interesting bits:
On mobile platforms, this path is unique to the project and is not accessible by other applications for security reasons.
On HTML5 exports, user:// will refer to a virtual filesystem stored on the device via IndexedDB. (Interaction with the main filesystem can still be performed through the JavaScriptBridge singleton.)
The current default is to set context values during initialization, which works for most cases. The only context that is currently updated is "godot_performance".
This PR introduces a code path that updates values in the standard
Device
context just before the event is sent.Values that are dynamically updated in the Device context with this PR:
orientation
,free_memory
,usable_memory
,free_storage
.