Tweak so we're explicitly fullscreen on android. Tweak tile size on android as well
authorNeil <neil@dip.sun.ac.za>
Tue, 16 Apr 2013 20:42:46 +0000 (22:42 +0200)
committerNeil <neil@dip.sun.ac.za>
Tue, 16 Apr 2013 20:42:46 +0000 (22:42 +0200)
erdslangetjie/__main__.py

index 148236b4315c31961da160fdc27143eec42de68d..a7d594d5bac3554db9852cdd0178c92e850ee4b8 100644 (file)
@@ -15,8 +15,10 @@ from kivy.utils import platform
 from erdslangetjie.level import LevelList
 from erdslangetjie.player import ThePlayer, Nemesis
 
-TILE_SIZE = 48
-
+if platform() != 'android':
+    TILE_SIZE = 40
+else:
+    TILE_SIZE = 64
 
 class GameWindow(RelativeLayout):
 
@@ -224,21 +226,30 @@ class GameWindow(RelativeLayout):
 
 class GameApp(App):
 
+    title = "Peter's thread snake"
+
     def __init__(self):
         self.levels = LevelList()
         super(GameApp, self).__init__()
 
     def build(self):
-        root = ScrollView(size=(960, 640), size_hint=(None, None))
-        game = GameWindow(self.levels, root)
+        root = ScrollView(size_hint=(None, None))
+        return root
+
+    def on_start(self):
+        from kivy.base import EventLoop
+        window = EventLoop.window
+        if platform() == 'android':
+            window.fullscreen = True
+        self.root.size = window.size
+        game = GameWindow(self.levels, self.root)
         game.build()
-        root.add_widget(game)
+        self.root.add_widget(game)
         # Ensure the player is visible
-        root.scroll_x = 0
-        root.scroll_y = 0
+        self.root.scroll_x = 0
+        self.root.scroll_y = 0
         game.draw_player()
         game.draw_nemesis()
-        return root
 
 
 def main():