浏览代码

Refactor: Move DecoratorInstancer into the Decorator files

Michael Ragazzon 2 年之前
父节点
当前提交
05ec09bce3
共有 54 个文件被更改,包括 617 次插入1371 次删除
  1. 0 12
      CMake/FileList.cmake
  2. 0 8
      CMake/SampleFileList.cmake
  3. 0 1
      Include/RmlUi/Core.h
  4. 68 1
      Include/RmlUi/Core/Decorator.h
  5. 0 107
      Include/RmlUi/Core/DecoratorInstancer.h
  6. 24 0
      Samples/invaders/src/DecoratorDefender.cpp
  7. 13 0
      Samples/invaders/src/DecoratorDefender.h
  8. 0 55
      Samples/invaders/src/DecoratorInstancerDefender.cpp
  9. 0 51
      Samples/invaders/src/DecoratorInstancerDefender.h
  10. 0 63
      Samples/invaders/src/DecoratorInstancerStarfield.cpp
  11. 0 52
      Samples/invaders/src/DecoratorInstancerStarfield.h
  12. 32 0
      Samples/invaders/src/DecoratorStarfield.cpp
  13. 13 0
      Samples/invaders/src/DecoratorStarfield.h
  14. 2 2
      Samples/invaders/src/main.cpp
  15. 24 0
      Samples/luainvaders/src/DecoratorDefender.cpp
  16. 13 0
      Samples/luainvaders/src/DecoratorDefender.h
  17. 0 55
      Samples/luainvaders/src/DecoratorInstancerDefender.cpp
  18. 0 51
      Samples/luainvaders/src/DecoratorInstancerDefender.h
  19. 0 63
      Samples/luainvaders/src/DecoratorInstancerStarfield.cpp
  20. 0 52
      Samples/luainvaders/src/DecoratorInstancerStarfield.h
  21. 32 0
      Samples/luainvaders/src/DecoratorStarfield.cpp
  22. 13 0
      Samples/luainvaders/src/DecoratorStarfield.h
  23. 2 2
      Samples/luainvaders/src/main.cpp
  24. 39 0
      Source/Core/Decorator.cpp
  25. 0 1
      Source/Core/DecoratorGradient.h
  26. 0 73
      Source/Core/DecoratorInstancer.cpp
  27. 0 1
      Source/Core/DecoratorNinePatch.h
  28. 148 0
      Source/Core/DecoratorTiled.cpp
  29. 26 0
      Source/Core/DecoratorTiled.h
  30. 39 0
      Source/Core/DecoratorTiledBox.cpp
  31. 10 0
      Source/Core/DecoratorTiledBox.h
  32. 0 73
      Source/Core/DecoratorTiledBoxInstancer.cpp
  33. 0 51
      Source/Core/DecoratorTiledBoxInstancer.h
  34. 27 0
      Source/Core/DecoratorTiledHorizontal.cpp
  35. 10 0
      Source/Core/DecoratorTiledHorizontal.h
  36. 0 62
      Source/Core/DecoratorTiledHorizontalInstancer.cpp
  37. 0 51
      Source/Core/DecoratorTiledHorizontalInstancer.h
  38. 25 0
      Source/Core/DecoratorTiledImage.cpp
  39. 10 0
      Source/Core/DecoratorTiledImage.h
  40. 0 59
      Source/Core/DecoratorTiledImageInstancer.cpp
  41. 0 51
      Source/Core/DecoratorTiledImageInstancer.h
  42. 0 181
      Source/Core/DecoratorTiledInstancer.cpp
  43. 0 70
      Source/Core/DecoratorTiledInstancer.h
  44. 28 0
      Source/Core/DecoratorTiledVertical.cpp
  45. 10 0
      Source/Core/DecoratorTiledVertical.h
  46. 0 62
      Source/Core/DecoratorTiledVerticalInstancer.cpp
  47. 0 51
      Source/Core/DecoratorTiledVerticalInstancer.h
  48. 1 1
      Source/Core/ElementAnimation.cpp
  49. 0 1
      Source/Core/ElementDecoration.cpp
  50. 4 4
      Source/Core/Factory.cpp
  51. 1 1
      Source/Core/PropertyParserDecorator.cpp
  52. 1 1
      Source/Core/StyleSheet.cpp
  53. 1 1
      Source/Core/StyleSheetParser.cpp
  54. 1 1
      Source/Core/TypeConverter.cpp

+ 0 - 12
CMake/FileList.cmake

@@ -14,14 +14,9 @@ set(Core_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNinePatch.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiled.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBox.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBoxInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontal.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontalInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImage.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImageInstancer.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVertical.h
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVerticalInstancer.h
     ${PROJECT_SOURCE_DIR}/Source/Core/DocumentHeader.h
     ${PROJECT_SOURCE_DIR}/Source/Core/ElementAnimation.h
     ${PROJECT_SOURCE_DIR}/Source/Core/ElementBackgroundBorder.h
@@ -142,7 +137,6 @@ set(Core_PUB_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DataVariable.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Debug.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Decorator.h
-    ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/DecoratorInstancer.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Dictionary.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.h
     ${PROJECT_SOURCE_DIR}/Include/RmlUi/Core/Element.inl
@@ -250,18 +244,12 @@ set(Core_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Source/Core/DataViewDefault.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Decorator.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorGradient.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorNinePatch.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiled.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBox.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledBoxInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontal.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledHorizontalInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImage.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledImageInstancer.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVertical.cpp
-    ${PROJECT_SOURCE_DIR}/Source/Core/DecoratorTiledVerticalInstancer.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/DocumentHeader.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/Element.cpp
     ${PROJECT_SOURCE_DIR}/Source/Core/ElementAnimation.cpp

+ 0 - 8
CMake/SampleFileList.cmake

@@ -135,8 +135,6 @@ set(tutorial_drag_SRC_FILES
 
 set(invaders_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerStarfield.h
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorStarfield.h
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Defender.h
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/ElementGame.h
@@ -158,8 +156,6 @@ set(invaders_HDR_FILES
 
 set(invaders_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorInstancerStarfield.cpp
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/DecoratorStarfield.cpp
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/Defender.cpp
     ${PROJECT_SOURCE_DIR}/Samples/invaders/src/ElementGame.cpp
@@ -182,8 +178,6 @@ set(invaders_SRC_FILES
 
 set(luainvaders_HDR_FILES
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerDefender.h
-    ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerStarfield.h
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorStarfield.h
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Defender.h
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/ElementGame.h
@@ -200,8 +194,6 @@ set(luainvaders_HDR_FILES
 
 set(luainvaders_SRC_FILES
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerDefender.cpp
-    ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorInstancerStarfield.cpp
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/DecoratorStarfield.cpp
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/Defender.cpp
     ${PROJECT_SOURCE_DIR}/Samples/luainvaders/src/ElementGame.cpp

+ 0 - 1
Include/RmlUi/Core.h

@@ -41,7 +41,6 @@
 #include "Core/DataTypes.h"
 #include "Core/DataVariable.h"
 #include "Core/Decorator.h"
-#include "Core/DecoratorInstancer.h"
 #include "Core/Element.h"
 #include "Core/ElementDocument.h"
 #include "Core/ElementInstancer.h"

+ 68 - 1
Include/RmlUi/Core/Decorator.h

@@ -30,6 +30,8 @@
 #define RMLUI_CORE_DECORATOR_H
 
 #include "Header.h"
+#include "PropertyDictionary.h"
+#include "PropertySpecification.h"
 #include "Texture.h"
 #include "Types.h"
 
@@ -38,8 +40,12 @@ namespace Rml {
 class DecoratorInstancer;
 class Element;
 class PropertyDictionary;
-class Property;
+
+struct Sprite;
 struct Texture;
+class StyleSheet;
+class DecoratorInstancerInterface;
+class PropertyDefinition;
 
 /**
     The abstract base class for any visual object that can be attached to any element.
@@ -87,5 +93,66 @@ private:
 	Vector<Texture> additional_textures;
 };
 
+/**
+    An element instancer provides a method for allocating and deallocating decorators.
+
+    It is important at the same instancer that allocated a decorator releases it. This ensures there are no issues with
+    memory from different DLLs getting mixed up.
+
+    @author Peter Curry
+ */
+
+class RMLUICORE_API DecoratorInstancer {
+public:
+	DecoratorInstancer();
+	virtual ~DecoratorInstancer();
+
+	/// Instances a decorator given the property tag and attributes from the RCSS file.
+	/// @param[in] name The type of decorator desired. For example, "decorator: simple(...);" is declared as type "simple".
+	/// @param[in] properties All RCSS properties associated with the decorator.
+	/// @param[in] instancer_interface An interface for querying the active style sheet.
+	/// @return A shared_ptr to the decorator if it was instanced successfully.
+	virtual SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) = 0;
+
+	/// Returns the property specification associated with the instancer.
+	const PropertySpecification& GetPropertySpecification() const;
+
+protected:
+	/// Registers a property for the decorator.
+	/// @param[in] property_name The name of the new property (how it is specified through RCSS).
+	/// @param[in] default_value The default value to be used.
+	/// @return The new property definition, ready to have parsers attached.
+	PropertyDefinition& RegisterProperty(const String& property_name, const String& default_value);
+	/// Registers a shorthand property definition. Specify a shorthand name of 'decorator' to parse anonymous decorators.
+	/// @param[in] shorthand_name The name to register the new shorthand property under.
+	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is
+	/// the order in which the values will be processed.
+	/// @param[in] type The type of shorthand to declare.
+	/// @param True if all the property names exist, false otherwise.
+	ShorthandId RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type);
+
+private:
+	PropertySpecification properties;
+};
+
+class RMLUICORE_API DecoratorInstancerInterface {
+public:
+	DecoratorInstancerInterface(const StyleSheet& style_sheet, const PropertySource* property_source) :
+		style_sheet(style_sheet), property_source(property_source)
+	{}
+
+	/// Get a sprite from any @spritesheet in the style sheet the decorator is being instanced on.
+	const Sprite* GetSprite(const String& name) const;
+
+	/// Get a texture using the given filename.
+	/// This will use the document path where the 'decorator' property was declared to locate relative files, if available.
+	Texture GetTexture(const String& filename) const;
+
+private:
+	const StyleSheet& style_sheet;
+	const PropertySource* property_source;
+};
+
 } // namespace Rml
 #endif

+ 0 - 107
Include/RmlUi/Core/DecoratorInstancer.h

@@ -1,107 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_CORE_DECORATORINSTANCER_H
-#define RMLUI_CORE_DECORATORINSTANCER_H
-
-#include "Header.h"
-#include "PropertyDictionary.h"
-#include "PropertySpecification.h"
-
-namespace Rml {
-
-struct Sprite;
-struct Texture;
-class StyleSheet;
-class Decorator;
-class DecoratorInstancerInterface;
-class PropertyDefinition;
-
-/**
-    An element instancer provides a method for allocating and deallocating decorators.
-
-    It is important at the same instancer that allocated a decorator releases it. This ensures there are no issues with
-    memory from different DLLs getting mixed up.
-
-    @author Peter Curry
- */
-
-class RMLUICORE_API DecoratorInstancer {
-public:
-	DecoratorInstancer();
-	virtual ~DecoratorInstancer();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	/// @param[in] name The type of decorator desired. For example, "decorator: simple(...);" is declared as type "simple".
-	/// @param[in] properties All RCSS properties associated with the decorator.
-	/// @param[in] instancer_interface An interface for querying the active style sheet.
-	/// @return A shared_ptr to the decorator if it was instanced successfully.
-	virtual SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
-		const DecoratorInstancerInterface& instancer_interface) = 0;
-
-	/// Returns the property specification associated with the instancer.
-	const PropertySpecification& GetPropertySpecification() const;
-
-protected:
-	/// Registers a property for the decorator.
-	/// @param[in] property_name The name of the new property (how it is specified through RCSS).
-	/// @param[in] default_value The default value to be used.
-	/// @return The new property definition, ready to have parsers attached.
-	PropertyDefinition& RegisterProperty(const String& property_name, const String& default_value);
-	/// Registers a shorthand property definition. Specify a shorthand name of 'decorator' to parse anonymous decorators.
-	/// @param[in] shorthand_name The name to register the new shorthand property under.
-	/// @param[in] properties A comma-separated list of the properties this definition is shorthand for. The order in which they are specified here is
-	/// the order in which the values will be processed.
-	/// @param[in] type The type of shorthand to declare.
-	/// @param True if all the property names exist, false otherwise.
-	ShorthandId RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type);
-
-private:
-	PropertySpecification properties;
-};
-
-class RMLUICORE_API DecoratorInstancerInterface {
-public:
-	DecoratorInstancerInterface(const StyleSheet& style_sheet, const PropertySource* property_source) :
-		style_sheet(style_sheet), property_source(property_source)
-	{}
-
-	/// Get a sprite from any @spritesheet in the style sheet the decorator is being instanced on.
-	const Sprite* GetSprite(const String& name) const;
-
-	/// Get a texture using the given filename.
-	/// This will use the document path where the 'decorator' property was declared to locate relative files, if available.
-	Texture GetTexture(const String& filename) const;
-
-private:
-	const StyleSheet& style_sheet;
-	const PropertySource* property_source;
-};
-
-} // namespace Rml
-#endif

+ 24 - 0
Samples/invaders/src/DecoratorDefender.cpp

@@ -31,8 +31,10 @@
 #include <RmlUi/Core/Element.h>
 #include <RmlUi/Core/GeometryUtilities.h>
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/RenderInterface.h>
 #include <RmlUi/Core/Texture.h>
+#include <RmlUi/Core/Types.h>
 
 DecoratorDefender::~DecoratorDefender() {}
 
@@ -72,3 +74,25 @@ void DecoratorDefender::RenderElement(Rml::Element* element, Rml::DecoratorDataH
 		render_interface->RenderGeometry(vertices, 4, indices, 6, texture, position);
 	}
 }
+
+DecoratorInstancerDefender::DecoratorInstancerDefender()
+{
+	id_image_src = RegisterProperty("image-src", "").AddParser("string").GetId();
+	RegisterShorthand("decorator", "image-src", Rml::ShorthandType::FallThrough);
+}
+
+DecoratorInstancerDefender::~DecoratorInstancerDefender() {}
+
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
+	const Rml::DecoratorInstancerInterface& instancer_interface)
+{
+	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
+	Rml::String image_source = image_source_property->Get<Rml::String>();
+	Rml::Texture texture = instancer_interface.GetTexture(image_source);
+
+	auto decorator = Rml::MakeShared<DecoratorDefender>();
+	if (decorator->Initialise(texture))
+		return decorator;
+
+	return nullptr;
+}

+ 13 - 0
Samples/invaders/src/DecoratorDefender.h

@@ -54,4 +54,17 @@ private:
 	int image_index;
 };
 
+class DecoratorInstancerDefender : public Rml::DecoratorInstancer {
+public:
+	DecoratorInstancerDefender();
+	~DecoratorInstancerDefender();
+
+	/// Instances a decorator given the property tag and attributes from the RCSS file.
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
+		const Rml::DecoratorInstancerInterface& instancer_interface) override;
+
+private:
+	Rml::PropertyId id_image_src;
+};
+
 #endif

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

@@ -1,55 +0,0 @@
-/*
- * 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-2023 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 "DecoratorInstancerDefender.h"
-#include "DecoratorDefender.h"
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/PropertyDefinition.h>
-#include <RmlUi/Core/Types.h>
-
-DecoratorInstancerDefender::DecoratorInstancerDefender()
-{
-	id_image_src = RegisterProperty("image-src", "").AddParser("string").GetId();
-	RegisterShorthand("decorator", "image-src", Rml::ShorthandType::FallThrough);
-}
-
-DecoratorInstancerDefender::~DecoratorInstancerDefender() {}
-
-Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
-	const Rml::DecoratorInstancerInterface& instancer_interface)
-{
-	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
-	Rml::String image_source = image_source_property->Get<Rml::String>();
-	Rml::Texture texture = instancer_interface.GetTexture(image_source);
-
-	auto decorator = Rml::MakeShared<DecoratorDefender>();
-	if (decorator->Initialise(texture))
-		return decorator;
-
-	return nullptr;
-}

+ 0 - 51
Samples/invaders/src/DecoratorInstancerDefender.h

@@ -1,51 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_INVADERS_DECORATORINSTANCERDEFENDER_H
-#define RMLUI_INVADERS_DECORATORINSTANCERDEFENDER_H
-
-#include <RmlUi/Core/DecoratorInstancer.h>
-
-/**
-    @author Robert Curry
- */
-
-class DecoratorInstancerDefender : public Rml::DecoratorInstancer {
-public:
-	DecoratorInstancerDefender();
-	~DecoratorInstancerDefender();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
-		const Rml::DecoratorInstancerInterface& instancer_interface) override;
-
-private:
-	Rml::PropertyId id_image_src;
-};
-
-#endif

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

@@ -1,63 +0,0 @@
-/*
- * 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-2023 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 "DecoratorInstancerStarfield.h"
-#include "DecoratorStarfield.h"
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/PropertyDefinition.h>
-
-DecoratorInstancerStarfield::DecoratorInstancerStarfield()
-{
-	id_num_layers = RegisterProperty("num-layers", "3").AddParser("number").GetId();
-	id_top_colour = RegisterProperty("top-colour", "#dddc").AddParser("color").GetId();
-	id_bottom_colour = RegisterProperty("bottom-colour", "#333c").AddParser("color").GetId();
-	id_top_speed = RegisterProperty("top-speed", "10.0").AddParser("number").GetId();
-	id_bottom_speed = RegisterProperty("bottom-speed", "2.0").AddParser("number").GetId();
-	id_top_density = RegisterProperty("top-density", "15").AddParser("number").GetId();
-	id_bottom_density = RegisterProperty("bottom-density", "10").AddParser("number").GetId();
-}
-
-DecoratorInstancerStarfield::~DecoratorInstancerStarfield() {}
-
-Rml::SharedPtr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
-	const Rml::DecoratorInstancerInterface& /*instancer_interface*/)
-{
-	int num_layers = properties.GetProperty(id_num_layers)->Get<int>();
-	Rml::Colourb top_colour = properties.GetProperty(id_top_colour)->Get<Rml::Colourb>();
-	Rml::Colourb bottom_colour = properties.GetProperty(id_bottom_colour)->Get<Rml::Colourb>();
-	float top_speed = properties.GetProperty(id_top_speed)->Get<float>();
-	float bottom_speed = properties.GetProperty(id_bottom_speed)->Get<float>();
-	int top_density = properties.GetProperty(id_top_density)->Get<int>();
-	int bottom_density = properties.GetProperty(id_bottom_density)->Get<int>();
-
-	auto decorator = Rml::MakeShared<DecoratorStarfield>();
-	if (decorator->Initialise(num_layers, top_colour, bottom_colour, top_speed, bottom_speed, top_density, bottom_density))
-		return decorator;
-
-	return nullptr;
-}

+ 0 - 52
Samples/invaders/src/DecoratorInstancerStarfield.h

@@ -1,52 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_INVADERS_DECORATORINSTANCERSTARFIELD_H
-#define RMLUI_INVADERS_DECORATORINSTANCERSTARFIELD_H
-
-#include "DecoratorStarfield.h"
-#include <RmlUi/Core/DecoratorInstancer.h>
-
-/**
-    @author Robert Curry
- */
-
-class DecoratorInstancerStarfield : public Rml::DecoratorInstancer {
-public:
-	DecoratorInstancerStarfield();
-	~DecoratorInstancerStarfield();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
-		const Rml::DecoratorInstancerInterface& instancer_interface) override;
-
-private:
-	Rml::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;
-};
-
-#endif

+ 32 - 0
Samples/invaders/src/DecoratorStarfield.cpp

@@ -34,6 +34,7 @@
 #include <RmlUi/Core/ElementUtilities.h>
 #include <RmlUi/Core/GeometryUtilities.h>
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/RenderInterface.h>
 #include <RmlUi/Core/SystemInterface.h>
 #include <Shell.h>
@@ -151,3 +152,34 @@ void DecoratorStarfield::StarField::Update(double t)
 		}
 	}
 }
+
+DecoratorInstancerStarfield::DecoratorInstancerStarfield()
+{
+	id_num_layers = RegisterProperty("num-layers", "3").AddParser("number").GetId();
+	id_top_colour = RegisterProperty("top-colour", "#dddc").AddParser("color").GetId();
+	id_bottom_colour = RegisterProperty("bottom-colour", "#333c").AddParser("color").GetId();
+	id_top_speed = RegisterProperty("top-speed", "10.0").AddParser("number").GetId();
+	id_bottom_speed = RegisterProperty("bottom-speed", "2.0").AddParser("number").GetId();
+	id_top_density = RegisterProperty("top-density", "15").AddParser("number").GetId();
+	id_bottom_density = RegisterProperty("bottom-density", "10").AddParser("number").GetId();
+}
+
+DecoratorInstancerStarfield::~DecoratorInstancerStarfield() {}
+
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
+	const Rml::DecoratorInstancerInterface& /*instancer_interface*/)
+{
+	int num_layers = properties.GetProperty(id_num_layers)->Get<int>();
+	Rml::Colourb top_colour = properties.GetProperty(id_top_colour)->Get<Rml::Colourb>();
+	Rml::Colourb bottom_colour = properties.GetProperty(id_bottom_colour)->Get<Rml::Colourb>();
+	float top_speed = properties.GetProperty(id_top_speed)->Get<float>();
+	float bottom_speed = properties.GetProperty(id_bottom_speed)->Get<float>();
+	int top_density = properties.GetProperty(id_top_density)->Get<int>();
+	int bottom_density = properties.GetProperty(id_bottom_density)->Get<int>();
+
+	auto decorator = Rml::MakeShared<DecoratorStarfield>();
+	if (decorator->Initialise(num_layers, top_colour, bottom_colour, top_speed, bottom_speed, top_density, bottom_density))
+		return decorator;
+
+	return nullptr;
+}

+ 13 - 0
Samples/invaders/src/DecoratorStarfield.h

@@ -78,4 +78,17 @@ private:
 	};
 };
 
+class DecoratorInstancerStarfield : public Rml::DecoratorInstancer {
+public:
+	DecoratorInstancerStarfield();
+	~DecoratorInstancerStarfield();
+
+	/// Instances a decorator given the property tag and attributes from the RCSS file.
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
+		const Rml::DecoratorInstancerInterface& instancer_interface) override;
+
+private:
+	Rml::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;
+};
+
 #endif

+ 2 - 2
Samples/invaders/src/main.cpp

@@ -26,8 +26,8 @@
  *
  */
 
-#include "DecoratorInstancerDefender.h"
-#include "DecoratorInstancerStarfield.h"
+#include "DecoratorDefender.h"
+#include "DecoratorStarfield.h"
 #include "ElementGame.h"
 #include "EventHandlerHighScore.h"
 #include "EventHandlerOptions.h"

+ 24 - 0
Samples/luainvaders/src/DecoratorDefender.cpp

@@ -31,8 +31,10 @@
 #include <RmlUi/Core/Element.h>
 #include <RmlUi/Core/GeometryUtilities.h>
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/RenderInterface.h>
 #include <RmlUi/Core/Texture.h>
+#include <RmlUi/Core/Types.h>
 
 DecoratorDefender::~DecoratorDefender() {}
 
@@ -72,3 +74,25 @@ void DecoratorDefender::RenderElement(Rml::Element* element, Rml::DecoratorDataH
 		render_interface->RenderGeometry(vertices, 4, indices, 6, texture, position);
 	}
 }
+
+DecoratorInstancerDefender::DecoratorInstancerDefender()
+{
+	id_image_src = RegisterProperty("image-src", "").AddParser("string").GetId();
+	RegisterShorthand("decorator", "image-src", Rml::ShorthandType::FallThrough);
+}
+
+DecoratorInstancerDefender::~DecoratorInstancerDefender() {}
+
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
+	const Rml::DecoratorInstancerInterface& instancer_interface)
+{
+	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
+	Rml::String image_source = image_source_property->Get<Rml::String>();
+	Rml::Texture texture = instancer_interface.GetTexture(image_source);
+
+	auto decorator = Rml::MakeShared<DecoratorDefender>();
+	if (decorator->Initialise(texture))
+		return decorator;
+
+	return nullptr;
+}

+ 13 - 0
Samples/luainvaders/src/DecoratorDefender.h

@@ -54,4 +54,17 @@ private:
 	int image_index;
 };
 
+class DecoratorInstancerDefender : public Rml::DecoratorInstancer {
+public:
+	DecoratorInstancerDefender();
+	~DecoratorInstancerDefender();
+
+	/// Instances a decorator given the property tag and attributes from the RCSS file.
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
+		const Rml::DecoratorInstancerInterface& instancer_interface) override;
+
+private:
+	Rml::PropertyId id_image_src;
+};
+
 #endif

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

@@ -1,55 +0,0 @@
-/*
- * 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-2023 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 "DecoratorInstancerDefender.h"
-#include "DecoratorDefender.h"
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/PropertyDefinition.h>
-#include <RmlUi/Core/Types.h>
-
-DecoratorInstancerDefender::DecoratorInstancerDefender()
-{
-	id_image_src = RegisterProperty("image-src", "").AddParser("string").GetId();
-	RegisterShorthand("decorator", "image-src", Rml::ShorthandType::FallThrough);
-}
-
-DecoratorInstancerDefender::~DecoratorInstancerDefender() {}
-
-Rml::SharedPtr<Rml::Decorator> DecoratorInstancerDefender::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
-	const Rml::DecoratorInstancerInterface& instancer_interface)
-{
-	const Rml::Property* image_source_property = properties.GetProperty(id_image_src);
-	Rml::String image_source = image_source_property->Get<Rml::String>();
-	Rml::Texture texture = instancer_interface.GetTexture(image_source);
-
-	auto decorator = Rml::MakeShared<DecoratorDefender>();
-	if (decorator->Initialise(texture))
-		return decorator;
-
-	return nullptr;
-}

+ 0 - 51
Samples/luainvaders/src/DecoratorInstancerDefender.h

@@ -1,51 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_LUAINVADERS_DECORATORINSTANCERDEFENDER_H
-#define RMLUI_LUAINVADERS_DECORATORINSTANCERDEFENDER_H
-
-#include <RmlUi/Core/DecoratorInstancer.h>
-
-/**
-    @author Robert Curry
- */
-
-class DecoratorInstancerDefender : public Rml::DecoratorInstancer {
-public:
-	DecoratorInstancerDefender();
-	~DecoratorInstancerDefender();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
-		const Rml::DecoratorInstancerInterface& instancer_interface) override;
-
-private:
-	Rml::PropertyId id_image_src;
-};
-
-#endif

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

@@ -1,63 +0,0 @@
-/*
- * 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-2023 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 "DecoratorInstancerStarfield.h"
-#include "DecoratorStarfield.h"
-#include <RmlUi/Core/Math.h>
-#include <RmlUi/Core/PropertyDefinition.h>
-
-DecoratorInstancerStarfield::DecoratorInstancerStarfield()
-{
-	id_num_layers = RegisterProperty("num-layers", "3").AddParser("number").GetId();
-	id_top_colour = RegisterProperty("top-colour", "#dddc").AddParser("color").GetId();
-	id_bottom_colour = RegisterProperty("bottom-colour", "#333c").AddParser("color").GetId();
-	id_top_speed = RegisterProperty("top-speed", "10.0").AddParser("number").GetId();
-	id_bottom_speed = RegisterProperty("bottom-speed", "2.0").AddParser("number").GetId();
-	id_top_density = RegisterProperty("top-density", "15").AddParser("number").GetId();
-	id_bottom_density = RegisterProperty("bottom-density", "10").AddParser("number").GetId();
-}
-
-DecoratorInstancerStarfield::~DecoratorInstancerStarfield() {}
-
-Rml::SharedPtr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
-	const Rml::DecoratorInstancerInterface& /*instancer_interface*/)
-{
-	int num_layers = properties.GetProperty(id_num_layers)->Get<int>();
-	Rml::Colourb top_colour = properties.GetProperty(id_top_colour)->Get<Rml::Colourb>();
-	Rml::Colourb bottom_colour = properties.GetProperty(id_bottom_colour)->Get<Rml::Colourb>();
-	float top_speed = properties.GetProperty(id_top_speed)->Get<float>();
-	float bottom_speed = properties.GetProperty(id_bottom_speed)->Get<float>();
-	int top_density = properties.GetProperty(id_top_density)->Get<int>();
-	int bottom_density = properties.GetProperty(id_bottom_density)->Get<int>();
-
-	auto decorator = Rml::MakeShared<DecoratorStarfield>();
-	if (decorator->Initialise(num_layers, top_colour, bottom_colour, top_speed, bottom_speed, top_density, bottom_density))
-		return decorator;
-
-	return nullptr;
-}

+ 0 - 52
Samples/luainvaders/src/DecoratorInstancerStarfield.h

@@ -1,52 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_LUAINVADERS_DECORATORINSTANCERSTARFIELD_H
-#define RMLUI_LUAINVADERS_DECORATORINSTANCERSTARFIELD_H
-
-#include "DecoratorStarfield.h"
-#include <RmlUi/Core/DecoratorInstancer.h>
-
-/**
-    @author Robert Curry
- */
-
-class DecoratorInstancerStarfield : public Rml::DecoratorInstancer {
-public:
-	DecoratorInstancerStarfield();
-	~DecoratorInstancerStarfield();
-
-	/// Instances a decorator given the property tag and attributes from the RCSS file.
-	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
-		const Rml::DecoratorInstancerInterface& instancer_interface) override;
-
-private:
-	Rml::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;
-};
-
-#endif

+ 32 - 0
Samples/luainvaders/src/DecoratorStarfield.cpp

@@ -34,6 +34,7 @@
 #include <RmlUi/Core/ElementUtilities.h>
 #include <RmlUi/Core/GeometryUtilities.h>
 #include <RmlUi/Core/Math.h>
+#include <RmlUi/Core/PropertyDefinition.h>
 #include <RmlUi/Core/RenderInterface.h>
 #include <RmlUi/Core/SystemInterface.h>
 #include <Shell.h>
@@ -151,3 +152,34 @@ void DecoratorStarfield::StarField::Update(double t)
 		}
 	}
 }
+
+DecoratorInstancerStarfield::DecoratorInstancerStarfield()
+{
+	id_num_layers = RegisterProperty("num-layers", "3").AddParser("number").GetId();
+	id_top_colour = RegisterProperty("top-colour", "#dddc").AddParser("color").GetId();
+	id_bottom_colour = RegisterProperty("bottom-colour", "#333c").AddParser("color").GetId();
+	id_top_speed = RegisterProperty("top-speed", "10.0").AddParser("number").GetId();
+	id_bottom_speed = RegisterProperty("bottom-speed", "2.0").AddParser("number").GetId();
+	id_top_density = RegisterProperty("top-density", "15").AddParser("number").GetId();
+	id_bottom_density = RegisterProperty("bottom-density", "10").AddParser("number").GetId();
+}
+
+DecoratorInstancerStarfield::~DecoratorInstancerStarfield() {}
+
+Rml::SharedPtr<Rml::Decorator> DecoratorInstancerStarfield::InstanceDecorator(const Rml::String& /*name*/, const Rml::PropertyDictionary& properties,
+	const Rml::DecoratorInstancerInterface& /*instancer_interface*/)
+{
+	int num_layers = properties.GetProperty(id_num_layers)->Get<int>();
+	Rml::Colourb top_colour = properties.GetProperty(id_top_colour)->Get<Rml::Colourb>();
+	Rml::Colourb bottom_colour = properties.GetProperty(id_bottom_colour)->Get<Rml::Colourb>();
+	float top_speed = properties.GetProperty(id_top_speed)->Get<float>();
+	float bottom_speed = properties.GetProperty(id_bottom_speed)->Get<float>();
+	int top_density = properties.GetProperty(id_top_density)->Get<int>();
+	int bottom_density = properties.GetProperty(id_bottom_density)->Get<int>();
+
+	auto decorator = Rml::MakeShared<DecoratorStarfield>();
+	if (decorator->Initialise(num_layers, top_colour, bottom_colour, top_speed, bottom_speed, top_density, bottom_density))
+		return decorator;
+
+	return nullptr;
+}

+ 13 - 0
Samples/luainvaders/src/DecoratorStarfield.h

@@ -78,4 +78,17 @@ private:
 	};
 };
 
+class DecoratorInstancerStarfield : public Rml::DecoratorInstancer {
+public:
+	DecoratorInstancerStarfield();
+	~DecoratorInstancerStarfield();
+
+	/// Instances a decorator given the property tag and attributes from the RCSS file.
+	Rml::SharedPtr<Rml::Decorator> InstanceDecorator(const Rml::String& name, const Rml::PropertyDictionary& properties,
+		const Rml::DecoratorInstancerInterface& instancer_interface) override;
+
+private:
+	Rml::PropertyId id_num_layers, id_top_colour, id_bottom_colour, id_top_speed, id_bottom_speed, id_top_density, id_bottom_density;
+};
+
 #endif

+ 2 - 2
Samples/luainvaders/src/main.cpp

@@ -26,8 +26,8 @@
  *
  */
 
-#include "DecoratorInstancerDefender.h"
-#include "DecoratorInstancerStarfield.h"
+#include "DecoratorDefender.h"
+#include "DecoratorStarfield.h"
 #include "ElementGame.h"
 #include "HighScores.h"
 #include "LuaInterface.h"

+ 39 - 0
Source/Core/Decorator.cpp

@@ -28,6 +28,7 @@
 
 #include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/PropertyDefinition.h"
+#include "../../Include/RmlUi/Core/StyleSheet.h"
 #include "../../Include/RmlUi/Core/Texture.h"
 #include "TextureDatabase.h"
 #include <algorithm>
@@ -76,4 +77,42 @@ const Texture* Decorator::GetTexture(int index) const
 	return &(additional_textures[index]);
 }
 
+DecoratorInstancer::DecoratorInstancer() : properties(10, 10) {}
+
+DecoratorInstancer::~DecoratorInstancer() {}
+
+const PropertySpecification& DecoratorInstancer::GetPropertySpecification() const
+{
+	return properties;
+}
+
+PropertyDefinition& DecoratorInstancer::RegisterProperty(const String& property_name, const String& default_value)
+{
+	return properties.RegisterProperty(property_name, default_value, false, false);
+}
+
+ShorthandId DecoratorInstancer::RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type)
+{
+	return properties.RegisterShorthand(shorthand_name, property_names, type);
+}
+
+const Sprite* DecoratorInstancerInterface::GetSprite(const String& name) const
+{
+	return style_sheet.GetSprite(name);
+}
+
+Texture DecoratorInstancerInterface::GetTexture(const String& filename) const
+{
+	Texture texture;
+
+	if (!property_source)
+	{
+		Log::Message(Log::LT_WARNING, "Texture name '%s' in decorator could not be loaded, no property source available.", filename.c_str());
+		return texture;
+	}
+
+	texture.Set(filename, property_source->path);
+
+	return texture;
+}
 } // namespace Rml

+ 0 - 1
Source/Core/DecoratorGradient.h

@@ -30,7 +30,6 @@
 #define RMLUI_CORE_DECORATORGRADIENT_H
 
 #include "../../Include/RmlUi/Core/Decorator.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
 #include "../../Include/RmlUi/Core/ID.h"
 
 namespace Rml {

+ 0 - 73
Source/Core/DecoratorInstancer.cpp

@@ -1,73 +0,0 @@
-/*
- * 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-2023 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/DecoratorInstancer.h"
-#include "../../Include/RmlUi/Core/StyleSheet.h"
-
-namespace Rml {
-
-DecoratorInstancer::DecoratorInstancer() : properties(10, 10) {}
-
-DecoratorInstancer::~DecoratorInstancer() {}
-
-const PropertySpecification& DecoratorInstancer::GetPropertySpecification() const
-{
-	return properties;
-}
-
-PropertyDefinition& DecoratorInstancer::RegisterProperty(const String& property_name, const String& default_value)
-{
-	return properties.RegisterProperty(property_name, default_value, false, false);
-}
-
-ShorthandId DecoratorInstancer::RegisterShorthand(const String& shorthand_name, const String& property_names, ShorthandType type)
-{
-	return properties.RegisterShorthand(shorthand_name, property_names, type);
-}
-
-const Sprite* DecoratorInstancerInterface::GetSprite(const String& name) const
-{
-	return style_sheet.GetSprite(name);
-}
-
-Texture DecoratorInstancerInterface::GetTexture(const String& filename) const
-{
-	Texture texture;
-
-	if (!property_source)
-	{
-		Log::Message(Log::LT_WARNING, "Texture name '%s' in decorator could not be loaded, no property source available.", filename.c_str());
-		return texture;
-	}
-
-	texture.Set(filename, property_source->path);
-
-	return texture;
-}
-
-} // namespace Rml

+ 0 - 1
Source/Core/DecoratorNinePatch.h

@@ -30,7 +30,6 @@
 #define RMLUI_CORE_DECORATORNINEPATCH_H
 
 #include "../../Include/RmlUi/Core/Decorator.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
 #include "../../Include/RmlUi/Core/ID.h"
 #include "../../Include/RmlUi/Core/Spritesheet.h"
 

+ 148 - 0
Source/Core/DecoratorTiled.cpp

@@ -31,6 +31,8 @@
 #include "../../Include/RmlUi/Core/ElementUtilities.h"
 #include "../../Include/RmlUi/Core/GeometryUtilities.h"
 #include "../../Include/RmlUi/Core/Math.h"
+#include "../../Include/RmlUi/Core/PropertyDefinition.h"
+#include "../../Include/RmlUi/Core/Spritesheet.h"
 #include <algorithm>
 
 namespace Rml {
@@ -234,4 +236,150 @@ void DecoratorTiled::ScaleTileDimensions(Vector2f& tile_dimensions, float axis_v
 	}
 }
 
+DecoratorTiledInstancer::DecoratorTiledInstancer(size_t num_tiles)
+{
+	tile_property_ids.reserve(num_tiles);
+}
+
+void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool register_fit_modes)
+{
+	TilePropertyIds ids = {};
+
+	ids.src = RegisterProperty(CreateString(32, "%s-src", name.c_str()), "").AddParser("string").GetId();
+
+	String additional_modes;
+
+	if (register_fit_modes)
+	{
+		String fit_name = CreateString(32, "%s-fit", name.c_str());
+		ids.fit = RegisterProperty(fit_name, "fill").AddParser("keyword", "fill, contain, cover, scale-none, scale-down").GetId();
+
+		String align_x_name = CreateString(32, "%s-align-x", name.c_str());
+		ids.align_x = RegisterProperty(align_x_name, "center").AddParser("keyword", "left, center, right").AddParser("length_percent").GetId();
+
+		String align_y_name = CreateString(32, "%s-align-y", name.c_str());
+		ids.align_y = RegisterProperty(align_y_name, "center").AddParser("keyword", "top, center, bottom").AddParser("length_percent").GetId();
+
+		additional_modes += ", " + fit_name + ", " + align_x_name + ", " + align_y_name;
+	}
+
+	ids.orientation = RegisterProperty(CreateString(32, "%s-orientation", name.c_str()), "none")
+						  .AddParser("keyword", "none, flip-horizontal, flip-vertical, rotate-180")
+						  .GetId();
+
+	RegisterShorthand(name,
+		CreateString(256, ("%s-src, %s-orientation" + additional_modes).c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str(),
+			name.c_str()),
+		ShorthandType::FallThrough);
+
+	tile_property_ids.push_back(ids);
+}
+
+bool DecoratorTiledInstancer::GetTileProperties(DecoratorTiled::Tile* tiles, Texture* textures, size_t num_tiles_and_textures,
+	const PropertyDictionary& properties, const DecoratorInstancerInterface& instancer_interface) const
+{
+	RMLUI_ASSERT(num_tiles_and_textures == tile_property_ids.size());
+
+	String previous_texture_name;
+	Texture previous_texture;
+
+	for (size_t i = 0; i < num_tiles_and_textures; i++)
+	{
+		const TilePropertyIds& ids = tile_property_ids[i];
+
+		const Property* src_property = properties.GetProperty(ids.src);
+		const String texture_name = src_property->Get<String>();
+
+		// Skip the tile if it has no source name.
+		// Declaring the name 'auto' is the same as an empty string. This gives an easy way to skip certain
+		// tiles in a shorthand since we can't always declare an empty string.
+		if (texture_name.empty() || texture_name == "auto")
+			continue;
+
+		// We are required to set default values before instancing the tile, thus, all properties should always be
+		// dereferencable. If the debugger captures a zero-dereference, check that all properties for every tile is set
+		// and default values are set just before instancing.
+
+		DecoratorTiled::Tile& tile = tiles[i];
+		Texture& texture = textures[i];
+
+		// A tile is always either a sprite or an image.
+		if (const Sprite* sprite = instancer_interface.GetSprite(texture_name))
+		{
+			tile.position = sprite->rectangle.Position();
+			tile.size = sprite->rectangle.Size();
+			tile.display_scale = sprite->sprite_sheet->display_scale;
+
+			texture = sprite->sprite_sheet->texture;
+		}
+		else
+		{
+			// No sprite found, so assume that the name is an image source. Since the common use case is to specify the
+			// same texture for all tiles, check the previous texture first before fetching from the global database.
+			if (texture_name == previous_texture_name)
+			{
+				texture = previous_texture;
+			}
+			else
+			{
+				texture = instancer_interface.GetTexture(texture_name);
+
+				if (!texture)
+					return false;
+
+				previous_texture_name = texture_name;
+				previous_texture = texture;
+			}
+		}
+
+		if (ids.fit != PropertyId::Invalid)
+		{
+			RMLUI_ASSERT(ids.align_x != PropertyId::Invalid && ids.align_y != PropertyId::Invalid);
+			const Property& fit_property = *properties.GetProperty(ids.fit);
+			tile.fit_mode = (DecoratorTiled::TileFitMode)fit_property.value.Get<int>();
+
+			const Property* align_properties[2] = {properties.GetProperty(ids.align_x), properties.GetProperty(ids.align_y)};
+
+			for (int dimension = 0; dimension < 2; dimension++)
+			{
+				using Style::LengthPercentage;
+
+				LengthPercentage& align = tile.align[dimension];
+				const Property& property = *align_properties[dimension];
+				if (property.unit == Unit::KEYWORD)
+				{
+					enum { TOP_LEFT, CENTER, BOTTOM_RIGHT };
+					switch (property.Get<int>())
+					{
+					case TOP_LEFT: align = LengthPercentage(LengthPercentage::Percentage, 0.0f); break;
+					case CENTER: align = LengthPercentage(LengthPercentage::Percentage, 50.0f); break;
+					case BOTTOM_RIGHT: align = LengthPercentage(LengthPercentage::Percentage, 100.0f); break;
+					}
+				}
+				else if (property.unit == Unit::PERCENT)
+				{
+					align = LengthPercentage(LengthPercentage::Percentage, property.Get<float>());
+				}
+				else if (property.unit == Unit::PX)
+				{
+					align = LengthPercentage(LengthPercentage::Length, property.Get<float>());
+				}
+				else
+				{
+					Log::Message(Log::LT_WARNING, "Decorator alignment value is '%s' which uses an unsupported unit (use px, %%, or keyword)",
+						property.ToString().c_str());
+				}
+			}
+		}
+
+		if (ids.orientation != PropertyId::Invalid)
+		{
+			const Property& orientation_property = *properties.GetProperty(ids.orientation);
+			tile.orientation = (DecoratorTiled::TileOrientation)orientation_property.value.Get<int>();
+		}
+	}
+
+	return true;
+}
+
 } // namespace Rml

+ 26 - 0
Source/Core/DecoratorTiled.h

@@ -126,5 +126,31 @@ protected:
 	void ScaleTileDimensions(Vector2f& tile_dimensions, float axis_value, Axis axis) const;
 };
 
+class DecoratorTiledInstancer : public DecoratorInstancer {
+public:
+	DecoratorTiledInstancer(size_t num_tiles);
+
+protected:
+	/// Adds the property declarations for a tile.
+	/// @param[in] name The name of the tile property.
+	/// @param[in] register_fit_modes If true, the tile will have the fit modes registered.
+	void RegisterTileProperty(const String& name, bool register_fit_modes = false);
+
+	/// Retrieves all the properties for a tile from the property dictionary.
+	/// @param[out] tile The tile structure for storing the tile properties.
+	/// @param[out] textures Holds the textures declared for the tile.
+	/// @param[in] properties The user-defined list of parameters for the decorator.
+	/// @param[in] instancer_interface An interface for querying the active style sheet.
+	bool GetTileProperties(DecoratorTiled::Tile* tiles, Texture* textures, size_t num_tiles_and_textures, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) const;
+
+private:
+	struct TilePropertyIds {
+		PropertyId src, fit, align_x, align_y, orientation;
+	};
+
+	Vector<TilePropertyIds> tile_property_ids;
+};
+
 } // namespace Rml
 #endif

+ 39 - 0
Source/Core/DecoratorTiledBox.cpp

@@ -258,4 +258,43 @@ void DecoratorTiledBox::RenderElement(Element* element, DecoratorDataHandle elem
 		data->geometry[i].Render(translation);
 }
 
+DecoratorTiledBoxInstancer::DecoratorTiledBoxInstancer() : DecoratorTiledInstancer(9)
+{
+	RegisterTileProperty("top-left-image");
+	RegisterTileProperty("top-right-image");
+	RegisterTileProperty("bottom-left-image");
+	RegisterTileProperty("bottom-right-image");
+
+	RegisterTileProperty("left-image");
+	RegisterTileProperty("right-image");
+	RegisterTileProperty("top-image");
+	RegisterTileProperty("bottom-image");
+
+	RegisterTileProperty("center-image");
+
+	RegisterShorthand("decorator",
+		"top-left-image, top-image, top-right-image, left-image, center-image, right-image, bottom-left-image, bottom-image, bottom-right-image",
+		ShorthandType::RecursiveCommaSeparated);
+}
+
+DecoratorTiledBoxInstancer::~DecoratorTiledBoxInstancer() {}
+
+SharedPtr<Decorator> DecoratorTiledBoxInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
+	const DecoratorInstancerInterface& instancer_interface)
+{
+	constexpr size_t num_tiles = 9;
+
+	DecoratorTiled::Tile tiles[num_tiles];
+	Texture textures[num_tiles];
+
+	if (!GetTileProperties(tiles, textures, num_tiles, properties, instancer_interface))
+		return nullptr;
+
+	auto decorator = MakeShared<DecoratorTiledBox>();
+	if (!decorator->Initialise(tiles, textures))
+		return nullptr;
+
+	return decorator;
+}
+
 } // namespace Rml

+ 10 - 0
Source/Core/DecoratorTiledBox.h

@@ -72,5 +72,15 @@ private:
 	Tile tiles[9];
 };
 
+class DecoratorTiledBoxInstancer : public DecoratorTiledInstancer {
+public:
+	DecoratorTiledBoxInstancer();
+	~DecoratorTiledBoxInstancer();
+
+	/// Instances a box decorator.
+	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) override;
+};
+
 } // namespace Rml
 #endif

+ 0 - 73
Source/Core/DecoratorTiledBoxInstancer.cpp

@@ -1,73 +0,0 @@
-/*
- * 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-2023 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 "DecoratorTiledBoxInstancer.h"
-#include "DecoratorTiledBox.h"
-
-namespace Rml {
-
-DecoratorTiledBoxInstancer::DecoratorTiledBoxInstancer() : DecoratorTiledInstancer(9)
-{
-	RegisterTileProperty("top-left-image");
-	RegisterTileProperty("top-right-image");
-	RegisterTileProperty("bottom-left-image");
-	RegisterTileProperty("bottom-right-image");
-
-	RegisterTileProperty("left-image");
-	RegisterTileProperty("right-image");
-	RegisterTileProperty("top-image");
-	RegisterTileProperty("bottom-image");
-
-	RegisterTileProperty("center-image");
-
-	RegisterShorthand("decorator",
-		"top-left-image, top-image, top-right-image, left-image, center-image, right-image, bottom-left-image, bottom-image, bottom-right-image",
-		ShorthandType::RecursiveCommaSeparated);
-}
-
-DecoratorTiledBoxInstancer::~DecoratorTiledBoxInstancer() {}
-
-SharedPtr<Decorator> DecoratorTiledBoxInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
-	const DecoratorInstancerInterface& instancer_interface)
-{
-	constexpr size_t num_tiles = 9;
-
-	DecoratorTiled::Tile tiles[num_tiles];
-	Texture textures[num_tiles];
-
-	if (!GetTileProperties(tiles, textures, num_tiles, properties, instancer_interface))
-		return nullptr;
-
-	auto decorator = MakeShared<DecoratorTiledBox>();
-	if (!decorator->Initialise(tiles, textures))
-		return nullptr;
-
-	return decorator;
-}
-
-} // namespace Rml

+ 0 - 51
Source/Core/DecoratorTiledBoxInstancer.h

@@ -1,51 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_CORE_DECORATORTILEDBOXINSTANCER_H
-#define RMLUI_CORE_DECORATORTILEDBOXINSTANCER_H
-
-#include "DecoratorTiledInstancer.h"
-
-namespace Rml {
-
-/**
-    @author Peter Curry
- */
-
-class DecoratorTiledBoxInstancer : public DecoratorTiledInstancer {
-public:
-	DecoratorTiledBoxInstancer();
-	~DecoratorTiledBoxInstancer();
-
-	/// Instances a box decorator.
-	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
-		const DecoratorInstancerInterface& instancer_interface) override;
-};
-
-} // namespace Rml
-#endif

+ 27 - 0
Source/Core/DecoratorTiledHorizontal.cpp

@@ -143,4 +143,31 @@ void DecoratorTiledHorizontal::RenderElement(Element* element, DecoratorDataHand
 		data->geometry[i].Render(translation);
 }
 
+DecoratorTiledHorizontalInstancer::DecoratorTiledHorizontalInstancer() : DecoratorTiledInstancer(3)
+{
+	RegisterTileProperty("left-image");
+	RegisterTileProperty("right-image");
+	RegisterTileProperty("center-image");
+	RegisterShorthand("decorator", "left-image, center-image, right-image", ShorthandType::RecursiveCommaSeparated);
+}
+
+DecoratorTiledHorizontalInstancer::~DecoratorTiledHorizontalInstancer() {}
+
+SharedPtr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
+	const DecoratorInstancerInterface& instancer_interface)
+{
+	constexpr size_t num_tiles = 3;
+
+	DecoratorTiled::Tile tiles[num_tiles];
+	Texture textures[num_tiles];
+
+	if (!GetTileProperties(tiles, textures, num_tiles, properties, instancer_interface))
+		return nullptr;
+
+	auto decorator = MakeShared<DecoratorTiledHorizontal>();
+	if (!decorator->Initialise(tiles, textures))
+		return nullptr;
+
+	return decorator;
+}
 } // namespace Rml

+ 10 - 0
Source/Core/DecoratorTiledHorizontal.h

@@ -62,5 +62,15 @@ private:
 	Tile tiles[3];
 };
 
+class DecoratorTiledHorizontalInstancer : public DecoratorTiledInstancer {
+public:
+	DecoratorTiledHorizontalInstancer();
+	~DecoratorTiledHorizontalInstancer();
+
+	/// Instances a horizontal decorator.
+	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) override;
+};
+
 } // namespace Rml
 #endif

+ 0 - 62
Source/Core/DecoratorTiledHorizontalInstancer.cpp

@@ -1,62 +0,0 @@
-/*
- * 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-2023 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 "DecoratorTiledHorizontalInstancer.h"
-#include "DecoratorTiledHorizontal.h"
-
-namespace Rml {
-
-DecoratorTiledHorizontalInstancer::DecoratorTiledHorizontalInstancer() : DecoratorTiledInstancer(3)
-{
-	RegisterTileProperty("left-image");
-	RegisterTileProperty("right-image");
-	RegisterTileProperty("center-image");
-	RegisterShorthand("decorator", "left-image, center-image, right-image", ShorthandType::RecursiveCommaSeparated);
-}
-
-DecoratorTiledHorizontalInstancer::~DecoratorTiledHorizontalInstancer() {}
-
-SharedPtr<Decorator> DecoratorTiledHorizontalInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
-	const DecoratorInstancerInterface& instancer_interface)
-{
-	constexpr size_t num_tiles = 3;
-
-	DecoratorTiled::Tile tiles[num_tiles];
-	Texture textures[num_tiles];
-
-	if (!GetTileProperties(tiles, textures, num_tiles, properties, instancer_interface))
-		return nullptr;
-
-	auto decorator = MakeShared<DecoratorTiledHorizontal>();
-	if (!decorator->Initialise(tiles, textures))
-		return nullptr;
-
-	return decorator;
-}
-
-} // namespace Rml

+ 0 - 51
Source/Core/DecoratorTiledHorizontalInstancer.h

@@ -1,51 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_CORE_DECORATORTILEDHORIZONTALINSTANCER_H
-#define RMLUI_CORE_DECORATORTILEDHORIZONTALINSTANCER_H
-
-#include "DecoratorTiledInstancer.h"
-
-namespace Rml {
-
-/**
-    @author Peter Curry
- */
-
-class DecoratorTiledHorizontalInstancer : public DecoratorTiledInstancer {
-public:
-	DecoratorTiledHorizontalInstancer();
-	~DecoratorTiledHorizontalInstancer();
-
-	/// Instances a horizontal decorator.
-	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
-		const DecoratorInstancerInterface& instancer_interface) override;
-};
-
-} // namespace Rml
-#endif

+ 25 - 0
Source/Core/DecoratorTiledImage.cpp

@@ -72,4 +72,29 @@ void DecoratorTiledImage::RenderElement(Element* element, DecoratorDataHandle el
 	data->Render(element->GetAbsoluteOffset(BoxArea::Padding).Round());
 }
 
+DecoratorTiledImageInstancer::DecoratorTiledImageInstancer() : DecoratorTiledInstancer(1)
+{
+	RegisterTileProperty("image", true);
+	RegisterShorthand("decorator", "image", ShorthandType::RecursiveRepeat);
+}
+
+DecoratorTiledImageInstancer::~DecoratorTiledImageInstancer() {}
+
+SharedPtr<Decorator> DecoratorTiledImageInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
+	const DecoratorInstancerInterface& instancer_interface)
+{
+	DecoratorTiled::Tile tile;
+	Texture texture;
+
+	if (!GetTileProperties(&tile, &texture, 1, properties, instancer_interface))
+		return nullptr;
+
+	auto decorator = MakeShared<DecoratorTiledImage>();
+
+	if (!decorator->Initialise(tile, texture))
+		return nullptr;
+
+	return decorator;
+}
+
 } // namespace Rml

+ 10 - 0
Source/Core/DecoratorTiledImage.h

@@ -60,5 +60,15 @@ private:
 	Tile tile;
 };
 
+class DecoratorTiledImageInstancer : public DecoratorTiledInstancer {
+public:
+	DecoratorTiledImageInstancer();
+	~DecoratorTiledImageInstancer();
+
+	/// Instances an image decorator.
+	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) override;
+};
+
 } // namespace Rml
 #endif

+ 0 - 59
Source/Core/DecoratorTiledImageInstancer.cpp

@@ -1,59 +0,0 @@
-/*
- * 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-2023 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 "DecoratorTiledImageInstancer.h"
-#include "DecoratorTiledImage.h"
-
-namespace Rml {
-
-DecoratorTiledImageInstancer::DecoratorTiledImageInstancer() : DecoratorTiledInstancer(1)
-{
-	RegisterTileProperty("image", true);
-	RegisterShorthand("decorator", "image", ShorthandType::RecursiveRepeat);
-}
-
-DecoratorTiledImageInstancer::~DecoratorTiledImageInstancer() {}
-
-SharedPtr<Decorator> DecoratorTiledImageInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
-	const DecoratorInstancerInterface& instancer_interface)
-{
-	DecoratorTiled::Tile tile;
-	Texture texture;
-
-	if (!GetTileProperties(&tile, &texture, 1, properties, instancer_interface))
-		return nullptr;
-
-	auto decorator = MakeShared<DecoratorTiledImage>();
-
-	if (!decorator->Initialise(tile, texture))
-		return nullptr;
-
-	return decorator;
-}
-
-} // namespace Rml

+ 0 - 51
Source/Core/DecoratorTiledImageInstancer.h

@@ -1,51 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_CORE_DECORATORTILEDIMAGEINSTANCER_H
-#define RMLUI_CORE_DECORATORTILEDIMAGEINSTANCER_H
-
-#include "DecoratorTiledInstancer.h"
-
-namespace Rml {
-
-/**
-    @author Peter Curry
- */
-
-class DecoratorTiledImageInstancer : public DecoratorTiledInstancer {
-public:
-	DecoratorTiledImageInstancer();
-	~DecoratorTiledImageInstancer();
-
-	/// Instances an image decorator.
-	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
-		const DecoratorInstancerInterface& instancer_interface) override;
-};
-
-} // namespace Rml
-#endif

+ 0 - 181
Source/Core/DecoratorTiledInstancer.cpp

@@ -1,181 +0,0 @@
-/*
- * 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-2023 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 "DecoratorTiledInstancer.h"
-#include "../../Include/RmlUi/Core/PropertyDefinition.h"
-#include "../../Include/RmlUi/Core/Spritesheet.h"
-
-namespace Rml {
-
-DecoratorTiledInstancer::DecoratorTiledInstancer(size_t num_tiles)
-{
-	tile_property_ids.reserve(num_tiles);
-}
-
-void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool register_fit_modes)
-{
-	TilePropertyIds ids = {};
-
-	ids.src = RegisterProperty(CreateString(32, "%s-src", name.c_str()), "").AddParser("string").GetId();
-
-	String additional_modes;
-
-	if (register_fit_modes)
-	{
-		String fit_name = CreateString(32, "%s-fit", name.c_str());
-		ids.fit = RegisterProperty(fit_name, "fill").AddParser("keyword", "fill, contain, cover, scale-none, scale-down").GetId();
-
-		String align_x_name = CreateString(32, "%s-align-x", name.c_str());
-		ids.align_x = RegisterProperty(align_x_name, "center").AddParser("keyword", "left, center, right").AddParser("length_percent").GetId();
-
-		String align_y_name = CreateString(32, "%s-align-y", name.c_str());
-		ids.align_y = RegisterProperty(align_y_name, "center").AddParser("keyword", "top, center, bottom").AddParser("length_percent").GetId();
-
-		additional_modes += ", " + fit_name + ", " + align_x_name + ", " + align_y_name;
-	}
-
-	ids.orientation = RegisterProperty(CreateString(32, "%s-orientation", name.c_str()), "none")
-						  .AddParser("keyword", "none, flip-horizontal, flip-vertical, rotate-180")
-						  .GetId();
-
-	RegisterShorthand(name,
-		CreateString(256, ("%s-src, %s-orientation" + additional_modes).c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str(), name.c_str(),
-			name.c_str()),
-		ShorthandType::FallThrough);
-
-	tile_property_ids.push_back(ids);
-}
-
-bool DecoratorTiledInstancer::GetTileProperties(DecoratorTiled::Tile* tiles, Texture* textures, size_t num_tiles_and_textures,
-	const PropertyDictionary& properties, const DecoratorInstancerInterface& instancer_interface) const
-{
-	RMLUI_ASSERT(num_tiles_and_textures == tile_property_ids.size());
-
-	String previous_texture_name;
-	Texture previous_texture;
-
-	for (size_t i = 0; i < num_tiles_and_textures; i++)
-	{
-		const TilePropertyIds& ids = tile_property_ids[i];
-
-		const Property* src_property = properties.GetProperty(ids.src);
-		const String texture_name = src_property->Get<String>();
-
-		// Skip the tile if it has no source name.
-		// Declaring the name 'auto' is the same as an empty string. This gives an easy way to skip certain
-		// tiles in a shorthand since we can't always declare an empty string.
-		if (texture_name.empty() || texture_name == "auto")
-			continue;
-
-		// We are required to set default values before instancing the tile, thus, all properties should always be
-		// dereferencable. If the debugger captures a zero-dereference, check that all properties for every tile is set
-		// and default values are set just before instancing.
-
-		DecoratorTiled::Tile& tile = tiles[i];
-		Texture& texture = textures[i];
-
-		// A tile is always either a sprite or an image.
-		if (const Sprite* sprite = instancer_interface.GetSprite(texture_name))
-		{
-			tile.position = sprite->rectangle.Position();
-			tile.size = sprite->rectangle.Size();
-			tile.display_scale = sprite->sprite_sheet->display_scale;
-
-			texture = sprite->sprite_sheet->texture;
-		}
-		else
-		{
-			// No sprite found, so assume that the name is an image source. Since the common use case is to specify the
-			// same texture for all tiles, check the previous texture first before fetching from the global database.
-			if (texture_name == previous_texture_name)
-			{
-				texture = previous_texture;
-			}
-			else
-			{
-				texture = instancer_interface.GetTexture(texture_name);
-
-				if (!texture)
-					return false;
-
-				previous_texture_name = texture_name;
-				previous_texture = texture;
-			}
-		}
-
-		if (ids.fit != PropertyId::Invalid)
-		{
-			RMLUI_ASSERT(ids.align_x != PropertyId::Invalid && ids.align_y != PropertyId::Invalid);
-			const Property& fit_property = *properties.GetProperty(ids.fit);
-			tile.fit_mode = (DecoratorTiled::TileFitMode)fit_property.value.Get<int>();
-
-			const Property* align_properties[2] = {properties.GetProperty(ids.align_x), properties.GetProperty(ids.align_y)};
-
-			for (int dimension = 0; dimension < 2; dimension++)
-			{
-				using Style::LengthPercentage;
-
-				LengthPercentage& align = tile.align[dimension];
-				const Property& property = *align_properties[dimension];
-				if (property.unit == Unit::KEYWORD)
-				{
-					enum { TOP_LEFT, CENTER, BOTTOM_RIGHT };
-					switch (property.Get<int>())
-					{
-					case TOP_LEFT: align = LengthPercentage(LengthPercentage::Percentage, 0.0f); break;
-					case CENTER: align = LengthPercentage(LengthPercentage::Percentage, 50.0f); break;
-					case BOTTOM_RIGHT: align = LengthPercentage(LengthPercentage::Percentage, 100.0f); break;
-					}
-				}
-				else if (property.unit == Unit::PERCENT)
-				{
-					align = LengthPercentage(LengthPercentage::Percentage, property.Get<float>());
-				}
-				else if (property.unit == Unit::PX)
-				{
-					align = LengthPercentage(LengthPercentage::Length, property.Get<float>());
-				}
-				else
-				{
-					Log::Message(Log::LT_WARNING, "Decorator alignment value is '%s' which uses an unsupported unit (use px, %%, or keyword)",
-						property.ToString().c_str());
-				}
-			}
-		}
-
-		if (ids.orientation != PropertyId::Invalid)
-		{
-			const Property& orientation_property = *properties.GetProperty(ids.orientation);
-			tile.orientation = (DecoratorTiled::TileOrientation)orientation_property.value.Get<int>();
-		}
-	}
-
-	return true;
-}
-
-} // namespace Rml

+ 0 - 70
Source/Core/DecoratorTiledInstancer.h

@@ -1,70 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_CORE_DECORATORTILEDINSTANCER_H
-#define RMLUI_CORE_DECORATORTILEDINSTANCER_H
-
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
-#include "DecoratorTiled.h"
-
-namespace Rml {
-
-class StyleSheet;
-
-/**
-    @author Peter Curry
- */
-
-class DecoratorTiledInstancer : public DecoratorInstancer {
-public:
-	DecoratorTiledInstancer(size_t num_tiles);
-
-protected:
-	/// Adds the property declarations for a tile.
-	/// @param[in] name The name of the tile property.
-	/// @param[in] register_fit_modes If true, the tile will have the fit modes registered.
-	void RegisterTileProperty(const String& name, bool register_fit_modes = false);
-
-	/// Retrieves all the properties for a tile from the property dictionary.
-	/// @param[out] tile The tile structure for storing the tile properties.
-	/// @param[out] textures Holds the textures declared for the tile.
-	/// @param[in] properties The user-defined list of parameters for the decorator.
-	/// @param[in] instancer_interface An interface for querying the active style sheet.
-	bool GetTileProperties(DecoratorTiled::Tile* tiles, Texture* textures, size_t num_tiles_and_textures, const PropertyDictionary& properties,
-		const DecoratorInstancerInterface& instancer_interface) const;
-
-private:
-	struct TilePropertyIds {
-		PropertyId src, fit, align_x, align_y, orientation;
-	};
-
-	Vector<TilePropertyIds> tile_property_ids;
-};
-
-} // namespace Rml
-#endif

+ 28 - 0
Source/Core/DecoratorTiledVertical.cpp

@@ -145,4 +145,32 @@ void DecoratorTiledVertical::RenderElement(Element* element, DecoratorDataHandle
 		data->geometry[i].Render(translation);
 }
 
+DecoratorTiledVerticalInstancer::DecoratorTiledVerticalInstancer() : DecoratorTiledInstancer(3)
+{
+	RegisterTileProperty("top-image");
+	RegisterTileProperty("bottom-image");
+	RegisterTileProperty("center-image");
+	RegisterShorthand("decorator", "top-image, center-image, bottom-image", ShorthandType::RecursiveCommaSeparated);
+}
+
+DecoratorTiledVerticalInstancer::~DecoratorTiledVerticalInstancer() {}
+
+SharedPtr<Decorator> DecoratorTiledVerticalInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
+	const DecoratorInstancerInterface& instancer_interface)
+{
+	constexpr size_t num_tiles = 3;
+
+	DecoratorTiled::Tile tiles[num_tiles];
+	Texture textures[num_tiles];
+
+	if (!GetTileProperties(tiles, textures, num_tiles, properties, instancer_interface))
+		return nullptr;
+
+	auto decorator = MakeShared<DecoratorTiledVertical>();
+	if (!decorator->Initialise(tiles, textures))
+		return nullptr;
+
+	return decorator;
+}
+
 } // namespace Rml

+ 10 - 0
Source/Core/DecoratorTiledVertical.h

@@ -62,5 +62,15 @@ private:
 	Tile tiles[3];
 };
 
+class DecoratorTiledVerticalInstancer : public DecoratorTiledInstancer {
+public:
+	DecoratorTiledVerticalInstancer();
+	~DecoratorTiledVerticalInstancer();
+
+	/// Instances a vertical decorator.
+	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
+		const DecoratorInstancerInterface& instancer_interface) override;
+};
+
 } // namespace Rml
 #endif

+ 0 - 62
Source/Core/DecoratorTiledVerticalInstancer.cpp

@@ -1,62 +0,0 @@
-/*
- * 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-2023 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 "DecoratorTiledVerticalInstancer.h"
-#include "DecoratorTiledVertical.h"
-
-namespace Rml {
-
-DecoratorTiledVerticalInstancer::DecoratorTiledVerticalInstancer() : DecoratorTiledInstancer(3)
-{
-	RegisterTileProperty("top-image");
-	RegisterTileProperty("bottom-image");
-	RegisterTileProperty("center-image");
-	RegisterShorthand("decorator", "top-image, center-image, bottom-image", ShorthandType::RecursiveCommaSeparated);
-}
-
-DecoratorTiledVerticalInstancer::~DecoratorTiledVerticalInstancer() {}
-
-SharedPtr<Decorator> DecoratorTiledVerticalInstancer::InstanceDecorator(const String& /*name*/, const PropertyDictionary& properties,
-	const DecoratorInstancerInterface& instancer_interface)
-{
-	constexpr size_t num_tiles = 3;
-
-	DecoratorTiled::Tile tiles[num_tiles];
-	Texture textures[num_tiles];
-
-	if (!GetTileProperties(tiles, textures, num_tiles, properties, instancer_interface))
-		return nullptr;
-
-	auto decorator = MakeShared<DecoratorTiledVertical>();
-	if (!decorator->Initialise(tiles, textures))
-		return nullptr;
-
-	return decorator;
-}
-
-} // namespace Rml

+ 0 - 51
Source/Core/DecoratorTiledVerticalInstancer.h

@@ -1,51 +0,0 @@
-/*
- * 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-2023 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.
- *
- */
-
-#ifndef RMLUI_CORE_DECORATORTILEDVERTICALINSTANCER_H
-#define RMLUI_CORE_DECORATORTILEDVERTICALINSTANCER_H
-
-#include "DecoratorTiledInstancer.h"
-
-namespace Rml {
-
-/**
-    @author Peter Curry
- */
-
-class DecoratorTiledVerticalInstancer : public DecoratorTiledInstancer {
-public:
-	DecoratorTiledVerticalInstancer();
-	~DecoratorTiledVerticalInstancer();
-
-	/// Instances a vertical decorator.
-	SharedPtr<Decorator> InstanceDecorator(const String& name, const PropertyDictionary& properties,
-		const DecoratorInstancerInterface& instancer_interface) override;
-};
-
-} // namespace Rml
-#endif

+ 1 - 1
Source/Core/ElementAnimation.cpp

@@ -27,7 +27,7 @@
  */
 
 #include "ElementAnimation.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
+#include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/Factory.h"
 #include "../../Include/RmlUi/Core/PropertyDefinition.h"

+ 0 - 1
Source/Core/ElementDecoration.cpp

@@ -29,7 +29,6 @@
 #include "ElementDecoration.h"
 #include "../../Include/RmlUi/Core/ComputedValues.h"
 #include "../../Include/RmlUi/Core/Decorator.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/ElementDocument.h"
 #include "../../Include/RmlUi/Core/Profiling.h"

+ 4 - 4
Source/Core/Factory.cpp

@@ -50,10 +50,10 @@
 #include "DataViewDefault.h"
 #include "DecoratorGradient.h"
 #include "DecoratorNinePatch.h"
-#include "DecoratorTiledBoxInstancer.h"
-#include "DecoratorTiledHorizontalInstancer.h"
-#include "DecoratorTiledImageInstancer.h"
-#include "DecoratorTiledVerticalInstancer.h"
+#include "DecoratorTiledBox.h"
+#include "DecoratorTiledHorizontal.h"
+#include "DecoratorTiledImage.h"
+#include "DecoratorTiledVertical.h"
 #include "ElementHandle.h"
 #include "Elements/ElementImage.h"
 #include "Elements/ElementLabel.h"

+ 1 - 1
Source/Core/PropertyParserDecorator.cpp

@@ -27,7 +27,7 @@
  */
 
 #include "PropertyParserDecorator.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
+#include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/Factory.h"
 #include "../../Include/RmlUi/Core/Profiling.h"
 #include "../../Include/RmlUi/Core/PropertySpecification.h"

+ 1 - 1
Source/Core/StyleSheet.cpp

@@ -27,7 +27,7 @@
  */
 
 #include "../../Include/RmlUi/Core/StyleSheet.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
+#include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/Element.h"
 #include "../../Include/RmlUi/Core/Profiling.h"
 #include "../../Include/RmlUi/Core/PropertyDefinition.h"

+ 1 - 1
Source/Core/StyleSheetParser.cpp

@@ -27,7 +27,7 @@
  */
 
 #include "StyleSheetParser.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
+#include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/Factory.h"
 #include "../../Include/RmlUi/Core/Log.h"
 #include "../../Include/RmlUi/Core/Profiling.h"

+ 1 - 1
Source/Core/TypeConverter.cpp

@@ -28,7 +28,7 @@
 
 #include "../../Include/RmlUi/Core/TypeConverter.h"
 #include "../../Include/RmlUi/Core/Animation.h"
-#include "../../Include/RmlUi/Core/DecoratorInstancer.h"
+#include "../../Include/RmlUi/Core/Decorator.h"
 #include "../../Include/RmlUi/Core/PropertyDictionary.h"
 #include "../../Include/RmlUi/Core/PropertySpecification.h"
 #include "../../Include/RmlUi/Core/StyleSheetSpecification.h"