_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
CGraphic Class Reference

#include <video.h>

Inheritance diagram for CGraphic:
gcn::Image CPlayerColorGraphic

Public Member Functions

bool IsLoaded () const
 
virtual void * _getData () const
 
virtual int getWidth () const
 
virtual int getHeight () const
 
- Public Member Functions inherited from gcn::Image
 Image (void *data, int width, int height)
 
 Image (const std::string &filename)
 
virtual ~Image ()
 

Public Attributes

std::string File
 
std::string HashFile
 Filename. More...
 
SDL_Surface * Surface
 Filename used in hash. More...
 
SDL_Surface * SurfaceFlip
 Surface. More...
 
frame_pos_t * frame_map
 Flipped surface. More...
 
frame_pos_t * frameFlip_map
 
int Width
 
int Height
 Width of a frame. More...
 
int NumFrames
 Height of a frame. More...
 
int GraphicWidth
 Number of frames. More...
 
int GraphicHeight
 Original graphic width. More...
 
int Refs
 Original graphic height. More...
 
bool Resized
 Uses of this graphic. More...
 
GLfloat TextureWidth
 Image has been resized. More...
 
GLfloat TextureHeight
 Width of the texture. More...
 
GLuint * Textures
 Height of the texture. More...
 
int NumTextures
 Texture names. More...
 
GLuint ** ColorCyclingTextures
 Number of textures. More...
 
int NumColorCycles
 Texture names. More...
 

Protected Member Functions

 CGraphic ()
 
 ~CGraphic ()
 
- Protected Member Functions inherited from gcn::Image
 Image ()
 

Friends

class CFont
 Number of color cycled texture groups. More...
 

graphic.cpp - The general graphic functions.

void DrawClip (int x, int y) const
 
void DrawSub (int gx, int gy, int w, int h, int x, int y) const
 
void DrawSubClip (int gx, int gy, int w, int h, int x, int y) const
 
void DrawSubTrans (int gx, int gy, int w, int h, int x, int y, unsigned char alpha) const
 
void DrawSubClipTrans (int gx, int gy, int w, int h, int x, int y, unsigned char alpha) const
 
void DrawFrame (unsigned frame, int x, int y) const
 
void DoDrawFrameClip (GLuint *textures, unsigned frame, int x, int y) const
 
void DrawFrameClip (unsigned frame, int x, int y) const
 
void DrawFrameTrans (unsigned frame, int x, int y, int alpha) const
 
void DrawFrameClipTrans (unsigned frame, int x, int y, int alpha) const
 
void DrawFrameX (unsigned frame, int x, int y) const
 
void DoDrawFrameClipX (GLuint *textures, unsigned frame, int x, int y) const
 
void DrawFrameClipX (unsigned frame, int x, int y) const
 
void DrawFrameTransX (unsigned frame, int x, int y, int alpha) const
 
void DrawFrameClipTransX (unsigned frame, int x, int y, int alpha) const
 
bool DeleteColorCyclingTextures ()
 
void Load (bool grayscale=false)
 
void Flip ()
 
void UseDisplayFormat ()
 
void Resize (int w, int h)
 
void SetOriginalSize ()
 
bool TransparentPixel (int x, int y)
 
void MakeShadow ()
 
void GenFramesMap ()
 
static CGraphicNew (const std::string &file, int w=0, int h=0)
 
static CGraphicForceNew (const std::string &file, int w=0, int h=0)
 
static CGraphicGet (const std::string &file)
 
static void Free (CGraphic *g)
 

Additional Inherited Members

- Static Public Member Functions inherited from gcn::Image
static ImageLoader_getImageLoader ()
 
static void setImageLoader (ImageLoader *imageLoader)
 
- Protected Attributes inherited from gcn::Image
void * mData
 
int mWidth
 
int mHeight
 
bool mLoadedWithImageLoader
 
- Static Protected Attributes inherited from gcn::Image
static ImageLoadermImageLoader = NULL
 

Constructor & Destructor Documentation

CGraphic::CGraphic ( )
inlineprotected
CGraphic::~CGraphic ( )
inlineprotected

Member Function Documentation

virtual void* CGraphic::_getData ( ) const
inlinevirtual

Gets the data of the Image. Image data can be different things depending on what ImageLoader you use. If you for instance use the SDLImageLoader then an SDL_Surface will be returned.

Returns
a void pointer to the Image data.
See also
SDLImageLoader, AllegroImageLoader

Reimplemented from gcn::Image.

bool CGraphic::DeleteColorCyclingTextures ( )
void CGraphic::DoDrawFrameClip ( GLuint *  textures,
unsigned  frame,
int  x,
int  y 
) const
void CGraphic::DoDrawFrameClipX ( GLuint *  textures,
unsigned  frame,
int  x,
int  y 
) const
void CGraphic::DrawClip ( int  x,
int  y 
) const

Video draw the graphic clipped.

Parameters
xX screen position
yY screen position
void CGraphic::DrawFrame ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object unclipped.

Parameters
framenumber of frame (object index)
xx coordinate on the screen
yy coordinate on the screen
void CGraphic::DrawFrameClip ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object clipped.

Parameters
framenumber of frame (object index)
xx coordinate on the screen
yy coordinate on the screen
void CGraphic::DrawFrameClipTrans ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const
void CGraphic::DrawFrameClipTransX ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const
void CGraphic::DrawFrameClipX ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object clipped and flipped in X direction.

Parameters
framenumber of frame (object index)
xx coordinate on the screen
yy coordinate on the screen
void CGraphic::DrawFrameTrans ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const
void CGraphic::DrawFrameTransX ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const
void CGraphic::DrawFrameX ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object unclipped and flipped in X direction.

Parameters
framenumber of frame (object index)
xx coordinate on the screen
yy coordinate on the screen
void CGraphic::DrawSub ( int  gx,
int  gy,
int  w,
int  h,
int  x,
int  y 
) const

Video draw part of graphic.

Parameters
gxX offset into object
gyY offset into object
wwidth to display
hheight to display
xX screen position
yY screen position
void CGraphic::DrawSubClip ( int  gx,
int  gy,
int  w,
int  h,
int  x,
int  y 
) const

Video draw part of graphic clipped.

Parameters
gxX offset into object
gyY offset into object
wwidth to display
hheight to display
xX screen position
yY screen position
void CGraphic::DrawSubClipTrans ( int  gx,
int  gy,
int  w,
int  h,
int  x,
int  y,
unsigned char  alpha 
) const

Video draw part of graphic with alpha and clipped.

Parameters
gxX offset into object
gyY offset into object
wwidth to display
hheight to display
xX screen position
yY screen position
alphaAlpha
void CGraphic::DrawSubTrans ( int  gx,
int  gy,
int  w,
int  h,
int  x,
int  y,
unsigned char  alpha 
) const

Video draw part of graphic with alpha.

Parameters
gxX offset into object
gyY offset into object
wwidth to display
hheight to display
xX screen position
yY screen position
alphaAlpha
void CGraphic::Flip ( )

Flip graphic and store in graphic->SurfaceFlip

CGraphic * CGraphic::ForceNew ( const std::string &  file,
int  w = 0,
int  h = 0 
)
static

Make a new graphic object. Don't reuse a graphic from the hash table.

Parameters
fileFilename
wWidth of a frame (optional)
hHeight of a frame (optional)
Returns
New graphic object
void CGraphic::Free ( CGraphic g)
static

Free a graphic

Parameters
gPointer to the graphic
void CGraphic::GenFramesMap ( )
CGraphic * CGraphic::Get ( const std::string &  filename)
static

Get a graphic object.

Parameters
filenameFilename
Returns
Graphic object
virtual int CGraphic::getHeight ( ) const
inlinevirtual

Gets the height of the Image.

Returns
the image height

Reimplemented from gcn::Image.

virtual int CGraphic::getWidth ( ) const
inlinevirtual

Gets the width of the Image.

Returns
the image width

Reimplemented from gcn::Image.

bool CGraphic::IsLoaded ( ) const
inline
void CGraphic::Load ( bool  grayscale = false)

Load a graphic

Parameters
grayscaleMake a grayscale surface
void CGraphic::MakeShadow ( )

Make shadow sprite

Todo:
FIXME: 32bpp
CGraphic * CGraphic::New ( const std::string &  filename,
int  w = 0,
int  h = 0 
)
static

Make a new graphic object.

Parameters
filenameFilename
wWidth of a frame (optional)
hHeight of a frame (optional)
Returns
New graphic object
void CGraphic::Resize ( int  w,
int  h 
)

Resize a graphic

Parameters
wNew width of graphic.
hNew height of graphic.
void CGraphic::SetOriginalSize ( )

Sets the original size for a graphic

bool CGraphic::TransparentPixel ( int  x,
int  y 
)

Check if a pixel is transparent

Parameters
xX coordinate
yY coordinate
Returns
True if the pixel is transparent, False otherwise
void CGraphic::UseDisplayFormat ( )

Convert the SDL surface to the display format

Friends And Related Function Documentation

friend class CFont
friend

Number of color cycled texture groups.

Member Data Documentation

GLuint** CGraphic::ColorCyclingTextures

Number of textures.

std::string CGraphic::File
frame_pos_t* CGraphic::frame_map

Flipped surface.

frame_pos_t* CGraphic::frameFlip_map
int CGraphic::GraphicHeight

Original graphic width.

int CGraphic::GraphicWidth

Number of frames.

std::string CGraphic::HashFile

Filename.

int CGraphic::Height

Width of a frame.

int CGraphic::NumColorCycles

Texture names.

int CGraphic::NumFrames

Height of a frame.

int CGraphic::NumTextures

Texture names.

int CGraphic::Refs

Original graphic height.

bool CGraphic::Resized

Uses of this graphic.

SDL_Surface* CGraphic::Surface

Filename used in hash.

SDL_Surface* CGraphic::SurfaceFlip

Surface.

GLfloat CGraphic::TextureHeight

Width of the texture.

GLuint* CGraphic::Textures

Height of the texture.

GLfloat CGraphic::TextureWidth

Image has been resized.

int CGraphic::Width

The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.