Allow per-context transformations (#9)

This commit is contained in:
Kevin Harrison 2016-12-29 23:17:13 -05:00
parent 8b5482e74f
commit 26f05c82e4
6 changed files with 377 additions and 95 deletions

14
example/transform.lua Normal file
View file

@ -0,0 +1,14 @@
-- Apply transformations to a basic UI.
return function(ui)
local t = love.timer.getTime()
ui:translate(350 + 100 * math.cos(t / 4), 350 + 100 * math.sin(t / 4))
ui:rotate(t / 8)
ui:scale(1 + math.sin(t / 4) / 2, 1 + math.cos(t / 4) / 2)
ui:shear(math.cos(t / 8) / 4, math.sin(t / 8) / 4)
if ui:windowBegin('Transform', 0, 0, 200, 200, 'border', 'title') then
ui:layoutRow('dynamic', 150, 1)
ui:label('You can apply transformations to the UI using ui:rotate, ui:scale, ui:shear, and ui:translate.', 'wrap')
end
ui:windowEnd()
end