Skip to content

Commit

Permalink
Fix compilation error with MinGW-w64 6.1 and SFML 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlevasseur committed Aug 12, 2016
1 parent b0abd8e commit 43d8e3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion yapg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(ENTITYX_STATIC_LIBRARY "${CMAKE_SOURCE_DIR}/libs/entityx/bin/libentityx.a")
target_include_directories(yapg-game PUBLIC ${ENTITYX_INCLUDE_DIR})

#SFML lib
find_package(SFML 2.3 REQUIRED system window graphics audio)
find_package(SFML 2 REQUIRED system window graphics audio)
target_include_directories(yapg-game PUBLIC ${SFML_INCLUDE_DIR})

#OpenGL
Expand Down
8 changes: 4 additions & 4 deletions yapg/Sources/Platformer/PlatformerSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ void PlatformerSystem::update(entityx::EntityManager &es, entityx::EventManager
while(IsCollidingObstacle(polygon, polygonTransform, potentialObstacles, NO_EXCEPTIONS, PlatformComponent::Platform))
{
//Try to move the object on Y-axis to support slopes
polygonTransform.translate(0.f, -1-ceil(abs(requestedXMove)));
polygonTransform.translate(0.f, -1-ceil(std::fabs(requestedXMove)));
if(!IsCollidingObstacle(polygon, polygonTransform, potentialObstacles, NO_EXCEPTIONS, PlatformComponent::Platform))
{
requestedYMove += -1-ceil(abs(requestedXMove));
requestedYMove += -1-ceil(std::fabs(requestedXMove));

//Drop the object onto the obstacle
while(!IsCollidingObstacle(polygon, polygonTransform, potentialObstacles, NO_EXCEPTIONS, PlatformComponent::Platform))
Expand Down Expand Up @@ -373,7 +373,7 @@ void PlatformerSystem::update(entityx::EntityManager &es, entityx::EventManager
}

//Ignore micro movement to avoid the "shaking" effect
if(abs(requestedFall) < 1.f)
if(std::fabs(requestedFall) < 1.f)
{
requestedYMove -= requestedFall;
polygonTransform.translate(0.f, -requestedFall);
Expand Down Expand Up @@ -412,7 +412,7 @@ void PlatformerSystem::update(entityx::EntityManager &es, entityx::EventManager
//Call the movement callbacks
if(IsOnFloor(polygon, polygonTransform, potentialObstacles, overlappingJumpthrus))
{
if(abs(position.x - oldX - requestedXFloorMove) > 0.1f)
if(std::fabs(position.x - oldX - requestedXFloorMove) > 0.1f)
platformer.movementStateCallbacks.setState(PlatformerComponent::Walking);
else
platformer.movementStateCallbacks.setState(PlatformerComponent::Idle);
Expand Down

0 comments on commit 43d8e3d

Please sign in to comment.