47 lines
921 B
Lua
47 lines
921 B
Lua
local love = assert( love )
|
|
local lg = love.graphics
|
|
local time = 0
|
|
local text = ""
|
|
|
|
--Set up the canvas.
|
|
assert( lg.getCanvasFormats( false ).stencil8, "Error: 8-bit stencil buffers not supported on this system." )
|
|
local stencil = love.graphics.newCanvas(
|
|
lg.getWidth(),
|
|
lg.getHeight(),
|
|
{
|
|
type = "2d",
|
|
format = "stencil8",
|
|
readable = false,
|
|
msaa = 0,
|
|
dpiscale = 1,
|
|
mipmaps = "none",
|
|
})
|
|
|
|
local canvas = love.graphics.newCanvas(
|
|
lg.getWidth(),
|
|
lg.getHeight(),
|
|
{
|
|
type = "2d",
|
|
format = "rgba8",
|
|
readable = true,
|
|
msaa = 0,
|
|
dpiscale = 1,
|
|
mipmaps = "none",
|
|
})
|
|
|
|
function love.update(dt)
|
|
time = time + dt
|
|
end
|
|
|
|
function love.draw()
|
|
lg.setCanvas{{canvas}, depthstencil = {stencil}}
|
|
lg.clear()
|
|
lg.setColor( 1,1,1,0.3 )
|
|
lg.rectangle( "fill", time * 15.0 , 0, 400, 400 )
|
|
lg.setCanvas()
|
|
lg.draw( canvas )
|
|
end
|
|
|
|
function love.textinput(t)
|
|
text = text..t
|
|
end |