Exemple #1
0
void Cancion::lanzar(){
    distanciaPulso = 250;
    margenIzquierdo = 150;

    esperaInicial = 5; // 3 tiempos

    resalteNotaActual.reset( new Gosu::Image(g, L"media/secCanciones/cancionesIndicadorNota.png"));

    barraProgresoFondo.reset( new ElementoImagen(g, "media/secCanciones/cancionesBarraProgreso.png",
                                                 3, Animacion::tAlpha));
    barraProgresoFondo -> animacion = new Animacion(1, 20, Animacion::tEaseOutQuad, 30);
    barraProgresoFondo -> animacion -> set(0,0,255);
    barraProgresoFondo -> setXY(180, 560);

    barraProgreso.reset(new Gosu::Image(g, L"media/secCanciones/cancionesBarraRelleno.png"));

    imagenPartitura.reset( new ElementoImagen(g, "media/secCanciones/partitura.png", 
                                              3, Animacion::tAlpha));
    imagenPartitura -> animacion = new Animacion(1, 20, Animacion::tEaseOutQuad, 20);
    imagenPartitura -> animacion -> set (0, 0, 255);
    imagenPartitura -> setXY(0, 200);


    barraSuperior.reset(new ElementoCombinado(g, Animacion::tPos, 3));
    barraSuperior -> setImagen("media/secCanciones/cancionesTopBar.png");
    barraSuperior -> setTexto("00000", "media/fNormal.ttf",
                              49, 0xffffffff,
                              Texto::alignCentro,
                              true, 33,
                              0, 0);
    
    barraSuperior -> animacion = new Animacion(2, 20, Animacion::tEaseOutQuad, 0);
    barraSuperior -> animacion -> set(0,0,0);
    barraSuperior -> animacion -> set(1, -139, 0);


    barraInferior.reset(new ElementoCombinado(g, Animacion::tPos, 3));
    barraInferior -> setImagen("media/secCanciones/cancionesBottomBar.png");
    barraInferior -> setTexto("Progreso total:", "media/fNormal.ttf",
                              32, 0xffffffff,
                              Texto::alignIzq,
                              true, 39,
                              20, 90);

    barraInferior -> animacion = new Animacion(2, 20, Animacion::tEaseOutQuad, 10);
    barraInferior -> animacion -> set(0,0,0);
    barraInferior -> animacion -> set(1, 600, 461); //*/

    sistemaPartc . reset(new SistemaParticulas(g, 150, 150, // cantidad y duración
                                               80, 0.5,  // distancia y escala
                                               Gosu::Color(255,255,255)));

    Nota::initImagenes(g);
    parsear ();
}
Exemple #2
0
int hijo (int sdtc){

	
	char buffer[4096]; /*almacena la comunicacion*/
	int leido; /*almacena lo q se lee desde el port 5000 al 8080*/

	int sdmotion; /*descriptor q inicia el socket de comunicacion */	
	int leidomotion;
	char buffermotion[4096];
	struct hostent *Host; //IP del servidor
	struct sockaddr_in Direccion; //Estructura necesaria para la funcion bind()

	#if DEBUG
		printf ("hijo = %d\n", getpid());
	#endif


	/* Obtengo la ip a la cual conectarme */
	if ((Host = gethostbyname ("localhost")) == NULL)
		printf ("Error en gethostbyname()\n");
	else
		printf ("IP: %s\n", Host->h_name);

	/* Abrimos el socket */
	/* AF_INET porque el cliente puede estar en una PC distinta al servidor */
	/* SOCK_STREAM porque se utilizara el protocolo TCP */
	if ((sdmotion = socket (AF_INET, SOCK_STREAM, 0)) == -1)
		printf ("Error en socket()\n");

	/* Vamos a atender el servicio */
	Direccion.sin_family = AF_INET; // Mismo que para la fucion Socket()
	Direccion.sin_port = htons(8080); //Puerto del servicio
	Direccion.sin_addr.s_addr = htonl (0x7f000001); //Direccion del servidor

	leido=read(sdtc,buffer, sizeof(buffer));	

	if (connect (sdmotion, (struct sockaddr *)&Direccion, sizeof Direccion) == -1)
		perror ("connect");
	
	write(sdmotion, buffer, leido);
	parsear(buffer,sdmotion, sdtc);


	while ((leidomotion=read(sdmotion,buffermotion, sizeof buffermotion)) > 0){
		
		write(sdtc,buffermotion,leidomotion);
	
		 }
	close(sdmotion);	
	
return 0;

}