- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

# Sprite Class Reference

`#include <Sprite.h>`

Inheritance diagram for Sprite:

List of all members.

## Public Member Functions
| Sprite ()
| Sprite (std::string filename)
| Sprite (std::string filename, int width, int height)
| Sprite (Sprite *sprite)
virtual Sprite * | instance ()
virtual void | draw (int x, int y, bool origin=LEVEL)
virtual void | clean ()
virtual void | drawBox (int x, int y, SDL_Rect drawBox)
int | width ()
int | height ()
void | setHeight (int h)
void | setWidth (int w)
virtual SDL_Rect | rect ()
virtual SDL_Rect | box ()
void | setRect (SDL_Rect r)
void | setBox (SDL_Rect b)
std::string | filename ()
int | getTexture ()
virtual void | update ()
virtual void | reset ()
xDirection | getDirection ()
void | setDirection (xDirection direction)
## Static Public Member Functions
static Sprite * | loadSprite (std::string filename)
static Sprite * | loadText (std::string filename)
static void | cleanSprites ()
## Static Public Attributes
static const bool | LEVEL = true
static const bool | SCREEN = false
## Protected Attributes
std::string | _filename
unsigned int | _hTexture
GLfloat | _coords [4]
SDL_Rect | _rect
SDL_Rect | _box
xDirection | _direction
## Static Protected Attributes
static std::map< std::string, Sprite * > | SPRITES

## Detailed Description

Definition at line 12 of file Sprite.h.

## Constructor & Destructor Documentation

Sprite::Sprite | ( |  | ) | `[inline]`

| Definition at line 15 of file Sprite.h.

Sprite::Sprite | ( | std::string | filename | ) |

| Definition at line 18 of file Sprite.cpp. References _box, _coords, _filename, _hTexture, _rect, glfuncs::instance(), and glfuncs::loadTexture().

Sprite::Sprite | ( | std::string | filename,
|  | int | width,
|  | int | height
| ) |

| Definition at line 40 of file Sprite.cpp. References _coords, _filename, _hTexture, _rect, glfuncs::instance(), and glfuncs::loadTexture().

Sprite::Sprite | ( | Sprite * | sprite | ) |

| Definition at line 48 of file Sprite.cpp. References _box, _direction, _filename, and _rect.

## Member Function Documentation

virtual SDL_Rect Sprite::box | ( |  | ) | `[inline, virtual]`

| Definition at line 39 of file Sprite.h. References _box.

virtual void Sprite::clean | ( |  | ) | `[inline, virtual]`

| Reimplemented in AnimatedSprite, and ShowOneSprite. Definition at line 29 of file Sprite.h.

void Sprite::cleanSprites | ( |  | ) | `[static]`

| Definition at line 34 of file Sprite.cpp. References SPRITES. Referenced by Level::~Level().

void Sprite::draw | ( | int | x,
|  | int | y,
|  | bool | origin = `LEVEL`
| ) | `[virtual]`

| Reimplemented in AnimatedSprite, and ShowOneSprite. Definition at line 56 of file Sprite.cpp. References _box, _coords, _direction, _hTexture, _rect, Screen::drawLevel(), Screen::drawScreen(), Screen::instance(), LEVEL, RIGHT, and SCREEN. Referenced by Tile::draw(), TitleScreenMenu::draw(), Menu::draw(), EventPoint::draw(), Door::draw(), Bullet::draw(), Weapon::drawAmmo(), drawBox(), and Level::drawHUD().

void Sprite::drawBox | ( | int | x,
|  | int | y,
|  | SDL_Rect | drawBox
| ) | `[virtual]`

| Definition at line 88 of file Sprite.cpp. References _coords, _rect, and draw(). Referenced by Tile::draw().

std::string Sprite::filename | ( |  | ) | `[inline]`

| Definition at line 42 of file Sprite.h. References _filename.

xDirection Sprite::getDirection | ( |  | ) | `[inline]`

| Definition at line 53 of file Sprite.h. References _direction.

int Sprite::getTexture | ( |  | ) | `[inline]`

| Definition at line 43 of file Sprite.h. References _hTexture.

int Sprite::height | ( |  | ) | `[inline]`

| Definition at line 35 of file Sprite.h. References _rect. Referenced by Bullet::Bullet(), Background::draw(), Door::setOpen(), and Tile::Tile().

Sprite * Sprite::instance | ( |  | ) | `[virtual]`

| Reimplemented in AnimatedSprite, and ShowOneSprite. Definition at line 13 of file Sprite.cpp. Referenced by loadSprite().

Sprite * Sprite::loadSprite | ( | std::string | filename | ) | `[static]`

| Definition at line 110 of file Sprite.cpp. References instance(), and SPRITES. Referenced by AnimatedSprite::AnimatedSprite(), Bullet::Bullet(), Level::drawHUD(), Weapon::load(), Person::load(), Door::load(), readObjects(), Level::readTextures(), readTextures(), and ShowOneSprite::ShowOneSprite().

Sprite * Sprite::loadText | ( | std::string | filename | ) | `[static]`

| Definition at line 135 of file Sprite.cpp. References List::firstString(), Parser::parse(), and List::rest().

virtual SDL_Rect Sprite::rect | ( |  | ) | `[inline, virtual]`

| Definition at line 38 of file Sprite.h. References _rect.

virtual void Sprite::reset | ( |  | ) | `[inline, virtual]`

| Reimplemented in AnimatedSprite, and ShowOneSprite. Definition at line 46 of file Sprite.h.

void Sprite::setBox | ( | SDL_Rect | b | ) | `[inline]`

| Definition at line 41 of file Sprite.h. References _box.

void Sprite::setDirection | ( | xDirection | direction | ) | `[inline]`

| Definition at line 54 of file Sprite.h. References _direction. Referenced by Bullet::Bullet(), Person::draw(), and Bullet::draw().

void Sprite::setHeight | ( | int | h | ) | `[inline]`

| Definition at line 36 of file Sprite.h. References _rect. Referenced by Person::crouch(), readObjects(), readTextures(), and Person::uncrouch().

void Sprite::setRect | ( | SDL_Rect | r | ) | `[inline]`

| Definition at line 40 of file Sprite.h. References _rect.

void Sprite::setWidth | ( | int | w | ) | `[inline]`

| Definition at line 37 of file Sprite.h. References _rect. Referenced by readObjects(), and readTextures().

virtual void Sprite::update | ( |  | ) | `[inline, virtual]`

| Reimplemented in AnimatedSprite, and ShowOneSprite. Definition at line 45 of file Sprite.h. Referenced by Tile::update().

int Sprite::width | ( |  | ) | `[inline]`

| Definition at line 34 of file Sprite.h. References _rect. Referenced by Bullet::Bullet(), Background::draw(), Level::drawHUD(), Door::setOpen(), and Tile::Tile().

## Member Data Documentation

SDL_Rect Sprite::_box`[protected]`

| Definition at line 70 of file Sprite.h. Referenced by box(), draw(), ShowOneSprite::draw(), AnimatedSprite::draw(), setBox(), and Sprite().

GLfloat Sprite::_coords[4]`[protected]`

| Definition at line 68 of file Sprite.h. Referenced by draw(), Background::draw(), drawBox(), and Sprite().

xDirection Sprite::_direction`[protected]`

| Definition at line 71 of file Sprite.h. Referenced by draw(), ShowOneSprite::draw(), AnimatedSprite::draw(), getDirection(), setDirection(), and Sprite().

std::string Sprite::_filename`[protected]`

| Definition at line 66 of file Sprite.h. Referenced by AnimatedSprite::AnimatedSprite(), filename(), ShowOneSprite::ShowOneSprite(), and Sprite().

unsigned int Sprite::_hTexture`[protected]`

| Definition at line 67 of file Sprite.h. Referenced by draw(), Background::draw(), getTexture(), Sprite(), and Background::~Background().

SDL_Rect Sprite::_rect`[protected]`

| Definition at line 69 of file Sprite.h. Referenced by draw(), AnimatedSprite::draw(), drawBox(), height(), rect(), setHeight(), setRect(), setWidth(), Sprite(), and width().

const bool Sprite::LEVEL = true`[static]`

| Definition at line 58 of file Sprite.h. Referenced by draw().

const bool Sprite::SCREEN = false`[static]`

| Definition at line 59 of file Sprite.h. Referenced by draw(), TitleScreenMenu::draw(), Menu::draw(), Weapon::drawAmmo(), Level::drawHUD(), showColl(), showObject(), and showTexture().

map< string, Sprite * > Sprite::SPRITES`[static, protected]`

| Definition at line 63 of file Sprite.h. Referenced by cleanSprites(), and loadSprite().

The documentation for this class was generated from the following files:

- C:/Documents and Settings/jegan/Desktop/projectX/Sprite.h
- C:/Documents and Settings/jegan/Desktop/projectX/Sprite.cpp