~npisanti/rl_tools

ref: 42fc19701d10897ec966f18c35ad1ed3ce2ccc44 rl_tools/shaderdrop/main.lua -rw-r--r-- 965 bytes
42fc1970Nicola Pisanti defaults to nearest pixel for textures 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
41
42
43
44
45
46
47
48
require "strict"

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

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, 0, 0, 255 ) 
		        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