~npisanti/rl_tools

ref: 4abb671235d5a46f248130a42c0582d2639f262e rl_tools/shader/main.lua -rw-r--r-- 716 bytes
4abb6712Nicola Pisanti shader saves to png 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require "strict"

----------------------------------------------------
window.title( " " )

if args.count() > 0 then 
    frag.load( args.get(0), "glsl" ) 
end    

local w = 480 
local h = 480

if args.count() > 2 then
	w = tonumber( args.get(1) )
	h = tonumber( args.get(2) )
end

if args.count() > 3 then
	local m = tonumber( args.get(3) )
	window.size( w*m, h*m )
	layer.create( "def", w, h, m )
else
	window.size( w, h )
	layer.create( "def" )
end

----------------------------------------------------
function loop()
    layer.open()
        rl.clear(0,0,0,0)
    layer.close() 

    frag.apply( "glsl" )

	if key.pressed( key.s ) then 
		window.save("output.png")
		print ( "saved to output.png" )
	end 
end