Why does my project stop when I run it? What do I mean? Well, because my project (it's a "screen") stops me
at the moment of executing it, I will leave the code so that they can help me to know what happens.
function love.load()
love.window.setMode(300,200,{resizable=false})
end
function love.draw()
DrawDisplay(300,200)
end
function love.update()
end
function DrawDisplay(w,h)
for y = 1, h do
for x = 1, w do
DrawPoint(x - 1,y,color)
end
y = y + 1
end
end
function DrawPoint(x,y,color)
love.graphics.points(x,y)
love.graphics.setColor(love.math.colorFromBytes(128, 234, 255))
end
You should not draw pixel by pixel to fill the screen. OpenGL is very slow when doing that. Draw a rectangle that covers the whole area instead, like this:
I don't recall whether points are actually batched or not, but if they aren't, you might get *somewhat* better performance by drawing a tinted 1x1 white Image instead.
local dot = love.graphics.newImage(love.graphics.newImageData(1,1,'rgba8',string.char(255,255,255,255)))
function DrawPoint(x,y,color)
love.graphics.setColor(love.math.colorFromBytes(color))
love.graphics.draw(dot, x, y)
end
You might want to also specify color somewhere... since you do want to treat it as a variable you pass around.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.