gamedev
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
World Class Reference

#include <world.h>

Inheritance diagram for World:
Arena IndoorWorld

Public Member Functions

void addStructure (_TYPE t, float x, float y, World *outside, World *inside)
 
void addMob (int t, float x, float y)
 
void addMob (int t, float x, float y, void(*hey)(Mob *))
 
void addNPC (float x, float y)
 
void addObject (ITEM_ID, bool, const char *, float, float)
 
void update (Player *p, unsigned int delta)
 
virtual void generate (unsigned int width)
 
void generateFunc (unsigned int width, float(*func)(float))
 
void setBackground (WORLD_BG_TYPE bgt)
 
void setBGM (const char *path)
 
void bgmPlay (void)
 
void bgmStop (void)
 
void addLayer (unsigned int width)
 
virtual void draw (Player *p)
 
void detect (Player *p)
 
WorldgoWorldLeft (Player *p)
 
WorldgoWorldRight (Player *p)
 
WorldgoWorldBack (Player *p)
 
WorldgoWorldFront (Player *p)
 
WorldgoInsideStructure (Player *p)
 
void addHole (unsigned int start, unsigned int end)
 
int getTheWidth (void)
 
void save (FILE *)
 
void load (FILE *)
 

Public Attributes

WorldtoLeft
 
WorldtoRight
 
Worldbehind
 
Worldinfront
 
std::vector< NPC * > npc
 
std::vector< Structures * > build
 
std::vector< Mob * > mob
 
std::vector< Entity * > entity
 
std::vector< Object * > object
 

Protected Member Functions

void singleDetect (Entity *e)
 
void deleteEntities (void)
 

Protected Attributes

struct line_tline
 
int x_start
 
unsigned int lineCount
 
vec2star
 
TexturecbgTex
 
Mix_Music * bgmObj
 
char * bgm
 

Detailed Description

The world class. This class does everything a world should do.

Member Function Documentation

void World::deleteEntities ( void  )
protected

Empties all entity vectors. Each entity vector is iterated through, calling delete for each entry. Once all specific vectors are cleared, the general entity vector is emptied of the pointers to those other vectors. This function should only be called in World's destructor, as there shouldn't be another reason to call this function.

void World::singleDetect ( Entity e)
protected

Handle physics for a single entity. This function handles gravity and death for an entity. The public version of this, World::detect(), handles all entities in the world as well as the player. World::singleDetect() should never be used outside of World::detect(), which is why it is declared private.

Member Data Documentation

struct line_t* World::line
protected

The line array. This array is created through 'new' in World::generate(), with an amount of elements provided by the function.

unsigned int World::lineCount
protected

Number of lines in the world. While this number is helpful for knowing the world's width, it is kept private for security reasons. To compensate for this, World::getTheWidth() is provided (see below).

vec2* World::star
protected

An array of star coordinates.

int World::x_start
protected

Starting x coordinate. This x value is the point at which line[0] should reside, can be used to calculate the width of the world.


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