EXEC = main
-all: $(EXEC)
+all: SPECIAL:=-ggdb game
-dirty:
- rm -rf out/world.o
+release: SPECIAL = -static
+release: LIBS += -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid
+release: game
+
+game: $(EXEC)
clean:
rm -f $(EXEC)
rm -f out/*.o
-cleandata:
- rm -rf xml/*.dat
- rm -rf storyXML/*.dat
- rm brice.dat
- touch brice.dat
-
$(EXEC): $(CXXOUTDIR)/$(CXXOBJ) main.cpp
g++ -I. -std=c++11 -c entityx/help/Pool.cc -o out/Pool.o
g++ -I. -std=c++11 -c entityx/help/Timer.cc -o out/Timer.o
g++ -I. -std=c++11 -c entityx/System.cc -o out/System.o
@echo " CXX/LD main"
- @$(CXX) $(CXXFLAGS) $(CXXINC) $(CXXWARN) -o $(EXEC) main.cpp out/*.o $(LIBS)
+ @$(CXX) $(SPECIAL) $(CXXFLAGS) $(CXXINC) $(CXXWARN) -o $(EXEC) main.cpp out/*.o $(LIBS)
@rm -rf xml/*.dat
@rm -rf storyXML/*.dat
+#ifndef __WIN32__
+
#ifndef BMP_IMAGE_HPP
#define BMP_IMAGE_HPP
} __attribute__((packed)) BITMAPINFOHEADER;
#endif // BMP_IMAGE_HPP
+
+#endif // __WIN32__
\ No newline at end of file
float updateRate; /**< How often we will change each frame. */
float updateCurrent; /**< How much has been updated in the current frame. */
- uint updateType; /**< What the updateRate will base it's updates off of.
+ unsigned int updateType; /**< What the updateRate will base it's updates off of.
ie: Movement, attacking, jumping. */
- uint limbID; /**< The id of the limb we will be updating */
+ unsigned int limbID; /**< The id of the limb we will be updating */
- uint index = 0; /**< The current sprite being used for the limb. */
+ unsigned int index = 0; /**< The current sprite being used for the limb. */
std::vector<Frame> frame; /**< The multiple frames of each limb. */
};
// COMMENT
std::vector<Limb> limb;
// COMMENT
- uint index;
+ unsigned int index;
Animate(){
index = 0;
// COMMENT
- void firstFrame(uint updateType, Frame &sprite) {
- uint upid = updateType; //^see todo
+ void firstFrame(unsigned int updateType, Frame &sprite) {
+ unsigned int upid = updateType; //^see todo
for (auto &l : limb) {
if (l.updateType == upid) {
l.firstFrame(sprite);
}
}
//TODO make updateType an enum
- void updateAnimation(uint updateType, Frame& sprite, float dt) {
- uint upid = updateType; //^see todo
+ void updateAnimation(unsigned int updateType, Frame& sprite, float dt) {
+ unsigned int upid = updateType; //^see todo
for (auto &l : limb) {
if (l.updateType == upid) {
l.nextFrame(sprite, dt);
#include <atomic>
#include <chrono>
-#include <thread>
+#include <thread.hpp>
#include <entityx/entityx.h>
--- /dev/null
+#ifndef THREAD_HPP_
+#define THREAD_HPP_
+
+#ifndef __WIN32__
+#include <thread>
+#else
+#include <win32thread.hpp>
+#endif // __WIN32__
+
+#include <atomic>
+#include <entityx/entityx.h>
+
+class GameThread : public entityx::Receiver<GameThread> {
+private:
+ std::atomic_bool die;
+ std::thread thread;
+
+public:
+ GameThread(std::function<void(void)> func) {
+ die.store(false);
+ thread = std::thread([&](std::function<void(void)> f) {
+ while (!die.load())
+ f();
+ }, func);
+ }
+
+ ~GameThread(void) {
+ thread.join();
+ }
+
+ inline void stop(void) {
+ die.store(true);
+ }
+};
+
+#endif // THREAD_HPP_
\ No newline at end of file
#define WORLD_HPP_
#include <string>
-#include <thread>
#include <vector>
#include <SDL2/SDL_mixer.h>
#include <components.hpp>
#include <events.hpp>
#include <texture.hpp>
+#include <thread.hpp>
#include <vector2.hpp>
/**
#include <ui.hpp>
#include <inventory.hpp>
-class GameThread : public entityx::Receiver<GameThread> {
-private:
- std::atomic_bool die;
- std::thread thread;
-
-public:
- template<typename F>
- GameThread(F&& func) {
- die.store(false);
- thread = std::thread([this](F&& f) {
- while (!die.load())
- f();
- }, std::forward<F>(func));
- }
-
- ~GameThread(void) {
- thread.join();
- }
-
- void stop(void) {
- die.store(true);
- }
-};
-
/**
* The currently used folder to look for XML files in.
*/
// on game end, get back together
gtMain.stop();
gtDebug.stop();
+ gtFade.stop();
//game::engine.getSystem<WorldSystem>()->thAmbient.join(); // segfault or something
}
#include <iostream>
#include <list>
#include <sstream>
+#include <vector>
#include <error.hpp>
+#include <texture.hpp>
#ifndef __WIN32__
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
-#include <vector>
-
-#include <texture.hpp>
#endif // __WIN32__
std::vector<Frame> tmp;
SpriteData* sd;
- uint limb = 0;
+ unsigned int limb = 0;
vec2 foffset;
vec2 fsize;
auto entan = player.assign<Animate>();
auto animx = xmld.FirstChildElement()->FirstChildElement();
- uint limbid = 0;
+ unsigned int limbid = 0;
float limbupdate = 0;
- uint limbupdatetype = 0;
+ unsigned int limbupdatetype = 0;
while (animx) {
std::string animType = animx->Name();
#include <algorithm>
#include <string>
+#include <stdexcept>
#include <SDL2/SDL_image.h>
std::vector<GLubyte> bgr (SCREEN_WIDTH * SCREEN_HEIGHT * 3, 0);
- for(uint x = 0; x < SCREEN_WIDTH*SCREEN_HEIGHT*3; x+=3) {
+ for(unsigned int x = 0; x < SCREEN_WIDTH*SCREEN_HEIGHT*3; x+=3) {
bgr[x] = pixels[x+2];
bgr[x+1] = pixels[x+1];
bgr[x+2] = pixels[x];