A C, C++ and Rust library to draw graphics with pixels in the terminal

Overview

A library to draw graphics with pixels in the terminal

Who needs a GUI when you have a terminal ?

Building

To generate libpluto.a, run:

$ make

To install it so that your compiler can use it directly, run:

# make install

To compile some examples, run:

$ make exp

Pre-compiled library files are available in the releases tab (only for Linux x86-64)

Using the library

  1. Include the pluto header in your source file
#include  // do #include  if the lib is already installed
  1. Write your source code. An example program which draws a line:
#include 
#include "pluto.h"									/* Change path if needed */

int main()
{
    pluto_init_window();								/* Initialize pluto */
    pluto_save_screen();								/* Save screen */

    for (;;)
    {
    	for (int i = 0; i < _pluto_canvas.cheight; i++)
    	{
	    for (int j = 0; j < _pluto_canvas.cwidth; j++)
	    {
	    	pluto_set_cpix(j, i, rand() % 256, rand() % 256, rand() % 256);		/* Set pixel with random colours */
	    }
    	}

	pluto_write_out();								/* Write to output buffer */
	pluto_render();									/* Render the output buffer */
    }

    pluto_deinit();
    return 0;
}
  1. Link the library generated, for example:
$ gcc -o program program.c -lpluto  # install it before or use -L
  1. You're done! Just run your program now!

Comments in the pluto.h file describe what each function/data structure does

Perlin noise using plutonem


Mandelbrot (examples/mandelbrot.c)


Image rendered using plutonem


A raycaster written with plutonem

Plutonem is tested and works on:

  • Operating systems: Linux, BSD, MacOS, Windows (Cygwin or MinGW needed)
  • Terminal emulators: XTerm, Termite, Konsole, GNOME-terminal, Alacritty (best performance) and Kitty

Contributing:

  • Bug fixes
  • Features (don't pull request too many files at once)
  • Issue (GitHub issues tab) fixing

Troubleshooting

  1. Check if proper fonts are installed. Pluto uses Unicode characters from U+10240(10) to U+10495(10). I recommend the Cascadia Mono font.
  2. Check if your terminal supports Unicode
  3. Check your locale, lang (pluto only supports UTF-8 currently). I have my locale set to en_US.UTF-8. On Arch Linux, which I use, I would use this command to set it:
# localectl set-locale LANG=en_US.UTF-8
  1. Open an issue in the issues tab, provide your terminal name, what locale it is set to, and your font
You might also like...
X terminal emulator rendering through OpenGL ES Compute Shaders

Zutty is a terminal emulator for the X Window System, functionally similar to several other X terminal emulators such as xterm, rxvt and countless others

n³ The unorthodox terminal file manager
n³ The unorthodox terminal file manager

n³ The unorthodox terminal file manager

Graphs the activity of a chia harvester in a linux terminal.
Graphs the activity of a chia harvester in a linux terminal.

Chia Harvest Graph Monitor for Chia Harvesting Introduction The chiaharvestgraph tool will graph Chia Harvesting activity in a linux terminal. Use a 2

a simple to use linux terminal

a simple to use linux terminal

Collection of human friendly terminal interface for git.
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Simple benchmark for terminal output

TermBench This is a simple timing utility you can use to see how slow your terminal program is at parsing escape-sequence-coded color output. It can b

tinytetris - 80x23 terminal tetris
tinytetris - 80x23 terminal tetris

tinytetris - 80x23 terminal tetris

 Contour - A modern C++ Terminal Emulator
Contour - A modern C++ Terminal Emulator

contour is a modern terminal emulator, for everyday use. It is aiming for power users with a modern feature mindset.

Simple Unix Terminal Football Manager-like game.

Superleage 2020/2021 It is a "work in progress" simple game based on some mechanics of Football Manager. The game is in a very early stage of Developm

Comments
  • Missing srand in README.md starter code

    Missing srand in README.md starter code

    It needs srand first before calling multiple rand calls since it will generate same numbers if srand is not called

    You can include time.h and add srand(time(NULL))

    opened by GalaxianMonster 1
  • Improved speed, modified snow example, and removed resizing

    Improved speed, modified snow example, and removed resizing

    Improved speed by using fputs instead of write() Modified snow example Removed resizing due to unfixable SIGSEGV's Added newlines to the buffer so that the image is not slanted when the terminal is scaled up If the terminal is made smaller then the image will not come out correctly TGOL now has dead cell coloring and random setting Previous text is now put in the scrollback buffer unless you save it Improved speed by having the \e[H added to the buffer Stopped clfps* from clearing the screen

    opened by PQCraft 1
  • User now has choice between write() and fputs()

    User now has choice between write() and fputs()

    Added use_write struct member to enable the use of the write syscall instead of fputs Fixed an example Added an fflush to tgol in case use_write is enabled

    opened by PQCraft 0
Releases(3.0)
Owner
null
A terminal emulator that runs in your terminal. Powered by Turbo Vision.

tvterm A terminal emulator that runs in your terminal. Powered by Turbo Vision. tvterm is an experimental terminal emulator widget and application bas

null 21 Aug 8, 2022
Spitfire is a basic terminal language that can exicute code via the terminal.

Spitfire is a basic terminal language that can exicute code via the terminal. It is easy to learn and runs fast, considering that its just a 300 line c++ file.

jhomas tefferson 0 Nov 18, 2021
📺🗿 Terminal graphics for the 21st century.

???? Chafa is a command-line utility that converts all kinds of images, including animated GIFs, into sixel or ANSI/Unicode character output that can be displayed in a terminal.

Hans Petter Jansson 1.8k Nov 29, 2022
Small header only C++ library for writing multiplatform terminal applications

Terminal Terminal is small header only library for writing terminal applications. It works on Linux, macOS and Windows (in the native cmd.exe console)

Jupyter Xeus 263 Dec 1, 2022
Library for creating terminal applications with text-based widgets

Library for creating terminal applications with text-based widgets FINAL CUT is a C++ class library and widget toolkit with full mouse support for cre

Markus Gans 702 Dec 1, 2022
Terminal calculator made for programmers working with multiple number representations, sizes, and overall close to the bits

Programmer calculator The programmer calculator is a simple terminal tool designed to give maximum efficiency and flexibility to the programmer workin

romes 174 Nov 22, 2022
The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Microsoft 86.2k Nov 28, 2022
timg - Terminal Image and Video Viewer

timg - Terminal Image and Video Viewer

Henner Zeller 1.3k Nov 29, 2022
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Arthur Sonzogni 3.9k Nov 30, 2022
A little UNIX-inspired terminal application for the Numworks Calculator (not using escher).

L.E. Terminal (let for short) is a little UNIX-inspired terminal for the Numworks Calculator.

Cacahuète Sans Sel 20 Aug 31, 2022