From: Neil Date: Tue, 16 Apr 2013 20:42:46 +0000 (+0200) Subject: Tweak so we're explicitly fullscreen on android. Tweak tile size on android as well X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=a3e675221d3a7e1115f42cd6a84d91d5301a1015;p=erdslangetjie.git Tweak so we're explicitly fullscreen on android. Tweak tile size on android as well --- diff --git a/erdslangetjie/__main__.py b/erdslangetjie/__main__.py index 148236b..a7d594d 100644 --- a/erdslangetjie/__main__.py +++ b/erdslangetjie/__main__.py @@ -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():