34 lines
925 B
Lua
34 lines
925 B
Lua
-- Set the units of the default font to pixels instead of meters
|
|
local font = lovr.graphics.getDefaultFont()
|
|
font:setPixelDensity(1)
|
|
|
|
-- Set up a 2D orthographic projection, where (0, 0) is the upper
|
|
-- left of the window and the units are in pixels
|
|
local width, height = lovr.system.getWindowDimensions()
|
|
local projection = Mat4():orthographic(0, width, 0, height, -10, 10)
|
|
|
|
function drawGrid(pass)
|
|
pass:setColor(0, 1, 0)
|
|
for i=0,1,0.025 do
|
|
pass:line(0, height*i, 0, width, height*i, 0)
|
|
end
|
|
|
|
for i=0,1,0.025 do
|
|
pass:line(width*i, 0, 0, width*i, height, 0)
|
|
end
|
|
end
|
|
|
|
function lovr.draw(pass)
|
|
pass:setViewPose(1, mat4():identity())
|
|
pass:setProjection(1, projection)
|
|
pass:setDepthTest()
|
|
|
|
drawGrid(pass)
|
|
pass:circle(width/2, height/2, 0, 2, 0, 0, 0, 1, 'fill')
|
|
|
|
pass:setViewPose(2, mat4():identity())
|
|
pass:setProjection(2, projection)
|
|
drawGrid(pass)
|
|
pass:circle(width/2, height/2, 0, 2, 0, 0, 0, 1, 'fill')
|
|
end
|