[//]: # ( [MermaidChart: b8cb3274-dd5a-4ce9-b674-c1cf4af51848]
TDL is a C++ library that aims to provide a simple and easy-to-use interface for creating terminal-based applications. It is designed to be a lightweight and efficient solution for creating games, applications, and other software that can run in a terminal.
- Window Management: Create and manage terminal windows with ease.
- Texture and Sprite Management: Load and display images in the terminal.
- Event Handling: Handle keyboard / mouse input and other events.
- Sound and Music: Play sound effects and music in the terminal.
- Text Rendering: Render text in the terminal with different fonts and styles.
- Works on graphical terminals and TTYS: TDL works on both graphical terminals and TTYS.
To build and use TDL, you need the following dependencies:
- CMake
- GCC or Clang
- FreeType2
- libpng
- openAl
- libsndfile
- pkg-config
- libalsa
- libevdev
if you want to install dependancies on ubuntu you can use the following command:
sudo apt-get install cmake g++ libfreetype6-dev libpng-dev libopenal-dev libsndfile1-dev pkg-config libalsa-ocaml-dev libevdev-dev
On ArchLinux you can use the following command:
sudo pacman -S cmake gcc freetype2 libpng openal libsndfile pkg-config alsa-lib libevdev
To install from the AUR you can find the link here.
To install and use TDL in your project, please follow these steps:
-
Clone this repository.
-
Create build folders and run the following command inside:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ -DBUILD_SHARED_LIBS=ON
cmake --build . --target install (you may need to run this as sudo)
The file should be correctly installed, and you can build your code using cmake and use the library.
Here is a simple example of how to create a window and display an image using TDL:
You can find more examples in the examples folder. If you want to build the examples, you can use the following commands:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --target build_demo
The examples will be built in the `demo folder at the root of the repository.
if you want to try all the display method:
- run the demo binary on a gnome terminal (ASCII Method)
sudo ./demo 2> log- run the demo as the same way on a sixel-supported terminal like Konsole
- finaly switch to TTY and run the demo for the Pixel method
C++ code
int main() {
tdl::Window *win = tdl::Window::createWindow("WindowName");
while (true) {
win->clearPixel();
win->update();
win->draw();
}
return 0;
}C++ code
int main() {
tdl::Window *win = tdl::Window::createWindow("WindowName");
tdl::Texture *texture = new tdl::Texture("path/to/image.png");
tdl::Sprite *sprite = new tdl::Sprite(texture);
while (true) {
win->clearPixel();
win->drawSprite(sprite);
win->update();
win->draw();
}
return 0;
}You can find the documentation here.
This project is licensed under the GPL-3 License - see the LICENSE file for details.
TDL project contributing are very welcome! And you have a lot of ways to contribute from speaking about the project to contributing code. If you want to contribute to the project, please read the CONTRIBUTING file.


