Skip to content

Instantly share code, notes, and snippets.

@david-torres
Created June 28, 2012 19:31
Show Gist options
  • Save david-torres/3013369 to your computer and use it in GitHub Desktop.
Save david-torres/3013369 to your computer and use it in GitHub Desktop.
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