Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
l---------EdSexual.activity/Main.py1
-rwxr-xr-xEdSexual.activity/activity.py28
-rw-r--r--EdSexual.activity/activity/activity.info8
-rw-r--r--EdSexual.activity/activity/edsexual.svg93
l---------EdSexual.activity/api1
l---------EdSexual.activity/assets1
l---------EdSexual.activity/game1
-rwxr-xr-xEdSexual.activity/setup.py6
-rwxr-xr-xEdSexual.activity/sugargame/__init__.py (renamed from src/sugargame/__init__.py)0
-rwxr-xr-xEdSexual.activity/sugargame/canvas.py (renamed from src/sugargame/canvas.py)0
-rwxr-xr-xEdSexual.activity/sugargame/event.py (renamed from src/sugargame/event.py)0
-rwxr-xr-xbuild.sh21
-rwxr-xr-xsrc/Main.py22
-rwxr-xr-xsrc/api/Button.py2
-rwxr-xr-xsrc/api/Game.py15
-rwxr-xr-xsrc/api/Mouse.py7
17 files changed, 188 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index bc4c0af..fece0f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.pyc
*.py~
*.pyo
+*.xo
.project
.pydevproject
.settings
diff --git a/EdSexual.activity/Main.py b/EdSexual.activity/Main.py
new file mode 120000
index 0000000..0c2c64d
--- /dev/null
+++ b/EdSexual.activity/Main.py
@@ -0,0 +1 @@
+../src/Main.py \ No newline at end of file
diff --git a/EdSexual.activity/activity.py b/EdSexual.activity/activity.py
new file mode 100755
index 0000000..2217c52
--- /dev/null
+++ b/EdSexual.activity/activity.py
@@ -0,0 +1,28 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sugargame
+import sugargame.canvas
+from sugar.activity import activity
+
+import Main
+
+class Activity(activity.Activity):
+
+ def __init__(self, handle):
+ activity.Activity.__init__(self, handle)
+
+ self.max_participants = 1
+ self.actividad = Main.EdSexualGame()
+ self._pygamecanvas = sugargame.canvas.PygameCanvas(self)
+ self.set_canvas(self._pygamecanvas)
+ self._pygamecanvas.grab_focus()
+ self._pygamecanvas.run_pygame(self.actividad.main)
+ print 'saliendo'
+
+ def read_file(self, file_path):
+ pass
+
+ def write_file(self, file_path):
+ pass
+
diff --git a/EdSexual.activity/activity/activity.info b/EdSexual.activity/activity/activity.info
new file mode 100644
index 0000000..db31fa6
--- /dev/null
+++ b/EdSexual.activity/activity/activity.info
@@ -0,0 +1,8 @@
+[Activity]
+name = Educacion Sexual
+activity_version = 1
+bundle_id = org.ceibaljam.edsexual
+icon = edsexual
+exec = sugar-activity activity.Activity
+license = GPLv3
+summary = Game about Sexual Education
diff --git a/EdSexual.activity/activity/edsexual.svg b/EdSexual.activity/activity/edsexual.svg
new file mode 100644
index 0000000..1bbdbe7
--- /dev/null
+++ b/EdSexual.activity/activity/edsexual.svg
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ height="55"
+ id="svg2"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="edsexual.svg"
+ version="1.1"
+ width="55">
+ <defs
+ id="defs4">
+ <inkscape:perspective
+ id="perspective10"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ <inkscape:perspective
+ id="perspective2824"
+ inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
+ inkscape:vp_x="0 : 0.5 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="1 : 0.5 : 1"
+ sodipodi:type="inkscape:persp3d" />
+ </defs>
+ <sodipodi:namedview
+ bordercolor="#666666"
+ borderopacity="1.0"
+ id="base"
+ inkscape:current-layer="layer1"
+ inkscape:cx="-5.8526158"
+ inkscape:cy="23.273047"
+ inkscape:document-units="px"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:window-height="744"
+ inkscape:window-maximized="1"
+ inkscape:window-width="1366"
+ inkscape:window-x="0"
+ inkscape:window-y="24"
+ inkscape:zoom="7.9195959"
+ pagecolor="#ffffff"
+ showgrid="false"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:groupmode="layer"
+ inkscape:label="Capa 1"
+ transform="translate(0,-997.36218)">
+ <rect
+ style="fill:#0000ff;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="rect2985"
+ width="44.82143"
+ height="43.92857"
+ x="5.2525382"
+ y="1002.7103" />
+ <path
+ sodipodi:type="spiral"
+ style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="path2989"
+ sodipodi:cx="25.253813"
+ sodipodi:cy="24.442886"
+ sodipodi:expansion="1"
+ sodipodi:revolution="3"
+ sodipodi:radius="23.668631"
+ sodipodi:argument="-17.973497"
+ sodipodi:t0="0"
+ d="m 25.253813,24.442886 c 0.759711,0.911655 -0.854077,1.473854 -1.51523,1.26269 -1.791682,-0.57224 -1.872711,-2.941161 -1.01015,-4.293148 1.542919,-2.418388 4.977496,-2.405898 7.071068,-0.757611 3.072402,2.418926 2.957768,7.042495 0.505072,9.848987 -3.269058,3.740613 -9.117807,3.517771 -12.626907,0.252532 -4.415844,-4.10897 -4.082018,-11.198067 7e-6,-15.404826 4.943879,-5.094949 13.281121,-4.648727 18.182746,0.252547 5.776395,5.775981 5.216983,15.365917 -0.505087,20.960665 C 28.748976,43.024079 17.903455,42.350995 11.616748,35.807096 4.4733915,28.371502 5.2604642,16.268443 12.626913,9.2905922 20.890956,1.4624986 34.252939,2.3637737 41.921336,10.553297 c 8.513375,9.091923 7.497745,23.713845 -1.515244,32.072342"
+ transform="translate(0.50507628,1001.4028)" />
+ </g>
+</svg>
diff --git a/EdSexual.activity/api b/EdSexual.activity/api
new file mode 120000
index 0000000..e839c85
--- /dev/null
+++ b/EdSexual.activity/api
@@ -0,0 +1 @@
+../src/api \ No newline at end of file
diff --git a/EdSexual.activity/assets b/EdSexual.activity/assets
new file mode 120000
index 0000000..2121391
--- /dev/null
+++ b/EdSexual.activity/assets
@@ -0,0 +1 @@
+../src/assets/ \ No newline at end of file
diff --git a/EdSexual.activity/game b/EdSexual.activity/game
new file mode 120000
index 0000000..71d12c9
--- /dev/null
+++ b/EdSexual.activity/game
@@ -0,0 +1 @@
+../src/game/ \ No newline at end of file
diff --git a/EdSexual.activity/setup.py b/EdSexual.activity/setup.py
new file mode 100755
index 0000000..da6bc28
--- /dev/null
+++ b/EdSexual.activity/setup.py
@@ -0,0 +1,6 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from sugar.activity import bundlebuilder
+if __name__ == "__main__":
+ bundlebuilder.start()
diff --git a/src/sugargame/__init__.py b/EdSexual.activity/sugargame/__init__.py
index 439eb0c..439eb0c 100755
--- a/src/sugargame/__init__.py
+++ b/EdSexual.activity/sugargame/__init__.py
diff --git a/src/sugargame/canvas.py b/EdSexual.activity/sugargame/canvas.py
index 980cb73..980cb73 100755
--- a/src/sugargame/canvas.py
+++ b/EdSexual.activity/sugargame/canvas.py
diff --git a/src/sugargame/event.py b/EdSexual.activity/sugargame/event.py
index 4cc3be8..4cc3be8 100755
--- a/src/sugargame/event.py
+++ b/EdSexual.activity/sugargame/event.py
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..6c3f530
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+CURRDIR=`pwd`
+
+rm -rf /tmp/staging
+rm -rf *.xo
+mkdir /tmp/staging
+
+cp -Lr EdSexual.activity -t /tmp/staging
+
+cd /tmp/staging/EdSexual.activity
+rm -rf locale
+git init
+git add *
+git commit -m 'all files'
+python setup.py build
+python setup.py dist_xo
+
+cd $CURRDIR
+mv /tmp/staging/EdSexual.activity/dist/*.xo .
+
diff --git a/src/Main.py b/src/Main.py
index 51d45b3..c069b64 100755
--- a/src/Main.py
+++ b/src/Main.py
@@ -7,15 +7,21 @@ from game.MenuState import CMenuState
import api.Game
from api.Game import CGame
-def main():
+class EdSexualGame():
- g = CGame()
+ def __init__(self):
+ pass
- ms = CMenuState()
- g.setState(ms)
-
- g.gameLoop()
- g.destroy()
+ def main(self):
+
+ g = CGame()
+
+ ms = CMenuState()
+ g.setState(ms)
+
+ g.gameLoop()
+ g.destroy()
if __name__ == "__main__":
- main() \ No newline at end of file
+ j = EdSexualGame()
+ j.main() \ No newline at end of file
diff --git a/src/api/Button.py b/src/api/Button.py
index c16855f..2bf33a5 100755
--- a/src/api/Button.py
+++ b/src/api/Button.py
@@ -38,7 +38,7 @@ class CButton(CLabel):
#check for mouse input
self.mclicked = False
-
+
if CMouse().firstPress():
if self.rect.collidepoint(CMouse().getPos()):
print("first press in button")
diff --git a/src/api/Game.py b/src/api/Game.py
index 071edb7..d3f181c 100755
--- a/src/api/Game.py
+++ b/src/api/Game.py
@@ -73,17 +73,19 @@ class CGame(object):
def init(self):
print "init pygame..."
pygame.init()
+ #pygame.display.init()
#pygame.font.init()
-
#screen = pygame.display.set_mode((1200, 900), FULLSCREEN)
- self.mScreen = pygame.display.set_mode((1200, 900))
+ self.mScreen = pygame.display.get_surface()
+ if not(self.mScreen):
+ self.mScreen = pygame.display.set_mode((1200, 900))
pygame.display.set_caption(_('Game'))
self.mBackground = pygame.Surface(self.mScreen.get_size())
self.mBackground.fill((255, 0, 0))
# Sound system initialization.
- pygame.mixer.init()
+ #pygame.mixer.init()
#self.mAllSprites = pygame.sprite.Group()
Sprites = []
@@ -103,9 +105,6 @@ class CGame(object):
print "start game loop here"
while not self.mQuit:
- self.mClock.tick(30)
- #print ("FPS: %.0f" % self.mClock.get_fps())
-
while gtk.events_pending():
gtk.main_iteration()
@@ -120,7 +119,7 @@ class CGame(object):
self.mMouse.update()
self.mMousePointerSprite.setXY(self.mMouse.getX(), self.mMouse.getY())
-
+
#self.mState.preUpdate()
self.mState.update()
@@ -136,6 +135,8 @@ class CGame(object):
#self.mState.postUpdate()
pygame.display.flip()
+ self.mClock.tick(30)
+ #print ("FPS: %.0f" % self.mClock.get_fps())
def doEvents(self, event):
""" overwrite this method to add your own events.
diff --git a/src/api/Mouse.py b/src/api/Mouse.py
index bf0e0c8..ba34eb6 100755
--- a/src/api/Mouse.py
+++ b/src/api/Mouse.py
@@ -43,10 +43,10 @@ class CMouse(object):
return self.mPressed
def firstPress(self):
- return self.pressed() and not self.mPrevPressed
+ return (self.mPressed and not self.mPrevPressed)
def release(self):
- return not self.pressed() and self.mPrevPressed
+ return (not(self.mPressed) and self.mPrevPressed)
def update(self):
#print("mouse update")
@@ -54,7 +54,8 @@ class CMouse(object):
#print("y=" + str(self.getY()))
self.mPrevPressed = self.mPressed;
- self.mPressed = (pygame.mouse.get_pressed() == (1, 0, 0))
+ pp = pygame.mouse.get_pressed()
+ self.mPressed = (pp[0] == 1 and pp[1] == 0 and pp[2] == 0)
def destroy(self):
self.mInstance = None