aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.hpp3
-rw-r--r--include/error.hpp7
-rw-r--r--include/texture.hpp3
-rw-r--r--include/vector2.hpp5
4 files changed, 16 insertions, 2 deletions
diff --git a/include/common.hpp b/include/common.hpp
index b9be831..9ecd912 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -5,6 +5,9 @@
#ifndef COMMON_HPP_
#define COMMON_HPP_
+#include <algorithm>
+#include <cctype>
+
// windows stuff
#ifdef __WIN32__
using uint = unsigned int;
diff --git a/include/error.hpp b/include/error.hpp
index ef61c91..c435889 100644
--- a/include/error.hpp
+++ b/include/error.hpp
@@ -4,9 +4,12 @@
#include <string>
#include <iostream>
-inline void UserError(const std::string& why)
+#define UserError(w) _UserError(__FILE__, __LINE__, w)
+#define UserAssert(c, e) if (!(c)) { UserError(e); }
+
+inline void _UserError(const char* file, int line, const std::string& why)
{
- std::cout << "User error: " << why << "!\n";
+ std::cout << file << ':' << line << ": error: " << why << "!\n";
abort();
}
diff --git a/include/texture.hpp b/include/texture.hpp
index fb4e588..25f73a5 100644
--- a/include/texture.hpp
+++ b/include/texture.hpp
@@ -41,9 +41,12 @@ public:
* @param file the path to the desired texture
* @param t the GLuint for the texture, if known
* @param v the size of the texture, if known
+ * @param hline if true, divides texture dim. by HLINE
*/
Texture(const std::string& file = "", const GLuint& t = 0xFFFFF, const vec2& v = vec2(0, 0));
+ Texture(const std::string& file, bool hline);
+
/**
* Gets the name (path) of the loaded texture.
* @return the texture's name
diff --git a/include/vector2.hpp b/include/vector2.hpp
index d335a4b..c1148da 100644
--- a/include/vector2.hpp
+++ b/include/vector2.hpp
@@ -66,6 +66,11 @@ struct vector2 {
return vector2<T>(x / n, y / n);
}
+ vector2<T> operator/=(const T& n) {
+ x /= n, y /= n;
+ return *this;
+ }
+
// compare
bool operator==(const vector2<T>& v) const {
return (x == v.x) && (y == v.y);