예제 #1
0
def main(**args):
    ventana = Ventana((800, 600))
    canvas = Canvas((800, 450), (0, 150))
    particula = Particula()
    canvas.add_particula(particula, 0)
    ventana.add_canvas(canvas, "0")
    ventana.run()
예제 #2
0
        self._superficie = superficie
        self._boton.surface = superficie

    def update(self, event):
        """Solo es una función de redirección que llama al método react
		del atributo menu
		"""
        self._menu.react(event)

    def render(self):
        """Renderiza al menu de elementos
		"""
        self._menu.refresh_population()
        self._menu.blit_and_update()


#pruebas
if __name__ == '__main__':
    from canvas import Canvas
    from ventana import Ventana
    from vector import Vector
    from particula import Particula

    import pygame

    ventana = Ventana((800, 600))
    canvas = Canvas((800, 450), (0, 150))
    particula = Particula()
    canvas.add_particula(particula, 0)
    ventana.add_canvas(canvas, "0")
    ventana.run()
예제 #3
0
                                      superficie=self.superficie,
                                      color=PARTICULA_VECTOR_X_COLOR,
                                      grosor=PARTICULA_VECTOR_X_GROSOR)

                    VectorGrafico(Punto(pos_x, pos_y),
                                  vector.get_vector_y()).render(  #velocidad y
                                      superficie=self.superficie,
                                      color=PARTICULA_VECTOR_Y_COLOR,
                                      grosor=PARTICULA_VECTOR_X_GROSOR)

                    VectorGrafico(Punto(pos_x, pos_y),
                                  vector).render(  #velocidad resultante
                                      superficie=self.superficie,
                                      color=PARTICULA_VECTOR_COLOR,
                                      grosor=PARTICULA_VECTOR_X_GROSOR)

        #acomoda la pantalla para que se vea bien el tiro
        self.superficie.blit(pygame.transform.rotate(self.superficie, 180),
                             (0, 0))
        self.superficie.blit(
            pygame.transform.flip(self.superficie, True, False), (0, 0))


#----PRUEBAS
if __name__ == '__main__':
    from ventana import Ventana
    v = Ventana((600, 400))
    canvas = Canvas((600, 200), (0, 10))
    v.add_canvas(canvas, "0")
    v.run()