Updates to compile with MinGW 7.2 + small fixes (#13)

* Added missing headers to compile with MinGW 7.2. Added support for Glad instead of GLEW with USE_GLAD.

* [BlockFurnace] Fixed smelting timer. Bit shifting u16(32) by <<16(32) is undefined behaviour.

* #undef M_PI and redefine to ensure portability
This commit is contained in:
exilief 2018-11-20 02:49:59 +01:00 committed by Quentin Bazin
parent 3b8124b795
commit 3984492e0b
8 changed files with 22 additions and 2 deletions

View File

@ -18,6 +18,8 @@
#include <glm/glm.hpp>
#undef M_PI
#define M_PI 3.14159265358979323846
#ifndef RADIANS_PER_DEGREES
#define RADIANS_PER_DEGREES (M_PI / 180.0f)
#endif

View File

@ -21,7 +21,11 @@
#include <OpenGL/gl.h>
#else
#ifdef __MINGW32__
#include <GL/glew.h>
#ifdef USE_GLAD
#include <GLAD/glad.h>
#else
#include <GL/glew.h>
#endif // USE_GLAD, else GLEW
#else
#include <GL/gl.h>
#endif

View File

@ -18,6 +18,8 @@
#include "RenderStates.hpp"
#undef M_PI
#define M_PI 3.14159265358979323846
#ifndef RADIANS_PER_DEGREES
#define RADIANS_PER_DEGREES (M_PI / 180.0f)
#endif

View File

@ -42,9 +42,15 @@ void Application::init() {
void Application::initOpenGL() {
#ifdef __MINGW32__
#ifdef USE_GLAD
if(!gladLoadGL()) {
throw EXCEPTION("OpenGL init failed");
}
#else
if(glewInit() != GLEW_OK) {
throw EXCEPTION("glew init failed");
}
#endif // USE_GLAD, else GLEW
#endif
glEnable(GL_BLEND);

View File

@ -11,6 +11,8 @@
*
* =====================================================================================
*/
#include <ctime>
#include "CoreApplication.hpp"
#include "Exception.hpp"
// #include "GamePad.hpp"

View File

@ -86,6 +86,6 @@ void BlockFurnace::onTick(const glm::ivec3 &blockPosition, Player &, Chunk &, Wo
data->inventory.setStack(1, 0, recipe->result().item().id(), outputStack.amount() + recipe->result().amount());
}
data->data = ticksRemaining | (currentBurnTime << 16) | ((u32)itemProgress << 32);
data->data = ticksRemaining | ((u32)currentBurnTime << 16) | ((u64)itemProgress << 32);
}

View File

@ -11,6 +11,8 @@
*
* =====================================================================================
*/
#include <cstring>
#include "Chunk.hpp"
#include "GameClock.hpp"
#include "Registry.hpp"

View File

@ -11,6 +11,8 @@
*
* =====================================================================================
*/
#include <cstring>
#include "Chunk.hpp"
#include "ChunkLightmap.hpp"
#include "Registry.hpp"