Screen cutting helper
Posted: Sat Nov 14, 2015 7:23 pm
Just sharing this module I whipped up to assist me in cutting up screen regions. If it helps anyone, great! To wit:
Alignments can be: left, right, top, bottom, top left, top right, bottom left, bottom right
The .love includes an interactive demo.
Code: Select all
cutter = require("cutter")
-- function cutter.cut(width, height, [alignment], [container])
-- a box 50% of the screen size (Blue)
box1 = cutter.cut(0.5, 0.5, "center")
-- a box half the height of the first box, aligned to the bottom (Green)
box2 = cutter.cut(1, 0.5, "bottom", box1)
-- a box half the width of the previous, left aligned (Red)
box3 = cutter.cut(0.5, 1, "left", box2)
The .love includes an interactive demo.