#ifndef __GRAPHICS_H__
#define __GRAPHICS_H__

#include <stdlib.h>
#include <string>
#include <math.h>
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_ttf.h"
#include "SDL_syswm.h"
#include "SDL_rotozoom.h"
#include "SDL_gfxPrimitives.h"
extern "C" {
#include "bitmask.h"
}
#include "fftfile.h"

#define PI 3.1415926535897932384626433832795

extern int SMOOTH;

void CenterWindow();
void drawString(TTF_Font *font, int x, int y, std::string text, SDL_Color color);
void centerString(TTF_Font *font, int x, int y, std::string text, SDL_Color color);
void DrawIMG(SDL_Surface *img, int x, int y);
void DrawIMG(SDL_Surface *img, int x, int y, int w, int h);
void DrawPixel(int x, int y, Uint8 R, Uint8 G, Uint8 B);
void Slock();
void Sulock();
Uint32 getpixel(SDL_Surface *surface, int x, int y);
void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
bitmask *MakeMask(SDL_Surface *surface);
bool BoxCollision(SDL_Rect dest, SDL_Rect src);
void ColorizeSurface(SDL_Surface *surf, Uint8 r, Uint8 g, Uint8 b);

class StarField
{
public:
	StarField() {}
	~StarField() {};
	void Init(int fieldw, int fieldh);
	void Display(int x, int y);
	void DisplayWarp(int x, int y, int angle, int length);
private:
	int starfieldx[60];
	int starfieldy[60];
	int height;
	int width;
};

class StaticAnim
{
public:
	StaticAnim();
	~StaticAnim();
	StaticAnim(const StaticAnim &oldanim);
	void LoadFrames(std::string sanim);
	void SetX(int sx);
	void SetY(int sy);
	void DisplayNext(int sx, int sy);
	void IncNext();
	SDL_Surface *GetAnim(int index);
	int GetNextFrame();
	int GetCurFrame();
	int GetX();
	int GetY();
	int GetWidth();
	int GetHeight();
	float GetZoom();
	std::string GetBase();
	void SetZoom(float szoom);
private:
	std::string animbase;
	SDL_Surface *anim[12];
	int nextframe;
	int x;
	int y;
	int w;
	int h;
	float zoom;
};

#endif /* __GRAPHICS_H__ */

