Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/YoButia.py
diff options
context:
space:
mode:
Diffstat (limited to 'YoButia.py')
-rw-r--r--YoButia.py63
1 files changed, 61 insertions, 2 deletions
diff --git a/YoButia.py b/YoButia.py
index 2b2b57b..1ba4760 100644
--- a/YoButia.py
+++ b/YoButia.py
@@ -4,6 +4,7 @@ import os
import imp
from gettext import gettext as _
import time
+import sys
#constantes
EVENTORESPUESTA = pygame.USEREVENT+1
@@ -14,6 +15,15 @@ CAMINORECURSOS = "recursos"
CAMINOCOMUN = "comun"
CAMINOIMAGENES = "imagenes"
CAMINODATOS = "datos"
+CAMINOFUENTES = "fuentes"
+
+clock = pygame.time.Clock()
+
+def wait_events():
+ """ Funcion para esperar por eventos de pygame sin consumir CPU """
+ global clock
+ clock.tick(20)
+ return pygame.event.get()
class YoButia():
def __init__(self):
@@ -32,11 +42,18 @@ class YoButia():
time.sleep(2)
+ #Main principal del juego
+ while 1:
+ self.pantallaInicial()
+
+
+ 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.mostrarTexto(_("Presione una tecla para continuar"),
self.fuente32,
(int(600*scale+shift_x),int(800*scale+shift_y)),
(255,155,155))
@@ -88,8 +105,24 @@ class YoButia():
# fondo presentacion
self.fondo1 = self.cargarImagen("fondo1.png")
- #Cargar fuentes
+ # cargar fuentes
+ self.fuente60 = pygame.font.Font(os.path.join(CAMINORECURSOS,\
+ CAMINOCOMUN,\
+ CAMINOFUENTES,\
+ "Share-Regular.ttf"),
+ int(60*scale))
+ self.fuente40 = pygame.font.Font(os.path.join(CAMINORECURSOS,\
+ CAMINOCOMUN,\
+ CAMINOFUENTES,\
+ "Share-Regular.ttf"),
+ int(34*scale))
+ self.fuente9 = pygame.font.Font(os.path.join(CAMINORECURSOS,\
+ CAMINOCOMUN,\
+ CAMINOFUENTES,\
+ "Share-Regular.ttf"),
+ int(20*scale))
self.fuente32 = pygame.font.Font(None, int(30*scale))
+ self.fuente24 = pygame.font.Font(None, int(24*scale))
def loadCommons(self):
@@ -125,6 +158,32 @@ class YoButia():
int(imagen0.get_height()*scale)))
del imagen0
return imagen
+
+ def pantallaInicial(self):
+ """Pantalla con el menu principal del juego"""
+ global scale, shift_x, shift_y
+ self.pantalla.fill((0,0,0))
+ self.mostrarTexto(unicode(_("MENU PRINCIPAL"), "UTF-8"),
+ self.fuente60,
+ (int(50*scale+shift_x),
+ int(50*scale+shift_y)),
+ (255,255,255))
+ self.mostrarTexto(_("About this game"),
+ self.fuente40,
+ (int(300*scale+shift_x),int(825*scale+shift_y)),
+ (100,200,100))
+ pygame.display.flip()
+
+ while 1:
+ # Pump GTK messages.
+ while gtk.events_pending():
+ gtk.main_iteration()
+
+ for event in wait_events():
+ if event.type == pygame.KEYDOWN:
+ if event.key == 27: # escape: volver
+ sys.exit()
+ return
def main():
juego = YoButia()