From 174bcd3a415c21fc2c59a3af1b6333faa78b37d0 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Wed, 27 Apr 2016 08:50:07 -0400 Subject: ui fixes, other stuff --- include/common.hpp | 23 ++-------------------- include/config.hpp | 25 +++++++++++++++--------- include/gametime.hpp | 18 +++++++++-------- include/mob.hpp | 1 + include/threadpool.hpp | 53 -------------------------------------------------- 5 files changed, 29 insertions(+), 91 deletions(-) delete mode 100644 include/threadpool.hpp (limited to 'include') diff --git a/include/common.hpp b/include/common.hpp index 5a0fcb2..1f7b9fc 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -18,8 +18,7 @@ #include #include #include -#include -#include +#include #include #define GLEW_STATIC @@ -153,19 +152,6 @@ typedef col Color; #define GAME_NAME "Independent Study v0.7 alpha - NOW WITH lights and snow and stuff" -/** - * The desired width of the game window. - */ - -extern unsigned int SCREEN_WIDTH; - -/** - * The desired height of the game window. - */ - -extern unsigned int SCREEN_HEIGHT; - -extern bool FULLSCREEN; extern bool uiLoop; extern std::mutex mtx; @@ -179,13 +165,8 @@ extern std::mutex mtx; * */ -#define HLINES(n) (HLINE * n) - -extern unsigned int HLINE; +#define HLINES(n) (game::HLINE * n) -extern float VOLUME_MASTER; -extern float VOLUME_MUSIC; -extern float VOLUME_SFX; /** * A 'wrapper' for libc's srand(), as we hope to eventually have our own random number * generator. diff --git a/include/config.hpp b/include/config.hpp index 8bd0bc9..bc9d052 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -1,18 +1,25 @@ #ifndef CONFIG_H #define CONFIG_H -#include +#include -#include +namespace game { + extern unsigned int HLINE; + extern unsigned int SCREEN_WIDTH; + extern unsigned int SCREEN_HEIGHT; + extern bool FULLSCREEN; -#include -#include + namespace config { + extern float VOLUME_MASTER; + extern float VOLUME_MUSIC; + extern float VOLUME_SFX; - -namespace config { - void read(void); - void update(void); - void save(void); + extern std::string xmlFolder; + + void read(void); + void update(void); + void save(void); + } } #endif //CONFIG_H diff --git a/include/gametime.hpp b/include/gametime.hpp index c2991d2..a809ef9 100644 --- a/include/gametime.hpp +++ b/include/gametime.hpp @@ -1,16 +1,18 @@ #ifndef GAMETIME_H_ #define GAMETIME_H_ -namespace gtime { - void setTickCount(unsigned int t); - unsigned int getTickCount(void); - unsigned int getDeltaTime(void); +namespace game { + namespace time { + void setTickCount(unsigned int t); + unsigned int getTickCount(void); + unsigned int getDeltaTime(void); - void tick(void); - void tick(unsigned int ticks); - bool tickHasPassed(void); + void tick(void); + void tick(unsigned int ticks); + bool tickHasPassed(void); - void mainLoopHandler(void); + void mainLoopHandler(void); + } } #endif // GAMETIME_H_ diff --git a/include/mob.hpp b/include/mob.hpp index 0ed6bc1..9f006b9 100644 --- a/include/mob.hpp +++ b/include/mob.hpp @@ -76,6 +76,7 @@ public: class Trigger : public Mob { private: std::string id; + bool triggered; public: Trigger(void); diff --git a/include/threadpool.hpp b/include/threadpool.hpp deleted file mode 100644 index c341673..0000000 --- a/include/threadpool.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef THREADPOOL_H -#define THREADPOOL_H - -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -class ThreadPool -{ -public: - - // Constructor. - ThreadPool(int threads); - - // Destructor. - ~ThreadPool(); - - // Adds task to a task queue. - void Enqueue(function f); - - // Shut down the pool. - void ShutDown(); - -private: - // Thread pool storage. - vector threadPool; - - // Queue to keep track of incoming tasks. - queue> tasks; - - // Task queue mutex. - mutex tasksMutex; - - // Condition variable. - condition_variable condition; - - // Indicates that pool needs to be shut down. - bool terminate; - - // Indicates that pool has been terminated. - bool stopped; - - // Function that will be invoked by our threads. - void Invoke(); -}; - -#endif //THRE \ No newline at end of file -- cgit v1.2.3