~npisanti/scriptools

ref: 9ee95e959a219e79c421b7328a8d9ae098bcc09f scriptools/shaderdrop/main.lua -rw-r--r-- 942 bytes
9ee95e95Nicola Pisanti returns to book of shaders syntax 5 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
41
42
43
44
45
46
47
48
require "strict"

----------------------------------------------------
window.title( "" )
window.size( 480, 480 )
layer.create( "def" )

frag.load( args.get(0), "glsl" ) 

png.align_center()
png.load( "tests" )

local blackground = true
local clock = 60

----------------------------------------------------
function loop()
    frag.apply( "glsl" )

	png.select( "tests" );

	if clock == 60 then 
		if blackground then 
	    	layer.open()
		        rl.clear( 0, 0, 0, 0 )
		        rl.color( 255, 255, 255, 255 ) 
		        png.draw( window.width()*0.5, window.height()*0.5 )
		        png.next()
		  	layer.close()	
		else 
	    	layer.open()
		        rl.clear( 255, 255, 255, 255 )
		        rl.color( 0 ) 
		        png.draw( window.width()*0.5, window.height()*0.5 )
		        png.next()
		    layer.close()	
		end 
		clock = 0
	end 

	clock = clock + 1 

	if( key.pressed( key.space ) )then 
		blackground = not blackground;
	end
end