2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
SDLgfx.h
|
|
|
|
|
|
|
|
(c) 2006 Laurent Carlier <lordheavy@users.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
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2007-12-30 17:41:49 +01:00
|
|
|
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, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __SDLGFX_H
|
|
|
|
#define __SDLGFX_H
|
|
|
|
|
|
|
|
#include "SDL_h.h"
|
2009-08-17 20:08:56 +02:00
|
|
|
|
|
|
|
class SDLwindow;
|
|
|
|
class SDLsurface;
|
|
|
|
class SDLtexture;
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
class SDLgfx
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SDLgfx(SDLwindow* window);
|
|
|
|
SDLgfx(SDLsurface* surface);
|
2009-08-17 20:08:56 +02:00
|
|
|
~SDLgfx() {};
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
void resetGfx(void );
|
2010-05-23 17:27:56 +02:00
|
|
|
void SetColor(Uint32 color);
|
|
|
|
void Scale(GLfloat x, GLfloat y) { scalex = x; scaley = y; }
|
|
|
|
void Rotate(GLfloat z) { rotz = z; }
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
int GetLineStyle(void ) { return hLine; }
|
|
|
|
int GetLineWidth(void ) { return hLineWidth; }
|
|
|
|
int GetFillStyle(void ) { return hFill; }
|
|
|
|
void SetLineStyle(int style);
|
|
|
|
void SetLineWidth(int width) { hLineWidth = width; }
|
|
|
|
void SetFillStyle(int style);
|
|
|
|
|
|
|
|
void Clear(void);
|
|
|
|
void Blit(SDLsurface* s, int x, int y, int srcX = 0, int srcY = 0, int srcWidth = -1, int srcHeight = -1, int width = -1, int height = -1);
|
|
|
|
void DrawPixel(int x, int y);
|
|
|
|
void DrawLine(int x1, int y1, int x2, int y2);
|
|
|
|
void DrawRect(int x, int y, int w, int h);
|
|
|
|
void DrawEllipse(int x, int y, int w, int h);
|
|
|
|
|
|
|
|
private:
|
2009-08-17 20:08:56 +02:00
|
|
|
// hTex is null if we are drawing on a window !
|
|
|
|
SDLtexture* hTex;
|
|
|
|
|
|
|
|
void SetContext(void );
|
|
|
|
SDL_Surface* GetDestSurface(void );
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
// lines and fills
|
|
|
|
int hLine, hLineWidth;
|
|
|
|
int hFill;
|
2010-05-23 17:27:56 +02:00
|
|
|
|
|
|
|
// rotations & scaling
|
|
|
|
GLfloat rotx, roty, rotz;
|
|
|
|
GLfloat scalex, scaley;
|
2007-12-30 17:41:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __SDLGFX_H */
|
|
|
|
|