|
@@ -48,7 +48,7 @@ void DecoratorTiledInstancer::RegisterTileProperty(const String& name, bool regi
|
|
|
if (register_fit_modes)
|
|
if (register_fit_modes)
|
|
|
{
|
|
{
|
|
|
String fit_name = CreateString(32, "%s-fit", name.c_str());
|
|
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();
|
|
|
|
|
|
|
+ ids.fit = RegisterProperty(fit_name, "fill").AddParser("keyword", "fill, contain, cover, scale-none, scale-down, repeat, repeat-x, repeat-y").GetId();
|
|
|
|
|
|
|
|
String align_x_name = CreateString(32, "%s-align-x", name.c_str());
|
|
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();
|
|
ids.align_x = RegisterProperty(align_x_name, "center").AddParser("keyword", "left, center, right").AddParser("length_percent").GetId();
|
|
@@ -99,8 +99,9 @@ bool DecoratorTiledInstancer::GetTileProperties(DecoratorTiled::Tile* tiles, Tex
|
|
|
DecoratorTiled::Tile& tile = tiles[i];
|
|
DecoratorTiled::Tile& tile = tiles[i];
|
|
|
Texture& texture = textures[i];
|
|
Texture& texture = textures[i];
|
|
|
|
|
|
|
|
|
|
+ const Sprite* sprite = instancer_interface.GetSprite(texture_name);
|
|
|
// A tile is always either a sprite or an image.
|
|
// A tile is always either a sprite or an image.
|
|
|
- if (const Sprite* sprite = instancer_interface.GetSprite(texture_name))
|
|
|
|
|
|
|
+ if (sprite)
|
|
|
{
|
|
{
|
|
|
tile.position = sprite->rectangle.Position();
|
|
tile.position = sprite->rectangle.Position();
|
|
|
tile.size = sprite->rectangle.Size();
|
|
tile.size = sprite->rectangle.Size();
|
|
@@ -134,6 +135,14 @@ bool DecoratorTiledInstancer::GetTileProperties(DecoratorTiled::Tile* tiles, Tex
|
|
|
const Property& fit_property = *properties.GetProperty(ids.fit);
|
|
const Property& fit_property = *properties.GetProperty(ids.fit);
|
|
|
tile.fit_mode = (DecoratorTiled::TileFitMode)fit_property.value.Get<int>();
|
|
tile.fit_mode = (DecoratorTiled::TileFitMode)fit_property.value.Get<int>();
|
|
|
|
|
|
|
|
|
|
+ if (sprite && (tile.fit_mode == DecoratorTiled::TileFitMode::REPEAT ||
|
|
|
|
|
+ tile.fit_mode == DecoratorTiled::TileFitMode::REPEAT_X ||
|
|
|
|
|
+ tile.fit_mode == DecoratorTiled::TileFitMode::REPEAT_Y)) {
|
|
|
|
|
+ Log::Message(Log::LT_WARNING, "Decorator fit value is '%s', which is incompatible with a spritesheet",
|
|
|
|
|
+ fit_property.ToString().c_str());
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const Property* align_properties[2] = {properties.GetProperty(ids.align_x), properties.GetProperty(ids.align_y)};
|
|
const Property* align_properties[2] = {properties.GetProperty(ids.align_x), properties.GetProperty(ids.align_y)};
|
|
|
|
|
|
|
|
for (int dimension = 0; dimension < 2; dimension++)
|
|
for (int dimension = 0; dimension < 2; dimension++)
|