Closed Rakaneth closed 7 years ago
Since I'm silly and don't know how to submit a pull request, I'll just state the issue here:
on line 687, for i=0,h-1 do
omits the last line since h is already required to accommodate Lua's 1-based indexing. I changed this line to for i=0,h do
in my copy.
This changes the behavior of Display:clear and TextDisplay:clear.
If, previously, you were using the width and height arguments to clear a designated area of the display, you'll have to start adding one to the height (or stop subtracting one)
The height argument now designates the number of rows to be cleared (which is how width worked for columns) instead of the dumb 'clear one and then proceed clearing for h
rows'.
ugh, this still isn't working the way I want it to
This should finally be good
Here's the main.lua I finally wound up with after testing:
ROT = require 'rotLove/rotLove'
function love.load()
-- text display requires love.graphics to be loaded
love.window.setMode(800, 600)
frame=ROT.Display()
rand = math.random(1,3)
rng = rand == 1 and ROT.RNG.Twister:new() or
rand == 2 and ROT.RNG.LCG:new() or
ROT.RNG.MWC:new()
rng:randomseed()
end
function love.draw()
frame:draw()
end
x,y,i=1,1,64
update=false
function love.update()
for x=1,80 do for y=1,24 do
frame:write(string.char(i), x, y, getRandomColor(), getRandomColor())
i=i==120 and 1 or i+1
end end
if update then
frame:clear(' ', 2, 2, 78, 22)
--frame:clear()
end
end
function love.keypressed() update=not update end
function getRandomColor()
return { r=math.floor(rng:random(0,255)),
g=math.floor(rng:random(0,255)),
b=math.floor(rng:random(0,255)),
a=255}
end
It appears that the Display:clear() method is omitting the last row when a height is specified. I think I fixed this in the code - I will be submitting a pull request for this since the fix appears simple.