2011-06-22 20:12:22 +00:00
|
|
|
/* A class with some handy surface handling statics */
|
|
|
|
|
|
|
|
#ifndef _DRAWUTILS_H_
|
|
|
|
#define _DRAWUTILS_H_
|
|
|
|
|
|
|
|
#include <string>
|
2011-07-01 17:15:30 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_ttf.h>
|
2011-06-22 20:12:22 +00:00
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
class DrawUtils
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DrawUtils() {}
|
2011-06-24 13:40:13 +00:00
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
static SDL_Surface* load(string file);
|
2011-06-22 22:24:20 +00:00
|
|
|
|
2011-06-22 20:12:22 +00:00
|
|
|
static bool draw(SDL_Surface* dest, SDL_Surface* drawable, int x, int y);
|
|
|
|
static bool draw(SDL_Surface* dest, SDL_Surface* drawable, int x, int y,
|
|
|
|
int x2, int y2, int w, int h);
|
2011-06-24 13:40:13 +00:00
|
|
|
|
2011-06-23 01:54:35 +00:00
|
|
|
static void draw_line(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint16 width, Uint32 colour);
|
2011-07-01 21:44:43 +00:00
|
|
|
static void draw_circle(SDL_Surface* dest, Sint16 x, Sint16 y, Uint16 r, Uint32 colour);
|
2011-06-23 18:42:07 +00:00
|
|
|
static void draw_circle_filled(SDL_Surface* dest, Sint16 x, Sint16 y, Uint16 r, Uint32 colour);
|
2011-06-22 22:24:20 +00:00
|
|
|
|
2011-07-01 17:15:30 +00:00
|
|
|
static void draw_text(SDL_Surface* display, string text, int x, int y,
|
2011-07-01 22:04:15 +00:00
|
|
|
TTF_Font *font);
|
2011-07-01 17:15:30 +00:00
|
|
|
|
2011-06-22 22:24:20 +00:00
|
|
|
// transpare (v) - to make transparent
|
2011-06-24 13:40:13 +00:00
|
|
|
// this function makes a particular color key on a surface transparent
|
|
|
|
// the traditional color key is 255, 0, 255 (bright pink), so we default
|
|
|
|
// to that
|
|
|
|
static bool transpare(SDL_Surface* surface, int r = 255, int g = 0,
|
|
|
|
int b = 255);
|
2011-06-22 20:12:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|