David Blume's GitList
Repositories
roku_family_photos.git
Code
Commits
Branches
Tags
Search
Tree:
eb8b49b
Branches
Tags
dialog_test
main
roku_family_photos.git
source
main.brs
Refactor style with no functional change.
David Blume
commited
eb8b49b
at 2015-11-28 11:05:42
main.brs
Blame
History
Raw
sub main() print "Starting Family Photos" m.imageSizeX = 1280 m.imageSizeY = 720 m.index = 0 port = CreateObject("roMessagePort") m.screen = CreateObject("roScreen", true) m.screen.SetAlphaEnable(true) m.screen.Clear(&h000000FF) m.screen.SetMessagePort(port) m.arrayImages = [ "pkg:/images/Slide01.jpg", "pkg:/images/Slide02.jpg", "pkg:/images/Slide03.jpg" ] m.slideCount = m.arrayImages.Count() m.currentBitmap = CreateObject("roBitmap", m.arrayImages[m.index]) m.currentBitmap.SetAlphaEnable(true) m.scaleX = m.screen.GetWidth() / m.imageSizeX m.scaleY = m.screen.GetHeight() / m.imageSizeY m.screen.DrawScaledObject(0, 0, m.scaleX, m.scaleY, m.currentBitmap) change_slide() while(true) msg = wait(0, port) if type(msg) = "roUniversalControlEvent" button = msg.GetInt() if ((button = 5) Or (button = 6)) and m.index < m.slideCount - 1 print "Show Next Slide" m.index = m.index + 1 change_slide() else if (button = 4) And (m.index > 0) print "Show Previous Slide" m.index = m.index - 1 change_slide() end if end if end while end sub function change_slide() if m.index < 0 m.nextBitmap = CreateObject("roBitmap", "pkg:/images/background.jpg") else if m.index >= m.slideCount m.nextBitmap = CreateObject("roBitmap", "pkg:/images/background.jpg") else m.nextBitmap = CreateObject("roBitmap", m.arrayImages[m.index]) End if m.nextBitmap.SetAlphaEnable(true) for i = 0 to 255 step 5 hexcolor = &hFFFFFFFF - i hexcolor2 = &hFFFFFF00 + i m.screen.DrawScaledObject(0, 0, m.scaleX, m.scaleY, m.currentBitmap, hexcolor) 'fadeout m.screen.DrawScaledObject(0, 0, m.scaleX, m.scaleY, m.nextBitmap, hexcolor2) 'fadein m.screen.SwapBuffers() end for m.currentBitmap = 0 'release the current bitmap m.currentBitmap = m.nextBitmap 'assign the new next bitmap m.nextBitmap = 0 'release the next bitmap end function