ya2 · news · projects · code · about

on aspect ratio changed
[pmachines.git] / pmachines / pmachines.py
index 0936b42bb0203aad58c4a1b3d88bbf28f40ff95e..7e309e5adef96eb1fbd1bfb249403ad6e6c4706e 100755 (executable)
@@ -29,7 +29,7 @@ class Pmachines:
             return
         MusicMgr(self._options['settings']['volume'])
         self._set_physics()
-        Scene(self.world)
+        self._scene = Scene(self.world)
 
     def _configure(self):
         load_prc_file_data('', 'window-title pmachines')
@@ -83,6 +83,8 @@ class Pmachines:
         render.setAntialias(AntialiasAttrib.MAuto)
         self.base.set_background_color(0, 0, 0, 1)
         self.base.disable_mouse()
+        #self.base.accept('window-event', self._on_win_evt)
+        self.base.accept('aspectRatioChanged', self._on_aspect_ratio_changed)
 
     def _set_physics(self):
         if self._options['development']['physics_debug']:
@@ -102,3 +104,6 @@ class Pmachines:
             self.world.do_physics(dt)
             return task.cont
         taskMgr.add(update, 'update')
+
+    def _on_aspect_ratio_changed(self):
+        self._scene.on_aspect_ratio_changed()