Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

/include/ZE_ZImage.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002         This file is Part of the ZEngine Library for 2D game development.
00003                    Copyright (C) 2002, 2003 James Turk
00004 
00005                      Licensed under a BSD-style license.
00006 
00007     The maintainer of this library is James Turk (james@conceptofzero.net) 
00008      and the home of this Library is http://www.zengine.sourceforge.net
00009 *******************************************************************************/
00010 
00020 #ifndef __ze_zimage_h__
00021 #define __ze_zimage_h__
00022 
00023 #include "ZE_ZEngine.h"
00024 
00025 namespace ZE
00026 {
00027 
00033 class ZImage
00034 {
00035     protected:
00037         ZEngine* rEngine;
00039         GLfloat rTexMinX;
00041         GLfloat rTexMinY;
00043         GLfloat rTexMaxX;
00045         GLfloat rTexMaxY;
00047         SDL_Surface *rImage;
00049         unsigned int rTexID;
00051         unsigned int rWidth;
00053         unsigned int rHeight;
00055         Uint8 rAlpha;
00056     
00057     public:
00058 
00064         ZImage();
00065 
00072         ZImage(const ZImage &rhs);
00073 
00080         ZImage(std::string filename);
00081 
00088         ZImage(SDL_Surface *surface);
00089 
00101         ZImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00102 
00114         ZImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00115 
00121         virtual ~ZImage();
00122 
00124         //Opening and Closing//
00126 
00133         void Open(std::string filename);
00134 
00146         void OpenFromImage(SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00147 
00159         void OpenFromImage(const ZImage &img, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
00160 
00167         void Attach(SDL_Surface *surface);
00168 
00174         void Reload();
00175 
00181         void Release();
00182 
00184         //Graphics//
00186 
00194         void SetAlpha(Uint8 alpha);
00195 
00204         void SetColorKey(Uint8 red, Uint8 green, Uint8 blue);
00205 
00213         void Flip(bool horizontal, bool vertical);
00214 
00222         void Stretch(float xFactor, float yFactor);
00223 
00231         void Resize(unsigned int width, unsigned int height);
00232 
00239         void Bind() const;
00240 
00250         void Draw(int x, int y, Uint8 zIndex=0) const;
00251 
00261         void Draw(float x, float y, Uint8 zIndex=0) const;
00262 
00272         void DrawRotated(int x, int y, float angle, Uint8 zIndex=0) const;
00273 
00284         void DrawRotated(float x, float y, float angle, Uint8 zIndex=0) const;
00285 
00287         //Accessors//
00289 
00296         bool IsLoaded() const;
00297 
00303         SDL_Surface *Surface() const;
00304 
00311         int Width() const;
00312 
00319         int Height() const;
00320 
00328         Uint8 Alpha() const;
00329 };
00330 
00331 }
00332 
00333 #endif

Generated on Sun Jun 29 14:13:51 2003 for ZEngine by doxygen1.3