This kind of does what I wanted. Except for once I move the sprite offset , it seems to change the offset of the region also so my DrawRect parameters are no longer valid but attached to the Sprite boundaries.
Library "v30/bslDefender.brs"
Function main()
black=&hFF'RGBA
screen=CreateObject("roScreen",false,640,480)
msgport = CreateObject("roMessagePort")
screen.SetPort(msgport)
codes = bslUniversalControlEventCodes()
compositor=CreateObject("roCompositor")
compositor.SetDrawTo(screen, black)
'bigbm=CreateObject("roBitmap","pkg:/images/temp.png")
bigbm=CreateObject("roBitmap",{width:640, height:480, AlphaEnable: false})
bigbm.DrawRect(0,0,640,480,&HFFFFFF)
region=CreateObject("roRegion", bigbm, 0, 0, 640,480)
region.SetWrap(false)
view_sprite=compositor.NewSprite(0, 0, region)
compositor.draw()
screen.Finish()
x=10:y=0
While True
msg=wait(0, msgport) ' wait for a button
If type(msg)="roUniversalControlEvent" Then
If msg.GetInt()=codes.BUTTON_RIGHT_PRESSED Then
region.DrawRect(0,0,10,480,Rnd(&HFFFFFF))
view_sprite.MoveOffset(x, 0)
compositor.draw()
screen.Finish()
region.SetPretranslation(0,0)
Else If msg.GetInt()=codes.BUTTON_LEFT_PRESSED Then
region.DrawRect(630,0,640,480,Rnd(&HFFFFFF))
view_sprite.MoveOffset(-x, 0)
compositor.draw()
screen.Finish()
region.SetPretranslation(0,0)
Else If msg.GetInt() = codes.BUTTON_BACK_PRESSED ' back button
Exit While
End If
End If
x=x+10
End While
End Function