diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2012-10-17 01:12:23 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2012-10-17 01:12:23 (GMT) |
commit | 769ddd2cb32b11ed76ef07232026d65e88a9bb36 (patch) | |
tree | 574224e1856957a76758496506e889cd7e75ef82 | |
parent | ba6da3f4e9665e8bb8f6be64f09f40698980861a (diff) |
add all files of version 2
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | activity/activity.info | 4 | ||||
-rw-r--r-- | crazyeights.py | 3 | ||||
-rw-r--r-- | data/back.user.tga | bin | 0 -> 108754 bytes | |||
-rw-r--r-- | data/cards.user.png | bin | 0 -> 365139 bytes | |||
-rw-r--r-- | data/suit1.user.png | bin | 0 -> 968 bytes | |||
-rw-r--r-- | data/suit2.user.png | bin | 0 -> 893 bytes | |||
-rw-r--r-- | data/suit3.user.png | bin | 0 -> 1003 bytes | |||
-rw-r--r-- | data/suit4.user.png | bin | 0 -> 977 bytes | |||
-rw-r--r-- | data/suits.user.png | bin | 0 -> 3458 bytes | |||
-rw-r--r-- | fiftytwo.py | 5 | ||||
-rw-r--r-- | games_to_implement | 7 | ||||
-rw-r--r-- | gofishai | 1 | ||||
-rw-r--r-- | gui.py | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/__init__.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/_cairoimage.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/_gtkmain.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/_version.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/activity.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/buildmanifest.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/camera.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/canvas.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/copying | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/data/__init__.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/data/sleeping_svg.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/eventwrap.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/gtkEvent.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/mesh.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/pangofont.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/pausescreen.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/svgsprite.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/textsprite.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/util.py | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | olpcgames/video.py | 0 | ||||
-rw-r--r-- | run.py | 77 |
35 files changed, 96 insertions, 9 deletions
@@ -1,5 +1,9 @@ All entries are in DD/MM/YY format +23/06/08 + +FiftyTwo now has many features, including: A main menu, photo decks, support for the newer joyride builds, and a fully-functional GUI. This is version 0.2. + 05/03/08 - Secondary commit Crazy Eights is pretty much complete for non-mesh play. The FiftyTwo library leaves a lot to be desired for, though. It's pretty messy and needs optimization and doc comments. The smooth movement uses dirty rectangles now, rather than simply clearing the entire screen, making it several times faster. diff --git a/activity/activity.info b/activity/activity.info index 57007ca..e2218ae 100644 --- a/activity/activity.info +++ b/activity/activity.info @@ -1,7 +1,7 @@ [Activity] name = FiftyTwo -activity_version = 1 -host_version = 1 +activity_version = 2 +host_version = 2 service_name = org.laptop.games.FiftyTwo icon = FiftyTwo exec = sugar-activity activity.Activity diff --git a/crazyeights.py b/crazyeights.py index 8a59f7f..ac16f2f 100644 --- a/crazyeights.py +++ b/crazyeights.py @@ -248,6 +248,8 @@ def main(playertypes, screensize): sw = screensize[0] sh = screensize[1] + localplayers = 0 + # Reduce load pygame.event.set_blocked(MOUSEMOTION) @@ -296,6 +298,7 @@ def main(playertypes, screensize): players[-1].name = c[1:len(c)] players[-1].number = num players[-1].render_name() + localplayers += 1 elif c[0] == 'a': players += [aiplayer(positions[num])] diff --git a/data/back.user.tga b/data/back.user.tga Binary files differnew file mode 100644 index 0000000..94f71fd --- /dev/null +++ b/data/back.user.tga diff --git a/data/cards.user.png b/data/cards.user.png Binary files differnew file mode 100644 index 0000000..da3b9d0 --- /dev/null +++ b/data/cards.user.png diff --git a/data/suit1.user.png b/data/suit1.user.png Binary files differnew file mode 100644 index 0000000..303fdf6 --- /dev/null +++ b/data/suit1.user.png diff --git a/data/suit2.user.png b/data/suit2.user.png Binary files differnew file mode 100644 index 0000000..b859ad2 --- /dev/null +++ b/data/suit2.user.png diff --git a/data/suit3.user.png b/data/suit3.user.png Binary files differnew file mode 100644 index 0000000..12c895d --- /dev/null +++ b/data/suit3.user.png diff --git a/data/suit4.user.png b/data/suit4.user.png Binary files differnew file mode 100644 index 0000000..8d29fac --- /dev/null +++ b/data/suit4.user.png diff --git a/data/suits.user.png b/data/suits.user.png Binary files differnew file mode 100644 index 0000000..3d2bfd7 --- /dev/null +++ b/data/suits.user.png diff --git a/fiftytwo.py b/fiftytwo.py index 2836bac..099defe 100644 --- a/fiftytwo.py +++ b/fiftytwo.py @@ -55,7 +55,8 @@ def load_image(name, colorkey=None): except pygame.error, message: 'Cannot load image:', fullname print "Cannot load image: ", fullname - raise SystemExit, message + return None, None + #raise SystemExit, message if colorkey is not None: if colorkey is -1: @@ -213,6 +214,8 @@ class cardgroup(pygame.sprite.OrderedUpdates): temp = self.blank_card.get_rect() temp.move_ip(ulpos[0], ulpos[1]) self.back, unused = load_image('back.' + run.deck.deck + '.png') + if self.back is None: + self.back, unused = load_image('back.' + run.deck.deck + '.tga') list = self.sprites() length = len(list) diff --git a/games_to_implement b/games_to_implement new file mode 100644 index 0000000..9452ef1 --- /dev/null +++ b/games_to_implement @@ -0,0 +1,7 @@ +Solitare +Eucher +Freecell? (Copyrighted name? Opencell would be a good name) +Hearts +Spades +Go Fish! + diff --git a/gofishai b/gofishai new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/gofishai @@ -0,0 +1 @@ + @@ -41,8 +41,6 @@ class widget(pygame.sprite.Sprite): def detect_click(self, mouseposition): if mouseposition[0] > self.rect.left and mouseposition[0] < self.rect.right: if mouseposition[1] > self.rect.top and mouseposition[1] < self.rect.bottom: - print self.rect - print mouseposition return True return False @@ -80,6 +78,8 @@ class image(widget): self.image, self.rect = fiftytwo.load_image(file, trans) self.rect.x = position[0] self.rect.y = position[1] + self.rect.w = size[0] + self.rect.h = size[1] class button(widget): def __init__(self, position, size, title): diff --git a/olpcgames/__init__.py b/olpcgames/__init__.py index 95a27e7..95a27e7 100755..100644 --- a/olpcgames/__init__.py +++ b/olpcgames/__init__.py diff --git a/olpcgames/_cairoimage.py b/olpcgames/_cairoimage.py index 11f8d16..11f8d16 100755..100644 --- a/olpcgames/_cairoimage.py +++ b/olpcgames/_cairoimage.py diff --git a/olpcgames/_gtkmain.py b/olpcgames/_gtkmain.py index e3061c4..e3061c4 100755..100644 --- a/olpcgames/_gtkmain.py +++ b/olpcgames/_gtkmain.py diff --git a/olpcgames/_version.py b/olpcgames/_version.py index 1ae47cf..1ae47cf 100755..100644 --- a/olpcgames/_version.py +++ b/olpcgames/_version.py diff --git a/olpcgames/activity.py b/olpcgames/activity.py index 847de86..847de86 100755..100644 --- a/olpcgames/activity.py +++ b/olpcgames/activity.py diff --git a/olpcgames/buildmanifest.py b/olpcgames/buildmanifest.py index 899433b..899433b 100755..100644 --- a/olpcgames/buildmanifest.py +++ b/olpcgames/buildmanifest.py diff --git a/olpcgames/camera.py b/olpcgames/camera.py index bfd2b44..bfd2b44 100755..100644 --- a/olpcgames/camera.py +++ b/olpcgames/camera.py diff --git a/olpcgames/canvas.py b/olpcgames/canvas.py index 13e132e..13e132e 100755..100644 --- a/olpcgames/canvas.py +++ b/olpcgames/canvas.py diff --git a/olpcgames/copying b/olpcgames/copying index b8adee0..b8adee0 100755..100644 --- a/olpcgames/copying +++ b/olpcgames/copying diff --git a/olpcgames/data/__init__.py b/olpcgames/data/__init__.py index 8510186..8510186 100755..100644 --- a/olpcgames/data/__init__.py +++ b/olpcgames/data/__init__.py diff --git a/olpcgames/data/sleeping_svg.py b/olpcgames/data/sleeping_svg.py index fa67eee..fa67eee 100755..100644 --- a/olpcgames/data/sleeping_svg.py +++ b/olpcgames/data/sleeping_svg.py diff --git a/olpcgames/eventwrap.py b/olpcgames/eventwrap.py index 52457a1..52457a1 100755..100644 --- a/olpcgames/eventwrap.py +++ b/olpcgames/eventwrap.py diff --git a/olpcgames/gtkEvent.py b/olpcgames/gtkEvent.py index 8178509..8178509 100755..100644 --- a/olpcgames/gtkEvent.py +++ b/olpcgames/gtkEvent.py diff --git a/olpcgames/mesh.py b/olpcgames/mesh.py index 69473a1..69473a1 100755..100644 --- a/olpcgames/mesh.py +++ b/olpcgames/mesh.py diff --git a/olpcgames/pangofont.py b/olpcgames/pangofont.py index 54c5412..54c5412 100755..100644 --- a/olpcgames/pangofont.py +++ b/olpcgames/pangofont.py diff --git a/olpcgames/pausescreen.py b/olpcgames/pausescreen.py index c1dfa84..c1dfa84 100755..100644 --- a/olpcgames/pausescreen.py +++ b/olpcgames/pausescreen.py diff --git a/olpcgames/svgsprite.py b/olpcgames/svgsprite.py index 2c53178..2c53178 100755..100644 --- a/olpcgames/svgsprite.py +++ b/olpcgames/svgsprite.py diff --git a/olpcgames/textsprite.py b/olpcgames/textsprite.py index de166a6..de166a6 100755..100644 --- a/olpcgames/textsprite.py +++ b/olpcgames/textsprite.py diff --git a/olpcgames/util.py b/olpcgames/util.py index f4ecbf0..f4ecbf0 100755..100644 --- a/olpcgames/util.py +++ b/olpcgames/util.py diff --git a/olpcgames/video.py b/olpcgames/video.py index 152e9f8..152e9f8 100755..100644 --- a/olpcgames/video.py +++ b/olpcgames/video.py @@ -23,7 +23,7 @@ ############################################################################ import olpcgames, pygame, logging -from olpcgames import pausescreen +from olpcgames import pausescreen, camera import crazyeights @@ -43,9 +43,68 @@ class deckinfoclass(): deck = deckinfoclass() +def photo(screensize): + mouseposition = [0, 0, 0] + screen = pygame.display.get_surface() + fpslimiter = pygame.time.Clock() + photodynamic = gui.image((125, 125), (640, 480), 'back.regular.png') + photoreturn = gui.button((screensize[0]-300, screensize[1]-175), (150, 35), "Cancel") + photopopup = gui.popup((photodynamic, photoreturn), (100, 100), (screensize[0]-200, screensize[1]-200)) + photocamera = camera.Camera() + photodynamic.image = photocamera.snap() + + while 1: + fpslimiter.tick(20) + #photocamera.snap_async() + for event in pausescreen.get_events(): + if event.type == olpcgames.CAMERA_LOAD: + if event.success: + photodynamic.image = event.image + elif event.type == pygame.KEYDOWN: + if event.key == pygame.K_SPACE: + photodynamic.image = photocamera.snap() + elif event.type == pygame.MOUSEMOTION: + mouseposition[0] = event.pos[0] + mouseposition[1] = event.pos[1] + elif event.type == pygame.MOUSEBUTTONDOWN: + mouseposition[2] = 1 + elif event.type == pygame.MOUSEBUTTONUP: + mouseposition[2] = 0 + if photoreturn.detect_click(event.pos): + return + elif photodynamic.detect_click(event.pos): + r = photodynamic.image.get_rect() + r.x = mouseposition[0]-125 + r.y = mouseposition[1]-125 + r.w = 156 + r.h = 244 + sub = photodynamic.image.subsurface(r) + pygame.image.save(sub, 'data/back.user.tga') + return + + photopopup.update() + photopopup.draw(screen, mouseposition) + r = screen.get_rect() + r.x = 125 + r.y = 125 + r.w = 640 + r.h = 480 + screen.set_clip(r) + + r.x = mouseposition[0] + r.y = mouseposition[1] + r.w = 156 + r.h = 244 + + pygame.draw.rect(screen, (255, 0, 0), r, 4) + screen.set_clip() + + pygame.display.flip() + + def loop(screensize): screen = pygame.display.get_surface() - + decksel = False c8sheader = gui.label((100, 300), (200, 75), 'Crazy Eights', (0, 128, 0)) c8s2p = gui.button((100, 400), (200, 35), "Two players") @@ -56,17 +115,19 @@ def loop(screensize): mainquit = gui.button((50, screensize[1]-75), (100, 35), "Quit") maindeck = gui.button((screensize[0]-150, screensize[1]-75), (100, 35), "Deck") + mainphoto = gui.button(((screensize[0]/2)-75, (screensize[1]-75)), (150, 35), "Photo deck") mainheader = gui.image((50, 25), (screensize[0]-100, 200), 'fiftytwo.png', -1) - mainframe = gui.frame((mainheader, mainquit, maindeck), (25, screensize[1]-100), (screensize[0]-50, 75)) + mainframe = gui.frame((mainheader, mainquit, maindeck, mainphoto), (25, screensize[1]-100), (screensize[0]-50, 75)) deckselexit = gui.button((screensize[0]-215, screensize[1]-145), (115, 35), "Cancel") deckselregular = gui.image((115, 115), (crazyeights.card_width(), crazyeights.card_height()), 'back.regular.png') deckselgnome = gui.image((300, 115), (crazyeights.card_width(), crazyeights.card_height()), 'back.gnome.png') deckselparis = gui.image((485, 115), (crazyeights.card_width(), crazyeights.card_height()), 'back.paris.png') deckselshapes = gui.image((670, 115), (crazyeights.card_width(), crazyeights.card_height()), 'back.shapes.png') + deckseluser = gui.image((855, 115), (crazyeights.card_width(), crazyeights.card_height()), 'back.user.tga') - deckselpopup = gui.popup((deckselexit, deckselregular, deckselgnome, deckselparis, deckselshapes), (100, 100), (screensize[0]-200, screensize[1]-200)) + deckselpopup = gui.popup((deckselexit, deckselregular, deckselgnome, deckselparis, deckselshapes, deckseluser), (100, 100), (screensize[0]-200, screensize[1]-200)) mouseposition = [0, 0, 0] @@ -98,6 +159,9 @@ def loop(screensize): pygame.event.set_allowed(pygame.MOUSEMOTION) elif not decksel and maindeck.detect_click(event.pos): decksel = True + elif not decksel and mainphoto.detect_click(event.pos): + photo(screensize) + screen.fill(MMCOL) elif mainquit.detect_click(event.pos): return elif decksel and deckselexit.detect_click(event.pos): @@ -119,6 +183,11 @@ def loop(screensize): deck.deck = 'shapes' decksel = False screen.fill(MMCOL) + elif decksel and deckseluser.detect_click(event.pos): + deck.deck = 'user' + decksel = False + screen.fill(MMCOL) + if not decksel: c8sframe.update() |