-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #968 from Vavius/fix-moaiimagetexture
Attempt to fix MOAIImageTexture reallocated on each new glyph rendered
- Loading branch information
Showing
7 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
---------------------------------------------------------------- | ||
-- Copyright (c) 2010-2011 Zipline Games, Inc. | ||
-- All Rights Reserved. | ||
-- http://getmoai.com | ||
---------------------------------------------------------------- | ||
|
||
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:load ( 'arial-rounded.TTF' ) | ||
|
||
function glyphAlloc () | ||
text = "Hello 123456789 qwertyuiopasdfghjklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM" | ||
local textbox = MOAITextBox.new () | ||
textbox:setFont ( font ) | ||
textbox:setString ( "as" ) | ||
textbox:setTextSize ( 64 ) | ||
textbox:setWordBreak ( MOAITextBox.WORD_BREAK_CHAR ) | ||
textbox:setRect ( -160, -240, 160, 240 ) | ||
textbox:setYFlip ( true ) | ||
layer:insertProp ( textbox ) | ||
|
||
for i = 1, #text do | ||
textbox:setString ( text:sub ( 1, i )) | ||
coroutine.yield () | ||
end | ||
end | ||
|
||
thread = MOAICoroutine.new () | ||
thread:run ( glyphAlloc ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
::----------------------------------------------------------------:: | ||
:: Copyright (c) 2010-2011 Zipline Games, Inc. | ||
:: All Rights Reserved. | ||
:: http://getmoai.com | ||
::----------------------------------------------------------------:: | ||
|
||
@echo off | ||
|
||
:: verify paths | ||
if not exist "%MOAI_BIN%\moai.exe" ( | ||
echo. | ||
echo -------------------------------------------------------------------------------- | ||
echo ERROR: The MOAI_BIN environment variable either doesn't exist or it's pointing | ||
echo to an invalid path. Please point it at a folder containing moai.exe. | ||
echo -------------------------------------------------------------------------------- | ||
echo. | ||
goto end | ||
) | ||
|
||
if not exist "%MOAI_CONFIG%" ( | ||
echo. | ||
echo ------------------------------------------------------------------------------- | ||
echo WARNING: The MOAI_CONFIG environment variable either doesn't exist or it's | ||
echo pointing to an invalid path. Please point it at a folder containing config.lua. | ||
echo ------------------------------------------------------------------------------- | ||
echo. | ||
) | ||
|
||
:: run moai | ||
"%MOAI_BIN%\moai" "%MOAI_CONFIG%\config.lua" "main.lua" | ||
|
||
:end | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/sh | ||
#-------------------------------------------------------------------------------------- | ||
# Copyright (c) 2010-2013 Zipline Games, Inc. | ||
# All Rights Reserved. | ||
# http://getmoai.com | ||
#-------------------------------------------------------------------------------------- | ||
|
||
cd `dirname $0` | ||
|
||
# Verify paths | ||
if [ ! -f "$MOAI_BIN/moai" ]; then | ||
echo "---------------------------------------------------------------------------" | ||
echo "Error: The MOAI_BIN environment variable doesn't exist or its pointing to an" | ||
echo "invalid path. Please point it at a folder containing moai executable" | ||
echo "---------------------------------------------------------------------------" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "$MOAI_CONFIG/config.lua" ]; then | ||
echo "---------------------------------------------------------------------------" | ||
echo "WARNING: The MOAI_CONFIG environment variable either doesn't exist or it's" | ||
echo "pointing to an invalid path. Please point it at a folder containing config.lua" | ||
echo "---------------------------------------------------------------------------" | ||
exit 1 | ||
fi | ||
|
||
# Run moai | ||
$MOAI_BIN/moai $MOAI_CONFIG/config.lua main.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters