Forráskód Böngészése

Remove unused headers, forward declare instead where possible. Move Tween functions into cpp-file. Remove Stream conversion to/from String through type converter.

Michael Ragazzon 5 éve
szülő
commit
7d37ea414e
77 módosított fájl, 366 hozzáadás és 309 törlés
  1. 1 0
      CMake/FileList.cmake
  2. 1 1
      Include/RmlUi/Controls/ElementDataGridRow.h
  3. 1 3
      Include/RmlUi/Core/BaseXMLParser.h
  4. 1 1
      Include/RmlUi/Core/DecoratorInstancer.h
  5. 3 2
      Include/RmlUi/Core/ElementInstancer.h
  6. 1 1
      Include/RmlUi/Core/ElementUtilities.h
  7. 0 1
      Include/RmlUi/Core/EventInstancer.h
  8. 0 2
      Include/RmlUi/Core/PropertyDictionary.h
  9. 1 2
      Include/RmlUi/Core/PropertyParser.h
  10. 1 2
      Include/RmlUi/Core/PropertySpecification.h
  11. 0 1
      Include/RmlUi/Core/Stream.h
  12. 1 1
      Include/RmlUi/Core/StyleSheet.h
  13. 1 1
      Include/RmlUi/Core/Transform.h
  14. 19 176
      Include/RmlUi/Core/Tween.h
  15. 0 1
      Include/RmlUi/Core/TypeConverter.h
  16. 0 63
      Include/RmlUi/Core/TypeConverter.inl
  17. 4 11
      Include/RmlUi/Core/Types.h
  18. 3 2
      Include/RmlUi/Core/XMLNodeHandler.h
  19. 2 1
      Include/RmlUi/Core/XMLParser.h
  20. 1 0
      Samples/invaders/src/DecoratorInstancerDefender.cpp
  21. 1 0
      Samples/invaders/src/DecoratorInstancerStarfield.cpp
  22. 2 2
      Samples/invaders/src/Game.h
  23. 1 0
      Samples/luainvaders/src/DecoratorInstancerDefender.cpp
  24. 1 0
      Samples/luainvaders/src/DecoratorInstancerStarfield.cpp
  25. 2 2
      Samples/luainvaders/src/Game.h
  26. 1 0
      Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp
  27. 1 0
      Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp
  28. 1 1
      Source/Controls/ElementDataGridRow.cpp
  29. 1 0
      Source/Controls/ElementProgressBar.cpp
  30. 1 0
      Source/Controls/WidgetDropDown.cpp
  31. 1 0
      Source/Controls/WidgetSliderInput.cpp
  32. 2 0
      Source/Core/BaseXMLParser.cpp
  33. 1 0
      Source/Core/DecoratorGradient.cpp
  34. 1 0
      Source/Core/DecoratorNinePatch.cpp
  35. 0 2
      Source/Core/Element.cpp
  36. 4 1
      Source/Core/ElementAnimation.cpp
  37. 1 0
      Source/Core/ElementBackground.cpp
  38. 1 1
      Source/Core/ElementBackground.h
  39. 1 0
      Source/Core/ElementBorder.cpp
  40. 1 1
      Source/Core/ElementBorder.h
  41. 1 0
      Source/Core/ElementDecoration.cpp
  42. 5 1
      Source/Core/ElementImage.cpp
  43. 0 1
      Source/Core/ElementStyle.cpp
  44. 1 0
      Source/Core/FontEffectBlur.cpp
  45. 1 0
      Source/Core/FontEffectGlow.cpp
  46. 1 0
      Source/Core/FontEffectInstancer.cpp
  47. 1 0
      Source/Core/FontEffectOutline.cpp
  48. 1 0
      Source/Core/FontEffectShadow.cpp
  49. 1 0
      Source/Core/IdNameMap.h
  50. 1 0
      Source/Core/LayoutBlockBox.cpp
  51. 1 2
      Source/Core/LayoutEngine.cpp
  52. 1 0
      Source/Core/LayoutLineBox.cpp
  53. 1 0
      Source/Core/Lua/LuaDocument.cpp
  54. 3 2
      Source/Core/PropertyParserAnimation.cpp
  55. 2 2
      Source/Core/PropertyParserColour.h
  56. 1 0
      Source/Core/PropertyParserTransform.cpp
  57. 1 0
      Source/Core/PropertySpecification.cpp
  58. 1 1
      Source/Core/Stream.cpp
  59. 1 1
      Source/Core/StyleSheet.cpp
  60. 1 1
      Source/Core/StyleSheetNode.cpp
  61. 4 1
      Source/Core/StyleSheetParser.cpp
  62. 1 0
      Source/Core/StyleSheetSpecification.cpp
  63. 1 1
      Source/Core/TemplateCache.h
  64. 1 1
      Source/Core/TextureDatabase.h
  65. 1 1
      Source/Core/TextureLayout.cpp
  66. 2 2
      Source/Core/TextureLayout.h
  67. 1 1
      Source/Core/TextureLayoutRow.h
  68. 1 1
      Source/Core/TextureLayoutTexture.h
  69. 1 0
      Source/Core/TextureResource.cpp
  70. 2 2
      Source/Core/TextureResource.h
  71. 242 0
      Source/Core/Tween.cpp
  72. 1 1
      Source/Core/TypeConverter.cpp
  73. 2 0
      Source/Core/XMLNodeHandlerDefault.cpp
  74. 7 1
      Source/Core/XMLNodeHandlerHead.cpp
  75. 0 1
      Source/Core/XMLNodeHandlerHead.h
  76. 1 1
      Source/Core/XMLParseTools.h
  77. 6 2
      Source/Core/XMLParser.cpp

+ 1 - 0
CMake/FileList.cmake

@@ -301,6 +301,7 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/Transform.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/TransformPrimitive.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/TransformState.cpp
+    ${PROJECT_SOURCE_DIR}/Source/Core/Tween.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/TypeConverter.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/URL.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Variant.cpp

+ 1 - 1
Include/RmlUi/Controls/ElementDataGridRow.h

@@ -134,7 +134,7 @@ private:
 	// refreshed or not being loaded yet) and reloads them.
 	void LoadChildren(float time_slice);
 	// Loads a specific set of children. Called by the above function.
-	void LoadChildren(int first_row_to_load, int num_rows_to_load, Rml::Core::Time time_slice);
+	void LoadChildren(int first_row_to_load, int num_rows_to_load, double time_slice);
 
 	// Sets the dirty_cells flag on this row, and lets our ancestors know.
 	void DirtyCells();

+ 1 - 3
Include/RmlUi/Core/BaseXMLParser.h

@@ -32,14 +32,12 @@
 #include "Header.h"
 #include "Types.h"
 #include "Dictionary.h"
-#include <set>
 
 namespace Rml {
 namespace Core {
 
 class Stream;
-
-typedef Dictionary XMLAttributes;
+using XMLAttributes = Dictionary;
 
 /**
 	@author Peter Curry

+ 1 - 1
Include/RmlUi/Core/DecoratorInstancer.h

@@ -40,7 +40,7 @@ struct Sprite;
 class StyleSheet;
 class Decorator;
 class DecoratorInstancerInterface;
-
+class PropertyDefinition;
 
 /**
 	An element instancer provides a method for allocating and deallocating decorators.

+ 3 - 2
Include/RmlUi/Core/ElementInstancer.h

@@ -30,14 +30,15 @@
 #define RMLUICOREELEMENTINSTANCER_H
 
 #include "Traits.h"
-#include "XMLParser.h"
+#include "Types.h"
 #include "Header.h"
-#include "Element.h"
+#include "Profiling.h"
 
 namespace Rml {
 namespace Core {
 
 class Element;
+using XMLAttributes = Dictionary;
 
 /**
 	An element instancer provides a method for allocating

+ 1 - 1
Include/RmlUi/Core/ElementUtilities.h

@@ -30,12 +30,12 @@
 #define RMLUICOREELEMENTUTILITIES_H
 
 #include "Header.h"
-#include "Box.h"
 #include "Types.h"
 
 namespace Rml {
 namespace Core {
 
+class Box;
 class Context;
 class RenderInterface;
 namespace Style { struct ComputedValues; }

+ 0 - 1
Include/RmlUi/Core/EventInstancer.h

@@ -32,7 +32,6 @@
 #include "Traits.h"
 #include "Header.h"
 #include "Types.h"
-#include "ID.h"
 
 namespace Rml {
 namespace Core {

+ 0 - 2
Include/RmlUi/Core/PropertyDictionary.h

@@ -35,8 +35,6 @@
 namespace Rml {
 namespace Core {
 
-
-
 /**
 	A dictionary to property names to values.
 

+ 1 - 2
Include/RmlUi/Core/PropertyParser.h

@@ -31,12 +31,11 @@
 
 #include "Header.h"
 #include "Property.h"
-#include <map>
 
 namespace Rml {
 namespace Core {
 
-typedef UnorderedMap< String, int > ParameterMap;
+using ParameterMap = UnorderedMap< String, int >;
 
 /**
 	A property parser takes a property declaration in string form, validates it, and converts it to a Property.

+ 1 - 2
Include/RmlUi/Core/PropertySpecification.h

@@ -30,14 +30,13 @@
 #define RMLUICOREPROPERTYSPECIFICATION_H
 
 #include "Header.h"
-#include "Element.h"
-#include "PropertyDefinition.h"
 #include "PropertyIdSet.h"
 
 namespace Rml {
 namespace Core {
 
 class StyleSheetSpecification;
+class PropertyDefinition;
 class PropertyDictionary;
 class PropertyIdNameMap;
 class ShorthandIdNameMap;

+ 0 - 1
Include/RmlUi/Core/Stream.h

@@ -33,7 +33,6 @@
 #include "Traits.h"
 #include "Types.h"
 #include "URL.h"
-#include <list>
 
 namespace Rml {
 namespace Core {

+ 1 - 1
Include/RmlUi/Core/StyleSheet.h

@@ -32,7 +32,6 @@
 #include "Traits.h"
 #include "PropertyDictionary.h"
 #include "Spritesheet.h"
-#include <set>
 
 namespace Rml {
 namespace Core {
@@ -43,6 +42,7 @@ class StyleSheetNode;
 class Decorator;
 class FontEffect;
 class SpritesheetList;
+class Stream;
 struct Sprite;
 struct Spritesheet;
 

+ 1 - 1
Include/RmlUi/Core/Transform.h

@@ -51,7 +51,7 @@ class Property;
 class RMLUICORE_API Transform
 {
 public:
-	typedef std::vector< Transforms::Primitive > Primitives;
+	using Primitives = std::vector< Transforms::Primitive >;
 
 	/// Default constructor, initializes an identity transform
 	Transform();

+ 19 - 176
Include/RmlUi/Core/Tween.h

@@ -28,197 +28,40 @@
 #ifndef RMLUICORETWEEN_H
 #define RMLUICORETWEEN_H
 
-#include <array>
-#include "Math.h"
+#include <string>
+#include "Header.h"
 
 namespace Rml {
 namespace Core {
 
+using String = std::string;
 
-class Tween {
+class RMLUICORE_API Tween {
 public:
 	enum Type { None, Back, Bounce, Circular, Cubic, Elastic, Exponential, Linear, Quadratic, Quartic, Quintic, Sine, Callback, Count };
 	enum Direction { In = 1, Out = 2, InOut = 3 };
-	typedef float(*CallbackFnc)(float);
+	using CallbackFnc = float(*)(float);
 
-	Tween(Type type = Linear, Direction direction = Out) {
-		if (direction & In) type_in = type;
-		if (direction & Out) type_out = type;
-	}
-	Tween(Type type_in, Type type_out) : type_in(type_in), type_out(type_out) {}
-	Tween(CallbackFnc callback, Direction direction = In) : callback(callback) {
-		if (direction & In) type_in = Callback;
-		if (direction & Out) type_out = Callback;
-	}
+	Tween(Type type = Linear, Direction direction = Out);
+	Tween(Type type_in, Type type_out);
+	Tween(CallbackFnc callback, Direction direction = In);
 
-	float operator()(float t) const
-	{
-		if (type_in != None && type_out == None)
-		{
-			return in(t);
-		}
-		if (type_in == None && type_out != None)
-		{
-			return out(t);
-		}
-		if (type_in != None && type_out != None)
-		{
-			return in_out(t);
-		}
-		return t;
-	}
+	// Evaluate the Tweening function at point t in [0, 1].
+	float operator()(float t) const;
 
-	void reverse()
-	{
-		std::swap(type_in, type_out);
-	}
+	// Reverse direction of the tweening function.
+	void reverse();
 
-	// Tweening functions below.
-	// Partly based on http://libclaw.sourceforge.net/tweeners.html
+	bool operator==(const Tween& other) const;
+    bool operator!=(const Tween& other) const;
 
-	static float back(float t)
-	{
-		return t * t*(2.70158f*t - 1.70158f);
-	}
-	static float bounce(float t)
-	{
-		if (t > 1.f - 1.f / 2.75f)
-			return 1.f - 7.5625f*square(1.f - t);
-		else if (t > 1.f - 2.f / 2.75f)
-			return 1.0f - (7.5625f*square(1.f - t - 1.5f / 2.75f) + 0.75f);
-		else if (t > 1.f - 2.5f / 2.75f)
-			return 1.0f - (7.5625f*square(1.f - t - 2.25f / 2.75f) + 0.9375f);
-		return 1.0f - (7.5625f*square(1.f - t - 2.625f / 2.75f) + 0.984375f);
-	}
-	static float circular(float t)
-	{
-		return 1.f - Math::SquareRoot(1.f - t * t);
-	}
-	static float cubic(float t)
-	{
-		return t * t*t;
-	}
-	static float elastic(float t)
-	{
-		if (t == 0) return t;
-		if (t == 1) return t;
-		return -Math::Exp(7.24f*(t-1.f))*Math::Sin((t - 1.1f)*2.f*Math::RMLUI_PI / 0.4f);
-	}
-	static float exponential(float t)
-	{
-		if (t == 0) return t;
-		if (t == 1) return t;
-		return Math::Exp(7.24f*(t - 1.f));
-	}
-	static float linear(float t)
-	{
-		return t;
-	}
-	static float quadratic(float t)
-	{
-		return t * t;
-	}
-	static float quartic(float t)
-	{
-		return t*t*t*t;
-	}
-	static float quintic(float t)
-	{
-		return t*t*t*t*t;
-	}
-	static float sine(float t)
-	{
-		return 1.f - Math::Cos(t*Math::RMLUI_PI*0.5f);
-	}
-
-	bool operator==(const Tween& other) const { return type_in == other.type_in && type_out == other.type_out && callback == other.callback; }
-	bool operator!=(const Tween& other) const { return !(*this == other); }
-
-	String to_string() const
-	{
-		const std::array<String, size_t(Count)> type_str = { { "none", "back", "bounce", "circular", "cubic", "elastic", "exponential", "linear", "quadratic", "quartic", "quintic", "sine", "callback" } };
-
-		if (size_t(type_in) < type_str.size() && size_t(type_out) < type_str.size())
-		{
-			if (type_in == None && type_out == None)
-			{
-				return "none";
-			}
-			else if (type_in == type_out)
-			{
-				return type_str[size_t(type_in)] + String("-in-out");
-			}
-			else if (type_in == None)
-			{
-				return type_str[size_t(type_out)] + String("-out");
-			}
-			else if (type_out == None)
-			{
-				return type_str[size_t(type_in)] + String("-in");
-			}
-			else if (type_in != type_out)
-			{
-				return type_str[size_t(type_in)] + String("-in-") + type_str[size_t(type_out)] + String("-out");
-			}
-		}
-		return "unknown";
-	}
+	String to_string() const;
 
 private:
-
-
-	float tween(Type type, float t) const
-	{
-		switch (type)
-		{
-		case Back:
-			return back(t);
-		case Bounce:
-			return bounce(t);
-		case Circular:
-			return circular(t);
-		case Cubic:
-			return cubic(t);
-		case Elastic:
-			return elastic(t);
-		case Exponential:
-			return exponential(t);
-		case Linear:
-			return linear(t);
-		case Quadratic:
-			return quadratic(t);
-		case Quartic:
-			return quartic(t);
-		case Quintic:
-			return quintic(t);
-		case Sine:
-			return sine(t);
-		case Callback:
-			if (callback)
-				return (*callback)(t);
-			break;
-		default:
-			break;
-		}
-		return t;
-	}
-	float in(float t) const
-	{
-		return tween(type_in, t);
-	}
-	float out(float t) const
-	{
-		return 1.0f - tween(type_out, 1.0f - t);
-	}
-	float in_out(float t) const
-	{
-		if (t < 0.5f)
-			return tween(type_in, 2.0f*t)*0.5f;
-		else
-			return 0.5f + out(2.0f*t - 1.0f)*0.5f;
-	}
-
-	inline static float square(float t) { return t * t; }
+	float tween(Type type, float t) const;
+	float in(float t) const;
+	float out(float t) const;
+	float in_out(float t) const;
 
 	Type type_in = None;
 	Type type_out = None;

+ 0 - 1
Include/RmlUi/Core/TypeConverter.h

@@ -31,7 +31,6 @@
 
 #include "Types.h"
 #include "Log.h"
-#include "Stream.h"
 #include "StringUtilities.h"
 #include <stdlib.h>
 #include <stdio.h>

+ 0 - 63
Include/RmlUi/Core/TypeConverter.inl

@@ -36,36 +36,6 @@ bool TypeConverter<SourceType, DestType>::Convert(const SourceType& /*src*/, Des
 	return false;
 }
 
-///
-/// Partial specialisations at the top, as the full specialisations should be preferred.
-///
-template< typename T >
-class TypeConverter< T, Stream >
-{
-public:
-	static bool Convert(const T& src, Stream* dest)
-	{
-		String string_dest;
-		bool result = TypeConverter< T, String >::Convert(src, string_dest);
-		if (result)
-			dest->Write(string_dest);
-
-		return result;
-	}
-};
-
-template< typename T >
-class TypeConverter< Stream, T >
-{
-public:
-	static bool Convert(Stream* src, T& dest, size_t length = String::npos)
-	{
-		String string_src;
-		src->Read(string_src, src->Length() < length ? src->Length() : length);
-		return TypeConverter< String, T >::Convert(string_src, dest);
-	}
-};
-
 ///
 /// Full Specialisations
 ///
@@ -123,16 +93,6 @@ PASS_THROUGH(ScriptInterfacePtr);
 typedef void* voidPtr;
 PASS_THROUGH(voidPtr);
 
-template<>
-class TypeConverter< Stream, Stream >
-{
-public:
-	static bool Convert(Stream* src, Stream* dest)
-	{
-		return src->Write(dest, src->Length()) == src->Length();
-	}
-};
-
 /////////////////////////////////////////////////
 // Simple Types
 /////////////////////////////////////////////////
@@ -222,16 +182,6 @@ public:
 	}
 };
 
-template<>
-class TypeConverter< String, URL >
-{
-public:
-	static bool Convert(const String& src, URL& dest)
-	{
-		return dest.SetURL(src);		
-	}
-};
-
 template< typename DestType, typename InternalType, int count >
 class TypeConverterStringVector
 {
@@ -340,19 +290,6 @@ public:
 	}
 };
 
-template<>
-class TypeConverter< URL, String >
-{
-public:
-	static bool Convert(const URL& src, String& dest)
-	{
-		dest = src.GetURL();
-		return true;
-	}
-};
-
-
-
 template< typename SourceType, typename InternalType, int count >
 class TypeConverterVectorString
 {

+ 4 - 11
Include/RmlUi/Core/Types.h

@@ -29,24 +29,17 @@
 #ifndef RMLUICORETYPES_H
 #define RMLUICORETYPES_H
 
-#include <float.h>
-#include <limits.h>
-#include <cstring>
 #include <string>
 #include <cstdlib>
-#include <algorithm>
-#include <map>
 #include <memory>
-#include <set>
-#include <unordered_set>
 #include <vector>
 
-#include "Platform.h"
-#include "Profiling.h"
-#include "Debug.h"
 #include "Traits.h"
 
 #ifdef RMLUI_NO_THIRDPARTY_CONTAINERS
+#include <set>
+#include <map>
+#include <unordered_set>
 #include <unordered_map>
 #else
 #include "Containers/chobo/flat_map.hpp"
@@ -59,7 +52,6 @@ namespace Core {
 
 // Commonly used basic types
 using byte = unsigned char;
-using Time = double;
 using ScriptObject = void*;
 using std::size_t;
 
@@ -110,6 +102,7 @@ struct Animation;
 struct Transition;
 struct TransitionList;
 struct Rectangle;
+enum class EventId : uint16_t;
 enum class PropertyId : uint16_t;
 
 // Types for external interfaces.

+ 3 - 2
Include/RmlUi/Core/XMLNodeHandler.h

@@ -29,15 +29,16 @@
 #ifndef RMLUICOREXMLNODEHANDLER_H
 #define RMLUICOREXMLNODEHANDLER_H
 
-#include "Traits.h"
-#include "XMLParser.h"
 #include "Header.h"
+#include "Traits.h"
+#include "Types.h"
 
 namespace Rml {
 namespace Core {
 
 class Element;
 class XMLParser;
+using XMLAttributes = Dictionary;
 
 /**
 	A handler gets ElementStart, ElementEnd and ElementData called by the XMLParser.

+ 2 - 1
Include/RmlUi/Core/XMLParser.h

@@ -39,6 +39,7 @@ namespace Core {
 class DocumentHeader;
 class Element;
 class XMLNodeHandler;
+class URL;
 
 /**
 	RmlUi's XML parsing engine. The factory creates an instance of this class for each RML parse.
@@ -110,7 +111,7 @@ private:
 	XMLNodeHandler* active_handler;
 
 	// The parser stack.
-	typedef std::stack< ParseFrame > ParserStack;
+	using ParserStack = std::stack< ParseFrame >;
 	ParserStack stack;
 };
 

+ 1 - 0
Samples/invaders/src/DecoratorInstancerDefender.cpp

@@ -28,6 +28,7 @@
 
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 

+ 1 - 0
Samples/invaders/src/DecoratorInstancerStarfield.cpp

@@ -28,6 +28,7 @@
 
 #include "DecoratorStarfield.h"
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include "DecoratorInstancerStarfield.h"
 
 DecoratorInstancerStarfield::DecoratorInstancerStarfield()

+ 2 - 2
Samples/invaders/src/Game.h

@@ -99,9 +99,9 @@ private:
 	// The direction they're moving
 	float current_invader_direction;
 	// Time of the last invader update
-	Rml::Core::Time invader_frame_start;
+	double invader_frame_start;
 	// How often the invaders move
-	Rml::Core::Time invader_move_freq;
+	double invader_move_freq;
 
 	// Helper function to move the invaders
 	void MoveInvaders();

+ 1 - 0
Samples/luainvaders/src/DecoratorInstancerDefender.cpp

@@ -28,6 +28,7 @@
 
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 

+ 1 - 0
Samples/luainvaders/src/DecoratorInstancerStarfield.cpp

@@ -28,6 +28,7 @@
 
 #include "DecoratorStarfield.h"
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include "DecoratorInstancerStarfield.h"
 
 DecoratorInstancerStarfield::DecoratorInstancerStarfield()

+ 2 - 2
Samples/luainvaders/src/Game.h

@@ -100,9 +100,9 @@ private:
 	// The direction they're moving
 	float current_invader_direction;
 	// Time of the last invader update
-	Rml::Core::Time invader_frame_start;
+	double invader_frame_start;
 	// How often the invaders move
-	Rml::Core::Time invader_move_freq;
+	double invader_move_freq;
 	// Is the game over
 	bool game_over;
 

+ 1 - 0
Samples/tutorial/datagrid/src/DecoratorInstancerDefender.cpp

@@ -12,6 +12,7 @@
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
 #include <RmlUi/Core/Types.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include "DecoratorDefender.h"
 
 DecoratorInstancerDefender::DecoratorInstancerDefender()

+ 1 - 0
Samples/tutorial/datagrid_tree/src/DecoratorInstancerDefender.cpp

@@ -11,6 +11,7 @@
 
 #include "DecoratorInstancerDefender.h"
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/Types.h>
 #include "DecoratorDefender.h"
 

+ 1 - 1
Source/Controls/ElementDataGridRow.cpp

@@ -620,7 +620,7 @@ void ElementDataGridRow::LoadChildren(float time_slice)
 	}
 }
 
-void ElementDataGridRow::LoadChildren(int first_row_to_load, int num_rows_to_load, Rml::Core::Time time_slice)
+void ElementDataGridRow::LoadChildren(int first_row_to_load, int num_rows_to_load, double time_slice)
 {
 	double start_time = Core::Clock::GetElapsedTime();
 

+ 1 - 0
Source/Controls/ElementProgressBar.cpp

@@ -34,6 +34,7 @@
 #include "../../Include/RmlUi/Core/ElementDocument.h"
 #include "../../Include/RmlUi/Core/StyleSheet.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
+#include "../../Include/RmlUi/Core/URL.h"
 
 namespace Rml {
 namespace Controls {

+ 1 - 0
Source/Controls/WidgetDropDown.cpp

@@ -33,6 +33,7 @@
 #include "../../Include/RmlUi/Core/Event.h"
 #include "../../Include/RmlUi/Core/Input.h"
 #include "../../Include/RmlUi/Core/Property.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 #include "../../Include/RmlUi/Controls/ElementFormControl.h"
 
 namespace Rml {

+ 1 - 0
Source/Controls/WidgetSliderInput.cpp

@@ -29,6 +29,7 @@
 #include "WidgetSliderInput.h"
 #include "../../Include/RmlUi/Core/Math.h"
 #include "../../Include/RmlUi/Core/Element.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 
 namespace Rml {
 namespace Controls {

+ 2 - 0
Source/Core/BaseXMLParser.cpp

@@ -27,6 +27,8 @@
  */
 
 #include "../../Include/RmlUi/Core/BaseXMLParser.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
+#include "../../Include/RmlUi/Core/Stream.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/DecoratorGradient.cpp

@@ -31,6 +31,7 @@
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/GeometryUtilities.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 /*
 Gradient decorator usage in CSS:

+ 1 - 0
Source/Core/DecoratorNinePatch.cpp

@@ -30,6 +30,7 @@
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 namespace Rml {
 namespace Core {

+ 0 - 2
Source/Core/Element.cpp

@@ -32,8 +32,6 @@
 #include "../../Include/RmlUi/Core/PropertyIdSet.h"
 #include "../../Include/RmlUi/Core/TransformPrimitive.h"
 #include "../../Include/RmlUi/Core/TransformState.h"
-#include <algorithm>
-#include <limits>
 #include "Clock.h"
 #include "ComputeProperty.h"
 #include "ElementAnimation.h"

+ 4 - 1
Source/Core/ElementAnimation.cpp

@@ -28,8 +28,11 @@
 
 #include "ElementAnimation.h"
 #include "ElementStyle.h"
-#include "../../Include/RmlUi/Core/TransformPrimitive.h"
+#include "../../Include/RmlUi/Core/Element.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
+#include "../../Include/RmlUi/Core/Transform.h"
+#include "../../Include/RmlUi/Core/TransformPrimitive.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/ElementBackground.cpp

@@ -31,6 +31,7 @@
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/GeometryUtilities.h"
 #include "../../Include/RmlUi/Core/Property.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 
 
 namespace Rml {

+ 1 - 1
Source/Core/ElementBackground.h

@@ -29,12 +29,12 @@
 #ifndef RMLUICOREELEMENTBACKGROUND_H
 #define RMLUICOREELEMENTBACKGROUND_H
 
-#include "../../Include/RmlUi/Core/Box.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 
 namespace Rml {
 namespace Core {
 
+class Box;
 class Element;
 
 /**

+ 1 - 0
Source/Core/ElementBorder.cpp

@@ -30,6 +30,7 @@
 #include "ElementBorder.h"
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/Property.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 1
Source/Core/ElementBorder.h

@@ -29,12 +29,12 @@
 #ifndef RMLUICOREELEMENTBORDER_H
 #define RMLUICOREELEMENTBORDER_H
 
-#include "../../Include/RmlUi/Core/Box.h"
 #include "../../Include/RmlUi/Core/Geometry.h"
 
 namespace Rml {
 namespace Core {
 
+class Box;
 class Element;
 
 /**

+ 1 - 0
Source/Core/ElementDecoration.cpp

@@ -30,6 +30,7 @@
 #include "ElementDefinition.h"
 #include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/Element.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 
 namespace Rml {
 namespace Core {

+ 5 - 1
Source/Core/ElementImage.cpp

@@ -27,8 +27,12 @@
  */
 
 #include "ElementImage.h"
-#include "../../Include/RmlUi/Core.h"
 #include "TextureDatabase.h"
+#include "../../Include/RmlUi/Core/URL.h"
+#include "../../Include/RmlUi/Core/PropertyIdSet.h"
+#include "../../Include/RmlUi/Core/GeometryUtilities.h"
+#include "../../Include/RmlUi/Core/ElementDocument.h"
+#include "../../Include/RmlUi/Core/StyleSheet.h"
 
 namespace Rml {
 namespace Core {

+ 0 - 1
Source/Core/ElementStyle.cpp

@@ -27,7 +27,6 @@
  */
 
 #include "ElementStyle.h"
-#include <algorithm>
 #include "../../Include/RmlUi/Core/Core.h"
 #include "../../Include/RmlUi/Core/ElementDocument.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"

+ 1 - 0
Source/Core/FontEffectBlur.cpp

@@ -28,6 +28,7 @@
 
 #include "FontEffectBlur.h"
 #include "Memory.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/FontEffectGlow.cpp

@@ -28,6 +28,7 @@
 
 #include "FontEffectGlow.h"
 #include "Memory.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/FontEffectInstancer.cpp

@@ -27,6 +27,7 @@
  */
 
 #include "../../Include/RmlUi/Core/FontEffectInstancer.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/FontEffectOutline.cpp

@@ -27,6 +27,7 @@
  */
 
 #include "FontEffectOutline.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/FontEffectShadow.cpp

@@ -27,6 +27,7 @@
  */
 
 #include "FontEffectShadow.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/IdNameMap.h

@@ -30,6 +30,7 @@
 #define RMLUICOREIDNAMEMAP_H
 
 #include "../../Include/RmlUi/Core/Header.h"
+#include <algorithm>
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/LayoutBlockBox.cpp

@@ -33,6 +33,7 @@
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
 #include "../../Include/RmlUi/Core/ElementScroll.h"
 #include "../../Include/RmlUi/Core/Property.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 
 namespace Rml {
 namespace Core {

+ 1 - 2
Source/Core/LayoutEngine.cpp

@@ -35,9 +35,8 @@
 #include "../../Include/RmlUi/Core/ElementScroll.h"
 #include "../../Include/RmlUi/Core/ElementText.h"
 #include "../../Include/RmlUi/Core/Property.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 #include "../../Include/RmlUi/Core/Types.h"
-#include <math.h>
-#include <cstddef>
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/LayoutLineBox.cpp

@@ -33,6 +33,7 @@
 #include "../../Include/RmlUi/Core/Property.h"
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
 #include "../../Include/RmlUi/Core/ElementText.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 #include <stack>
 
 namespace Rml {

+ 1 - 0
Source/Core/Lua/LuaDocument.cpp

@@ -28,6 +28,7 @@
  
 #include "precompiled.h"
 #include "LuaDocument.h"
+#include <RmlUi/Core/Stream.h>
 #include <RmlUi/Core/Lua/lua.hpp>
 #include <RmlUi/Core/Lua/Interpreter.h>
 

+ 3 - 2
Source/Core/PropertyParserAnimation.cpp

@@ -28,10 +28,11 @@
 
 
 #include "PropertyParserAnimation.h"
-#include "../../Include/RmlUi/Core/StringUtilities.h"
+#include "PropertyShorthandDefinition.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 #include "../../Include/RmlUi/Core/PropertyIdSet.h"
+#include "../../Include/RmlUi/Core/StringUtilities.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
-#include "PropertyShorthandDefinition.h"
 
 
 namespace Rml {

+ 2 - 2
Source/Core/PropertyParserColour.h

@@ -30,7 +30,7 @@
 #define RMLUICOREPROPERTYPARSERCOLOUR_H
 
 #include "../../Include/RmlUi/Core/PropertyParser.h"
-#include <unordered_map>
+#include "../../Include/RmlUi/Core/Types.h"
 
 namespace Rml {
 namespace Core {
@@ -55,7 +55,7 @@ public:
 	bool ParseValue(Property& property, const String& value, const ParameterMap& parameters) const override;
 
 private:
-	typedef UnorderedMap< String, Colourb> ColourMap;
+	using ColourMap = UnorderedMap< String, Colourb>;
 	ColourMap html_colours;
 };
 

+ 1 - 0
Source/Core/PropertyParserTransform.cpp

@@ -30,6 +30,7 @@
 #include "../../Include/RmlUi/Core/TransformPrimitive.h"
 #include "../../Include/RmlUi/Core/Transform.h"
 #include "StringCache.h"
+#include <string.h>
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/PropertySpecification.cpp

@@ -32,6 +32,7 @@
 #include "../../Include/RmlUi/Core/PropertyDictionary.h"
 #include "PropertyShorthandDefinition.h"
 #include "IdNameMap.h"
+#include <array>
 
 namespace Rml {
 namespace Core {

+ 1 - 1
Source/Core/Stream.cpp

@@ -27,8 +27,8 @@
  */
 
 #include "../../Include/RmlUi/Core/Stream.h"
-#include <algorithm>
 #include <stdio.h>
+#include <string.h>
 
 namespace Rml {
 namespace Core {

+ 1 - 1
Source/Core/StyleSheet.cpp

@@ -27,7 +27,6 @@
  */
 
 #include "../../Include/RmlUi/Core/StyleSheet.h"
-#include <algorithm>
 #include "ElementDefinition.h"
 #include "StringCache.h"
 #include "StyleSheetFactory.h"
@@ -38,6 +37,7 @@
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/Factory.h"
 #include "../../Include/RmlUi/Core/FontEffect.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 #include "../../Include/RmlUi/Core/PropertyDefinition.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
 #include "../../Include/RmlUi/Core/FontEffectInstancer.h"

+ 1 - 1
Source/Core/StyleSheetNode.cpp

@@ -27,8 +27,8 @@
  */
 
 #include "StyleSheetNode.h"
-#include <algorithm>
 #include "../../Include/RmlUi/Core/Element.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 #include "StyleSheetFactory.h"
 #include "StyleSheetNodeSelector.h"
 

+ 4 - 1
Source/Core/StyleSheetParser.cpp

@@ -27,7 +27,6 @@
  */
 
 #include "StyleSheetParser.h"
-#include <algorithm>
 #include "ComputeProperty.h"
 #include "StringCache.h"
 #include "StyleSheetFactory.h"
@@ -35,9 +34,13 @@
 #include "../../Include/RmlUi/Core/DecoratorInstancer.h"
 #include "../../Include/RmlUi/Core/Factory.h"
 #include "../../Include/RmlUi/Core/Log.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
+#include "../../Include/RmlUi/Core/PropertySpecification.h"
 #include "../../Include/RmlUi/Core/StreamMemory.h"
 #include "../../Include/RmlUi/Core/StyleSheet.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
+#include <algorithm>
 
 namespace Rml {
 namespace Core {

+ 1 - 0
Source/Core/StyleSheetSpecification.cpp

@@ -28,6 +28,7 @@
 
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
 #include "../../Include/RmlUi/Core/PropertyIdSet.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
 #include "PropertyParserNumber.h"
 #include "PropertyParserAnimation.h"
 #include "PropertyParserColour.h"

+ 1 - 1
Source/Core/TemplateCache.h

@@ -61,7 +61,7 @@ private:
 	TemplateCache();
 	~TemplateCache();
 
-	typedef UnorderedMap<String, Template*> Templates;
+	using Templates = UnorderedMap<String, Template*>;
 	Templates templates;
 	Templates template_ids;
 };

+ 1 - 1
Source/Core/TextureDatabase.h

@@ -64,7 +64,7 @@ private:
 	TextureDatabase();
 	~TextureDatabase();
 
-	typedef UnorderedMap< String, SharedPtr<TextureResource> > TextureMap;
+	using TextureMap = UnorderedMap< String, SharedPtr<TextureResource> >;
 	TextureMap textures;
 };
 

+ 1 - 1
Source/Core/TextureLayout.cpp

@@ -27,9 +27,9 @@
  */
 
 #include "TextureLayout.h"
-#include <algorithm>
 #include "TextureLayoutRectangle.h"
 #include "TextureLayoutTexture.h"
+#include <algorithm>
 
 namespace Rml {
 namespace Core {

+ 2 - 2
Source/Core/TextureLayout.h

@@ -76,8 +76,8 @@ public:
 	bool GenerateLayout(int max_texture_dimensions);
 
 private:
-	typedef std::vector< TextureLayoutRectangle > RectangleList;
-	typedef std::vector< TextureLayoutTexture > TextureList;
+	using RectangleList = std::vector< TextureLayoutRectangle >;
+	using TextureList = std::vector< TextureLayoutTexture >;
 
 	TextureList textures;
 	RectangleList rectangles;

+ 1 - 1
Source/Core/TextureLayoutRow.h

@@ -68,7 +68,7 @@ public:
 	void Unplace();
 
 private:
-	typedef std::vector< TextureLayoutRectangle* > RectangleList;
+	using RectangleList = std::vector< TextureLayoutRectangle* >;
 
 	int height;
 	RectangleList rectangles;

+ 1 - 1
Source/Core/TextureLayoutTexture.h

@@ -67,7 +67,7 @@ public:
 	UniquePtr<byte[]> AllocateTexture();
 
 private:
-	typedef std::vector< TextureLayoutRow > RowList;
+	using RowList = std::vector< TextureLayoutRow >;
 
 	Vector2i dimensions;
 	RowList rows;

+ 1 - 0
Source/Core/TextureResource.cpp

@@ -30,6 +30,7 @@
 #include "TextureDatabase.h"
 #include "../../Include/RmlUi/Core/Log.h"
 #include "../../Include/RmlUi/Core/RenderInterface.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 
 namespace Rml {
 namespace Core {

+ 2 - 2
Source/Core/TextureResource.h

@@ -74,8 +74,8 @@ protected:
 private:
 	String source;
 
-	typedef std::pair< TextureHandle, Vector2i > TextureData;
-	typedef SmallUnorderedMap< RenderInterface*, TextureData > TextureDataMap;
+	using TextureData = std::pair< TextureHandle, Vector2i >;
+	using TextureDataMap = SmallUnorderedMap< RenderInterface*, TextureData >;
 	TextureDataMap texture_data;
 
 	UniquePtr<TextureCallback> texture_callback;

+ 242 - 0
Source/Core/Tween.cpp

@@ -0,0 +1,242 @@
+/*
+ * This source file is part of RmlUi, the HTML/CSS Interface Middleware
+ *
+ * For the latest information, see http://github.com/mikke89/RmlUi
+ *
+ * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
+ * Copyright (c) 2019 The RmlUi Team, and contributors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#include "../../Include/RmlUi/Core/Tween.h"
+#include "../../Include/RmlUi/Core/Math.h"
+#include <array>
+#include <utility>
+
+namespace Rml {
+namespace Core {
+
+namespace TweenFunctions {
+
+// Tweening functions below.
+// Partly based on http://libclaw.sourceforge.net/tweeners.html
+
+static inline float square(float t) {
+	return t * t;
+}
+
+static float back(float t)
+{
+	return t * t * (2.70158f * t - 1.70158f);
+}
+
+static float bounce(float t)
+{
+	if (t > 1.f - 1.f / 2.75f)
+		return 1.f - 7.5625f * square(1.f - t);
+	else if (t > 1.f - 2.f / 2.75f)
+		return 1.0f - (7.5625f * square(1.f - t - 1.5f / 2.75f) + 0.75f);
+	else if (t > 1.f - 2.5f / 2.75f)
+		return 1.0f - (7.5625f * square(1.f - t - 2.25f / 2.75f) + 0.9375f);
+	return 1.0f - (7.5625f * square(1.f - t - 2.625f / 2.75f) + 0.984375f);
+}
+
+static float circular(float t)
+{
+	return 1.f - Math::SquareRoot(1.f - t * t);
+}
+
+static float cubic(float t)
+{
+	return t * t * t;
+}
+
+static float elastic(float t)
+{
+	if (t == 0) return t;
+	if (t == 1) return t;
+	return -Math::Exp(7.24f * (t - 1.f)) * Math::Sin((t - 1.1f) * 2.f * Math::RMLUI_PI / 0.4f);
+}
+
+static float exponential(float t)
+{
+	if (t == 0) return t;
+	if (t == 1) return t;
+	return Math::Exp(7.24f * (t - 1.f));
+}
+
+static float linear(float t)
+{
+	return t;
+}
+
+static float quadratic(float t)
+{
+	return t * t;
+}
+
+static float quartic(float t)
+{
+	return t * t * t * t;
+}
+
+static float quintic(float t)
+{
+	return t * t * t * t * t;
+}
+
+static float sine(float t)
+{
+	return 1.f - Math::Cos(t * Math::RMLUI_PI * 0.5f);
+}
+
+} // namespace TweenFunctions
+
+
+Tween::Tween(Type type, Direction direction) {
+	if (direction & In) type_in = type;
+	if (direction & Out) type_out = type;
+}
+Tween::Tween(Type type_in, Type type_out) : type_in(type_in), type_out(type_out) {}
+Tween::Tween(CallbackFnc callback, Direction direction) : callback(callback) {
+	if (direction & In) type_in = Callback;
+	if (direction & Out) type_out = Callback;
+}
+float Tween::operator()(float t) const
+{
+	if (type_in != None && type_out == None)
+	{
+		return in(t);
+	}
+	if (type_in == None && type_out != None)
+	{
+		return out(t);
+	}
+	if (type_in != None && type_out != None)
+	{
+		return in_out(t);
+	}
+	return t;
+}
+
+void Tween::reverse()
+{
+	std::swap(type_in, type_out);
+}
+
+bool Tween::operator==(const Tween& other) const
+{
+	return type_in == other.type_in && type_out == other.type_out && callback == other.callback;
+} 
+
+bool Tween::operator!=(const Tween& other) const
+{
+	return !(*this == other);
+}
+
+String Tween::to_string() const
+{
+	static const std::array<String, size_t(Count)> type_str = { { "none", "back", "bounce", "circular", "cubic", "elastic", "exponential", "linear", "quadratic", "quartic", "quintic", "sine", "callback" } };
+
+	if (size_t(type_in) < type_str.size() && size_t(type_out) < type_str.size())
+	{
+		if (type_in == None && type_out == None)
+		{
+			return "none";
+		}
+		else if (type_in == type_out)
+		{
+			return type_str[size_t(type_in)] + String("-in-out");
+		}
+		else if (type_in == None)
+		{
+			return type_str[size_t(type_out)] + String("-out");
+		}
+		else if (type_out == None)
+		{
+			return type_str[size_t(type_in)] + String("-in");
+		}
+		else if (type_in != type_out)
+		{
+			return type_str[size_t(type_in)] + String("-in-") + type_str[size_t(type_out)] + String("-out");
+		}
+	}
+	return "unknown";
+}
+
+float Tween::tween(Type type, float t) const
+{
+	using namespace TweenFunctions;
+
+	switch (type)
+	{
+	case Back:
+		return back(t);
+	case Bounce:
+		return bounce(t);
+	case Circular:
+		return circular(t);
+	case Cubic:
+		return cubic(t);
+	case Elastic:
+		return elastic(t);
+	case Exponential:
+		return exponential(t);
+	case Linear:
+		return linear(t);
+	case Quadratic:
+		return quadratic(t);
+	case Quartic:
+		return quartic(t);
+	case Quintic:
+		return quintic(t);
+	case Sine:
+		return sine(t);
+	case Callback:
+		if (callback)
+			return (*callback)(t);
+		break;
+	default:
+		break;
+	}
+	return t;
+}
+
+float Tween::in(float t) const
+{
+	return tween(type_in, t);
+}
+
+float Tween::out(float t) const
+{
+	return 1.0f - tween(type_out, 1.0f - t);
+}
+
+float Tween::in_out(float t) const
+{
+	if (t < 0.5f)
+		return tween(type_in, 2.0f * t) * 0.5f;
+	else
+		return 0.5f + out(2.0f * t - 1.0f) * 0.5f;
+}
+
+}
+}

+ 1 - 1
Source/Core/TypeConverter.cpp

@@ -26,10 +26,10 @@
  *
  */
 
+#include "../../Include/RmlUi/Core/TypeConverter.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"
 #include "../../Include/RmlUi/Core/Animation.h"
 #include "../../Include/RmlUi/Core/Transform.h"
-#include "../../Include/RmlUi/Core/TypeConverter.h"
 
 namespace Rml {
 namespace Core {

+ 2 - 0
Source/Core/XMLNodeHandlerDefault.cpp

@@ -31,8 +31,10 @@
 #include "../../Include/RmlUi/Core/Log.h"
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/Factory.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
 #include "../../Include/RmlUi/Core/XMLParser.h"
 
+
 namespace Rml {
 namespace Core {
 

+ 7 - 1
Source/Core/XMLNodeHandlerHead.cpp

@@ -29,7 +29,13 @@
 #include "XMLNodeHandlerHead.h"
 #include "DocumentHeader.h"
 #include "TemplateCache.h"
-#include "../../Include/RmlUi/Core.h"
+#include "../../Include/RmlUi/Core/Element.h"
+#include "../../Include/RmlUi/Core/ElementDocument.h"
+#include "../../Include/RmlUi/Core/StringUtilities.h"
+#include "../../Include/RmlUi/Core/SystemInterface.h"
+#include "../../Include/RmlUi/Core/XMLParser.h"
+#include "../../Include/RmlUi/Core/URL.h"
+#include "../../Include/RmlUi/Core/Core.h"
 
 namespace Rml {
 namespace Core {

+ 0 - 1
Source/Core/XMLNodeHandlerHead.h

@@ -30,7 +30,6 @@
 #define RMLUICOREXMLNODEHANDLERHEAD_H
 
 #include "../../Include/RmlUi/Core/XMLNodeHandler.h"
-#include <stack>
 
 namespace Rml {
 namespace Core {

+ 1 - 1
Source/Core/XMLParseTools.h

@@ -29,7 +29,7 @@
 #ifndef RMLUICOREXMLPARSETOOLS_H
 #define RMLUICOREXMLPARSETOOLS_H
 
-#include "../../Include/RmlUi/Core/XMLParser.h"
+#include "../../Include/RmlUi/Core/Types.h"
 
 namespace Rml {
 namespace Core {

+ 6 - 2
Source/Core/XMLParser.cpp

@@ -26,15 +26,19 @@
  *
  */
 
-#include "../../Include/RmlUi/Core/XMLParser.h"
 #include "DocumentHeader.h"
 #include "../../Include/RmlUi/Core/Log.h"
+#include "../../Include/RmlUi/Core/Profiling.h"
+#include "../../Include/RmlUi/Core/Stream.h"
+#include "../../Include/RmlUi/Core/Types.h"
 #include "../../Include/RmlUi/Core/XMLNodeHandler.h"
+#include "../../Include/RmlUi/Core/URL.h"
+#include "../../Include/RmlUi/Core/XMLParser.h"
 
 namespace Rml {
 namespace Core {
 
-typedef UnorderedMap< String, SharedPtr<XMLNodeHandler> > NodeHandlers;
+using NodeHandlers = UnorderedMap< String, SharedPtr<XMLNodeHandler> > ;
 static NodeHandlers node_handlers;
 static SharedPtr<XMLNodeHandler> default_node_handler;