Skip to content

Commit

Permalink
Don't repeat images within spritesheets
Browse files Browse the repository at this point in the history
  • Loading branch information
viseztrance committed Aug 6, 2023
1 parent 55ba52e commit 9400a4c
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions Source/Core/DecoratorTiled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,31 @@ void DecoratorTiled::Tile::GenerateGeometry(Vector<Vertex>& vertices, Vector<int
break;
case REPEAT:
final_tile_dimensions = surface_dimensions;
repeat_factor = surface_dimensions / tile_dimensions;
if (scaled_texcoords[1].y - scaled_texcoords[0].y == 1.0 && scaled_texcoords[1].y - scaled_texcoords[0].y == 1.0) {
repeat_factor = surface_dimensions / tile_dimensions;
} else {
Log::Message(Log::LT_WARNING, "Texture repeating is not supported for spritesheets.");
}
break;
case REPEAT_X:
final_tile_dimensions = Vector2f(surface_dimensions.x, tile_dimensions.y);
repeat_factor.x = surface_dimensions.x / tile_dimensions.x;
offset_and_clip_tile = true;

if (scaled_texcoords[1].x - scaled_texcoords[0].x == 1.0) {
repeat_factor.x = surface_dimensions.x / tile_dimensions.x;
} else {
Log::Message(Log::LT_WARNING, "Texture repeating (repeat-x) is not supported for spritesheets.");
}
break;
case REPEAT_Y:
final_tile_dimensions = Vector2f(tile_dimensions.x, surface_dimensions.y);
repeat_factor.y = surface_dimensions.y / tile_dimensions.y;
offset_and_clip_tile = true;

if (scaled_texcoords[1].y - scaled_texcoords[0].y == 1.0) {
repeat_factor.y = surface_dimensions.y / tile_dimensions.y;
} else {
Log::Message(Log::LT_WARNING, "Texture repeating (repeat-y) is not supported for spritesheets.");
}
break;
}

Expand Down

0 comments on commit 9400a4c

Please sign in to comment.