Skip to content

Commit

Permalink
Added code, config and script to run a pygame app on the RG350.
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonbits committed Jan 22, 2020
0 parents commit b21218f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ball.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import sys, pygame
pygame.init()
pygame.joystick.init()

size = width, height = 320, 240
speed = [2, 2]
black = 0, 0, 0

screen = pygame.display.set_mode(size)

ball = pygame.image.load("icon.png")
ballrect = ball.get_rect()

while 1:
for event in pygame.event.get():
print pygame.event.event_name(event.type)
if event.type == pygame.KEYDOWN:
print "Key: ", event.key
sys.exit()

ballrect = ballrect.move(speed)
if ballrect.left < 0 or ballrect.right > width:
speed[0] = -speed[0]
if ballrect.top < 0 or ballrect.bottom > height:
speed[1] = -speed[1]

screen.fill(black)
screen.blit(ball, ballrect)
pygame.display.flip()
3 changes: 3 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rm -f bouncing_ball.opk && \
python -m compileall ./ && \
mksquashfs default.gcw0.desktop ball.pyc icon.png intro_ball.gif bouncing_ball.opk -all-root -no-xattrs -noappend -no-exports
7 changes: 7 additions & 0 deletions default.gcw0.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=Bouncing Ball
Comment=Bouncing ball example extracted from pygame tutorial
Exec=python ball.pyc
Categories=games;
Icon=icon
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added intro_ball.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b21218f

Please sign in to comment.