When Text is too long, it cannot be show complete.
this is my Code:
SCREEN_W = display.contentWidth -- 屏幕宽度
SCREEN_H = display.contentHeight -- 屏幕高度
HALF_W = SCREEN_W / 2 -- 屏幕一半宽度
HALF_H = SCREEN_H / 2 -- 屏幕一半高度
display.setStatusBar( display.HiddenStatusBar)
local function main()
local str = "solar2D is a cross-platform framework which is ideal for rapidly creating apps and games for mobile devices, TV, desktop systems and HTML5. That means you can create your project once and publish it to multiple devices, including Apple iPhone and iPad, Android phones and tablets, Amazon Fire, Mac Desktop"
local textWarning = display.newText(str, SCREEN_W, HALF_H, native.systemFont, 25)
textWarning.anchorX = 0
local function textMove()
textWarning.x = textWarning.x - 5
if textWarning.x < -textWarning.width then
textWarning.x = SCREEN_W
end
end
Runtime:addEventListener("enterFrame", textMove)
end
main()
First thing, to show text which might become big or wide it is better to use this code
local yourTextOptions =
{
width = display.contentWidth-100,
fontSize = 25,
align="left"
}
local yourText= display.newText(yourTextOptions)
yourText.text="solar2D is a cross-platform framework which is ideal for rapidly creating apps and games for mobile devices, TV, desktop systems and HTML5. That means you can create your project once and publish it to multiple devices, including Apple iPhone and iPad, Android phones and tablets, Amazon Fire, Mac Desktop"
yourText.anchorX=0
yourText.x=0
yourText.y=display.contentCenterY
Then for moving objects in general whether text or anything else it is better to use transition commands or physics commands if the object was a physics object like:
Because text is rendered as an image in Solar2D, I think the problem you are running into is that your really long line of text is exceeding the maximum resolution of the device and being truncated.
Take a look here under “Gotchas.”
What you could do is make a display group to hold all the text, anchor the children, break the text up into manageable chunks and set each segment next to the last one using object.width and then animate the whole group.