Browse Source

Remove some C++14 code, fixes C++11 and GCC compatibility, closes #3 hopefully (thanks @Barotto)

Michael Ragazzon 6 years ago
parent
commit
ad74d3d6c6

+ 4 - 0
Include/Rocket/Core/Animation.h

@@ -63,6 +63,10 @@ struct TransitionList {
 	bool none = true;
 	bool all = false;
 	std::vector<Transition> transitions;
+
+	TransitionList() {}
+	TransitionList(bool none, bool all, std::vector<Transition> transitions) :
+		none(none), all(all), transitions(transitions) {}
 };
 
 inline bool operator==(const Animation& a, const Animation& b) { return a.duration == b.duration && a.tween == b.tween && a.delay == b.delay && a.alternate == b.alternate && a.paused == b.paused && a.num_iterations == b.num_iterations && a.name == b.name; }

+ 2 - 0
Include/Rocket/Core/Vector2.h

@@ -31,6 +31,8 @@
 #include "Debug.h"
 #include "Math.h"
 
+#include <cmath>
+
 namespace Rocket {
 namespace Core {
 

+ 1 - 1
Include/Rocket/Core/Vector3.inl

@@ -70,7 +70,7 @@ Vector3< Type > Vector3< Type >::Normalise() const
 }
 
 template <>
-Vector3< float > Vector3< float >::Normalise() const
+inline Vector3< float > Vector3< float >::Normalise() const
 {
 	float magnitude = Magnitude();
 	if (Math::IsZero(magnitude))

+ 3 - 3
Source/Core/Element.cpp

@@ -2644,7 +2644,7 @@ void Element::UpdateTransformState()
 			if (have_perspective && context)
 			{
 				if (!transform_state)
-					transform_state = std::make_unique<TransformState>();
+					transform_state.reset(new TransformState);
 				perspective_value.view_size = context->GetDimensions();
 				transform_state->SetPerspective(&perspective_value);
 			}
@@ -2750,7 +2750,7 @@ void Element::UpdateTransformState()
 			if (have_local_perspective && context)
 			{
 				if (!transform_state)
-					transform_state = std::make_unique<TransformState>();
+					transform_state.reset(new TransformState);
 				local_perspective.view_size = context->GetDimensions();
 				transform_state->SetLocalPerspective(&local_perspective);
 			}
@@ -2773,7 +2773,7 @@ void Element::UpdateTransformState()
 					* Matrix4f::Translate(-transform_origin);
 
 				if (!transform_state)
-					transform_state = std::make_unique<TransformState>();
+					transform_state.reset(new TransformState);
 				transform_state->SetTransform(&transform_value);
 			}
 			else if (transform_state)

+ 1 - 1
Source/Core/ElementAnimation.cpp

@@ -118,7 +118,7 @@ static Property InterpolateProperties(const Property & p0, const Property& p1, f
 		using namespace Rocket::Core::Transforms;
 
 		// Build the new, interpolating transform
-		auto t = std::make_unique<Transform>();
+		std::unique_ptr<Transform> t(new Transform);
 
 		auto t0 = p0.value.Get<TransformRef>();
 		auto t1 = p1.value.Get<TransformRef>();

+ 1 - 1
Source/Core/PropertyParserTransform.cpp

@@ -53,7 +53,7 @@ bool PropertyParserTransform::ParseValue(Property& property, const String& value
 		return true;
 	}
 
-	auto transform = std::make_unique<Transform>();
+	std::unique_ptr<Transform> transform(new Transform);
 
 	char const* next = value.CString();