commit cb3ea70e79ae0a56e564e40cf3fdc253a87ef18b Author: Paul Liverman Date: Tue May 3 22:18:23 2016 -0700 init shit diff --git a/run src.bat b/run src.bat new file mode 100644 index 0000000..719900b --- /dev/null +++ b/run src.bat @@ -0,0 +1,2 @@ +@ECHO OFF +"C:\Program Files\Love\LOVE.exe" "%cd%\src" diff --git a/screenshots/fade.png b/screenshots/fade.png new file mode 100644 index 0000000..6f36b0f Binary files /dev/null and b/screenshots/fade.png differ diff --git a/screenshots/flower.png b/screenshots/flower.png new file mode 100644 index 0000000..e504f6e Binary files /dev/null and b/screenshots/flower.png differ diff --git a/screenshots/nothing.png b/screenshots/nothing.png new file mode 100644 index 0000000..f530564 Binary files /dev/null and b/screenshots/nothing.png differ diff --git a/screenshots/nothing2.png b/screenshots/nothing2.png new file mode 100644 index 0000000..019a13d Binary files /dev/null and b/screenshots/nothing2.png differ diff --git a/src/conf.lua b/src/conf.lua new file mode 100644 index 0000000..278978d --- /dev/null +++ b/src/conf.lua @@ -0,0 +1,9 @@ +function love.conf(t) + t.title = "FADE" + t.console = true --tmp + + local w, h = love.graphics.getDesktopDimensions() + t.window.width = w + t.window.height = h + t.window.borderless = true +end diff --git a/src/hsv.lua b/src/hsv.lua new file mode 100644 index 0000000..26c1157 --- /dev/null +++ b/src/hsv.lua @@ -0,0 +1,41 @@ +local function hue_to_rgb(hue) + local c = 1 + local x = 1 - math.abs((hue / 60) % 2 - 1) + local m = 0 + + local r, g, b + + if hue < 60 then + r = c + g = x + b = 0 + elseif hue < 120 + r = x + g = c + b = 0 + elseif hue < 180 + r = 0 + g = c + b = x + elseif hue < 240 + r = 0 + g = x + b = c + elseif hue < 300 + r = x + g = 0 + b = c + elseif hue < 360 + r = c + g = 0 + b = x + end + + r = math.floor(r * 255) + g = math.floor(g * 255) + b = math.floor(b * 255) + + return r, g, b +end + +return hue_to_rgb diff --git a/src/main.lua b/src/main.lua new file mode 100644 index 0000000..8f4f402 --- /dev/null +++ b/src/main.lua @@ -0,0 +1,67 @@ +local lg = love.graphics +local lm = love.mouse + +local left +local major, minor, revision = love.getVersion() +if (major == 0) and (minor == 10) then + left = 1 +else + left = "l" +end + +local point = {} +local lines = {} + +local function dist(x1, y1, x2, y2) + local X = x2 - x1 + local Y = y2 - y1 + return math.sqrt(X*X + Y*Y) +end + +local delta, rate = 0, 1/20 +function love.update(dt) + if lm.isDown(left) then + local x, y = lm.getPosition() + if dist(point.x, point.y, x, y) > 1 then + table.insert(lines, {gray = 255, alpha = 255, x = x, y = y}) + point.x = x + point.y = y + end + end + + delta = delta + dt + if delta >= rate then + delta = delta - rate + + for i = 1, #lines do + lines[i].gray = lines[i].gray - 1 + end + + while lines[1] and lines[1].gray == 0 do + table.remove(lines, 1) + end + end +end + +function love.draw() + for i = 1, #lines - 1 do + lg.setColor(lines[i].gray, lines[i].gray, lines[i].gray, lines[i].alpha) + lg.line(lines[i].x, lines[i].y, lines[i+1].x, lines[i+1].y) + end +end + +---[[ +function love.mousepressed(x, y) + point = {x = x, y = y} +end +--]] + +function love.mousereleased(x, y) + table.insert(lines, {gray = 0, alpha = 0, x = x, y = y}) +end + +function love.keypressed(key) + if key == "escape" then + love.event.quit() + end +end