#pragma once
#include "SDL2/SDL.h"

class DrawManager
{
public:
	DrawManager(int pMode);
	~DrawManager(void);

	bool Init(void);
	bool Flip(void);

	SDL_Surface *LoadBitmap(const char *bitmapfilename, const bool doColorKey = false);
	SDL_Surface *LoadMask(const char *bitmapfilename);
	void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* clip = NULL );
	void Blit( int x, int y, SDL_Surface* source, SDL_Rect* clip = NULL );
	void Print( int x, int y, SDL_Surface* source, int w, int h, const char *text, SDL_Surface* dest = NULL );
	void FadeOut();
	void FadeIn();
	void FadeOutGray();
	void FadeInGray();
	void DrawFadedBack();
	SDL_Surface *LoadFont(const char *bitmapfilename, const Uint32 color = 0xFFFFFFFF);

	int mode;

	Uint32 color_blanco;
	Uint32 color_rojo;
	Uint32 color_verde;
	Uint32 color_azul;
private:
	SDL_Surface *screen;
	SDL_Surface *black;
	SDL_Surface *temp;
	SDL_Surface *faded;
	int alpha;

	Uint32 get_pixel32( SDL_Surface *surface, int x, int y );
	void put_pixel32( SDL_Surface *surface, int x, int y, Uint32 pixel );

};
