C++ Console/Terminal graphics library. Decouples graphics code from OS code, and provides performant and easy-to-use systems.
- Unicode support (recommended to use only monospaced characters).
- Full ANSI color support, with fallback to lower color depths: 4-bit, 8-bit, and 24-bit "Truecolor".
- Framerates as high as 1000's per-second, thanks to smart rendering routines (lazy updating, color-batching).
- Automatic centering of graphics within terminal window.
- Windows support (support for Linux and MacOS are planned).
- Open Visual Studio.
- Create a new project.
- Filter the templates by "C++" language, and "Windows" platform.
- Choose the "Empty Project" template for Windows.
- Name your project, choose a save location for the project, and then create the project.
- Download ConArtist's latest release and extract the contents of the .zip file into your project's folder.
- Add the ConArtist source files to your project via Project > Add Exisiting Item...
- Note: The files in the
utfcppfolder of the ConArtist library do not need to be added. Adding them will not hurt anything though, other than your project explorer becoming cluttered with a few more files.
- Note: The files in the
- Create your program's main C++ file via Project > Add New Item...
- Choose "C++ File (.cpp)", and name the file whatever you like (recommendation: "main.cpp").
- At this point, your Project folder should look something like this (plus a few extra files Visual Studio creates automatically):
Project Folder
├ conartist (folder containing .h and .cpp files, plus the "utfcpp" folder)
├ main.cpp
└ Project.sln
- Include the ConArtist library, and create the main function, where you'll write your program.
#include "conartist/ConArtist.h"
int main() {
}- You're ready to create games with ConArtist!
Here is a simple "Hello World" program for Windows.
#include "conartist/ConArtist.h"
using namespace std::chrono_literals; // allows writing "5s" (five seconds) in this_thread::sleep_for()
int main()
{
// Create a display buffer 60 cells wide, and 15 cells high, where we will draw our graphics.
// Also create a display output, which will push our graphics to the terminal.
ConArtist::CADisplayBuffer caDisplayBuffer(60, 15);
ConArtist::CADisplayOutputCMD caDisplayOutputCMD;
// Set the text and background colors to a 4-bit white and 4-bit blue, respectively
caDisplayBuffer.fillColor(0, 0, 80, 25, ConArtist::CAColor(ConArtist::ANSI_4BIT_WHITE, ConArtist::ANSI_4BIT_BLUE));
// Place a string into the center of the screen buffer
std::u32string hello = U"Hello ConArtist!";
int xCoord = caDisplayBuffer.width / 2 - hello.size() / 2;
int yCoord = caDisplayBuffer.height / 2;
caDisplayBuffer.drawText(xCoord, yCoord, hello);
// Display the screen buffer to the terminal
caDisplayOutputCMD.pushOutput(caDisplayBuffer);
// Show the terminal for 5 seconds before the program finishes and closes automatically
std::this_thread::sleep_for(5s);
}- The SNEK project is built using ConArtist.
- ISO C++11 Standard or higher is required. This is due to this library's use of the optional C++11 API from the UTF8-CPP library.
- Doesn't currently play well with non-monospaced characters (e.g. full-width Katakana). Monospaced alternatives should be used instead (e.g. half-width kana)
- When working with Unicode ASCII-style graphics, the use of UTF-32 encoded
u32stringis recommended over UTF-8 encodedstring, as it simplifies character indexing operations. ConArtist usesu32stringinternally, and converts UTF-8 encodedstringand UTF-16 encodedu16stringto UTF-32 encodedu32stringwhen these datatypes are passed as parameters to ConArtist class functions. Despite this, ConArtist's memory & performance footprints are very minimal. The choice of UTF-32 encoding simplifies Unicode ASCII-style game development and reduces potential bugs significantly.
- The UTF8-CPP library is used to convert between string encodings.
