coredump
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2015
10:56 AM
2D API N00b question
I am trying to learn the 2D API for a custom UI I am working on and can't get anything to draw on the canvas. What am I doing wrong ?
This is supposed to draw a solid yellow rectangle at the top of the screen
This is supposed to draw a solid yellow rectangle at the top of the screen
sub main()
screen = CreateObject("roScreen",true)
screen.DrawRect(0, 0, 1280, 121, &hFFFF00FF)
screen.Finish()
msgport = CreateObject("roMessagePort")
screen.SetMessagePort(msgport)
pressedState = -1 ' If > 0, is the button currently in pressed state
' Start our event loop
while true
if pressedState = -1 then
msg=wait(0, msgport) ' wait for a button press
else
msg=wait(1, msgport) ' wait for a button release or move in current pressedState direction
endif
if type(msg)="roUniversalControlEvent" then
keypressed = msg.GetInt()
print "keypressed=";keypressed
end if
end while
end sub
2 REPLIES 2

RokuJoel
Binge Watcher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2015
11:08 AM
Re: 2D API N00b question
You created a double buffered screen. You need to call swapbuffers() instead of Finish() on your screen.
- Joel
- Joel

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2015
11:58 AM
Re: 2D API N00b question
Welcome to the 2D API Jungle! 8-)