#11231 NORM 1.75-so: Wrong dimenssions in PyGame activities
Zarro Boogs per Child
bugtracker at laptop.org
Mon Sep 12 20:17:11 EDT 2011
#11231: Wrong dimenssions in PyGame activities
------------------------------------+---------------------------------------
Reporter: godiard | Owner: jnettlet
Type: defect | Status: new
Priority: normal | Milestone: 1.75-software
Component: not assigned | Version: not specified
Resolution: | Keywords:
Next_action: never set | Verified: 0
Deployment_affected: | Blockedby:
Blocking: |
------------------------------------+---------------------------------------
Comment(by Quozl):
Regression caused by X server supporting many modes.
However, the code in Maze and Physics is incorrect, as it chooses the
first of many screen resolutions supported by the X server, instead of the
resolution the screen is currently set to.
On os4 on XO-1.75, pygame.display.list_modes() returns [(1920, 1200),
(1920, 1080), (1680, 1050), (1600, 1200), (1440, 900), (1366, 768), (1280,
1024), (1280, 960), (1280, 800), (1280, 768), (1280, 720), (1200, 900),
(1152, 864), (1024, 768), (1024, 600), (800, 600), (800, 480)]
The fix to Maze so that it is resilient in the face of this X server
configuration, is to change the set_mode() method call in the main()
function of game.py:
{{{
def main():
"""Run a game of Maze."""
# ask pygame how big the screen is, leaving a little room for the
toolbar
toolbarheight = 75
pygame.display.init()
videoinfo = pygame.display.Info()
width = videoinfo.current_w
height = videoinfo.current_h - toolbarheight
screen = pygame.display.set_mode((width, height))
game = MazeGame(screen)
game.run()
}}}
The same can be said of Physics, which is fixed in physics.py thus:
{{{
def main():
toolbarheight = 75
tabheight = 45
pygame.init()
pygame.display.init()
videoinfo = pygame.display.Info()
x = videoinfo.current_w
y = videoinfo.current_h
screen = pygame.display.set_mode((x, y - toolbarheight - tabheight))
game = PhysicsGame(screen)
game.run()
}}}
Regardless of the eventual fix to the modes offered by the X server, these
activities should also be fixed.
--
Ticket URL: <http://dev.laptop.org/ticket/11231#comment:1>
One Laptop Per Child <http://laptop.org/>
OLPC bug tracking system
More information about the Bugs
mailing list