#Stretch window over every screen
1 messages · Page 1 of 1 (latest)
My understanding is that there isn't a really easy way to do this universally for all games.
If you use the Control node and it's derivatives, you can anchor their position to a specific point on the screen, and this will help to a degree.
Having a specific implementation for for your game will give you the best results.
Many games pick a resolution they're targeting (such as 1440p for PC games), and then work from there, adding padding or maybe changing FoV?
if your game is a 2D game that takes place on a sort of "board", you can generally add "black bars" or some sort of environment art around it to offset the issue. You can look at Wildfrost or Hearhstone as great examples of this, just put the game into windowed mode and try changing the resolution to see how it behaves.
FYI for anyone else looking, I believe the question is about how to size the game window so it covers every pixel of arbitrary multiscreen setups, like this one.
that makes more sense than my interpretation for sure
I can't look more deeply but it does seem like godot has the concept of virtual desktop coordinates, see here https://docs.godotengine.org/en/stable/classes/class_displayserver.html#class-displayserver-method-screen-get-position. So maybe you can iterate over each screen, find its minimum and maximum point in this virtual desktop coordinate space, then find the rectangle that encloses all those points
I already got somrthing working
Vector2I windowSize = Vector2I.Zero;
for (int i = 0; i < DisplayServer.GetScreenCount(); i++)
{
windowSize += DisplayServer.ScreenGetSize(i);
}
GetWindow().Position = Vector2I.Zero;
GetWindow().Size = windowSize;
this will work fine until you have three screens in a triangle shape
ah yes, the popular triforce setup 😆
very much
i personally make everything very versatile, maybe too versatile, so i would have used a more versatile solution
versatile
Woks with that too
In a triangle setup, the 0,0 point is here
But you can easily end up with "invalid" coords? Invalid being outside of a screen. It's cute that 0,0 is in this virtual corner, but it's not usable.
It doesn't need to be in my case.
I need this to have a small sprite follow the cursor on every screen. On startup, it's loaded at the cursor's current position and because it only follows behind, it can never leave the visible area.
The user also doesn't interact with anything. It's just an overlay.