Exemplo n.º 1
0
// Funciona somente se a imagem nao possuir canal alpha
bool imagem::desenha_transparente(int x, int y, int trans)
{
	if(!egl_init) return false;
	if( (index < 0) && (!falha) ) return false;

	if(falha)
	{
		egl_texto(falha_str,x,y,255,0,0);
		return false;
	}

	pos.x = x;
	pos.y = y;
	SDL_SetAlpha(bmp[curr],SDL_SRCALPHA,trans);
	SDL_BlitSurface(bmp[curr],NULL,tela,&pos);
	SDL_SetAlpha(bmp[curr],SDL_SRCALPHA,255);

	tempo--;
	if(!tempo)
	{
		curr++;
		tempo = vel;
		if(curr > index) 
		{
			curr = 0;
			return false;
		}
	}
	return true;
}
Exemplo n.º 2
0
bool imagem::desenha(int x, int y, bool borda)
{
	if(!egl_init) return false;
	if( (index < 0) && (!falha) ) return false;

	if(falha)
	{
		egl_texto(falha_str,x,y,255,0,0);
		return false;
	}

	pos.x = x;
	pos.y = y;
	SDL_BlitSurface(bmp[curr],NULL,tela,&pos);

	if(borda) egl_retangulo(x,y,x+bmp[curr]->w,y+bmp[curr]->h,255,255,255);

	tempo--;
	if(!tempo)
	{
		curr++;
		tempo = vel;
		if(curr > index) 
		{
			curr = 0;
			return false;
		}
	}
	return true;
}
Telas* TelaPrincipal::desenha()
{
	bg.desenha(0,0);
	player.desenha(Chiyo,705,250);
	egl_texto(player.getNome(),200,70);
	egl_texto(hp,45,115);
	egl_texto(atk,90,355);
	egl_texto(def,100,378);
	egl_texto(dmg,60,445);
	


	if(key[SDLK_BACKSPACE] )
	{
		return new MenuPrincipal();
	}
	return NULL;
}
Exemplo n.º 4
0
bool imagem::desenha_rotacionado(int x, int y, long rotacao )
{
	if(!egl_init) return false;
	if( (index < 0) && (!falha) ) return false;

	if(falha)
	{
		egl_texto(falha_str,x,y,255,0,0);
		return false;
	}

	SDL_Surface *imgrot = rotozoomSurface(bmp[curr],(double)rotacao,1,0);

	int deltah = (imgrot->h - bmp[curr]->h);
	int deltaw = (imgrot->w - bmp[curr]->w);

	x = x - deltaw/2;
	y = y - deltah/2;

	pos.x = x;
	pos.y = y;

	SDL_BlitSurface(imgrot,NULL,tela,&pos);
	SDL_FreeSurface(imgrot);

	tempo--;
	if(!tempo)
	{
		curr++;
		tempo = vel;
		if(curr > index) 
		{
			curr = 0;
			return false;
		}
	}
	return true;
}