Get rid of Loki
This commit is contained in:
1 parent
15a2cbe410
commit
ef0392fb63
27 files changed
+92
-52
No files matched your search
Regular → Executable
+2
-2
@@ -23,7 +23,7 @@
|
||||
#ifndef UTIL_ANIMATION_H
|
||||
#define UTIL_ANIMATION_H
|
||||
#include <vector>
|
||||
#include "Functor.h"
|
||||
#include <functional>
|
||||
#include "log.h"
|
||||
|
||||
namespace Util {
|
||||
@@ -56,7 +56,7 @@ namespace Util {
|
||||
inline const OnDone & getDone() const { return onDone; }
|
||||
void jumpToFrame(const uint16_t num, const Status andDo);
|
||||
void update(const uint32_t & nowTicks);
|
||||
typedef Loki::Functor<void> CallbackType;
|
||||
typedef std::function<void()> CallbackType;
|
||||
void setCallback(CallbackType & cb) { callback = cb; }
|
||||
|
||||
uint16_t currentFrame;
|
||||
|
||||
Regular → Executable
+1
-2
@@ -110,7 +110,6 @@ namespace Util {
|
||||
|
||||
/** Instance of BufferCache.
|
||||
*/
|
||||
typedef SingletonHolder<BufferCache, CreateUsingNew, DefaultLifetime,
|
||||
SingleThreaded> BufferCacheHolder;
|
||||
typedef SingletonHolder<BufferCache> BufferCacheHolder;
|
||||
}
|
||||
#endif
|
||||
Regular → Executable
+1
@@ -23,6 +23,7 @@
|
||||
#include <cstdlib>
|
||||
#include <physfs.h>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include "m_exceptions.h"
|
||||
#include "file_helper.h"
|
||||
#include "buffercache.h"
|
||||
|
||||
Regular → Executable
+1
-2
@@ -47,8 +47,7 @@ namespace Util {
|
||||
std::string userHomeDir;
|
||||
};
|
||||
|
||||
typedef Loki::SingletonHolder<FileHelper, Loki::CreateUsingNew, Loki::DefaultLifetime,
|
||||
Loki::SingleThreaded> FileHelperHolder;
|
||||
typedef Loki::SingletonHolder<FileHelper> FileHelperHolder;
|
||||
}
|
||||
#define GET_FILE_HELPER Util::FileHelperHolder::Instance()
|
||||
|
||||
|
||||
Regular → Executable
+3
-3
@@ -85,8 +85,7 @@ namespace GUI {
|
||||
|
||||
};
|
||||
|
||||
typedef Loki::SingletonHolder<Manager, Loki::CreateUsingNew, Loki::DefaultLifetime,
|
||||
Loki::SingleThreaded> ManagerHolder;
|
||||
typedef Loki::SingletonHolder<Manager> ManagerHolder;
|
||||
|
||||
class Animation : public Util::Animation {
|
||||
public:
|
||||
@@ -196,7 +195,8 @@ namespace GUI {
|
||||
void receive(SDL_MouseButtonEvent & mb_event);
|
||||
SDL_Color innerColor;
|
||||
float value;
|
||||
typedef Loki::Functor<void, LOKI_TYPELIST_1(float)> SC_Functor;
|
||||
//typedef Loki::Functor<void, LOKI_TYPELIST_1(float)> SC_Functor;
|
||||
typedef std::function<void(float)> SC_Functor;
|
||||
SC_Functor changeCB;
|
||||
};
|
||||
|
||||
|
||||
+14
-2
@@ -1,7 +1,18 @@
|
||||
#include "map_helper.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
|
||||
namespace Util {
|
||||
|
||||
SpriteCreationArea::SpriteCreationArea()
|
||||
{
|
||||
std::srand(unsigned(std::time(0)));
|
||||
}
|
||||
|
||||
|
||||
void SpriteCreationArea::setRects(const SDL_Rect & allowed, const SDL_Rect & denied) {
|
||||
validRects = std::make_pair(allowed, denied);
|
||||
onScreen = denied;
|
||||
@@ -23,8 +34,9 @@ namespace Util {
|
||||
}
|
||||
|
||||
TupleOfUint8 SpriteCreationArea::getValidCoord() {
|
||||
uint32_t x = rnd.nextUint(validRects.first.w) + validRects.first.x;
|
||||
uint32_t y = rnd.nextUint(validRects.first.h) + validRects.first.y;
|
||||
uint32_t x = std::rand() % validRects.first.w + validRects.first.x;
|
||||
uint32_t y = std::rand() % validRects.first.h + validRects.first.y;
|
||||
|
||||
return std::make_pair(x, y);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@
|
||||
#include <SDL_video.h>
|
||||
#include <cassert> // yasli/random.h needs it
|
||||
#include "math3d.h"
|
||||
#include "yasli/random.h"
|
||||
//#include "yasli/random.h"
|
||||
|
||||
namespace Util {
|
||||
typedef std::pair<SDL_Rect, SDL_Rect> TupleOfRects;
|
||||
@@ -15,11 +15,11 @@ namespace Util {
|
||||
|
||||
class SpriteCreationArea {
|
||||
public:
|
||||
SpriteCreationArea();
|
||||
//ListOfTupleOfRects validTuple;
|
||||
TupleOfRects validRects;
|
||||
void setRects(const SDL_Rect & allowed, const SDL_Rect & denied);
|
||||
TupleOfUint8 getValidCoord();
|
||||
Random rnd;
|
||||
bool isOnScreen(const Vector3D & p);
|
||||
bool isOffScreen(const Vector3D & p);
|
||||
private:
|
||||
|
||||
Regular → Executable
+1
-2
@@ -70,8 +70,7 @@ namespace Audio {
|
||||
m_map.clear();
|
||||
}
|
||||
|
||||
typedef Loki::SingletonHolder< SampleCache , Loki::CreateUsingNew,
|
||||
Loki::DefaultLifetime, Loki::SingleThreaded> SampleCacheHolder;
|
||||
typedef Loki::SingletonHolder< SampleCache> SampleCacheHolder;
|
||||
}
|
||||
|
||||
#endif
|
||||
Regular → Executable
+1
-2
@@ -28,8 +28,7 @@ namespace Audio {
|
||||
Audio::SoundDevice::OPEN); }
|
||||
};
|
||||
|
||||
typedef Loki::SingletonHolder<Mixer, Loki::CreateUsingNew,
|
||||
Loki::DefaultLifetime, Loki::SingleThreaded> MixerHolder;
|
||||
typedef Loki::SingletonHolder<Mixer> MixerHolder;
|
||||
}
|
||||
|
||||
#endif
|
||||
Regular → Executable
+3
-2
@@ -25,11 +25,12 @@
|
||||
#ifdef WITH_SOUND
|
||||
|
||||
#include <SDL_sound.h>
|
||||
#include "Functor.h"
|
||||
#include <functional>
|
||||
|
||||
namespace Audio {
|
||||
static int music_volume = 127;
|
||||
typedef Loki::Functor<void> MusicFinishedCallbackType;
|
||||
//typedef Loki::Functor<void> MusicFinishedCallbackType;
|
||||
typedef std::function<void()> MusicFinishedCallbackType;
|
||||
|
||||
struct MusicPlayerCtrl {
|
||||
static bool isPlaying;
|
||||
|
||||
Regular → Executable
+3
-4
@@ -24,7 +24,7 @@
|
||||
#define OGTA_TIMER_H
|
||||
#include <map>
|
||||
#include "Singleton.h"
|
||||
#include "Functor.h"
|
||||
#include <functional>
|
||||
|
||||
// instead of SDL_GetTicks()
|
||||
#define TIMER_OPENSTEER_CLOCK
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
class Timer {
|
||||
public:
|
||||
typedef Loki::Functor<void, LOKI_TYPELIST_1(float)> CallbackType;
|
||||
typedef std::function<void(float)> CallbackType;
|
||||
struct TimeEvent {
|
||||
TimeEvent(const uint32_t & b, const uint32_t e, CallbackType & c);
|
||||
TimeEvent(const uint32_t & b, CallbackType & c);
|
||||
@@ -73,7 +73,6 @@ class Timer {
|
||||
SimTimeMap simTimeEvents;
|
||||
};
|
||||
|
||||
typedef Loki::SingletonHolder<Timer, Loki::CreateUsingNew,
|
||||
Loki::DefaultLifetime, Loki::SingleThreaded> TimerHolder;
|
||||
typedef Loki::SingletonHolder<Timer> TimerHolder;
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user