Are meshes visible in LoVE? If so, what is wrong with this?
Posted: Tue Mar 18, 2014 12:47 pm
After reading a bit about Lua, I decided to start tinkering with a program for LoVE. This proved difficult. The idea is that I simply draw a rectangle with the mouse, similar to how the desktop creates a bounding box when you click and then drag.
With this code I am expecting a purple block to appear after I release the mouse button but nothing happens.
Does all drawing to the screen NEED to take place is love.draw?
Thanks for the consideration
With this code I am expecting a purple block to appear after I release the mouse button but nothing happens.
Does all drawing to the screen NEED to take place is love.draw?
Code: Select all
function love.load()
love.mouse.setPosition(1,1)
cpx = 1
cpy = 1
rpx = 1
rpy = 1
end
function love.update(dt)
x = love.mouse.getX()
y = love.mouse.getY()
function love.mousepressed(x,y,button)
if button == "l"
then cpx = x
cpy = y
end
end
function love.mousereleased(x,y,button)
if button == "l"
then rpx = x
rpy = y
end
end
vertices =
{
{cpx,cpy,
0,0,
255,0,255
},
{rpx,rpy,
0,0,
255,0,255
},
{cpx,rpy,
0,0,
255,0,255
},
{rpx,cpy,
0,0,
255,0,255
}
}
function love.mousereleased(x,y,button)
if button == "l"
then plop = love.graphics.newMesh(vertices, tx, "fan")
love.graphics.draw(plop, cpx, cpy)
end
end
end
function love.draw()
end