"RokuJoel" wrote:
Are you sure your sprites are transparent and not occluding the background you drew to the screen? Sometimes it is really tricky getting various layers and transparency working. I just did some testing, and I can't verify that drawall() erases the background. I could be wrong, but with some quick limited testing, I don't think that it does.
- Joel
Well..... maybe others can comment then. FYI... my draw loop is basically:
while <whatever>
scrn.SetAlphaEnable(false)
scrn.DrawObject(0,0, StationaryBackgroundBM)
scrn.SetAlphaEnable(true)
' comp.DrawAll() 'DrawAll() does a clear screen???
comp.Draw()
scrn.swapBuffers()
<more code stuffis>
end while
If I comment out comp.Draw() and uncomment comp.DrawAll() the background is not there. If I use Draw() it's there. Maybe I'm doing something stupid..... IDK. I'll do more testing and get back to you. This is on v 3.1 Roku 1.
EDIT: OK, created test. Try this: (you'll need to create a Background.jpg and a smallsprite.png file in /images. The background.jpg filled the screen, the smallsprite was 68x68 in my test). If it's not clearing the screen, why is the background not showing up for DrawAll()?... as you can see it prints a message to the debug console showing what method it is using at any moment.
With my test, the background blitted in drawObject (line noted in comment) is not showing (is black) for DrawAll() and there with Draw(). So... what am I doing that's incorrect?
If you're trying to duplicate it, remember to use a double-buffered screen, or just use code below.
Sub Main()
screen = CreateObject("roScreen", true, 640, 480)
screen.Clear(0)
screen.SetAlphaEnable(true)
sh = screen.GetHeight()
sw = screen.GetWidth()
backgroundBM = CreateObject("roBitmap", "pkg:/images/Background.jpg")
comp = CreateObject("roCompositor")
comp.SetDrawTo(screen, &H00FF)
sbitMap = CreateObject("roBitmap", "pkg:/images/smallsprite.png")
sregion = CreateObject("roRegion", sBitMap, 0, 0, sBitMap.GetWidth(), sBitMap.Getheight())
sprite = comp.NewSprite(100, 100, sregion, 1)
sprite.SetDrawableFlag(true)
while true
Counter = 0
while Counter < 400
screen.SetAlphaEnable(false)
screen.DrawObject(0,0, backgroundBM) ' <<--- Image blit
screen.SetAlphaEnable(true)
if Counter < 200 then
if Counter = 0 then Print "Using DrawAll()"
comp.DrawAll()
else
if Counter = 200 then Print "Using Draw()"
sprite.MoveOffset(0,0) ' Mark sprite dirty.
comp.Draw()
end if
screen.swapBuffers()
Counter = Counter + 1
end while
end while
End Sub