snakeware

Python-based Linux distro for x86-64 and RPi
git clone git://squid-tech.com/snakeware.git
Log | Files | Refs | README

commit b9a49b1e5259e0a1f5cdffaffeda4355eba627e8
parent 5947971b34f90b10a81bb49561bbd6a829ad7bf1
Author: Josh Moore <jxm5210@rit.edu>
Date:   Thu, 28 May 2020 10:44:17 -0400

Refactor default pos code

Diffstat:
Msnakewm/apps/games/pong/__init__.py | 12+++++-------
Msnakewm/apps/test/HelloWorld/__init__.py | 9++++++++-
2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/snakewm/apps/games/pong/__init__.py b/snakewm/apps/games/pong/__init__.py @@ -6,12 +6,10 @@ def load(manager, params): params[0] should be the desired position. A default position will be used if a pos is not provided. """ - default_pos = (50, 50) + # default position + pos = (50, 50) if params is not None and len(params) > 0: - # create PongWindow of user-specified size - PongWindow(params[0], manager) - else: - # create PongWindow of default size - PongWindow(default_pos, manager) - + pos = params[0] + + PongWindow(pos, manager) diff --git a/snakewm/apps/test/HelloWorld/__init__.py b/snakewm/apps/test/HelloWorld/__init__.py @@ -6,8 +6,15 @@ def load(manager, params): An example implementation of the load() function called by the snakewm loadapp() function. """ + + # default position + pos = (10, 10) + + if params is not None and len(params) > 0: + pos = params[0] + pygame_gui.windows.UIMessageWindow( - rect=pygame.Rect((10, 10), (300, 160)), + rect=pygame.Rect(pos, (300, 160)), window_title="snakeware", html_message="Hello World!", manager=manager