Skip to content

ANSI Escape Sequence Emulation Library for QB64-PE

License

Notifications You must be signed in to change notification settings

a740g/ANSI-Print-64

Repository files navigation

ANSI ESCAPE SEQUENCE EMULATOR

This is an ANSI Escape Sequence Emulator library written entirely in QB64-PE.

Screenshot Screenshot Screenshot Screenshot

FEATURES

  • No dependency on third party libraries
  • Works on Windows, Linux & macOS
  • Works in 32bpp graphics mode emulating text mode colors and true color extensions
  • Supports most common ANSI escape sequences and even some obscure ones
  • Supports embedded ANSI music - WIP
  • Supports ANSImation content
  • Support querying width and height of the content in characters - WIP
  • Easy plug-&-play API - OK
  • Loads and renders ANS, ASC, DIZ, NFO and TXT files
  • Includes a demo viewer to show how to use the library

USAGE

  • Clone the repository to a directory of your choice
  • Open Terminal and change to the directory using an appropriate OS command
  • Run git submodule update --init --recursive to initialize, fetch and checkout git submodules
  • Open ANSIPrint64.bas in the QB64-PE IDE and press F5 to compile and run
  • To use the library in your project add the Toolbox64 repository as a Git submodule

API

' Easy top-level API (call and forget style)
SUB ANSI_Print (sANSI AS STRING)

' Core library functions (if more control is required)
SUB ANSI_InitializeEmulator
SUB ANSI_ResetEmulator
SUB ANSI_SetEmulationSpeed (nCPS AS LONG)
FUNCTION ANSI_PrintCharacter%% (ch AS _UNSIGNED _BYTE)
FUNCTION ANSI_PrintString%% (s AS STRING)

' Library support functions
SUB ANSI_SetTextCanvasColor (c AS _UNSIGNED LONG, isBackground AS LONG, isLegacy AS LONG)
FUNCTION ANSI_GetTextCanvasWidth&
FUNCTION ANSI_GetTextCanvasHeight&
SUB ANSI_ClearTextCanvasArea (l AS LONG, t AS LONG, r AS LONG, b AS LONG)

FAQ

What can I do with this?

  • Anything you want! Use it in games, demos or for writing pretty text mode user interfaces and output.

Can you implement feature x / y?

  • With the limited time I have between my day job, home and family, there is only so much I can do. I do maintain a list of TODO (see below). However, those do not have any set deadlines. If you need something implemented, submit a GitHub issue about it or do it yourself and submit a PR.

I found a bug. How can I help?

  • Let me know using GitHub issues or fix it yourself and submit a PR!

Can this be used in a game / demo?

  • Absolutely. The demo code included in a good example.

NOTES

  • This requires the latest version of QB64-PE
  • The renderer is designed for QB64's 32BPP graphics Window. Legacy SCREENs will not work
  • This is WIP. So, expect things to change and break. There are some bugs and quirks that needs to be worked out
  • When you clone a repository that contains submodules, the submodules are not automatically cloned by default
  • You will need to use the git submodule update --init --recursive to initialize, fetch and checkout git submodules

BIBLIOGRAPHY

ASSETS

Icon by DesignContest

CREDITS

Rick Christy (grymmjack) for pointing out issues and helping me with invaluable resources. This project includes some of his artwork for testing. Thanks Rick!

Releases

No releases published

Packages

No packages published

Languages