Page 1 of 1

Screen cutting helper

Posted: Sat Nov 14, 2015 7:23 pm
by kbmonkey
Just sharing this module I whipped up to assist me in cutting up screen regions. If it helps anyone, great! To wit:

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)
cutter-module2.png
cutter-module2.png (4.17 KiB) Viewed 733 times
Alignments can be: left, right, top, bottom, top left, top right, bottom left, bottom right

The .love includes an interactive demo.