Crate glerminal [] [src]

Introduction

GLerminal is an OpenGL Terminal that is both easy to use and lightweight!

This crate consists of two major parts that are exposed to the user:

Starting with a simple example might be wise though;

After that you should browse through the rest of this guide and read about terminal and text_buffer documentations respectively

Example

extern crate glerminal;

use glerminal::terminal::TerminalBuilder;
use glerminal::text_buffer::TextBuffer;

fn main() {
    let terminal = TerminalBuilder::new()
        .with_title("Hello GLerminal!")
        .with_dimensions((1280, 720))
        .build();
    let mut text_buffer;
    match TextBuffer::new(&terminal, (80, 24)) {
        Ok(buffer) => text_buffer = buffer,
        Err(error) => panic!(format!("Failed to initialize text buffer: {}", error)),
    }

    text_buffer.write("Hello, GLerminal!");
    terminal.flush(&mut text_buffer);

    while terminal.refresh() {
        terminal.draw(&text_buffer);
    }
}

terminal

Terminal (and TerminalBuilder) will be the first struct(s) that you'll have to deal with:

TerminalBuilder is used to build the terminal, and Terminal is used as sort of a 'window' or 'canvas' for everything else, like the TextBuffer. The Terminal is able to change the title of the screen with .set_title, get input with .get_input, draw the latest flush with .draw or (like mentioned earlier), flush the TextBuffer with .flush.

Examples can be found at terminal module.

text_buffer

TextBuffer is the struct that will be used the most. With this struct you will be writing, clearing and changing colors of the text you are writing, for example.

Another important struct that you might be using however, is the Parser. With this struct you can simply pass a string that the parser will parse, and the TextBuffer will then change colors or shakiness of your text accordingly.

Examples can be found at text_buffer module.

Modules

font

This module is used to load fonts that can be used in the TextBuffer

input

This module includes the Input that can be retrieved via Terminal

terminal

This module acts as the window and "canvas" of the terminal, handling most behind-the-sceneries

text_buffer

This module contains two of the most central structs of GLerminal; TextBuffer and Parser

Enums

VirtualKeyCode

Symbolic name for a keyboard key.