gamedev
|
#include <world.h>
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) |
World * | goWorldLeft (Player *p) |
World * | goWorldRight (Player *p) |
World * | goWorldBack (Player *p) |
World * | goWorldFront (Player *p) |
World * | goInsideStructure (Player *p) |
void | addHole (unsigned int start, unsigned int end) |
int | getTheWidth (void) |
void | save (FILE *) |
void | load (FILE *) |
Public Attributes | |
World * | toLeft |
World * | toRight |
World * | behind |
World * | infront |
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_t * | line |
int | x_start |
unsigned int | lineCount |
vec2 * | star |
Texturec * | bgTex |
Mix_Music * | bgmObj |
char * | bgm |
The world class. This class does everything a world should do.
|
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.
|
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.
|
protected |
The line array. This array is created through 'new' in World::generate(), with an amount of elements provided by the function.
|
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).
|
protected |
An array of star coordinates.
|
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.