____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       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"

graphic.cpp File Reference

The general graphic functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include <string>
#include <map>
#include <list>
#include "video.h"
#include "player.h"
#include "intern_video.h"
#include "iocompat.h"
#include "iolib.h"

Go to the source code of this file.

Functions

static void FreeSurface (SDL_Surface **surface)
void FreeOpenGLGraphics ()
 Reload OpenGL graphics.
void ReloadGraphics ()
 Reload OpenGL.
static int PowerOf2 (int x)
static void MakeTextures2 (CGraphic *g, GLuint texture, CUnitColors *colors, int ow, int oh)
static void MakeTextures (CGraphic *g, int player, CUnitColors *colors)
void MakeTexture (CGraphic *g)
 Make an OpenGL texture of the player color pixels only.
void MakePlayerColorTexture (CPlayerColorGraphic *g, int player)
 Free OpenGL graphics.

Variables

static int HashCount
static std::map< std::string,
CGraphic * > 
GraphicHash
static std::list< CGraphic * > Graphics


Detailed Description

The general graphic functions.

Definition in file graphic.cpp.


Function Documentation

void FreeOpenGLGraphics (  ) 

Reload OpenGL graphics.

Free OpenGL graphics

Definition at line 732 of file graphic.cpp.

References Graphics, CGraphic::NumTextures, CPlayerColorGraphic::PlayerColorTextures, and PlayerMax.

Referenced by CVideo::ResizeScreen().

static void FreeSurface ( SDL_Surface **  surface  )  [static]

Free a SDL surface

Parameters:
surface SDL surface to free

Definition at line 668 of file graphic.cpp.

Referenced by CGraphic::Free(), and CGraphic::Resize().

void MakePlayerColorTexture ( CPlayerColorGraphic g,
int  player 
)

Free OpenGL graphics.

Make an OpenGL texture with the player colors.

Parameters:
g The graphic to texture with player colors.
player Player number to make textures for.

Definition at line 1069 of file graphic.cpp.

References MakeTextures(), CPlayerColorGraphic::PlayerColorTextures, and Players.

Referenced by CPlayerColorGraphic::DrawPlayerColorFrameClip(), CPlayerColorGraphic::DrawPlayerColorFrameClipX(), and ReloadGraphics().

void MakeTexture ( CGraphic g  ) 

Make an OpenGL texture of the player color pixels only.

Make an OpenGL texture or textures out of a graphic object.

Parameters:
g The graphic object.

Definition at line 1054 of file graphic.cpp.

References MakeTextures(), and CGraphic::Textures.

Referenced by CGraphic::Load(), MakeFontColorTextures(), CGraphic::MakeShadow(), ReloadGraphics(), and CGraphic::Resize().

static void MakeTextures ( CGraphic g,
int  player,
CUnitColors colors 
) [static]

Make an OpenGL texture or textures out of a graphic object.

Parameters:
g The graphic object.
player Player number.
colors Unit colors.

Definition at line 1008 of file graphic.cpp.

References GLMaxTextureSize, CGraphic::GraphicHeight, CGraphic::GraphicWidth, MakeTextures2(), CGraphic::NumTextures, CPlayerColorGraphic::PlayerColorTextures, PowerOf2(), CGraphic::TextureHeight, CGraphic::Textures, and CGraphic::TextureWidth.

Referenced by MakePlayerColorTexture(), and MakeTexture().

static void MakeTextures2 ( CGraphic g,
GLuint  texture,
CUnitColors colors,
int  ow,
int  oh 
) [static]

Make an OpenGL texture or textures out of a graphic object.

Parameters:
g The graphic object.
texture Texture.
colors Unit colors.
ow Offset width.
oh Offset height.

Definition at line 879 of file graphic.cpp.

References _C_, CUnitColors::Colors, DebugPrint, GLMaxTextureSize, GLTextureCompressionSupported, CGraphic::GraphicHeight, CGraphic::GraphicWidth, PlayerColorIndexCount, PlayerColorIndexStart, PowerOf2(), CGraphic::Surface, UseGLTextureCompression, and CGraphic::Width.

Referenced by MakeTextures().

static int PowerOf2 ( int  x  )  [static]

Find the next power of 2 >= x

Definition at line 863 of file graphic.cpp.

Referenced by MakeTextures(), and MakeTextures2().

void ReloadGraphics (  ) 

Reload OpenGL.

Reload OpenGL graphics

Definition at line 753 of file graphic.cpp.

References Graphics, MakePlayerColorTexture(), MakeTexture(), CPlayerColorGraphic::PlayerColorTextures, and PlayerMax.

Referenced by ReloadOpenGL().


Variable Documentation

std::map<std::string, CGraphic *> GraphicHash [static]

std::list<CGraphic *> Graphics [static]

Definition at line 59 of file graphic.cpp.

Referenced by CGraphic::Free(), FreeOpenGLGraphics(), CGraphic::Load(), and ReloadGraphics().

int HashCount [static]

Definition at line 55 of file graphic.cpp.

Referenced by CPlayerColorGraphic::ForceNew(), and CGraphic::ForceNew().


Generated on Sat Feb 21 00:28:16 2009 for Bos Wars by  doxygen 1.5.6