I am new to the 2D API and roku developing obviously and was trying to figure out how the roCompositor would help me. I am creating a custom UI that looks something like this
+--------------------------------------------+
| Logo |
+--------------------------------------------+
| menu item 1 Category Title |
| menu item 2 |
| menu item 3 poster 1 , 2 , 3 |
| menu item 4 poster 4 , 5 , 6 |
| |
+--------------------------------------------+
The Logo is drawn with DrawObject, the menu item's and category title's are drawn with DrawText. Here is the code I use to load the posters and draw them (I am not checking return values at the moment, just trying to get basic concepts to work before making it robust) :
' Draw Movie Posters
current_movie = 0
poster_columns = 3
poster_height = 285
poster_row_pad = 50
poster_width = 201
poster_column_pad = 50
l_width = poster_width + poster_column_pad
l_x = 366
l_y = 220
' NewHttp2 is part of the urlUtils.brs included with the scroll SDK example
http = NewHttp2("http://whopix.files.wordpress.com/2013/07/doctor-widow-wardrobe-dvd.jpg", "text/xml")
http.GetToFileWithTimeout("tmp:/doctor-widow-wardrobe-dvd.jpg", 120)
poster1 = CreateObject("roBitmap", "tmp:/doctor-widow-wardrobe-dvd.jpg")
http = NewHttp2("http://whopix.files.wordpress.com/2013/07/doctor-widow-wardrobe-dvd.jpg", "text/xml")
http.GetToFileWithTimeout("tmp:/doctor-widow-wardrobe-dvd.jpg", 120)
poster2 = CreateObject("roBitmap", "tmp:/doctor-widow-wardrobe-dvd.jpg")
http = NewHttp2("http://whopix.files.wordpress.com/2013/07/doctor-widow-wardrobe-dvd.jpg", "text/xml")
http.GetToFileWithTimeout("tmp:/doctor-widow-wardrobe-dvd.jpg", 120)
poster3 = CreateObject("roBitmap", "tmp:/doctor-widow-wardrobe-dvd.jpg")
http = NewHttp2("http://whopix.files.wordpress.com/2013/07/doctor-widow-wardrobe-dvd.jpg", "text/xml")
http.GetToFileWithTimeout("tmp:/doctor-widow-wardrobe-dvd.jpg", 120)
poster4 = CreateObject("roBitmap", "tmp:/doctor-widow-wardrobe-dvd.jpg")
http = NewHttp2("http://whopix.files.wordpress.com/2013/07/doctor-widow-wardrobe-dvd.jpg", "text/xml")
http.GetToFileWithTimeout("tmp:/doctor-widow-wardrobe-dvd.jpg", 120)
poster5 = CreateObject("roBitmap", "tmp:/doctor-widow-wardrobe-dvd.jpg")
http = NewHttp2("http://whopix.files.wordpress.com/2013/07/doctor-widow-wardrobe-dvd.jpg", "text/xml")
http.GetToFileWithTimeout("tmp:/doctor-widow-wardrobe-dvd.jpg", 120)
poster6 = CreateObject("roBitmap", "tmp:/doctor-widow-wardrobe-dvd.jpg")
posterArray = [poster1, poster2, poster3, poster4, poster5, poster6]
For each bitmap in posterArray
screen.DrawScaledObject( l_x, l_y, 0.75, 0.75, bitmap )
l_x = l_x + l_width
current_movie = current_movie + 1
if (current_movie = poster_columns)
l_x = 366
l_y = l_y + (poster_height + poster_row_pad)
current_movie = 0
end if
end for
screen.swapbuffers()