Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- basically draws an image with
- aaa bbb aaa bbb ...
- ccc bbb ccc bbb
- aaa bbb aaa bbb
- ccc bbb ccc bbb
- aaa bbb aaa bbb
- ccc bbb ccc bbb
- ...
- if you know the luminance of a and c, and b columns blends in perfectly, then the luminance of b is the average of that of a and c
- keys:
- escape - quit
- f - toggle fullscreen. this is borderless windowed so it shouldn't overwrite any LUT you have loaded.
- q,a - increase/decrease a
- w,s - increase/decrease b
- e,d - increase/decrease c
- c,z - increase/decrease the precision of adjusting a,b,c
- x - swap columns
- t - change color to white
- r - red
- g - green
- b -blue
- ]]
- function love.load()
- a = 0
- b = 190
- c = 255
- p = 1
- seed = 3.14159
- col = 2
- z = 0
- love.keyboard.setKeyRepeat(true)
- love.graphics.setBackgroundColor(0, 0, 0)
- love.window.setMode(1600,900,{resizable=true})
- --love.window.setFullscreen(true, "desktop")
- end
- function setcol(c)
- if col == 0 then
- love.graphics.setColor(c, c, c)
- elseif col == 1 then
- love.graphics.setColor(c, 0, 0)
- elseif col == 2 then
- love.graphics.setColor(0, c, 0)
- elseif col == 3 then
- love.graphics.setColor(0, 0, c)
- end
- end
- function love.draw()
- math.randomseed(seed)
- setcol(b)
- for x = 100,1800,100 do
- for y = 100, 1100 do
- love.graphics.rectangle("fill", x+z*50, y, 49, 1)
- end
- end
- setcol(a)
- for x = 150,1850,100 do
- for y = 99,1100,2 do
- love.graphics.rectangle("fill",x-z*50,y,49,1)
- end
- end
- setcol(c)
- for x = 150,1850,100 do
- for y = 100,1100,2 do
- love.graphics.rectangle("fill",x-z*50,y,49,1)
- end
- end
- love.graphics.setColor(255, 255, 255)
- love.graphics.print(a.." "..b.." "..c.." "..p, 100, 10)
- end
- function love.keypressed(key)
- --lua y u no switch??
- if key == 'q' then --increase/decrease colors
- a = a + p
- elseif key == 'a' then
- a = a - p
- elseif key == 'w' then
- b = b + p
- elseif key == 's' then
- b = b - p
- elseif key == 'e' then
- c = c + p
- elseif key == 'd' then
- c = c - p
- elseif key == 'z' then --increase/decrease precision
- p = p / 4
- elseif key == 'c' then
- p = p * 4
- elseif key == 't' then --change color
- col = 0
- elseif key == 'r' then
- col = 1
- elseif key == 'g' then
- col = 2
- elseif key == 'b' then
- col = 3
- elseif key == 'x' then --swap columns
- z = 1 - z
- elseif key == "f" then
- love.window.setFullscreen(not love.window.getFullscreen( ), "desktop")
- elseif key == 'escape' then
- love.event.quit()
- end
- if a > 255 then a = 255
- elseif a < 0 then a = 0 end
- if b > 255 then b = 255
- elseif b < 0 then b = 0 end
- if c > 255 then c = 255
- elseif c < 0 then c = 0 end
- if p > 64 then p = 64
- elseif p < 1/64 then p = 1/64 end
- seed = math.random()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement