Fix scaling a better way

This commit is contained in:
Kae 2023-07-03 09:10:09 +10:00
parent 7999442f01
commit 069d61e487
2 changed files with 4 additions and 6 deletions

View File

@ -66,6 +66,9 @@ LuaAnimationComponent<Base>::LuaAnimationComponent() {
if (renderLayerName) if (renderLayerName)
renderLayer = parseRenderLayer(*renderLayerName); renderLayer = parseRenderLayer(*renderLayerName);
if (auto image = drawable.part.ptr<Drawable::ImagePart>())
image->transformation.scale(0.125f);
m_drawables.append({move(drawable), renderLayer}); m_drawables.append({move(drawable), renderLayer});
}); });
animationCallbacks.registerCallback("clearLightSources", [this]() { animationCallbacks.registerCallback("clearLightSources", [this]() {

View File

@ -449,12 +449,7 @@ Maybe<Drawable> LuaConverter<Drawable>::to(LuaEngine& engine, LuaValue const& v)
else if (auto poly = table->get<Maybe<PolyF>>("poly")) else if (auto poly = table->get<Maybe<PolyF>>("poly"))
drawable = Drawable::makePoly(poly.take(), color); drawable = Drawable::makePoly(poly.take(), color);
else if (auto image = table->get<Maybe<String>>("image")) else if (auto image = table->get<Maybe<String>>("image"))
drawable = Drawable::makeImage( drawable = Drawable::makeImage(image.take(), 1.0f, table->get<Maybe<bool>>("centered").value(true), Vec2F(), color);
image.take(),
table->get<Maybe<bool>>("screenSpace").value(false) ? 1.0f : 1.0f / TilePixels,
table->get<Maybe<bool>>("centered").value(true),
Vec2F(),
color);
else else
return {}; // throw LuaAnimationComponentException("Drawable table must have 'line', 'poly', or 'image'"); return {}; // throw LuaAnimationComponentException("Drawable table must have 'line', 'poly', or 'image'");