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
ani_texture.cpp File Reference
#include "cmd/unit_generic.h"
#include "ani_texture.h"
#include "audiolib.h"
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include "lin_time.h"
#include "vegastrike.h"
#include "vsfilesystem.h"
#include "vs_globals.h"
#include "vs_random.h"
#include "../gldrv/gl_globals.h"
#include <set>
#include <math.h>

Go to the source code of this file.

Functions

static unsigned int intmin (unsigned int a, unsigned int b)
 
static unsigned int intmax (unsigned int a, unsigned int b)
 
static enum ADDRESSMODE parseAddressMode (const string &addrmodestr, ADDRESSMODE defaultAddressMode)
 
static void ActivateWhite (int stage)
 
static void alltrim (string &str)
 
static void alltrim (char *_str)
 

Variables

static set< AnimatedTexture * > anis
 

Function Documentation

static void ActivateWhite ( int  stage)
static

Definition at line 47 of file ani_texture.cpp.

References Texture::LoadSuccess(), Texture::MakeActive(), MIPMAP, BaseUtil::Texture(), TEXTURE2D, and TEXTURE_2D.

Referenced by AnimatedTexture::MakeActive().

48 {
49  static Texture *white = new Texture( "white.bmp", 0, MIPMAP, TEXTURE2D, TEXTURE_2D, 1 );
50  if ( white->LoadSuccess() )
51  white->MakeActive( stage );
52 }
static void alltrim ( string &  str)
static

Definition at line 409 of file ani_texture.cpp.

Referenced by alltrim(), and AnimatedTexture::LoadAni().

410 {
411  string::size_type ltrim = str.find_first_not_of( " \t\r\n" );
412  string::size_type rtrim = str.find_last_not_of( " \t\r\n" );
413  if (rtrim != string::npos) str.resize( rtrim+1 );
414  str.erase( 0, ltrim );
415 }
static void alltrim ( char *  _str)
static

Definition at line 417 of file ani_texture.cpp.

References alltrim().

418 {
419  string str = _str;
420  alltrim( str );
421  strcpy( _str, str.c_str() );
422 }
static unsigned int intmax ( unsigned int  a,
unsigned int  b 
)
inlinestatic

Definition at line 25 of file ani_texture.cpp.

References a.

Referenced by AnimatedTexture::MakeActive().

26 {
27  return a < b ? b : a;
28 }
static unsigned int intmin ( unsigned int  a,
unsigned int  b 
)
inlinestatic

Definition at line 20 of file ani_texture.cpp.

References b.

Referenced by AnimatedTexture::MakeActive().

21 {
22  return a < b ? a : b;
23 }
static enum ADDRESSMODE parseAddressMode ( const string &  addrmodestr,
ADDRESSMODE  defaultAddressMode 
)
static

Definition at line 30 of file ani_texture.cpp.

References BORDER, CLAMP, MIRROR, and WRAP.

Referenced by AnimatedTexture::LoadAni(), and AnimatedTexture::LoadFrame().

31 {
32  enum ADDRESSMODE addrmode = defaultAddressMode;
33  if (addrmodestr == "wrap")
34  addrmode = WRAP;
35 
36  else if (addrmodestr == "mirror")
37  addrmode = MIRROR;
38 
39  else if (addrmodestr == "clamp")
40  addrmode = CLAMP;
41 
42  else if (addrmodestr == "border")
43  addrmode = BORDER;
44  return addrmode;
45 }

Variable Documentation