diff options
author | RoLo <grupo-proyecto-butia-2012@googlegroups.com> | 2012-07-29 23:39:52 (GMT) |
---|---|---|
committer | RoLo <grupo-proyecto-butia-2012@googlegroups.com> | 2012-07-29 23:39:52 (GMT) |
commit | fe278c00ca8b1363290d33a565b38c1deb2f92d8 (patch) | |
tree | b7d9d550622266413746a0eb1bbc70844f6f3c58 |
On branch master
Initial commit
new file: .project
new file: .pydevproject
new file: .settings/org.eclipse.core.resources.prefs
new file: YoButia.py
new file: recursos/comun/datos/commons.py
new file: recursos/comun/datos/commons.pyc
new file: recursos/comun/imagenes/fondo1.png
-rw-r--r-- | .project | 17 | ||||
-rw-r--r-- | .pydevproject | 10 | ||||
-rw-r--r-- | .settings/org.eclipse.core.resources.prefs | 2 | ||||
-rw-r--r-- | YoButia.py | 134 | ||||
-rw-r--r-- | recursos/comun/datos/commons.py | 41 | ||||
-rw-r--r-- | recursos/comun/datos/commons.pyc | bin | 0 -> 311 bytes | |||
-rw-r--r-- | recursos/comun/imagenes/fondo1.png | bin | 0 -> 52520 bytes |
7 files changed, 204 insertions, 0 deletions
diff --git a/.project b/.project new file mode 100644 index 0000000..e6b5df6 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>YoButia</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.python.pydev.PyDevBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.python.pydev.pythonNature</nature> + </natures> +</projectDescription> diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..23a1332 --- /dev/null +++ b/.pydevproject @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse-pydev version="1.0"?> + +<pydev_project> +<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH"> +<path>/YoButia</path> +</pydev_pathproperty> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property> +<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Python</pydev_property> +</pydev_project> diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..62156a2 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding//recursos/comun/datos/commons.py=utf-8 diff --git a/YoButia.py b/YoButia.py new file mode 100644 index 0000000..2b2b57b --- /dev/null +++ b/YoButia.py @@ -0,0 +1,134 @@ +import pygame +import gtk +import os +import imp +from gettext import gettext as _ +import time + +#constantes +EVENTORESPUESTA = pygame.USEREVENT+1 +EVENTODESPEGUE = EVENTORESPUESTA+1 +EVENTOREFRESCO = EVENTODESPEGUE+1 +TIEMPOREFRESCO = 250 +CAMINORECURSOS = "recursos" +CAMINOCOMUN = "comun" +CAMINOIMAGENES = "imagenes" +CAMINODATOS = "datos" + +class YoButia(): + def __init__(self): + pass + def principal(self): + print "Clase principal" + #Aca va el loop principal del juego. + global scale, shift_x, shift_y + pygame.time.set_timer(EVENTOREFRESCO,TIEMPOREFRESCO) + + self.loadAll() + + self.loadCommons() + + self.presentacion() + + time.sleep(2) + + def presentacion(self): + self.pantalla.fill((0,0,0)) + self.pantalla.blit(self.fondo1, + (int(75*scale+shift_x),int(75*scale+shift_y))) + self.mostrarTexto(_("Press any key to skip"), + self.fuente32, + (int(600*scale+shift_x),int(800*scale+shift_y)), + (255,155,155)) + pygame.display.flip() + + def mostrarTexto(self,texto,fuente,posicion,color): + """Muestra texto en una determinada posicion""" + text = fuente.render(texto, 1, color) + textrect = text.get_rect() + textrect.center = posicion + self.pantalla.blit(text, textrect) + + def loadAll(self): + #Metodo que carga las imagenes y sonidos + + global scale, shift_x, shift_y, xo_resolution + pygame.init() + pygame.display.init() + # crear pantalla + self.anchoPantalla = gtk.gdk.screen_width() + self.altoPantalla = gtk.gdk.screen_height() + self.pantalla = pygame.display.get_surface() + if not(self.pantalla): + # prevent hide zones + self.anchoPantalla = self.anchoPantalla - 50 + self.altoPantalla = self.altoPantalla - 100 + self.pantalla = pygame.display.set_mode((self.anchoPantalla, + self.altoPantalla)) + pygame.display.flip() + if self.anchoPantalla==1200 and self.altoPantalla==900: + xo_resolution = True + scale = 1 + shift_x = 0 + shift_y = 0 + else: + xo_resolution = False + if self.anchoPantalla/1200.0<self.altoPantalla/900.0: + scale = self.anchoPantalla/1200.0 + shift_x = 0 + shift_y = int((self.altoPantalla-scale*900)/2) + else: + scale = self.altoPantalla/900.0 + shift_x = int((self.anchoPantalla-scale*1200)/2) + shift_y = 0 + # cargar imagenes generales + self.camino_imagenes = os.path.join(CAMINORECURSOS, + CAMINOCOMUN, + CAMINOIMAGENES) + # fondo presentacion + self.fondo1 = self.cargarImagen("fondo1.png") + + #Cargar fuentes + self.fuente32 = pygame.font.Font(None, int(30*scale)) + + def loadCommons(self): + + self.listaPrefijos = list() + + r_path = os.path.join(CAMINORECURSOS, CAMINOCOMUN, CAMINODATOS, 'commons.py') + a_path = os.path.abspath(r_path) + f = None + try: + f = imp.load_source('commons', a_path) + except: + print _('Cannot open %s') % 'commons' + + if f: + if hasattr(f, 'PREFIX'): + for e in f.PREFIX: + e1 = unicode(e, 'UTF-8') + self.listaPrefijos.append(e1) + + self.numeroPrefijos = len(self.listaPrefijos) + + def cargarImagen(self,nombre): + """Carga una imagen y la escala de acuerdo a la resolucion""" + global scale, xo_resolution + if xo_resolution: + imagen = pygame.image.load( \ + os.path.join(self.camino_imagenes,nombre)) + else: + imagen0 = pygame.image.load( \ + os.path.join(self.camino_imagenes,nombre)) + imagen = pygame.transform.scale(imagen0, + (int(imagen0.get_width()*scale), + int(imagen0.get_height()*scale))) + del imagen0 + return imagen + +def main(): + juego = YoButia() + juego.principal() + +if __name__ == "__main__": + main()
\ No newline at end of file diff --git a/recursos/comun/datos/commons.py b/recursos/comun/datos/commons.py new file mode 100644 index 0000000..6f7718c --- /dev/null +++ b/recursos/comun/datos/commons.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +from gettext import gettext as _ + +BEGIN = [ + _('Do you like to know about Robot? Lets start!') +] + +LEARNING = [ + _('Do you know about Robot?'), + _('Choose from images the once"s that shows Robots'), + _('Can you show me where are Robots?'), + _('Find the sensors in the images'), + _('Choose the actuators in the images'), + _('Which of these tasks can make a robot?') + ] +REWARDS = [ + _('Perfect, you are becoming an expert!'), + _('You have done very well! Continue like that'), + _('Well done!'), + _('Brilliant!') + ] +MISTAKES = [ + _('Try again, you can do it!'), + _('No, that is not correct. Try again!'), + _('No, it is not a Robot'), + _('No, it is not a sensor'), + _('No, it is not an actuator'), + ] +BYE = [ + _("Better luck next time\nI'll rest a while..."), + _("The next time will be better\nI'm going to play with my friends."), + _("Please try again") +] + ] +CREDITS = [ + _("Author: Rolo, Seba, Sil"), + _("Send corrections, comments or suggestions to: grupo-proyecto-butia-2012@googlegroups.com"), + "", + _("This program is free software developed by the community") + ]
\ No newline at end of file diff --git a/recursos/comun/datos/commons.pyc b/recursos/comun/datos/commons.pyc Binary files differnew file mode 100644 index 0000000..240a1d6 --- /dev/null +++ b/recursos/comun/datos/commons.pyc diff --git a/recursos/comun/imagenes/fondo1.png b/recursos/comun/imagenes/fondo1.png Binary files differnew file mode 100644 index 0000000..47cca59 --- /dev/null +++ b/recursos/comun/imagenes/fondo1.png |