/*Faceset.cpp, sprite routines.
    Copyright (C) 2007 EasyRPG Project <http://easyrpg.sourceforge.net/>.

    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 3 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, see <http://www.gnu.org/licenses/>.  */

#include "Faceset.h"



void Faceset::init_Faceset(int posx,int posy,int theframe)
{
	x = posx;
	y = posy;
	frame = theframe;
	cols=4;//redefinir
	rows=4;//redefinir
	int w = 48;
	int h = 48;
	SDL_Surface * Eximg;
	Eximg = SDL_CreateRGBSurface(SDL_SWSURFACE,w, h, 16,0, 0,0, 0);
	SDL_Rect fuente = {(frame%cols)* w,(frame/cols) * h, w, h};
	SDL_Rect rect = {0,0, 0, 0};
	SDL_BlitSurface (img, & fuente,	Eximg, &rect);
	dispose();
	set_surface(Eximg);

}

void Faceset::drawf (SDL_Surface * screen)
{
	int w = getw();
	int h = geth();

	SDL_Rect fuente = {(frame%cols)* w,(frame/cols) * h, w, h};
	SDL_Rect rect = {x,y, 0, 0};
	SDL_BlitSurface (img, & fuente,	screen, &rect);
}

