Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hello World using Moai SDK
MOAISim.openWindow('test', 320, 480)
viewport = MOAIViewport.new()
viewport:setSize(320, 480)
viewport:setScale(320, 480)
layer = MOAILayer2D.new()
layer:setViewport(viewport)
MOAISim.pushRenderPass(layer)
font = MOAIFont.new()
font:loadFromTTF('Bastarda-K.ttf', ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,.?!', 12, 163)
textbox = MOAITextBox.new()
textbox:setFont(font)
textbox:setRect(-160, -80, 160, 80)
textbox:setLoc(0, -100)
textbox:setYFlip(true)
textbox:setAlignment(MOAITextBox.CENTER_JUSTIFY)
layer:insertProp(textbox)
text = '<c:0F0>Hello World!</>'
textbox:setString(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment