Example #1
0
void Bonus_salud::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b)const
{
	//TODO...
	//Se asume que todos los frames van mirando a la derecha.
	b.establecer_tipo(Bloque_transformacion_representable::tipos::TR_BITMAP);
	b.establecer_alpha(255);
	b.establecer_recurso(Recursos_graficos::RT_DEFECTO);
	b.establecer_recorte(16, 32, W, H);
	b.establecer_posicion(acc_espaciable_x(), acc_espaciable_y(), W, H);
}
void Celda_decorativa::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b) const
{
    const auto& t=b.obtener_frame(App_Definiciones::animaciones::celdas, indice, 0);

    using namespace App_Definiciones;
    b.establecer_tipo(App_Graficos::Bloque_transformacion_representable::tipos::tr_bitmap);
    b.establecer_recurso(App::Recursos_graficos::rt_celdas);
    b.establecer_recorte(t.x, t.y, t.w, t.h);
    b.establecer_posicion(x*definiciones::dim_celda, y*definiciones::dim_celda, definiciones::dim_celda, definiciones::dim_celda);
}
void Celda_decorativa::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b) const
{
	using namespace App_Definiciones;

	//TODO: en el futuro el tipo de sala determinaría la animación que se escogería.
	const auto& t=b.obtener_frame(animaciones::celdas_template, indice, 0);

	using namespace App_Definiciones;
	b.establecer_tipo(App_Graficos::Bloque_transformacion_representable::tipos::tr_bitmap);
	b.establecer_recurso(App::Recursos_graficos::rt_template_tiles);
	b.establecer_posicion(x*definiciones::dim_celda, y*definiciones::dim_celda, definiciones::dim_celda, definiciones::dim_celda);
	b.establecer_recorte(t.x, t.y, t.w, t.h);
}
void Particula_numero::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b)const
{
	if(!textos.count(numero))
	{
		std::stringstream ss;
		ss<<numero;

		textos.insert(std::make_pair(numero, DLibV::Representacion_texto_auto(
				DLibV::Gestor_superficies::obtener(App::Recursos_graficos::rs_fuente_base), 
				ss.str() ) ) );
	}

	b.establecer_externa(textos.at(numero));

	switch(color)
	{
		case App_Definiciones::colores::colores_texto::blanco: b.establecer_mod_color(255, 255, 255); break;
		case App_Definiciones::colores::colores_texto::rojo: b.establecer_mod_color(255, 0, 0); break;
		case App_Definiciones::colores::colores_texto::verde: b.establecer_mod_color(0, 255, 0); break;
		case App_Definiciones::colores::colores_texto::azul: b.establecer_mod_color(0, 0, 255); break;
	}

	float alpha=calcular_parcial_tiempo_vida(255);
	if(alpha < 0.0f) alpha=0.0f;

	const auto& c=textos.at(numero).acc_posicion();

	b.establecer_alpha(alpha);
	b.establecer_posicion(acc_espaciable_x(), acc_espaciable_y(), c.w, c.h);
}
void Enemigo_basico::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b) const
{
	using namespace App_Graficos;
	using namespace App_Definiciones;
	const auto& f=b.obtener_frame(animaciones::sprites, animaciones_sprites::enemigo_basico, 0);

	//Se asume que todos los frames van mirando a la derecha.
	b.establecer_tipo(Bloque_transformacion_representable::tipos::tr_bitmap);
	b.establecer_alpha(255);
	b.establecer_recurso(App::Recursos_graficos::rt_juego);
	b.establecer_recorte(f.x, f.y, f.w, f.h);
	b.establecer_posicion(acc_espaciable_x()+f.desp_x, acc_espaciable_y()+f.desp_y, W, H);
	b.invertir_horizontal(direccion==App_Definiciones::direcciones::izquierda);
}
Example #6
0
void Bonus_salud::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b)const
{
	using namespace App_Definiciones;
	const auto& f=b.obtener_frame(animaciones::sprites, animaciones_sprites::bonus_salud, 0);

	b.establecer_tipo(Bloque_transformacion_representable::tipos::tr_bitmap);
	b.establecer_alpha(255);
	b.establecer_recurso(Recursos_graficos::rt_juego);
	b.establecer_recorte(f.x, f.y, f.w, f.h);
	b.establecer_posicion(acc_espaciable_x()+f.desp_x, acc_espaciable_y()+f.desp_y, W, H);
}
void Particula_fantasma_jugador::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b)const
{
	using namespace App_Definiciones;
	const auto& f=b.obtener_frame(animaciones::sprites, animaciones_sprites::jugador, 0);

	float alpha=calcular_parcial_tiempo_vida(192);
	if(alpha < 0.0f) alpha=0.0f;

	b.establecer_tipo(App_Graficos::Bloque_transformacion_representable::tipos::tr_bitmap);
	b.establecer_alpha(alpha);
	b.establecer_recurso(App::Recursos_graficos::rt_juego);
	b.establecer_recorte(f.x, f.y, f.w, f.h);
	b.establecer_posicion(x, y, f.w+extra_w, f.h+extra_h);
	b.invertir_horizontal(direccion==App_Definiciones::direcciones::izquierda);
}
void Obstaculo_generico::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b)const
{
	using namespace App_Definiciones;
	const auto& f=b.obtener_frame(animaciones::sprites, indice_animacion, 0);

	b.establecer_tipo(App_Graficos::Bloque_transformacion_representable::tipos::tr_bitmap);
	b.establecer_alpha(255);
	b.establecer_recurso(App::Recursos_graficos::rt_juego);
	b.establecer_recorte(f.x, f.y, f.w, f.h);
	b.establecer_posicion(acc_espaciable_x()+f.desp_x, acc_espaciable_y()+f.desp_y, 15, 22); //w, h);

}
void Particula_humo::transformar_bloque(App_Graficos::Bloque_transformacion_representable &b)const
{
	using namespace App_Definiciones;
	//Pasamos el tiempo de vida para hacer efecto "reverse".
	const auto& f=b.obtener_animacion(animaciones::particulas, animaciones_particulas::humo).obtener_para_tiempo_animacion(acc_tiempo_vida(), acc_tiempo_vida_inicial()).frame;

	b.establecer_tipo(App_Graficos::Bloque_transformacion_representable::tipos::tr_bitmap);
	b.establecer_alpha(127);
	b.establecer_recurso(App::Recursos_graficos::rt_particulas);
	b.establecer_recorte(f.x, f.y, f.w, f.h);

	//Centramos la posición según el ancho del frame anterior.
	float pos_x=x-(w / 2);
	float pos_y=y-(h / 2);

	w=f.w;
	h=f.h;

	b.establecer_posicion(pos_x, pos_y, w, h);
}