#include <SDL/SDL_video.h>

#include "loaders.h"

SDL_Surface* itfz_LoadIMG(string file){
    SDL_Surface *temp;
    file = "img/" + file + ".png";
    temp = IMG_Load(file.c_str()); //Carga imagen
    if (temp == NULL) {
        printf("error al cargar imagen:%s\n", SDL_GetError());
        exit(EXIT_FAILURE);
    }
    SDL_SetAlpha(temp, SDL_SRCALPHA | SDL_RLEACCEL, 0); // Lee canales alpha
    temp = SDL_DisplayFormatAlpha(temp); // Optimiza
    return(temp);
}
void itfz_PosIMG(SDL_Surface* temp,int hor,int ver,SDL_Surface* scr){
    SDL_Rect dest;
    dest.x = hor;
    dest.y = ver;
    SDL_BlitSurface(temp, NULL, scr, &dest);
}

TTF_Font* itfz_LoadFont(char* file, int ptsize)
{
  TTF_Font* tmpfont;
  tmpfont = TTF_OpenFont(file, ptsize);
  if (tmpfont == NULL){
    printf("Error al cargar la fuente: %s %s \n", file, TTF_GetError());
    exit(EXIT_FAILURE);
  }
  return tmpfont;
}
