QB64 Phoenix Edition
AAFB - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Expanding Horizons (Libraries) (https://qb64phoenix.com/forum/forumdisplay.php?fid=21)
+---- Forum: a740g (https://qb64phoenix.com/forum/forumdisplay.php?fid=55)
+---- Thread: AAFB (/showthread.php?tid=2640)



AAFB - a740g - 04-30-2024

I’ve been toying with the idea of rendering graphics to SCREEN 0 for a while and have figured out quite a few things on how to accomplish this at a reasonably good speed. However, one of those experiments turned out to be the most fun of all. So much so that I decided to convert it into a tiny library and share it here. You can use this to give your programs a retro artistic look.

The library has just two functions: AAFB_Render and AAFB_SetupScreen0.

The AAFB_Render function is used to render any graphics image onto a SCREEN 0 image. It takes two parameters: srcImage and dstImage. The srcImage parameter is the handle of the graphics image to be rendered, and the dstImage parameter is the handle of the destination SCREEN 0 image where the ASCII art image will be rendered onto. dstImage can be 0 (i.e. the real SCREEN). srcImage and dstImage must have the same dimensions.

Code: (Select All)
SUB AAFB_Render (BYVAL srcImage AS LONG, BYVAL dstImage AS LONG)

The AAFB_SetupScreen0 is just a convenience function that quickly sets up SCREEN 0 with optimal settings.

Code: (Select All)
SUB AAFB_SetupScreen0 (screenWidth AS _UNSIGNED INTEGER, screenHeight AS _UNSIGNED INTEGER)

QB64-PE 3.12 is required. To use an older compiler, remove the "$INCLUDEONCE" lines from AAFB.bi and AAFB.bas.

There are some demos included in the Demo folder.

[Image: Screenshot-2024-04-30-180035.png]
RokCoder's Galaga running on top of AAFB.

[Image: Screenshot-2024-04-30-180440.png]
FishTank demo running on top of AAFB.

Limitations:
  • There is no built-in scaling. However, this can be easily done with _PUTIMAGE
  • Although it is quite fast, the rendering is done on the CPU and hence may not be suitable for high-resolution rendering (e.g. WIDTH 1920, 1080). However, lots of performance can be gained if you compile with the QB64-PE optimization option enabled.
  • It does not render to the console / terminal. There are other of libraries that do that. However, they are limited to a reduced set of ASCII characters. AAFB uses all 256 ASCII characters.



RE: AAFB - bplus - 04-30-2024

those are some nice screen shots specially considering they are on screen 0, @Pete might enjoy just to say, 'told ya so!'

what is it about pixel art or impressionistic paintings that are so beautiful? you reduce detail and yet it is prettier.

+1 this is amazing result of self challenge to do graphics on screen 0 but don't we have all that already in graphics screens?


RE: AAFB - a740g - 04-30-2024

(04-30-2024, 03:08 PM)bplus Wrote: +1 this is amazing result of self challenge to do graphics on screen 0 but don't we have all that already in graphics screens?

Thanks! We do. This was just "for science" and "what if". Basically just for fun. Big Grin


RE: AAFB - Pete - 05-01-2024

And like I keep telling you guys, SCREEN 0 is the only screen anyone would ever need!

Pete Big Grin +2


RE: AAFB - grymmjack - 05-01-2024

@a740g this is interesting. Are those little o characters?

Going to put this in GitHub too?


RE: AAFB - a740g - 05-01-2024

(05-01-2024, 09:53 PM)grymmjack Wrote: @a740g this is interesting. Are those little o characters?

Going to put this in GitHub too?

Yeah. But the code can use any ASCII character. I basically wrote a tiny program that takes the QB64 8x8 px font and sorts the whole range based on intensity (i.e. how many pixels are set). These are then put in a LUT from where it is used.

Yes. I'll eventually clean this up and put it on GitHub.


RE: AAFB - GareBear - 05-02-2024

a740g,

Very good on what you did.  The game demo reminds me of the arcade version. I did just as well today as then.


RE: AAFB - a740g - 05-02-2024

(05-02-2024, 04:34 PM)GareBear Wrote: a740g,

Very good on what you did.  The game demo reminds me of the arcade version. I did just as well today as then.

Thanks! But just to clarify, only the rendering library is mine. I do not take any credit for the game. That brilliant piece of work was done by @RokCoder. You can find the original here: https://qb64phoenix.com/forum/showthread.php?tid=1443 or https://github.com/rokcoder-qb64/galaga


RE: AAFB - RokCoder - 05-02-2024

That looks awesome! Makes me want to do some more retro repros. Nice work indeed!


RE: AAFB - TerryRitchie - 05-02-2024

(05-02-2024, 05:54 PM)RokCoder Wrote: That looks awesome! Makes me want to do some more retro repros. Nice work indeed!
Oh yes, please do! I love your games.