Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AAFB
#1
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.


Attached Files
.zip   AAFB.zip (Size: 7.61 MB / Downloads: 26)
Reply


Messages In This Thread
AAFB - by a740g - 04-30-2024, 01:16 PM
RE: AAFB - by bplus - 04-30-2024, 03:08 PM
RE: AAFB - by a740g - 04-30-2024, 03:58 PM
RE: AAFB - by Pete - 05-01-2024, 07:53 AM
RE: AAFB - by grymmjack - 05-01-2024, 09:53 PM
RE: AAFB - by a740g - 05-01-2024, 11:20 PM
RE: AAFB - by GareBear - 05-02-2024, 04:34 PM
RE: AAFB - by a740g - 05-02-2024, 05:44 PM
RE: AAFB - by RokCoder - 05-02-2024, 05:54 PM
RE: AAFB - by TerryRitchie - 05-02-2024, 07:20 PM



Users browsing this thread: 1 Guest(s)