Sista

Sista is a lightweight and easy-to-use object-oriented library for handling terminal graphics in C++.

Sista provides a set of classes and functions to make terminal games in C++ easier, thus preventing developers from having to reinvent the wheel every time they want to make a terminal game.

Download

To install Sista, simply download the latest release from GitHub. Extract the contents of the archive to your project’s source directory.

An easier approach can be to directly clone the repository into your project’s directory.

git clone https://github.com/FLAK-ZOSO/Sista

If you want to use Sista as a shared library without installing it from source, you can download the x86-64 library from the latest release on GitHub. Then, just rename it to libSista.so and place it in your system library path (e.g., /usr/local/lib on Linux and MacOS, or C:Program FilesSistalib on Windows).

Usage

The way you use Sista depends on how you want to include it in your project. There are two main ways to use Sista:

  1. As a source library

  2. As a shared library

In the first case, you will include the Sista headers in your project and compile the source files along with your project. In the second case, you will install Sista as a shared library and link against it when compiling your project.

As a source library

To use Sista, simply include the "sista.hpp" header in your project’s source files. This is the inclusion method for versions before v`2.0.0`.

#include "include/sista/sista.hpp"

The "sista.hpp" header includes all of the other headers in the "include/sista/" directory, so you don’t have to include them individually. However, you will have to include them in the compilation process as shown here.

IMPLEMENTATIONS = include/sista/ansi.cpp include/sista/border.cpp include/sista/coordinates.cpp include/sista/cursor.cpp include/sista/field.cpp include/sista/pawn.cpp

all: objects file clean

objects:
    g++ -std=c++17 -Wall -g -c $(IMPLEMENTATIONS)

sista: objects
    g++ -std=c++17 -Wall -g -c sista.cpp
    g++ -std=c++17 -Wall -g -o sista sista.o ansi.o border.o coordinates.o cursor.o pawn.o field.o

clean:
    rm -f *.o

This assumes that you have the include/sista/ directory in your project’s source directory, and that sista.cpp is the only file of your project that uses Sista. For more complex projects, you can use a build system like CMake or Make to manage the compilation process.

You can likely find a good example of a Makefile for a statically linked from source Sista project at Inävjaga.

As a shared library

To use Sista as a shared library, you will need to install it in your system library path. This is the preferred inclusion method in Linux for versions v`2.0.0` and later.

To install Sista, you can use the provided Makefile in the repository. Simply run the following command in your terminal with administrative privileges:

sudo make install

On most Linux and macOS systems, /usr/local/lib is a standard library path and no additional configuration is needed after installation. If you install Sista to a different location, you may need to adjust your library search path (e.g., by setting LD_LIBRARY_PATH on Linux or DYLD_LIBRARY_PATH on macOS).

After installing Sista, you can include it in your project by adding the following line to your source files:

#include <sista/sista.hpp>

You will also need to link against the Sista library when compiling your project. You can do this by adding the following flags to your compilation command:

g++ -std=c++17 -o sista sista.cpp -lSista

This assumes that you have installed Sista in the default system library path, which is /usr/local/lib for libraries and /usr/local/include/sista for headers, and that sista.cpp is the only file of your project that uses Sista. For more complex projects, you can use a build system like CMake or Make to manage the compilation process.

You can verify that Sista is installed correctly by running the following command in your terminal:

sudo ldconfig -p | grep libSista

If Sista is installed correctly, you should see an output similar to this:

libSista.so (libc6,x86-64) => /usr/local/lib/libSista.so

If you see this output, you can now use Sista in your projects as a shared library as described above.

The equivalent command on MacOS to check if Sista is installed correctly is:

otool -L /usr/local/lib/libSista.so

You can also link statically against Sista by using the following command:

g++ -std=c++17 -o sista sista.cpp -static -lSista

This will create a statically linked executable that includes the Sista library, which can be useful if you want to distribute your application without requiring users to install Sista separately.

If you need to uninstall Sista, you can run the following command in your terminal with administrative privileges:

sudo make uninstall

If you want to use Sista as a shared library on Windows, you can follow the same steps as above, but you will need to use MinGW or MSYS2 to compile your project. The installation command is the same:

make install

You can likely find a good example of a Makefile that dynamically links to the Sista shared library at Inävjaga.

Documentation

Most of the documentation can be found here on Read the Docs: Sista Documentation.

The present documentation focuses on a legacy unmaintained release of Sista, which is version 2.y.z.

Some additional documentation for Sista can be found in the Release Notes on GitHub.

Introduction

A simple example of how to use Sista to make a terminal animation is provided by sista.cpp.

A more detailed explaination of the example can be found in the intro.

Demos

You can find some demos of Sista in the demo directory of the repository.

These demos showcase various features of Sista. They are minimal examples and, unlike the sista.cpp example, they do not provide a complete walkthrough of the library.

Derived works

Here are some of the most relevant works based on Sista, which you can use as a base for your project or as examples to better understand the syntax coming with the library.

  • Inomhus - Bättre att stanna inomhus (better be in the house) - a survival videogame

  • Starklag - den starkastes lag (the law of the strongest) - a partial evolution simulator

  • Dödas - de dödas angrepp (attack of the dead) - a survival speedrun videogame

  • Dune - a survival videogame inspired by Dune

  • Inävjaga - Inälvor jagade (intestin hunt) - a survival videogame with hordes of enemies