colored and stuff

This commit is contained in:
Paul Liverman
2016-05-03 23:35:46 -07:00
parent cb3ea70e79
commit 71e8f39d56
15 changed files with 91 additions and 16 deletions

BIN
screenshots/1462340658.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
screenshots/1462340746.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
screenshots/1462340848.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
screenshots/1462340889.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
screenshots/fade2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
screenshots/fade3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
screenshots/fade3.xcf Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -2,8 +2,8 @@ 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
--local w, h = love.window.getDesktopDimensions()
--t.window.width = w
--t.window.height = h
t.window.borderless = true
end

View File

@@ -9,23 +9,23 @@ local function hue_to_rgb(hue)
r = c
g = x
b = 0
elseif hue < 120
elseif hue < 120 then
r = x
g = c
b = 0
elseif hue < 180
elseif hue < 180 then
r = 0
g = c
b = x
elseif hue < 240
elseif hue < 240 then
r = 0
g = x
b = c
elseif hue < 300
elseif hue < 300 then
r = x
g = 0
b = c
elseif hue < 360
else
r = c
g = 0
b = x

View File

@@ -1,3 +1,4 @@
local hsv = require "hsv"
local lg = love.graphics
local lm = love.mouse
@@ -5,12 +6,21 @@ local left
local major, minor, revision = love.getVersion()
if (major == 0) and (minor == 10) then
left = 1
right = 2
else
left = "l"
right = "r"
end
local point = {}
local lines = {}
local hue = 60
local blacknwhite = false
function love.load()
local w, h = love.window.getDesktopDimensions()
love.window.setMode(w, h, {borderless = true})
end
local function dist(x1, y1, x2, y2)
local X = x2 - x1
@@ -19,11 +29,23 @@ local function dist(x1, y1, x2, y2)
end
local delta, rate = 0, 1/20
local swatch = 4
function love.update(dt)
--print(hue) --tmp
if swatch > 0 then
swatch = swatch - dt
end
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})
local r, g, b
if lm.isDown(right) or blacknwhite then
r, g, b = 255, 255, 255
else
r, g, b = hsv(hue)
end
table.insert(lines, {red = r, green = g, blue = b, alpha = 255, x = x, y = y})
point.x = x
point.y = y
end
@@ -34,10 +56,12 @@ function love.update(dt)
delta = delta - rate
for i = 1, #lines do
lines[i].gray = lines[i].gray - 1
if lines[i].alpha > 0 then
lines[i].alpha = lines[i].alpha - 1
end
end
while lines[1] and lines[1].gray == 0 do
while lines[1] and lines[1].alpha == 0 do
table.remove(lines, 1)
end
end
@@ -45,23 +69,74 @@ 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.setColor(lines[i].red, lines[i].green, lines[i].blue, lines[i].alpha)
lg.line(lines[i].x, lines[i].y, lines[i+1].x, lines[i+1].y)
end
if (swatch > 0) and (not blacknwhite) then
local r, g, b = hsv(hue)
lg.setColor(r, g, b, swatch * 63)
lg.rectangle("fill", 0, 0, lg.getWidth()/10, lg.getWidth()/10)
end
end
---[[
function love.mousepressed(x, y)
point = {x = x, y = y}
function love.mousepressed(x, y, button)
if button == left then
point = {x = x, y = y}
elseif button == "wu" then
hue = hue - 30
if hue < 0 then
hue = 360
end
swatch = 4
elseif button == "wd" then
hue = hue + 30
if hue > 360 then
hue = 0
end
swatch = 4
end
end
--]]
function love.mousereleased(x, y)
table.insert(lines, {gray = 0, alpha = 0, x = x, y = y})
function love.mousereleased(x, y, button)
if button == left then
table.insert(lines, {red = 0, green = 0, blue = 0, alpha = 0, x = x, y = y})
end
end
function love.wheelmoved(x, y)
if y < 0 then
hue = hue - 30
if hue < 0 then
hue = 360
end
swatch = 4
elseif y > 0 then
hue = hue + 30
if hue > 360 then
hue = 0
end
swatch = 4
end
end
function love.keypressed(key)
if key == "escape" then
love.event.quit()
end
if key == "p" then
local screenshot = lg.newScreenshot()
screenshot:encode("png", os.time() .. ".png")
end
if key == "b" then
blacknwhite = not blacknwhite
end
if key == "c" then
lines = {}
end
end