Canvas is this a good way to use it ?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Posts: 50
Joined: Sat Dec 28, 2019 6:35 pm

Canvas is this a good way to use it ?

Post by gcmartijn »

Yust to be sure, I already saw that I can use multiple canvas to draw thing in the background and use it later, and this is working for all devices.
This is something else then"multicanvas") that I don't want to use because I don't want to use simultaneously drawing and has less support.

The cool thing about a canvas is, that I can draw everything using 0,0 top left so its more easy to do some things (for me).

Using more than one canvas, will that cost more gpu/cpu/mem ?

But the real question is this, code below, is that the way to do it ?
See the top and bottom canvas like a menu and don't update very often.
The game is in the middle canvas.

Code: Select all

function love.load()
    canvasTop =, 50)
    canvasMiddle =, 550)
    canvasBottom =, 90), 0, 0, 0.5)"fill", 0, 0, config.screenWidth, 90)

function love.update(dt)
  -- nothing for canvas functions

function love.draw(), 1, 1, 1) 
    -- do draw things for canvas Top, 1, 1, 1)
    -- do draw things for canvas Middle
    -- do draw things for canvas bottom, or is this better in the love.update function
            -- ^ Now because I use this, I can't do dynamic drawing like the rule below (because it will render over the other text)
            -- But now the whole idea about a canvas is 'faster' is away now,  but it is still easy to use I think.
  "x: " .. tostring(love.mouse.getX()) .. " y: " .. tostring(love.mouse.getY()), 0, 0)
            -- The idea about the canvasBottom is to hold some buttons and indicators, so maybe this is the good way to do it
            if newUpdate then
            -- and do the things
    -- draw everything, 0, 0, 0, 1, 1), 0, 50, 0, 1, 1), 0, 550, 0, 1, 1)
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests