Add {get/set}_window_position for Windows platform. #434
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
get_window_position
andset_window_position
to miniquad for Windows platform.set_window_position
uses the typical Request code path.get_window_position
adds ascreen_position
field toNativeDisplay
struct and updates it every time the screen position changes or is resized in the main update loop.Background
My motivation for this is to implement some form of pseudo hot-reloading (recompiling and reloading game state), which requires the window to always be in the same position and size. I've included an example in this gist, with a short video demonstration here.
There have also been numerous requests for this feature in the Discord channel and also #329.
Other platforms
This PR only adds Windows support. Other OSes will give an unimplemented error when trying to use these features. It is not applicable to ios/android/wasm platforms. For other platforms (
linux_*
,macos
), adding support involves:set_window_position
implementation and calling it inprocess_request
NativeDisplay.screen_position
in the main update loop for that platform.