diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ui.h | 28 | ||||
-rw-r--r-- | include/world.h | 22 |
2 files changed, 35 insertions, 15 deletions
diff --git a/include/ui.h b/include/ui.h index 2077837..8341a8c 100644 --- a/include/ui.h +++ b/include/ui.h @@ -2,17 +2,29 @@ #define UI_H #include <common.h> -#include <cstdarg> +#include <cstdarg> // For putText() -namespace ui { - void initFonts(void); - void setFontFace(const char *ttf); - void setFontSize(unsigned int size); +namespace ui { // Functions are kept in a namespace simply + // for organization + + extern bool debug; + extern unsigned int fontSize; + + void initFonts(void); // Checks for and initializes the FreeType 2 library + + void setFontFace(const char *ttf); // Checks and unpacks the TTF file for use by putString() and putText() + void setFontSize(unsigned int size); // Sets the size of the currently loaded font to 'size' pixels + + void putString(const float x,const float y,const char *s); // Draws the string 's' to the coordinates ('x','y'). The height (and therefore the width) + // are determined by what's currently set by setFontSize() + void putText(const float x,const float y,const char *str,...); // Draws the formatted string 'str' using putString() + + void dialogBox(const char *text); // Prepares a dialog box to be drawn (its drawn as a black background at the top of the + // screen and then 'text' is putString()'d - void putString(const float x,const float y,const char *s); - void putText(const float x,const float y,const char *str,...); + void draw(void); // Draws things like dialogBox's if necessary - void handleEvents(void); + void handleEvents(void); // Handles keyboard and mouse events } #endif // UI_H diff --git a/include/world.h b/include/world.h index 00b7a7f..2a1d3c3 100644 --- a/include/world.h +++ b/include/world.h @@ -3,6 +3,8 @@ #include <common.h> // For HLINE, vec2, OpenGL utilities, etc. +//#define WORLD_ENTITY_MAX 64 // Maximum number of entities that can be bound to a world + /* * World - creates and handles an area of land */ @@ -27,6 +29,9 @@ private: int x_start; // Worlds are centered on the x axis (0,n), this contains // where to start drawing the world to have it centered properly. World *behind,*infront; // Pointers to other areas of land that are behind or in front of this one, respectively. + //Entity **peeps; // Stores pointers to entities that are bound to the world + //unsigned int peepCount; // Number of entities bound to the world + void singleDetect(Entity *e); public: World *toLeft,*toRight; // Pointers to areas to the left and right of this world. These are made public // so that they can easily be set without a function. @@ -39,20 +44,23 @@ public: void draw(vec2 *vec); // Draws the world around the coordinates 'vec' - void detect(vec2 *v,vec2 *vel,const float width); // Insures objects/entities at location 'v' with a width of 'width' and a - // velocity of 'vel' stay outside of the ground (defined by array 'line'), - // and handles gravity for that object/entity by modifying it's velocity ('vel') - World *goWorldLeft(vec2 *loc,const float width); // Returns the world to the left of this one if it exists and the player at + void detect(Player *p); // Insures objects/entities stored in an Entity class stay outside of the + // ground (defined by array 'line'), and handles gravity for the object/entity + // by modifying it's velocity + + World *goWorldLeft(Player *p); // Returns the world to the left of this one if it exists and the player at // location 'loc' with width 'width' is at the left edge of this world. - World *goWorldRight(vec2 *loc,const float width); // Functions the same as goWorldLeft(), but checks/returns the world to the right + World *goWorldRight(Player *p); // Functions the same as goWorldLeft(), but checks/returns the world to the right // of the player. - World *goWorldBack(vec2 *loc,const float width); // Returns the address of the world behind this one if it exists and the player + World *goWorldBack(Player *p); // Returns the address of the world behind this one if it exists and the player // at location 'loc' with width 'width' is within the area of it (i.e., when this // world is drawn the world has to appear directly behind the player) - World *goWorldFront(vec2 *loc,const float width); // Functions the same as goWorldBack(), but checks/returns the world in front of + World *goWorldFront(Player *p); // Functions the same as goWorldBack(), but checks/returns the world in front of // this one. + + //void addEntity(Entity *e); // Binds an entity to this world (this world will then handle its drawing and detection) }; #endif // WORLD_H |