Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
interface_test.lua
local width = 1600
local height = 900
-- Create window & show loading message
window.create(width, height, "Interface test")
canvas.init()
canvas.beginFrame(width, height, 1.0)
canvas.createFont("Open Sans", "test/font/OpenSans-Regular.ttf")
canvas.fontFace("Open Sans")
canvas.fontSize(24)
canvas.fillColor(canvas.color(255, 255, 255, 255))
canvas.text(0, 0, "Loading...")
canvas.endFrame();
window.update()
-- Load resources
local background = canvas.color(135, 206, 250, 255)
local logo = {}
logo.image = canvas.createImage("editor/texture/test.png")
logo.width, logo.height = canvas.imageSize(logo.image)
logo.paint = canvas.imagePattern((width - logo.width / 2) / 2, 100, logo.width / 2, logo.height / 2, 0, logo.image, 1)
utils.sleep(5)
while not window.shouldClose() do
window.update()
canvas.beginFrame(width, height, 1.0)
-- Draw background
canvas.beginPath()
canvas.rect(0, 0, width, height)
canvas.fillColor(background)
canvas.fill()
-- Draw logo
canvas.beginPath()
canvas.fillPaint(logo.paint)
canvas.rect((width - logo.width / 2) / 2, 100, logo.width / 2, logo.height / 2)
canvas.fill()
canvas.endFrame();
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.