SDK2.0 beta 2 release, bugs in simulator
Bug 1 - Default.png is overzoomed when displayed on screen. From this main.lua get snapshot of screen and make Default.png, rebuild with Default.png, notice that title appears to jump up, then down , on actual device there is no jump, only smooth transition to screen.
Bug 2 - applicationStart isn't called from simulator in SDK2.0 beta 2 release, whereas works fine on actual device.
Regards
Andrew Wilson
PS. Thanks for the native keyboard number input, really needed that bug fixed to submit my first app.
--
-- main.lua -- Two bug sample. -- AGR Wilson
--
function newLabel( params )
local labelText
local size, font, textColor, align
if ( params.bounds ) then
local bounds = params.bounds
local left = bounds[1]
local top = bounds[2]
local width = bounds[3]
local height = bounds[4]
if ( params.size and type(params.size) == "number" ) then size=params.size else size=20 end
if ( params.font ) then font=params.font else font=native.systemFontBold end
if ( params.textColor ) then textColor=params.textColor else textColor={ 255, 255, 255, 255 } end
if ( params.offset and type(params.offset) == "number" ) then offset=params.offset else offset = 0 end
if ( params.align ) then align = params.align else align = "center" end
if ( params.text ) then
labelText = display.newText( params.text, 0, 0, font, size )
labelText:setTextColor( textColor[1], textColor[2], textColor[3], textColor[4] )
if ( align == "left" ) then
labelText.x = left + labelText.stageWidth * 0.5
elseif ( align == "right" ) then
labelText.x = (left + width) - labelText.stageWidth * 0.5
else
labelText.x = ((2 * left) + width) * 0.5
end
end
labelText.y = top + labelText.stageHeight * 0.5
-- Public methods
function labelText:setText( newText )
if ( newText ) then
self.text = newText
if ( "left" == align ) then
self.x = left + self.stageWidth / 2
elseif ( "right" == align ) then
self.x = (left + width) - self.stageWidth / 2
else
self.x = ((2 * left) + width) / 2
end
end
end
function labelText:setColor( textColor ) -- *** AGRW
if ( textColor and type(textColor) == "table" ) then
self:setTextColor( textColor[1], textColor[2], textColor[3], textColor[4] )
end
end
end
-- Return instance
return labelText
end
-- BUG 1 - Default.png is oversized, when title is printed it's lower on device. [ Make a Default.png from first run on device]
system.setIdleTimer( false ) -- turn off device sleeping
local title = newLabel{
bounds = { 10, 35, 300, 40 },
text = "Tap Tally",
font = "AmericanTypewriter-Bold",
textColor = { 255, 0, 48, 255 },
size = 42,
align = "center"
}
roundedRect = display.newRoundedRect( 7, 27, 308, display.contentHeight - 33, 8 )
roundedRect:setStrokeColor(255, 0, 48)
roundedRect.strokeWidth=1
-- BUG 2 with SDK2.0, beta 2 release need following line uncommented in simulator, since in simulator
-- applicationStart event seems to be missing.
--title:setText("Changed") -- uncomment to fix SDK2.0 beta 2 release issue in simulator
Runtime:addEventListener( "system",
function( event )
if event.type == "applicationStart" then
title:setText("Changed")
end
end
)
#173 is not reproducible in Beta 5.
Here's our test code
1 2 3 4 5 6 7 8 9 10 11 | print( "hello" ) Runtime:addEventListener( "system", function( event ) if event.type == "applicationStart" then print("appStart works") end end ) print( "goodbye" ) |
We were finally able to reproduce bug #173. It only happens if there is a Default.png file in the resource directory (where the app is located). This blocks the appplicationStart message. We are working on a fix.
Bug #172 -- oversized Default.png file is cause because the text metrics on the Mac is different from the phone, so the baselines will be different. We will look at better controlling text metrics in the future.
-Tom
Logged as cases 172 and 173