virtualdisplay¶
virtualdisplay¶
Virtual display transformation back and forth from screen coordinates and rectangles to game coordinates and rectangles.
This is needed to allow the game to run at multiple resolutions, but have game objects move the same way. The game coordinate system is scaled up and down, and translated to fit the available screen space.
-
virtualdisplay.gamepoint_from_screenpoint(point)¶ Returns the corresponding (transformed) game space point for the supplied point in screen-space
-
virtualdisplay.gamerect_from_screenrect(screenrect)¶ Returns the corresponding (transformed) game space rectangle for the supplied rectangle in screen-space
-
virtualdisplay.screenpoint_from_gamepoint(gamepoint)¶ Returns the corresponding (transformed) screen space point for the supplied point in game-space
-
virtualdisplay.screenrect_from_gamerect(gamerect)¶ Returns the corresponding (transformed) screen space rectangle for the supplied rectangle in game-space
-
virtualdisplay.set_screensize(screensize)¶ Set the physical screen size in pixels.
Calculates the transformations to and from game space, using an aspect-preserving scale.