diff options
Diffstat (limited to 'include/common.hpp')
-rw-r--r-- | include/common.hpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/include/common.hpp b/include/common.hpp index bbe852f..73b4928 100644 --- a/include/common.hpp +++ b/include/common.hpp @@ -12,10 +12,15 @@ #include <iostream> #include <string> #include <vector> -#include <thread> #include <cmath> #include <algorithm> +#ifndef __WIN32__ +# include <thread> +#else +# include <win32thread.hpp> +#endif // __WIN32__ + #include <shader_utils.hpp> #define GLEW_STATIC @@ -218,12 +223,7 @@ void safeSetColor(int r,int g,int b); */ void safeSetColorA(int r,int g,int b,int a); -// use our own millis function if we can, windows doesn't like <chrono> at the moment... -#ifdef __WIN32__ -#define millis() SDL_GetTicks() -#else unsigned int millis(void); -#endif // __WIN32__ // reads the names of files in a directory into the given string vector int getdir(std::string dir, std::vector<std::string> &files); @@ -240,10 +240,7 @@ void UserError(std::string reason); namespace std { template<class T> constexpr const T& clamp(const T& v, const T& lo, const T& hi) { - if (v < hi) - return (v > lo) ? v : lo; - else - return (v < hi) ? v : hi; + return (v > hi) ? ((v > lo) ? v : lo) : hi; } } |