diff options
author | Wade Brainerd <wadetb@gmail.com> | 2009-11-21 17:25:36 (GMT) |
---|---|---|
committer | Wade Brainerd <wadetb@gmail.com> | 2009-11-21 17:25:36 (GMT) |
commit | 47927d48d37fb2bb9fc6e2b29e5ee724652eebb3 (patch) | |
tree | 6ae1c1bb92164b6a578d1f0e9ab4f643d97bf076 | |
parent | 7f8f78bfbce3406981c203c878a892e1065e4e4d (diff) |
Better solution to the initial screen size.
-rw-r--r-- | README.txt | 2 | ||||
-rw-r--r-- | sugargame/canvas.py | 3 | ||||
-rw-r--r-- | sugargame/event.py | 6 |
3 files changed, 4 insertions, 7 deletions
@@ -96,6 +96,8 @@ main loop, remember to dispatch GTK messages using gtk.main_iteration(). for event in pygame.event.get(): if event.type == pygame.QUIT: return + elif event.type == pygame.VIDEORESIZE: + pygame.display.set_mode(event.size, pygame.RESIZABLE) # Clear Display screen.fill((255,255,255)) #255 for white diff --git a/sugargame/canvas.py b/sugargame/canvas.py index 27f9137..cf99a13 100644 --- a/sugargame/canvas.py +++ b/sugargame/canvas.py @@ -41,7 +41,8 @@ class PygameCanvas(gtk.EventBox): self._socket.get_window().set_cursor(None) # Initialize the Pygame window. - pygame.display.set_mode((0, 0), pygame.RESIZABLE) + r = self.get_allocation() + pygame.display.set_mode((r.width, r.height), pygame.RESIZABLE) # Hook certain Pygame functions with GTK equivalents. translator = event.Translator(self._mainwindow, self) diff --git a/sugargame/event.py b/sugargame/event.py index b315c1c..52ca4ab 100644 --- a/sugargame/event.py +++ b/sugargame/event.py @@ -69,12 +69,6 @@ class Translator(object): self._inner_evb.connect('motion-notify-event', self._mousemove_cb) self._inner_evb.connect('expose-event', self._expose_cb) self._inner_evb.connect('configure-event', self._resize_cb) - - # Fake the first VIDEORESIZE event to set the initial screen dimensions. - r = self._inner_evb.get_allocation() - evt = pygame.event.Event(pygame.VIDEORESIZE, - size=(r.width,r.height), width=r.width, height=r.height) - pygame.event.post(evt) # Internal data self.__stopped = False |