Library "v30/bslDefender.brs"
Sub Main()
font_registry = CreateObject("roFontRegistry")
font = font_registry.GetDefaultFont()
codes = bslUniversalControlEventCodes()
m.screen=CreateObject("roScreen", true)
m.msgport=CreateObject("roMessagePort")
m.screen.SetPort(m.msgport)
m.screen.Clear(&h394837FF)
m.screen.SetAlphaEnable(true)
m.screen.DrawText("background", 530, 250, &hebebebFF, font)
square = CreateObject("roBitmap", {width: 400, height: 400, AlphaEnable: true})
square.Clear(&h25344399)
rect = CreateObject("roBitmap", {width: 565, height: 280, AlphaEnable: false})
rect.drawRotatedobject( 0, 285, 45, square)
m.screen.drawobject(357, 220, rect)
m.screen.Swapbuffers()
rowrow = 0
while true
m.screen.Clear(&h394837FF)
m.screen.DrawText("background", 530, 250, &hebebebFF, font)
msg = m.msgport.getmessage()
if type(msg) = "roUniversalControlEvent"
button = msg.getint()
if button=codes.BUTTON_RIGHT_PRESSED
rowrow = rowrow + 45
m.screen.drawRotatedobject(357, 220, rowrow, rect)
m.screen.Swapbuffers()
end if
end if
end while
End Sub
"TheEndless" wrote:
If you want to hack it, you could potentially draw a rectangle, rotate it to the desired angle, clip it and then rotate it back. Or, you could carve it out of a rectangle with a fully transparent rectangle rotated to the desired angles and drawn on top with alpha blending disabled.
' This will create a right triangle lying on its long side
' Create a bitmap the size of the outer bounds of the triangle
' Make sure alpha enable is false, so the lines cut through the bitmap
triangle = CreateObject("roBitmap", { Width: 400, Height: 200, AlphaEnable: False })
' Clear the bitmap to the color you want
triangle.Clear(&HFFFFFFFF)
' Clear out the left slope
For x = 0 To 200
triangle.DrawLine(x, 0, x - 200, 200, &H00000000)
Next
' Clear out the right slope
For x = 200 To 400
triangle.DrawLine(x, 0, x + 200, 200, &H00000000)
Next
"TheEndless" wrote:
It seems that DrawRotatedObject() only supports arbitrary angles on devices with OpenGL support. I guess that's why they never updated the documentation.
"EnTerr" wrote:"TheEndless" wrote:
It seems that DrawRotatedObject() only supports arbitrary angles on devices with OpenGL support. I guess that's why they never updated the documentation.
What! :shock:
You mean the 27x0 line (RokuLT/Roku1/Roku2) - the joy and pride of RokuCo from Sep 2013 - cannot rotate to angles <> 90*n ?
What about Roku3, can it?
This shatters my belief, which was based on viewtopic.php?f=34&t=56314&p=432102#p432100
The suspicious silence of Roku* on the question suddenly seems to speak volumes. :oops:
Screen = CreateObject( "roScreen", True )
Screen.Clear( &hFFFFFFFF )
Screen.SwapBuffers()
bitmap = CreateObject( "roBitmap", { width: 200, height: 200 , AlphaEnable: False } )
bitmap.Clear( &h911820FF )
width = bitmap.GetWidth()
height = bitmap.GetHeight()
region = CreateObject( "roRegion", bitmap, 0, 0, width, height )
x = int( width / 2 )
y = int( height / 2 )
region.SetPretranslation( -x, -y )
for theta = 360 to 0 step -1
Screen.Clear( &hFFFFFFFF )
Screen.DrawRotatedObject( 100 + x, 100 + y, theta, region )
Screen.SwapBuffers()
end for