____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"#include <video.h>

Public Member 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 |
| CGraphic * | Clone () const |
| void | Load () |
| void | Flip () |
| void | UseDisplayFormat () |
| void | Resize (int w, int h) |
| bool | TransparentPixel (int x, int y) |
| void | MakeShadow () |
| bool | IsLoaded () const |
| virtual void * | _getData () const |
| virtual int | getWidth () const |
| virtual int | getHeight () const |
Static Public Member Functions | |
| static CGraphic * | New (const std::string &file, int w=0, int h=0) |
| static CGraphic * | ForceNew (const std::string &file, int w=0, int h=0) |
| static void | Free (CGraphic *g) |
Public Attributes | |
| std::string | File |
| Filename. | |
| std::string | HashFile |
| Filename used in hash. | |
| SDL_Surface * | Surface |
| Surface. | |
| SDL_Surface * | SurfaceFlip |
| Flipped surface. | |
| int | Width |
| Width of a frame. | |
| int | Height |
| Height of a frame. | |
| int | NumFrames |
| Number of frames. | |
| int | GraphicWidth |
| Original graphic width. | |
| int | GraphicHeight |
| Original graphic height. | |
| int | Refs |
| Uses of this graphic. | |
| bool | Resized |
| Image has been resized. | |
| GLfloat | TextureWidth |
| Width of the texture. | |
| GLfloat | TextureHeight |
| Height of the texture. | |
| GLuint * | Textures |
| Texture names. | |
| int | NumTextures |
| Number of textures. | |
Protected Member Functions | |
| CGraphic () | |
| ~CGraphic () | |
Friends | |
| void | MakeFontColorTextures (CFont *font) |
| void | CleanFonts (void) |
| void | ReloadFonts (void) |
| Cleanup the font module. | |
Definition at line 42 of file video.h.
| void CGraphic::DrawClip | ( | int | x, | |
| int | y | |||
| ) | const |
Video draw the graphic clipped.
| x | X screen position | |
| y | Y screen position |
Definition at line 71 of file graphic.cpp.
References CLIP_RECTANGLE, DrawSub(), Height, and Width.
Referenced by CButtonPanel::Draw(), CViewport::DrawMapBackgroundInViewport(), DrawPatch(), DrawPatchIcons(), DrawPatchTileIcons(), EditorUpdateDisplay(), and ShowTitleImage().
| void CGraphic::DrawSub | ( | int | gx, | |
| int | gy, | |||
| int | w, | |||
| int | h, | |||
| int | x, | |||
| int | y | |||
| ) | const |
Video draw part of graphic.
| 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 |
Definition at line 91 of file graphic.cpp.
References DrawTexture(), Surface, Textures, TheScreen, and UseOpenGL.
Referenced by DrawClip(), DrawFrame(), DrawSubClip(), DrawSubTrans(), and VideoDrawChar().
| void CGraphic::DrawSubClip | ( | int | gx, | |
| int | gy, | |||
| int | w, | |||
| int | h, | |||
| int | x, | |||
| int | y | |||
| ) | const |
Video draw part of graphic clipped.
| 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 |
Definition at line 113 of file graphic.cpp.
References CLIP_RECTANGLE, and DrawSub().
Referenced by DrawFrameClip().
| 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.
| 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 |
Definition at line 132 of file graphic.cpp.
References DrawSub(), Surface, and UseOpenGL.
Referenced by DrawFrameTrans(), and DrawSubClipTrans().
| 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.
| 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 |
Definition at line 159 of file graphic.cpp.
References CLIP_RECTANGLE, and DrawSubTrans().
Referenced by DrawFrameClipTrans().
| void CGraphic::DrawFrame | ( | unsigned | frame, | |
| int | x, | |||
| int | y | |||
| ) | const |
Draw graphic object unclipped.
| frame | number of frame (object index) | |
| x | x coordinate on the screen | |
| y | y coordinate on the screen |
Definition at line 175 of file graphic.cpp.
References DrawSub(), DrawTexture(), GraphicWidth, Height, Surface, Textures, UseOpenGL, and Width.
Referenced by DrawFrameTrans(), and DrawMenuButton().
| void CGraphic::DoDrawFrameClip | ( | GLuint * | textures, | |
| unsigned | frame, | |||
| int | x, | |||
| int | y | |||
| ) | const |
Definition at line 193 of file graphic.cpp.
References CLIP_RECTANGLE_OFS, DrawTexture(), GraphicWidth, Height, and Width.
Referenced by DrawFrameClip(), and CPlayerColorGraphic::DrawPlayerColorFrameClip().
| void CGraphic::DrawFrameClip | ( | unsigned | frame, | |
| int | x, | |||
| int | y | |||
| ) | const |
Draw graphic object clipped.
| frame | number of frame (object index) | |
| x | x coordinate on the screen | |
| y | y coordinate on the screen |
Definition at line 223 of file graphic.cpp.
References DoDrawFrameClip(), DrawSubClip(), Height, Surface, Textures, UseOpenGL, and Width.
Referenced by CDecoVarSpriteBar::Draw(), GraphicAnimation::draw(), DrawConstructionShadow(), DrawCosts(), DrawCursor(), DrawFogOfWarTile(), DrawFrameClipTrans(), CIcon::DrawIcon(), MissileType::DrawMissileType(), DrawPieMenu(), CPlayerColorGraphic::DrawPlayerColorFrameClip(), DrawPopup(), and DrawShadow().
| void CGraphic::DrawFrameTrans | ( | unsigned | frame, | |
| int | x, | |||
| int | y, | |||
| int | alpha | |||
| ) | const |
Definition at line 234 of file graphic.cpp.
References DrawFrame(), DrawSubTrans(), Height, Surface, UseOpenGL, and Width.
| void CGraphic::DrawFrameClipTrans | ( | unsigned | frame, | |
| int | x, | |||
| int | y, | |||
| int | alpha | |||
| ) | const |
Definition at line 248 of file graphic.cpp.
References DrawFrameClip(), DrawSubClipTrans(), Height, Surface, UseOpenGL, and Width.
Referenced by DrawFogOfWarTile(), and MissileType::DrawMissileType().
| void CGraphic::DrawFrameX | ( | unsigned | frame, | |
| int | x, | |||
| int | y | |||
| ) | const |
Draw graphic object unclipped and flipped in X direction.
| frame | number of frame (object index) | |
| x | x coordinate on the screen | |
| y | y coordinate on the screen |
Definition at line 293 of file graphic.cpp.
References DrawTexture(), GraphicWidth, Height, SurfaceFlip, Textures, TheScreen, UseOpenGL, and Width.
Referenced by DrawFrameTransX().
| void CGraphic::DoDrawFrameClipX | ( | GLuint * | textures, | |
| unsigned | frame, | |||
| int | x, | |||
| int | y | |||
| ) | const |
Definition at line 321 of file graphic.cpp.
References CLIP_RECTANGLE_OFS, DrawTexture(), GraphicWidth, Height, and Width.
Referenced by DrawFrameClipX(), and CPlayerColorGraphic::DrawPlayerColorFrameClipX().
| void CGraphic::DrawFrameClipX | ( | unsigned | frame, | |
| int | x, | |||
| int | y | |||
| ) | const |
Draw graphic object clipped and flipped in X direction.
| frame | number of frame (object index) | |
| x | x coordinate on the screen | |
| y | y coordinate on the screen |
Definition at line 359 of file graphic.cpp.
References CLIP_RECTANGLE, DoDrawFrameClipX(), Height, SurfaceFlip, Textures, TheScreen, UseOpenGL, and Width.
Referenced by DrawConstructionShadow(), DrawFrameClipTransX(), MissileType::DrawMissileType(), CPlayerColorGraphic::DrawPlayerColorFrameClipX(), and DrawShadow().
| void CGraphic::DrawFrameTransX | ( | unsigned | frame, | |
| int | x, | |||
| int | y, | |||
| int | alpha | |||
| ) | const |
Definition at line 388 of file graphic.cpp.
References DrawFrameX(), Height, Surface, SurfaceFlip, TheScreen, UseOpenGL, and Width.
| void CGraphic::DrawFrameClipTransX | ( | unsigned | frame, | |
| int | x, | |||
| int | y, | |||
| int | alpha | |||
| ) | const |
Definition at line 416 of file graphic.cpp.
References CLIP_RECTANGLE, DrawFrameClipX(), Height, Surface, SurfaceFlip, TheScreen, UseOpenGL, and Width.
Referenced by MissileType::DrawMissileType().
| CGraphic * CGraphic::New | ( | const std::string & | file, | |
| int | w = 0, |
|||
| int | h = 0 | |||
| ) | [static] |
Make a new graphic object.
| file | Filename | |
| w | Width of a frame (optional) | |
| h | Height of a frame (optional) |
Reimplemented in CPlayerColorGraphic.
Definition at line 487 of file graphic.cpp.
References Assert, ExitFatal(), File, GraphicHash, HashFile, Height, Refs, and Width.
Referenced by CclDefineCursor(), CclDefineMissileType(), CclSetFogOfWarGraphics(), CPatchType::load(), LoadDecorations(), ParseButtonStyleProperties(), PatchLoadIcons(), ShowTitleImage(), and tolua_stratagus_CGraphic_New00().
| 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.
| file | Filename | |
| w | Width of a frame (optional) | |
| h | Height of a frame (optional) |
Reimplemented in CPlayerColorGraphic.
Definition at line 559 of file graphic.cpp.
References ExitFatal(), File, GraphicHash, HashCount, HashFile, Height, sprintf_s(), and Width.
Referenced by Clone(), LoadConstructions(), and LoadUnitTypeSprite().
| CGraphic * CGraphic::Clone | ( | ) | const |
Clone a graphic
Definition at line 582 of file graphic.cpp.
References File, ForceNew(), Height, IsLoaded(), Load(), and Width.
Referenced by CreatePatchIcons().
| void CGraphic::Free | ( | CGraphic * | g | ) | [static] |
Free a graphic
| g | Pointer to the graphic |
Definition at line 690 of file graphic.cpp.
References Assert, FreeSurface(), GraphicHash, Graphics, HashFile, NumTextures, CPlayerColorGraphic::PlayerColorTextures, PlayerMax, Refs, Surface, SurfaceFlip, Textures, and UseOpenGL.
Referenced by CclSetFogOfWarGraphics(), CPatchType::clean(), CleanConstructions(), CleanCursors(), CleanDecorations(), CMap::CleanFogOfWar(), CleanPatchIcons(), CleanUserInterface(), CFont::New(), PatchFreeIcons(), ShowTitleImage(), tolua_stratagus_CGraphic_Free00(), CFont::~CFont(), CIcon::~CIcon(), CPatchType::~CPatchType(), CUnitType::~CUnitType(), and MissileType::~MissileType().
| void CGraphic::Load | ( | void | ) |
Load a graphic
Definition at line 626 of file graphic.cpp.
References Assert, ExitFatal(), File, GraphicHeight, Graphics, GraphicWidth, Height, LoadGraphicPNG(), MakeTexture(), NumFrames, Surface, UseOpenGL, and Width.
Referenced by Clone(), DrawMenuButton(), CUserInterface::Load(), CPatchType::load(), LoadFonts(), LoadIcons(), MissileType::LoadMissileSprite(), LoadUnitTypeSprite(), PatchLoadIcons(), Resize(), and ShowTitleImage().
| void CGraphic::Flip | ( | ) |
Flip graphic and store in graphic->SurfaceFlip
Definition at line 778 of file graphic.cpp.
References Surface, SurfaceFlip, and UseOpenGL.
Referenced by MissileType::LoadMissileSprite(), and LoadUnitTypeSprite().
| void CGraphic::UseDisplayFormat | ( | ) |
Convert the SDL surface to the display format
Definition at line 833 of file graphic.cpp.
References Surface, SurfaceFlip, and UseOpenGL.
Referenced by CUserInterface::Load().
| void CGraphic::Resize | ( | int | w, | |
| int | h | |||
| ) |
Resize a graphic
| w | New width of graphic. | |
| h | New height of graphic. |
Definition at line 1084 of file graphic.cpp.
References Assert, data, FreeSurface(), GraphicHeight, GraphicWidth, Height, int(), Load(), MakeTexture(), NumTextures, Resized, Surface, SurfaceFlip, Textures, UseOpenGL, and Width.
Referenced by CreatePatchIcons(), and ShowTitleImage().
| bool CGraphic::TransparentPixel | ( | int | x, | |
| int | y | |||
| ) |
Check if a pixel is transparent
| x | X coordinate | |
| y | Y coordinate |
Definition at line 1231 of file graphic.cpp.
References Surface.
Referenced by OnGraphic().
| void CGraphic::MakeShadow | ( | ) |
Make shadow sprite
Definition at line 1264 of file graphic.cpp.
References MakeTexture(), NumTextures, Surface, SurfaceFlip, Textures, and UseOpenGL.
Referenced by LoadUnitTypeSprite().
| bool CGraphic::IsLoaded | ( | ) | const [inline] |
Definition at line 91 of file video.h.
References Surface.
Referenced by Clone(), CFont::IsLoaded(), and MissileType::LoadMissileSprite().
| 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.
Reimplemented from gcn::Image.
Definition at line 94 of file video.h.
References Surface.
| virtual int CGraphic::getWidth | ( | ) | const [inline, virtual] |
Gets the width of the Image.
Reimplemented from gcn::Image.
Definition at line 95 of file video.h.
References Width.
Referenced by DrawCursor().
| virtual int CGraphic::getHeight | ( | ) | const [inline, virtual] |
Gets the height of the Image.
Reimplemented from gcn::Image.
Definition at line 96 of file video.h.
References Height.
Referenced by DrawCursor().
| void MakeFontColorTextures | ( | CFont * | font | ) | [friend] |
| void CleanFonts | ( | void | ) | [friend] |
| void ReloadFonts | ( | void | ) | [friend] |
| std::string CGraphic::File |
Filename.
Definition at line 98 of file video.h.
Referenced by Clone(), CPlayerColorGraphic::ForceNew(), ForceNew(), Load(), LoadFonts(), LoadGraphicPNG(), LoadIcons(), CPlayerColorGraphic::New(), New(), and CPatchManager::savePatchType().
| std::string CGraphic::HashFile |
Filename used in hash.
Definition at line 99 of file video.h.
Referenced by CPlayerColorGraphic::ForceNew(), ForceNew(), Free(), CPlayerColorGraphic::New(), and New().
| SDL_Surface* CGraphic::Surface |
Surface.
Definition at line 100 of file video.h.
Referenced by _getData(), DrawFrame(), DrawFrameClip(), DrawFrameClipTrans(), DrawFrameClipTransX(), DrawFrameTrans(), DrawFrameTransX(), DrawSub(), DrawSubTrans(), Flip(), Free(), GetColor(), GraphicPlayerPixels(), IsLoaded(), Load(), LoadGraphicPNG(), MakeFontColorTextures(), MakeShadow(), MakeTextures2(), CFont::MeasureWidths(), Resize(), TransparentPixel(), UseDisplayFormat(), and VideoDrawChar().
| SDL_Surface* CGraphic::SurfaceFlip |
Flipped surface.
Definition at line 101 of file video.h.
Referenced by DrawFrameClipTransX(), DrawFrameClipX(), DrawFrameTransX(), DrawFrameX(), Flip(), Free(), GraphicPlayerPixels(), MakeShadow(), Resize(), and UseDisplayFormat().
| int CGraphic::Width |
Width of a frame.
Definition at line 102 of file video.h.
Referenced by CalculateMaxIconSize(), Clone(), DoDrawFrameClip(), DoDrawFrameClipX(), DoDrawText(), DoScroll(), CDecoVarSpriteBar::Draw(), GraphicAnimation::draw(), DrawClip(), DrawFrame(), DrawFrameClip(), DrawFrameClipTrans(), DrawFrameClipTransX(), DrawFrameClipX(), DrawFrameTrans(), DrawFrameTransX(), DrawFrameX(), DrawPieMenu(), DrawUnitIcons(), DrawUnitSelection(), CPlayerColorGraphic::ForceNew(), ForceNew(), getWidth(), LetUnitDie(), Load(), MakeFontColorTextures(), MakeTextures2(), CFont::MeasureWidths(), CPlayerColorGraphic::New(), New(), PlayMissileSound(), Resize(), ShowTitleImage(), UiDrawLifeBar(), and UiDrawManaBar().
| int CGraphic::Height |
Height of a frame.
Definition at line 103 of file video.h.
Referenced by CalculateMaxIconSize(), Clone(), DoDrawFrameClip(), DoDrawFrameClipX(), DoDrawText(), DoScroll(), CDecoVarSpriteBar::Draw(), GraphicAnimation::draw(), DrawClip(), DrawFrame(), DrawFrameClip(), DrawFrameClipTrans(), DrawFrameClipTransX(), DrawFrameClipX(), DrawFrameTrans(), DrawFrameTransX(), DrawFrameX(), DrawPieMenu(), DrawUnitIcons(), DrawUnitSelection(), CPlayerColorGraphic::ForceNew(), ForceNew(), getHeight(), CFont::Height(), LetUnitDie(), Load(), MakeFontColorTextures(), CFont::MeasureWidths(), CPlayerColorGraphic::New(), New(), Resize(), ShowTitleImage(), UiDrawLifeBar(), and UiDrawManaBar().
Number of frames.
Definition at line 104 of file video.h.
Referenced by CursorAnimate(), CDecoVarSpriteBar::Draw(), GraphicAnimation::isFinished(), Load(), LoadIcons(), MissileType::LoadMissileSprite(), and MakeFontColorTextures().
Original graphic width.
Definition at line 105 of file video.h.
Referenced by DoDrawFrameClip(), DoDrawFrameClipX(), DoDrawText(), DrawFrame(), DrawFrameX(), DrawTexture(), Load(), LoadGraphicPNG(), MakeFontColorTextures(), MakeTextures(), MakeTextures2(), CFont::MeasureWidths(), and Resize().
Original graphic height.
Definition at line 106 of file video.h.
Referenced by DoDrawText(), DrawTexture(), Load(), LoadGraphicPNG(), MakeFontColorTextures(), MakeTextures(), MakeTextures2(), CFont::MeasureWidths(), and Resize().
| int CGraphic::Refs |
Uses of this graphic.
Definition at line 107 of file video.h.
Referenced by Free(), CPlayerColorGraphic::New(), and New().
| bool CGraphic::Resized |
| GLfloat CGraphic::TextureWidth |
Width of the texture.
Definition at line 109 of file video.h.
Referenced by DrawTexture(), and MakeTextures().
| GLfloat CGraphic::TextureHeight |
Height of the texture.
Definition at line 110 of file video.h.
Referenced by DrawTexture(), and MakeTextures().
| GLuint* CGraphic::Textures |
Texture names.
Definition at line 111 of file video.h.
Referenced by CleanFonts(), DrawFrame(), DrawFrameClip(), DrawFrameClipX(), DrawFrameX(), DrawSub(), Free(), FreeOpenGLFonts(), MakeShadow(), MakeTexture(), MakeTextures(), ReloadFonts(), and Resize().
Number of textures.
Definition at line 112 of file video.h.
Referenced by CleanFonts(), Free(), FreeOpenGLFonts(), FreeOpenGLGraphics(), MakeShadow(), MakeTextures(), and Resize().
1.5.6