Page 1 of 1

nxtBasic : Draw cube in the background and then bring it to screen128.

Posted: Fri Jul 26, 2024 10:11 am
by funkheld
hello, good day.

draw cube in the background and then bring it to screen128.
can you do that in nxtbasic?

thanks.
greetings

Re: nxtBasic : Draw cube in the background and then bring it to screen128.

Posted: Fri Jul 26, 2024 11:22 am
by unartic
Well, you mean double buffering in this instance. x16 does not support that in a good way. There is not enough vera memory to store two 256 colored bitmaps in vram, so 320x240, 256colors can not be double buffered. You could go to 16 color bitmap, then you can do double buffering, but support for 16 color bitmap is not as good as 256 color bitmap.

So If you want a cube to appear on the screen there are several ways with its advantages and disadvantages:
- Just draw to the bitmap layer: with animation this often results in flickering. (allthough the fastes)
- Draw somewhere within vram or highram yourself by setting bytes, which correspond to pixels and when needed copy a chunck of memory to vram. (see cube.bas in the examples which uses this approach, though the 'buffer' is drawn to the visible screen area)
- Mask of a piece of the bitmap layer by placing a sprite over it (for example if you have some kind of HUD on the screen). You can then draw 'under' it, and copy a rectangle to the coordinates you want your graphic to appear.

Maybe others can come up with even better solutions, as this is a x16-thing, not a nxtBasic thing.

Re: nxtBasic : Draw cube in the background and then bring it to screen128.

Posted: Fri Jul 26, 2024 12:14 pm
by funkheld
thanks, the idea with the HUD is good.

greeting