diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/Quest.h | 5 | ||||
-rw-r--r-- | include/common.h | 94 | ||||
-rw-r--r-- | include/entities.h | 14 | ||||
-rw-r--r-- | include/inventory.h | 2 | ||||
-rw-r--r-- | include/ui.h | 4 | ||||
-rw-r--r-- | include/world.h | 1 |
6 files changed, 88 insertions, 32 deletions
diff --git a/include/Quest.h b/include/Quest.h index bbcf7ee..75de64c 100644 --- a/include/Quest.h +++ b/include/Quest.h @@ -1,10 +1,9 @@ #ifndef QUEST_H
#define QUEST_H
-#include <vector>
-#include <cstdlib>
#include <cstring>
+#include <common.h>
#include <inventory.h>
#define DEBUG
@@ -28,4 +27,6 @@ public: bool hasQuest(const char *t);
};
+#include <entities.h>
+
#endif // QUEST_H
diff --git a/include/common.h b/include/common.h index 183b1cb..d5f1456 100644 --- a/include/common.h +++ b/include/common.h @@ -1,63 +1,101 @@ #ifndef COMMON_H #define COMMON_H -///THIS FILE IS USED FOR VARIABLES THAT WILL BE ACCESED BY MULTIPLE CLASSES/FILES +/* + * Include basic C/C++ facilities +*/ #include <iostream> +#include <cstdlib> #include <vector> #include <math.h> -#include <cstdlib> -#include <SDL2/SDL.h> + +/* + * Include GLEW and the SDL 2 headers +*/ + #include <GL/glew.h> + +#include <SDL2/SDL.h> #include <SDL2/SDL_opengl.h> #include <SDL2/SDL_image.h> #include <SDL2/SDL_mixer.h> -typedef struct { float x; float y; }vec2; +/* + * Create a basic 2-point structure for coordinate saving +*/ -enum _TYPE { //these are the main types of entities - STRUCTURET = -1, - PLAYERT = 0, - NPCT = 1, - MOBT = 2 -}; +typedef struct { + float x; + float y; +} vec2; -enum GENDER{ - MALE, - FEMALE, - NONE -}; - -#include <Quest.h> -#include <entities.h> +/* + * Define the game's name (displayed in the window title), + * the desired window dimensions, + * and whether or not we want the window to be fullscreen. +*/ #define GAME_NAME "Independent Study v.0.2 alpha" #define SCREEN_WIDTH 1280 #define SCREEN_HEIGHT 720 + //#define FULLSCREEN -#define HLINE 3 //base unit of the world +/* + * Define the length of a single HLINE. + * + * The game has a great amount of elements that need to be drawn or detected, and having each + * of them use specific hard-coded numbers would be painful to debug. As a solution, this + * definition was made. Every item being drawn to the screen and most object detection/physic + * handling is done based off of this number. Increasing it will give the game a zoomed-in + * feel, while decreasing it will do the opposite. + * +*/ + +#define HLINE 3 // 3 as in 3 pixels + +/* + * Define 'our' random number generation library. Eventually these macros will be replaced + * with actual functions. + * +*/ #define initRand(s) srand(s) #define getRand() rand() +/* + * At the bottom of this header is the prototype for DEBUG_prints, which writes a formatted + * string to the console containing the callee's file and line number. This macro simplifies + * it to a simple printf call. + * + * DEBUG must be defined for this macro to function. + * +*/ + #define DEBUG_printf( message, ...) DEBUG_prints(__FILE__, __LINE__, message, __VA_ARGS__ ) -template<typename T, size_t N> //this fuction returns the size of any array -int eAmt(T (&)[N]){return N;} +/* + * References the variable in main.cpp, used for smoother drawing. +*/ -extern bool gameRunning; extern unsigned int deltaTime; -extern unsigned int loops; -extern FILE* config; -extern FILE* names; - -extern Mix_Music *music; -extern Mix_Chunk *horn; +/* + * Loads an image from the given file path and attempts to make a texture out of it. The + * resulting GLuint is returned (used to recall the texture in glBindTexture). + * +*/ GLuint loadTexture(const char *fileName); + +/* + * Prints a formatted debug message to the console, along with the callee's file and line + * number. + * +*/ + void DEBUG_prints(const char* file, int line, const char *s,...); #endif // COMMON_H diff --git a/include/entities.h b/include/entities.h index 655390b..fab2ca5 100644 --- a/include/entities.h +++ b/include/entities.h @@ -2,6 +2,7 @@ #define ENTITIES_H #include <common.h> +#include <Quest.h> #include <inventory.h> #define DEBUG @@ -11,7 +12,18 @@ #define PLAYER_INV_SIZE 30 // The size of the player's inventory #define NPC_INV_SIZE 3 // Size of an NPC's inventory -extern FILE* names; +enum _TYPE { //these are the main types of entities + STRUCTURET = -1, + PLAYERT = 0, + NPCT = 1, + MOBT = 2 +}; + +enum GENDER{ + MALE, + FEMALE, + NONE +}; class Entity{ public: diff --git a/include/inventory.h b/include/inventory.h index c477b8e..cb3e59d 100644 --- a/include/inventory.h +++ b/include/inventory.h @@ -1,7 +1,7 @@ #ifndef INVENTORY_H #define INVENTORY_H -#include <cstdlib> +#include <common.h> #define DEBUG diff --git a/include/ui.h b/include/ui.h index 6f23a78..739aba0 100644 --- a/include/ui.h +++ b/include/ui.h @@ -4,6 +4,10 @@ #include <common.h> #include <cstdarg> // For putText() +#include <world.h> // World-switching stuff +#include <ft2build.h> // FreeType stuff +#include FT_FREETYPE_H + #define DEBUG namespace ui { // Functions are kept in a namespace simply diff --git a/include/world.h b/include/world.h index 4acb9ee..29c7822 100644 --- a/include/world.h +++ b/include/world.h @@ -2,6 +2,7 @@ #define WORLD_H #include <common.h> // For HLINE, vec2, OpenGL utilities, etc. +#include <entities.h> typedef struct { vec2 p1,p2; |