Open source Star Ruler 2 source code!

This commit is contained in:
Lucas de Vries
2018-07-17 14:15:37 +02:00
commit cc307720ff
4342 changed files with 2365070 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
#pragma once
#include <GL/glew.h>
#include "GLFW/glfw3.h"
+7
View File
@@ -0,0 +1,7 @@
#ifdef _MSC_VER
#include <intrin.h>
#define PREFETCH(x) _mm_prefetch(x, _MM_HINT_T0)
#endif
#ifdef __GNUC__
#define PREFETCH(x) __builtin_prefetch(x, 0, 3)
#endif
+39
View File
@@ -0,0 +1,39 @@
#pragma once
#if defined(_MSC_VER)
#ifdef _DEBUG
#define NO_DEFAULT default: throw 0;
#define UNREACHABLE throw 0;
#else
#define NO_DEFAULT default: __assume(0);
#define UNREACHABLE __assume(0);
#endif
#else
#ifdef _DEBUG
#define NO_DEFAULT default: throw 0;
#define UNREACHABLE throw 0;
#else
#define NO_DEFAULT default: __builtin_unreachable();
#define UNREACHABLE __builtin_unreachable();
#endif
#endif
#define foreach(var, cont) for(auto var = cont.begin(), end = cont.end(); var != end; ++var)
#ifdef WIN_MODE
#define unsigned_enum(name) enum name : unsigned
#else
#ifdef LIN_MODE
#define unsigned_enum(name) enum name
#endif
#endif
#define umap std::unordered_map
#define uset std::unordered_set
#define INIT_FUNC(name) namespace __init__##name { struct init { init()
#define INIT_FUNC_END } v; };
#define INIT_VAR(var) var; namespace __init__##var { struct init { init()
#define INIT_VAR_END } v; };
+33
View File
@@ -0,0 +1,33 @@
#ifdef WIN_MODE
#include <regex>
typedef std::regex regex;
typedef std::match_results<std::string::const_iterator> reg_result;
#define reg_compile(r, c)\
static regex r = std::regex(c)
#define reg_match(str, m, r)\
std::regex_match(str.cbegin(), str.cend(), m, r)
#define reg_str(str, m, i)\
m[i]
#else
#include <regex.h>
typedef regex_t* regex;
typedef regmatch_t reg_result[16];
#define reg_compile(r, c) \
static regex r = 0;\
if(!r) {\
r = new regex_t();\
regcomp(r, c, REG_EXTENDED);\
}
#define reg_match(str, m, r)\
!regexec(r, str.c_str(), 16, m, 0)
#define reg_str(str, m, i)\
str.substr(m[i].rm_so, m[i].rm_eo - m[i].rm_so)
#endif