summaryrefslogtreecommitdiffstats
path: root/src/Utility.cpp
diff options
context:
space:
mode:
authorElisey Puzko <puzko.e02@gmail.com>2018-02-25 12:49:36 +0100
committerElisey Puzko <puzko.e02@gmail.com>2018-02-25 12:50:23 +0100
commit78221efae3c038e2c21cb553891d9de8c37cf809 (patch)
treef5d7dea2c6dc5a3d2feb8f4c0413f83beef61793 /src/Utility.cpp
parentSome nice hack to avoid conflict of std::min and min macro (diff)
downloadAltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.tar
AltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.tar.gz
AltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.tar.bz2
AltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.tar.lz
AltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.tar.xz
AltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.tar.zst
AltCraft-78221efae3c038e2c21cb553891d9de8c37cf809.zip
Diffstat (limited to 'src/Utility.cpp')
-rw-r--r--src/Utility.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/Utility.cpp b/src/Utility.cpp
index c498fa3..848ee02 100644
--- a/src/Utility.cpp
+++ b/src/Utility.cpp
@@ -5,41 +5,41 @@
#include <easylogging++.h>
GLenum glCheckError_(const char *file, int line) {
- GLenum errorCode;
- while ((errorCode = glGetError()) != GL_NO_ERROR) {
- std::string error;
- switch (errorCode) {
- case GL_INVALID_ENUM:
- error = "INVALID_ENUM";
- break;
- case GL_INVALID_VALUE:
- error = "INVALID_VALUE";
- break;
- case GL_INVALID_OPERATION:
- error = "INVALID_OPERATION";
- break;
- case GL_STACK_OVERFLOW:
- error = "STACK_OVERFLOW";
- break;
- case GL_STACK_UNDERFLOW:
- error = "STACK_UNDERFLOW";
- break;
- case GL_OUT_OF_MEMORY:
- error = "OUT_OF_MEMORY";
- break;
- case GL_INVALID_FRAMEBUFFER_OPERATION:
- error = "INVALID_FRAMEBUFFER_OPERATION";
- break;
- }
- static int t = 0;
- LOG(ERROR) << "OpenGL error: " << error << " at " << file << ":" << line;
- }
- return errorCode;
+ GLenum errorCode;
+ while ((errorCode = glGetError()) != GL_NO_ERROR) {
+ std::string error;
+ switch (errorCode) {
+ case GL_INVALID_ENUM:
+ error = "INVALID_ENUM";
+ break;
+ case GL_INVALID_VALUE:
+ error = "INVALID_VALUE";
+ break;
+ case GL_INVALID_OPERATION:
+ error = "INVALID_OPERATION";
+ break;
+ case GL_STACK_OVERFLOW:
+ error = "STACK_OVERFLOW";
+ break;
+ case GL_STACK_UNDERFLOW:
+ error = "STACK_UNDERFLOW";
+ break;
+ case GL_OUT_OF_MEMORY:
+ error = "OUT_OF_MEMORY";
+ break;
+ case GL_INVALID_FRAMEBUFFER_OPERATION:
+ error = "INVALID_FRAMEBUFFER_OPERATION";
+ break;
+ }
+ static int t = 0;
+ LOG(ERROR) << "OpenGL error: " << error << " at " << file << ":" << line;
+ }
+ return errorCode;
}
LoopExecutionTimeController::LoopExecutionTimeController(duration delayLength)
- : delayLength(delayLength) {
- previousUpdate = clock::now();
+ : delayLength(delayLength) {
+ previousUpdate = clock::now();
}
LoopExecutionTimeController::~LoopExecutionTimeController() {
@@ -47,16 +47,16 @@ LoopExecutionTimeController::~LoopExecutionTimeController() {
}
void LoopExecutionTimeController::SetDelayLength(duration length) {
- delayLength = length;
+ delayLength = length;
}
unsigned long long LoopExecutionTimeController::GetIterations() {
- return iterations;
+ return iterations;
}
void LoopExecutionTimeController::Update() {
- iterations++;
- auto timeToSleep = delayLength - GetDelta();
+ iterations++;
+ auto timeToSleep = delayLength - GetDelta();
if (timeToSleep.count() > 0)
std::this_thread::sleep_for(timeToSleep);
previousPreviousUpdate = previousUpdate;
@@ -69,8 +69,8 @@ double LoopExecutionTimeController::GetDeltaMs() {
}
LoopExecutionTimeController::duration LoopExecutionTimeController::GetDelta() {
- auto now = clock::now();
- return duration(now-previousUpdate);
+ auto now = clock::now();
+ return duration(now-previousUpdate);
}
double LoopExecutionTimeController::GetDeltaS() {