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

CGraphic Class Reference

#include <video.h>

Inheritance diagram for CGraphic:

gcn::Image CPlayerColorGraphic

List of all members.


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
CGraphicClone () const
void Load ()
void Flip ()
void UseDisplayFormat ()
void Resize (int w, int h)
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 void Free (CGraphic *g)

Public Member Functions

bool IsLoaded () const
virtual void * _getData () const
virtual int getWidth () const
virtual int getHeight () const

Public Attributes

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

Protected Member Functions

 CGraphic ()
 ~CGraphic ()

Friends

class CFont
 Number of textures.

Classes

struct  frame_pos_t

Constructor & Destructor Documentation

CGraphic::CGraphic (  )  [inline, protected]

CGraphic::~CGraphic (  )  [inline, protected]


Member Function Documentation

void CGraphic::DrawClip ( int  x,
int  y 
) const

Video draw the graphic clipped.

Parameters:
x X screen position
y Y screen position

void CGraphic::DrawSub ( int  gx,
int  gy,
int  w,
int  h,
int  x,
int  y 
) const

Video draw part of graphic.

Parameters:
gx X offset into object
gy Y offset into object
w width to display
h height to display
x X screen position
y Y 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:
gx X offset into object
gy Y offset into object
w width to display
h height to display
x X screen position
y Y screen position

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:
gx X offset into object
gy Y offset into object
w width to display
h height to display
x X screen position
y Y screen position
alpha Alpha

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:
gx X offset into object
gy Y offset into object
w width to display
h height to display
x X screen position
y Y screen position
alpha Alpha

void CGraphic::DrawFrame ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object unclipped.

Parameters:
frame number of frame (object index)
x x coordinate on the screen
y y coordinate on the screen

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

void CGraphic::DrawFrameClip ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object clipped.

Parameters:
frame number of frame (object index)
x x coordinate on the screen
y y coordinate on the screen

void CGraphic::DrawFrameTrans ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const

void CGraphic::DrawFrameClipTrans ( 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:
frame number of frame (object index)
x x coordinate on the screen
y y coordinate on the screen

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

void CGraphic::DrawFrameClipX ( unsigned  frame,
int  x,
int  y 
) const

Draw graphic object clipped and flipped in X direction.

Parameters:
frame number of frame (object index)
x x coordinate on the screen
y y coordinate on the screen

void CGraphic::DrawFrameTransX ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const

void CGraphic::DrawFrameClipTransX ( unsigned  frame,
int  x,
int  y,
int  alpha 
) const

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

Make a new graphic object.

Parameters:
file Filename
w Width of a frame (optional)
h Height of a frame (optional)
Returns:
New graphic object

Reimplemented in CPlayerColorGraphic.

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:
file Filename
w Width of a frame (optional)
h Height of a frame (optional)
Returns:
New graphic object

Reimplemented in CPlayerColorGraphic.

CGraphic * CGraphic::Clone (  )  const

Clone a graphic

void CGraphic::Free ( CGraphic g  )  [static]

Free a graphic

Parameters:
g Pointer to the graphic

void CGraphic::Load (  ) 

Load a graphic

void CGraphic::Flip (  ) 

Flip graphic and store in graphic->SurfaceFlip

void CGraphic::UseDisplayFormat (  ) 

Convert the SDL surface to the display format

void CGraphic::Resize ( int  w,
int  h 
)

Resize a graphic

Parameters:
w New width of graphic.
h New height of graphic.

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

Check if a pixel is transparent

Parameters:
x X coordinate
y Y coordinate
Returns:
True if the pixel is transparent, False otherwise

void CGraphic::MakeShadow (  ) 

Make shadow sprite

Todo:
FIXME: 32bpp

bool CGraphic::IsLoaded (  )  const [inline]

virtual void* CGraphic::_getData (  )  const [inline, virtual]

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.

virtual int CGraphic::getWidth (  )  const [inline, virtual]

Gets the width of the Image.

Returns:
the image width

Reimplemented from gcn::Image.

virtual int CGraphic::getHeight (  )  const [inline, virtual]

Gets the height of the Image.

Returns:
the image height

Reimplemented from gcn::Image.

void CGraphic::GenFramesMap (  ) 


Friends And Related Function Documentation

friend class CFont [friend]

Number of textures.


Member Data Documentation

std::string CGraphic::File

std::string CGraphic::HashFile

Filename.

SDL_Surface* CGraphic::Surface

Filename used in hash.

SDL_Surface* CGraphic::SurfaceFlip

Surface.

frame_pos_t* CGraphic::frame_map

Flipped surface.

Width of a frame.

Height of a frame.

Number of frames.

Original graphic width.

Original graphic height.

Uses of this graphic.

Image has been resized.

Width of the texture.

Height of the texture.

Texture names.


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