Discord
Login
Community
DARK THEME

How to draw LoadImg?

image = asset_manager.loadImage("name", callback)

how Do I draw this img?

You need to use the screen.drawImage function:

init = function()
  img = asset_manager.loadImage("name", function(obj) print(obj) end)
end

update = function()
end

draw = function()
  screen.drawImage(img.image, 0, 0, 100, 100)
end

You can do it in two ways. In the first one, you write a function that will receive the data when it arrives.

  image = asset_manager.loadImage("screenshot20240427at220513f680", function(callback)
    print(callback)
    img = callback.image
  end)

The second way is to wait for the data

  image = asset_manager.loadImage("screenshot20240427at220513f680" )
  while not image.ready end

thx a lot guys

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community