"TheEndless" wrote:
It'd be even better if you could call GetBitmap() on the roTextureRequest with a GetState() of 4/Ready, instead of having to listen for the roTextureRequestEvents and keep track of it separately by request ID, but hey ho...
"Greg47" wrote:
Does anybody have an example of using the roTextureRequest and Manager in the background? I have it setup to create loading bitmaps first of all the data, but having trouble figuring out how to kick off and let the real images fill in as they are ready. Thanks.
While True
textureMsg = m.TextureMgr.GetMessagePort().GetMessage()
If textureMsg <> invalid Then
...
End If
screenMsg = m.Screen.GetMessagePort().GetMessage()
If screenMsg <> invalid Then
...
End If
End While
"TheEndless" wrote:"Greg47" wrote:
Does anybody have an example of using the roTextureRequest and Manager in the background? I have it setup to create loading bitmaps first of all the data, but having trouble figuring out how to kick off and let the real images fill in as they are ready. Thanks.
That's where being able to pull the bitmap directly from the roTextureRequest would come in really handy. Probably the best way to do it would be to share the message port, so you can listen for roTextureRequestEvents while you're listening for roUniversalControlEvents from your screen.
function getItems(textureManager As Object) As Object
items = CreateObject("roArray", 25, true)
for i = 0 to 25
bitmap = CreateObject("roBitmap", {width: width, height: height, AlphaEnable: true})
bitmap.Clear( &h222835FF )
request = CreateObject("roTextureRequest", "external url")
textureManager.RequestTexture(request)
items.Push(bitmap)
end for
return items
end function
"Greg47" wrote:
But then I'm struggling to figure out how to connect the requested bitmap back to the items array. I thought I could maybe get the request event id's and then connect that back to the item array index, but it does't seem that the event id is kicked off on every single item. It seems like it doesn't actually get the id until the async is complete. And maybe I'm trying to kick off the download in the wrong spot. Thanks for any help.
"TheEndless" wrote:Thanks. I was thinking the id wasn't there until after the event request triggered, but it is there before so that helps a lot. Thanks."Greg47" wrote:
But then I'm struggling to figure out how to connect the requested bitmap back to the items array. I thought I could maybe get the request event id's and then connect that back to the item array index, but it does't seem that the event id is kicked off on every single item. It seems like it doesn't actually get the id until the async is complete. And maybe I'm trying to kick off the download in the wrong spot. Thanks for any help.
The roTextureRequest.GetID() matches the roTextureRequestEvent.GetID(), so you should use that to link the two.