Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sprite.cpp File Reference
#include <stdlib.h>
#include <iostream>
#include "vsfilesystem.h"
#include "cmd/unit_generic.h"
#include "aux_texture.h"
#include "ani_texture.h"
#include "sprite.h"
#include "matrix.h"
#include "gfxlib.h"
#include "vegastrike.h"
#include "vs_globals.h"
#include "../gldrv/gl_globals.h"
#include <assert.h>
#include <math.h>
#include "gnuhash.h"
#include "audio/Types.h"
#include "audio/Source.h"

Go to the source code of this file.

Macros

#define M_PI_2   (1.57079632679489661923)
 

Typedefs

typedef vsUMap< std::string,
VSSprite * > 
VSSpriteCache
 

Functions

static std::pair< bool,
VSSprite * > 
cacheLookup (const char *file)
 
static void cacheInsert (const char *file, VSSprite *spr)
 

Variables

static VSSpriteCache sprite_cache
 

Macro Definition Documentation

#define M_PI_2   (1.57079632679489661923)

Definition at line 42 of file sprite.cpp.

Referenced by VSSprite::DrawHere().

Typedef Documentation

typedef vsUMap< std::string, VSSprite* > VSSpriteCache

Definition at line 50 of file sprite.cpp.

Function Documentation

static void cacheInsert ( const char *  file,
VSSprite spr 
)
static

Definition at line 63 of file sprite.cpp.

References VSFileSystem::GetHashName(), and sprite_cache.

Referenced by VSSprite::VSSprite().

64 {
65  std::string hashName = VSFileSystem::GetHashName( std::string( file ) );
66  sprite_cache.insert( std::pair< std::string, VSSprite* > ( hashName, spr ) );
67 }
static std::pair< bool, VSSprite* > cacheLookup ( const char *  file)
static

Definition at line 53 of file sprite.cpp.

References VSFileSystem::GetHashName(), and sprite_cache.

Referenced by VSSprite::VSSprite().

54 {
55  std::string hashName = VSFileSystem::GetHashName( std::string( file ) );
56  VSSpriteCache::iterator it = sprite_cache.find( hashName );
57  if ( it != sprite_cache.end() )
58  return std::pair< bool, VSSprite* > ( true, it->second );
59  else
60  return std::pair< bool, VSSprite* > ( false, (VSSprite*)NULL );
61 }

Variable Documentation

VSSpriteCache sprite_cache
static

Definition at line 51 of file sprite.cpp.

Referenced by cacheInsert(), and cacheLookup().