init shit
This commit is contained in:
2
run src.bat
Normal file
2
run src.bat
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
"C:\Program Files\Love\LOVE.exe" "%cd%\src"
|
BIN
screenshots/fade.png
Normal file
BIN
screenshots/fade.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
BIN
screenshots/flower.png
Normal file
BIN
screenshots/flower.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
BIN
screenshots/nothing.png
Normal file
BIN
screenshots/nothing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
screenshots/nothing2.png
Normal file
BIN
screenshots/nothing2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
9
src/conf.lua
Normal file
9
src/conf.lua
Normal file
@@ -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
|
41
src/hsv.lua
Normal file
41
src/hsv.lua
Normal file
@@ -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
|
67
src/main.lua
Normal file
67
src/main.lua
Normal file
@@ -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
|
Reference in New Issue
Block a user