Skip to content
Alison edited this page Sep 19, 2017 · 7 revisions

Welcome to the GAUSS wiki!

Syntax

GAUSS uses a custom syntax for drawing which goes as follows: $DRAW to mark the beginning of a frame $clear (optional) to clear the screen of existing text, followed by ${colour} where colour is the colour you wish to use, then ${type&length} where type is the pixel type, and length is the number of columns to draw in the chosen colour, on the current line. Finally the frame should end with $endDraw to signify that all characters drawn after this point are normal text and should be drawn in their default colour (usually white or black). All the information needed to draw your own frames can be found below including an index of variables and example code.

Commands & Variables

GAUSS uses static bindings to determine how to act. A list of them can be found below.

$DRAW: placed before the script, used to signify the beginning of a script.

$clear: placed at the beginning of the script, used to clear the shell of everything output before the script began.

${colour}: used to set the colour of all pixels output after it, or until a new colour is set. Options are: red, green, blue, purple, yellow, cyan, black, white, lred, lgreen, lblue, lpurple lcyan, lgrey, and dgrey.

${type&length): used to draw pixels of the specified type for the specified number of columns. Options for type are: p (solid pixel), lm (light dot-mesh), and dm (dark dot-mesh). Options for length are: 1-83 (contiguous pixels, will wrap if exceeds line length.).

$break: used to signify all following pixels should be drawn on the next line down.

Drawing and saving a static graphic

Let's start with a basic example for drawing a single monochrome line. It should be said that GAUSS is meant to be used to draw in real time, so do not press enter after each command, rather they should be chained together to form a single line. First we'll need to signify the beginning of the script, so type the following:

$DRAW

include the space after. Now we should clear the screen of text to better see and align our image:

$DRAW $clear

Now we need to choose a colour, how about blue?

$DRAW $clear${blue}

We also need to specify the pixel type, and number of pixels to draw. Solid should do, and we'll make it 15 pixels long:

$DRAW $clear${blue}${p15}

Now we need to signify the end of the script so that the rest of the terminal isn't drawn in blue afterward:

$DRAW $clear${blue}${p15} $endDraw

Go ahead and press enter, and you should now have something like this in your terminal:

While a good start this only allows you to do something very limited, so lets try a more complex script. This will display two lines, one that is green, and another below it that is half solid red, and half dark-mesh red:

$DRAW $clear${green}${p15}${break}${red}${p7}${dm8} $endDraw

The result should look like this:

Of course colour changes do not have to be saved for a new line, you can define a new colour at any point in the script:

$DRAW $clear${yellow}${p10}${blue}${p2}${purple}${p3} $endDraw

This will draw 10 yellow pixels, followed by two blue ones, and three purple ones:

Breaks are usually used for new lines, but pixels will overflow if the draw length exceeds the length of the line, so be careful!

$DRAW $clear${purple}${p83} $endDraw

You might want to save a more complex script so that the image can be used later, so lets try saving a script that combines all of these previous scripts into one and writing it to a file by appending the echo command for output:

$DRAW $clear${blue}${p15}${green}${p15}$break${red}${p7}${dm8}$break${yellow}${p10}${blue}${p2}${purple}${p3}$break${p83} $endDraw > script.txt

This will output in a form that cannot be read as normal text, but you can use cat to read the file directly and it will display the image.

Advanced Static Drawings

It is possible to make entire static images in GAUSS, as an example see the script and frame below, which mimic a TV station test screen.

demoA.txt:

$DRAW $clear${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${lgrey}${p10}${yellow}${p10}${cyan}${p10}${green}${p10}${purple}${p10}${red}${p10}${blue}${p10}${break}${blue}${p10}${black}${p10}${purple}${p10}${black}${p10}${cyan}${p10}${black}${p10}${lgrey}${p10}${break}${blue}${p10}${black}${p10}${purple}${p10}${black}${p10}${cyan}${p10}${black}${p10}${lgrey}${p10}${break}${blue}${p12}${lgrey}${lm12}${blue}${p12}${black}${p20}${dgrey}${dm4}${black}${p10}${break}${blue}${p12}${lgrey}${lm12}${blue}${p12}${black}${p20}${dgrey}${dm4}${black}${p10}${break}${blue}${p12}${lgrey}${lm12}${blue}${p12}${black}${p20}${dgrey}${dm4}${black}${p10}${break}${blue}${p12}${lgrey}${lm12}${blue}${p12}${black}${p20}${dgrey}${dm4}${black}${p10} $endDraw

demoA raw:

demoA frame:

Animation

While it is primarily used to draw static images in real time, the code can be echo'ed to a file in its raw format so that the image can be displayed on a machine without the GAUSS bindings. GAUSS can be combined with cat sed and sleep to easily create animations compatible with any Unix or Linux machine. There are two main methods to do this, the first is to script and save each frame individually, followed by using a shell script to cat each image in the right order. The second would be to script and save the entire animation as one image, and use sed to display the range of each frame. In either event the use of sleep in between each frame is highly recommended because the delay between the drawing of each frame is small enough that the animation would appear to pass in an instant on most if not all machines, and also adds more versatility as to how fast the animation is. If you want to see real-world examples of how to animate using GAUSS please see the demo animation script demo.bash under the /GAUSS/demo/progress animation/ directory of this repository. You can also find the script used to make each frame of the animation in /GAUSS/demo/progress animation/source.

Below is a quick rundown of how to create a DOS/BASIC themed progress bar animation.

Here is the source: $DRAW ${clear}${blue}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p9}${dgrey}${dm51}${dgrey}${p2}${blue}${p18}${break}${p9}${dgrey}${dm1}${red}${p23}100%${p23}${dgrey}${p2}${blue}${p18}${break}${p9}${dgrey}${dm1}${p52}${blue}${p18}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80}${break}${p80} $endDraw

Here is the raw:

Here is the frame:

We can then edit the number displayed, along with the colour and pixel data for the surrounding blocks, in order to easily create alternate versions of the frame, like this:

Alternate raw:

Alternate frame:

The /demo/progress animation/ folder in this repository contains 50 frames, one for every second percentile from 0 to 100, the source for the 100% frame, and a Bash script that demos animating the filling of this progress bar: