From a3e675221d3a7e1115f42cd6a84d91d5301a1015 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 16 Apr 2013 22:42:46 +0200 Subject: [PATCH] Tweak so we're explicitly fullscreen on android. Tweak tile size on android as well --- erdslangetjie/__main__.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) 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(): -- 2.34.1