Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Interfaz.py
blob: 93c145d06bd774f57f64669e15e652b6d9b8cf85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#   Interfaz.py por:
#   Flavio Danesse <fdanesse@gmail.com>
#   CeibalJAM! - Uruguay

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import pygame
import gc

from pygame.locals import *

gc.enable()

import BiblioJAM
from BiblioJAM.JAMButton import JAMButton
from BiblioJAM.JAMLabel import JAMLabel
import BiblioJAM.JAMGlobals as JAMG

import Globals as VG

class Interfaz(pygame.sprite.OrderedUpdates):
	def __init__(self):
		pygame.sprite.OrderedUpdates.__init__(self)
		separador = 10
		self.boton_pan= JAMButton("", VG.PAN)
		self.boton_pan.set_imagen(origen= VG.PAN)
		ancho_botones= self.boton_pan.get_tamanio()[0]
		self.boton_jarra= JAMButton("", VG.JARRA)
		self.boton_jarra.set_imagen(origen= VG.JARRA)

		x, y= VG.RESOLUCION[0] - separador - ancho_botones, separador

		self.boton_pan.set_posicion(punto=(x,y))
		y += self.boton_pan.get_tamanio()[1] + separador
		self.boton_jarra.set_posicion(punto=(x,y))

		y += self.boton_jarra.get_tamanio()[1] + separador*2
		self.boton_ciclo= JAMButton("Ciclo Vital", None)
		self.boton_ciclo.set_text(tamanio= 20)
		self.boton_ciclo.set_tamanios(tamanio= (ancho_botones, 50))
		self.boton_ciclo.set_posicion(punto=(x,y))

		y += self.boton_ciclo.get_tamanio()[1] + separador
		self.boton_muda= JAMButton("Muda", None)
		self.boton_muda.set_text(tamanio= 20)
		self.boton_muda.set_tamanios(tamanio= (ancho_botones, 50))
		self.boton_muda.set_posicion(punto=(x,y))

		y += self.boton_muda.get_tamanio()[1] + separador
		self.boton_reproduccion= JAMButton("Reproducción", None)
		self.boton_reproduccion.set_text(tamanio= 20)
		self.boton_reproduccion.set_tamanios(tamanio= (ancho_botones, 50))
		self.boton_reproduccion.set_posicion(punto=(x,y))

		y += self.boton_reproduccion.get_tamanio()[1] + separador
		self.boton_muerte= JAMButton("Muerte", None)
		self.boton_muerte.set_text(tamanio= 20)
		self.boton_muerte.set_tamanios(tamanio= (ancho_botones, 50))
		self.boton_muerte.set_posicion(punto=(x,y))

		y += self.boton_reproduccion.get_tamanio()[1] + separador
		self.boton_plaga= JAMButton("Plaga", None)
		self.boton_plaga.set_text(tamanio= 20)
		self.boton_plaga.set_tamanios(tamanio= (ancho_botones, 50))
		self.boton_plaga.set_posicion(punto=(x,y))

		self.boton_salir= JAMButton("Salir", None)
		self.boton_salir.set_text(tamanio= 20)
		self.boton_salir.set_tamanios(tamanio= (ancho_botones, 50))
		y = VG.RESOLUCION[1] - separador - self.boton_salir.get_tamanio()[1]
		self.boton_salir.set_posicion(punto=(x,y))

		self.imagenes_audio= VG.ICONOSAUDIO
		self.boton_musica= JAMButton("", self.imagenes_audio[0])
		self.boton_musica.set_imagen(origen= self.imagenes_audio[0])
		self.boton_musica.set_tamanios(tamanio= (ancho_botones, 70))
		y -= separador + self.boton_musica.get_tamanio()[1]
		self.boton_musica.set_posicion(punto=(x,y))
		self.posicion_boton_audio = (x,y)

		self.boton_extras= JAMButton("Lectura", None)
		self.boton_extras.set_text(tamanio= 20)
		self.boton_extras.set_tamanios(tamanio= (ancho_botones, 50))
		y -= separador + self.boton_extras.get_tamanio()[1]
		self.boton_extras.set_posicion(punto=(x,y))

		self.add(self.boton_pan)
		self.add(self.boton_jarra)
		self.add(self.boton_extras)
		self.add(self.boton_musica)
		self.add(self.boton_salir)

		a,b,c= JAMG.get_estilo_celeste()
		self.boton_pan.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_jarra.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_extras.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_musica.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_salir.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_ciclo.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_muda.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_reproduccion.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_muerte.set_colores(colorbas= a, colorbor= b, colorcara= c)
		self.boton_plaga.set_colores(colorbas= a, colorbor= b, colorcara= c)

		self.label_pan= JAMLabel("000")
		self.label_pan.set_text(tamanio= 25, color= (255,255,255,255))
		self.label_pan.set_imagen(origen= VG.PAN, tamanio= (40, 30))
		self.label_pan.set_contenedor(colorbas= (0,0,0,255))
		self.label_pan.set_posicion( (10,10) )
		self.add(self.label_pan)

		self.label_agua= JAMLabel("000")
		self.label_agua.set_text(tamanio= 25, color= (255,255,255,255))
		self.label_agua.set_imagen(origen= VG.AGUA, tamanio= (40, 30))
		self.label_agua.set_contenedor(colorbas= (0,0,0,255))
		x, y= self.label_pan.get_posicion()
		w, h= self.label_pan.get_tamanio()
		self.label_agua.set_posicion( (x+w+10, y) )
		self.add(self.label_agua)

		self.label_tiempo= JAMLabel("Tiempo de Juego = Años: 0 Dias: 0 Horas: 0")
		self.label_tiempo.set_text(tamanio= 25)
		x, y= self.label_agua.get_posicion()
		w, h= self.label_agua.get_tamanio()
		self.label_tiempo.set_posicion( (x+w+10, y) )
		self.add(self.label_tiempo)

		self.informacion_cucas = "Cucarachas: 0, Machos: 0, Hembras: 0, Ootecas: 0, Migración: 0"
		self.label_cucas_info= JAMLabel(self.informacion_cucas)
		self.label_cucas_info.set_text(tamanio= 25)
		x, y= (10, VG.RESOLUCION[1] - 10 - self.label_cucas_info.get_tamanio()[1])
		self.label_cucas_info.set_posicion( (x, y) )
		self.add(self.label_cucas_info)

	def set_pan_en_escenario(self, cantidad):
		self.label_pan.set_text(texto= cantidad)

	def set_agua_en_escenario(self, cantidad):
		self.label_agua.set_text(texto= cantidad)

	def set_tiempo_de_juego(self, tiempo):
		self.label_tiempo.set_text(texto= tiempo)

	def set_informacion_de_habitat(self, bichos):
		if self.informacion_cucas != bichos:
			self.informacion_cucas= bichos
			self.label_cucas_info.set_text(texto= self.informacion_cucas)