diff options
Diffstat (limited to 'util.lua')
-rw-r--r-- | util.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/util.lua b/util.lua new file mode 100644 index 0000000..6172d84 --- /dev/null +++ b/util.lua @@ -0,0 +1,27 @@ +local hsluv = require 'hsluv' + +local G = love.graphics +local function mouse_pos() + -- in world space + return G.inverseTransformPoint(love.mouse.getPosition()) +end + +local function write_at(text,x,y) + local tx,ty = G.transformPoint(x,y) + G.push() + G.origin() + G.print(text,tx,ty) + G.pop() +end + +local function phi_color(n) + local phi = (1+math.sqrt(5))/2 + local h = (360*phi*n)%360 + return hsluv.hsluv_to_rgb({h, 80, 60}) +end + +return { + mouse_pos = mouse_pos, + write_at = write_at, + phi_color = phi_color, +} |