2D Clipping

Blitz3D Forums/Blitz3D Beginners Area/2D Clipping

Marcell(Posted 2007) [#1]
Hello,
I'm making a scrolling 2D game with 2048 x 1536 bitmap, where 1024 x 768 portion of the bitmap is shown.

Does DrawImage handle clipping for me automatically? I've made my own clipping routine that uses CopyRect, but it seems that CopyRect does not handle transparency for any colours, DrawImage does.


Matty(Posted 2007) [#2]
Drawimage will handle that fine. I use a 3200x2400 image in blitzplus in one of my games as a background which only 800x600 is usually seen and I've not had any problems on anything I've run it on.


Sledge(Posted 2007) [#3]
I've never seen any problems drawing a massive bitmap either, even though we're advised not to. If it bugs you, though, you can CopyRect a screen-sized section to a screen-sized bitmap then DrawImage that to the backbuffer instead. Voila - "safe" sized blitting with transparency.


Zethrax(Posted 2007) [#4]
You can also use the Viewport command to clip part of the current drawing buffer.

For a scrolling game you may be better off going with a tiled approach, rather than using a single huge bitmap. The image you're using would take up 12 megabytes in memory, at 32 bits per pixel.


Marcell(Posted 2007) [#5]
Thanks, DrawImage does the clipping.
The enemies that are going in the big bitmap with "level coordinates" should appear to visible area pixel by pixel. I was previously using CopyRect for that, but as DrawImage handles the clipping, I can go with it. This makes my life easer. :-)