Thats what I have now and it draws only next letter ('B') in my example
Code: Select all
letters = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "V", "X", "Y", "Z"}
function love.draw()
for x = 2, drawWidth do
for z = 1, 10 do
love.graphics.setColor(0, 0, 0, 255)
love.graphics.print(string.char(string.byte(letters[1]) + z), (x - 1) * defaulPixelSize, 0)
end
end
2. Where I can find example of code to color specific draw (rectangle in my case), when I click on it? Ideally I want something like color picker, with most used colors and picker itself to appear, when I click on rectangle.
So something like: click on rectangle -> select color -> color it
Currently I draw a lot of rectangles (with love.graphics.rectangle) in for...do just the same way I used for first question, so I trying to fill specific rectangle I clicked on, but not all rectangles from for...do
So far I found Dither on github, maybe will be able to use some logic for picker, from it.
UPD: I was able to solve first part of question checking this tutorial: https://simplegametutorials.github.io/life/
I also found nice picker (not exactly as i want, but something) here: viewtopic.php?f=5&t=80492#p208493
But I have no idea how to display some area with picker only when I click rectangle, and use picked color for coloring.
Code: Select all
-- I only color in specified color now
elseif grid[y][x] then
--Should be somewhere here in my current code
love.graphics.setColor(0, 0, 255)
love.graphics.rectangle("fill", (x - 1) * defaulPixelSize, (y - 1) * defaulPixelSize, defaulPixelSize, defaulPixelSize)
Tried something like it:
Code: Select all
function love.load ()
function love.keypressed(key)
if key == "+" then
love.graphics.scale(2,2)
end
function love.keypressed(key)
if key == "-" then
love.graphics.scale(0.5,0.5)
end
Code: Select all
if love.keyboard.isDown('f') then
love.window.setFullscreen(true, "desktop")
end
Want to exit fullscreen when I press "f" second time, then fullscreen again, when I press "f" again etc...