AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.4k stars 289 forks source link

keep aspect ratio option for spriterenderer #779

Open Shadowblitz16 opened 4 years ago

Shadowblitz16 commented 4 years ago

Summary

Add keep aspect ratio for sprite renderer this would basically make sure the rect is always centered and and has the same size as the current texture frame.

Analysis

Pros

Cons

Attachments

-Now image

-What it could be image

SirePi commented 4 years ago

Maybe it would make sense to add a method that sets a SpriteRenderer's Rect to the values obtained from the currently assigned Material/BatchInfo.

Something like a public void UseNativeSize(Alignment alignment) where Alignment is used to define the origin of the Rect. Possibly add a button to call it from the editor as well, defaulting to Centered?

Shadowblitz16 commented 4 years ago

idk though I do think that it being centered and the aspect ratio mode should be separate.