Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 8

Scaling Sprites

It seems a bitmap is a property of a region
a region is a property of a sprite
drawscaledbitmap is a property of a screen

What is the simplest method of scaling a sprites bitmap? I want to scale some sprites to a fixed pixel width and then move them using sprite.moveto(x,y), but I'm not sure how to do this. I have sprites on screen, they are moving as I want them to, but I want to shrink em & keep em shrunk.

Anyone?

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
2 Replies
Highlighted
Level 9

Re: Scaling Sprites

roBitmap, roRegion, and roScreen all implement the ifDraw2D interface, so you can DrawScaledObject to any one of them. If you want to scale a sprite permanently, then I'd probably draw it to a bitmap scaled, then use that bitmap throughout the rest of the app. The scaleblit.brs file in the Simple2D sample shows and example of how to do this.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Highlighted
Level 8

Re: Scaling Sprites

Thanks for the suggestion, I got it working, the biggest issue being that the scaling factors are percentages, not pixels, so 0.50 instead of 50.0

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos