Skip to content
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

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

limbonaut
Copy link
Collaborator

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.

@limbonaut limbonaut added the enhancement New feature or request label Nov 19, 2024
@limbonaut limbonaut linked an issue Nov 19, 2024 that may be closed by this pull request
@@ -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.

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?

Copy link
Collaborator Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the resolution reported is the actual, physical screen resolution and not the resolution the game was running in?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. The rendering resolution is referred to as the viewport size (of the window), and you can have multiple windows as well, on different displays - it can get really complicated. You can also have nested viewports, so technically, the game could be rendered at higher resolution nested viewport, downscaled to window viewport size and upscaled to main screen resolution. 😄 Not that I recommend it.
Reference to doc: https://docs.godotengine.org/en/stable/tutorials/rendering/multiple_resolutions.html

src/sentry/contexts.cpp Show resolved Hide resolved
@limbonaut limbonaut force-pushed the feat/improve-context-handling branch from 2bcfe22 to c707078 Compare November 27, 2024 16:06
@limbonaut limbonaut merged commit df5b624 into main Nov 27, 2024
8 checks passed
@limbonaut limbonaut deleted the feat/improve-context-handling branch November 27, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve context handling
2 participants