I'm having some problems animating some text using an roImageCanvas.
Here's my initialization code, copied straight from the Component Reference Guide:
m.canvasItems = {
Text: GetInfoBlock()
TextAttrs: {
Color: "#FFCCCCCC"
Font: "Medium"
HAlign: "HCenter"
VAlign: "VCenter"
Direction: "LeftToRight"
}
TargetRect: {
x: m.display_size.w/4
y: m.display_size.h/4
w: m.display_size.w/2
h: m.display_size.h/2
}
}
m.canvas = CreateObject("roImageCanvas")
port = CreateObject("roMessagePort")
m.canvas.SetMessagePort(port)
'Set opaque background
m.canvas.SetLayer(0, {Color:"#FF000000", CompositionMode:"Source"})
m.canvas.SetLayer(1, m.canvasItems)
m.canvas.Show()
From time to time, I run this:
m.canvasItems.Text = GetInfoBlock()
m.canvas.SetLayer(1, m.canvasItems)
and the screen updates as expected. However, I'm also trying to bounce the text around the screen, and that isn't working.
Here's the place where I'm animating:
Sub sleep_ten_minutes()
m.timespan.Mark()
While true
sleep(20)
If m.timespan.TotalSeconds() >= 600 Then Return
animate(m.canvasItems.TargetRect, m.animation)
print m.canvasItems.TargetRect.x;",";m.canvasItems.TargetRect.y
m.canvas.SetLayer(1, m.canvasItems)
End While
End Sub
When I run it, I see this on my PuTTY session:
... inner loop...
321 , 181
322 , 182
323 , 183
[...]
499 , 359
500 , 360
501 , 359
but the text on the screen never moves. Can anyone help? Thanks!