Drawing an image file:
function love.load()
mario = love.graphics.newImage("mario.png")
end
function love.draw()
love.graphics.draw(mario)
end
Drawing an image from base64 on source code:
mario64 = "iVBORw0KGgoAAAANSUhEUgAAAQQAAAEEBAMAAAA8Jlc5AAAAElBMVEUAAAAAAACIcADYKAD8mDj///9LiYtiAAAAAXRSTlMAQObYZgAAAAFiS0dEBfhv6ccAAAEsSURBVHja7d3BDYUgEAVAWqCF34It2H9N/+RlEwIiUcF5R4zuHDdhwZTyw0mpnbA1BgEBAQEBAeF7hG1QEBAQEBAQENYl/ArZQ+L6wJYFAQEBAQEB4aWE+MlS6dbnCAgICAgICN8hDKYgICAgICAgLECofbJEjLnQsiAgICAgICC8lBCzd2bg1CcCAgICAgLCSwmx9ThGKE+2JggICAgICAgLEkolSoROGgICAgICAsKEhNrWRu3o5smtEQQEBAQEBIQJCaXRiKPEsR5Lx/XS6AUCAgICAgLCeoRSyVouHNFAQEBAQEBAmIxw9WpJBAQEBAQEhPUIMa1XTHf+0gIBAQEBAQFhYkLvEYwbpj4REBAQEBAQHiZ0Xv3U+z4CAgICAgLChISbg5BzzukP4FDNAIC3HvUAAAAASUVORK5CYII="
byte_data = love.data.decode('data', 'base64', mario64)
image_data = love.image.newImageData(byte_data)
image = love.graphics.newImage(image_data)
function love.draw()
love.graphics.draw(image)
end
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.