|
| 1 | +---------------------------------------------------------------- |
| 2 | +-- Copyright (c) 2010-2011 Zipline Games, Inc. |
| 3 | +-- All Rights Reserved. |
| 4 | +-- http://getmoai.com |
| 5 | +---------------------------------------------------------------- |
| 6 | + |
| 7 | +MOAISim.openWindow ( "test", 320, 480 ) |
| 8 | + |
| 9 | +viewport = MOAIViewport.new () |
| 10 | +viewport:setSize ( 320, 480 ) |
| 11 | +viewport:setScale ( 320, 480 ) |
| 12 | + |
| 13 | +layer = MOAILayer2D.new () |
| 14 | +layer:setViewport ( viewport ) |
| 15 | +MOAISim.pushRenderPass ( layer ) |
| 16 | + |
| 17 | +font = MOAIFont.new () |
| 18 | +font:load ( 'arial-rounded.TTF' ) |
| 19 | + |
| 20 | +function glyphAlloc () |
| 21 | + text = "Hello 123456789 qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM" |
| 22 | + local textbox = MOAITextBox.new () |
| 23 | + textbox:setFont ( font ) |
| 24 | + textbox:setString ( "as" ) |
| 25 | + textbox:setTextSize ( 64 ) |
| 26 | + textbox:setWordBreak ( MOAITextBox.WORD_BREAK_CHAR ) |
| 27 | + textbox:setRect ( -160, -240, 160, 240 ) |
| 28 | + textbox:setYFlip ( true ) |
| 29 | + layer:insertProp ( textbox ) |
| 30 | + |
| 31 | + for i = 1, #text do |
| 32 | + textbox:setString ( text:sub ( 1, i )) |
| 33 | + coroutine.yield () |
| 34 | + end |
| 35 | +end |
| 36 | + |
| 37 | +thread = MOAICoroutine.new () |
| 38 | +thread:run ( glyphAlloc ) |
0 commit comments