This is a cross-platform header-only curses-like lib.
Supported platforms (including but not limited to) are:
- Linux.
- MacOS.
- Windows.
Attaching the spaceship to a rigid body object:
Debug-drawing the broad-phase (AABB BVH) and the narrow-phase (character/character overlap tests) collision detection:
AABB
: A templetized (int, float) AABB class that can return aRectangle
object if needed. Used inCollisionHandler
for broad-phase detection.ASCII_Fonts.h
: API for rendering text using FIGlet fonts and allows you to style your text with different colors. Supported FIGlet fonts are:- Larry3D.
- SMSlant.
- Avatar.
Color.h
: Contains colour definitions for the 16 colors that Termin8or (and the terminal) supports. There are also two transparency colours / modes which allows you to overlay text using the same colours that are already present in a given location in the screen buffer (seeScreenHandler.h
).Gradient.h
: Allows you to access a vector of given objects using a normalized (0 to 1) t parameter. Useful for particle systems and things like that where it is used for color gradients.Drawing.h
: Features some drawing functions such asbresenham::plot_line()
,drawing::draw_box()
,drawing::draw_box_textured()
,drawing::draw_box_outline()
anddrawing::filled_circle_positions()
.GameEngine.h
: A highly customizable buy easy to use game engine (or engine for any real-time terminal-based program).Keyboard.h
: A keyboard handling API that is easy to use. Use classStreamKeyboard
to poll key presses. FunctionreadKey()
scans keypresses in an un-blocked manner and returns a structKeyPressDataPair
containing two objects of typeKeyPressData
;transient
andheld
. The former being the raw key presses and the latter being the raw key presses buffered in a buffer that has a size proportional to the FPS of the application. These two modes have their pros and cons: Transient mode is more accurate but cannot capture held key presses, held mode on the other hand is great at capturing held keys but due to buffering, it suffers from minor inaccurracies.LineData.h
: a struct that helps to convert bigger chunks of strings / colors along a single line of text to individual "pixels" that can be "streamed" to theScreenHandler
. This will likely be deprecated in the future in favour of more recent tools such as sprites.Pixel.h
: a struct containing data such as character (or std::string of a single character), foreground color, background color (r,c) position (and original position), line index toLineData
object and char index to within aLineData
object and an enabled flag. This will likely be deprecated in the future in favour of more recent tools such as sprites.MessageHandler.h
: TheMessageHandler
class allows you to queue up messages of different severity levels and durations. Messages are displayed in aui::TextBox
in the middle of the screen.ParticleSystem.h
: This ASCII-style particle system allows you to make cool real-time VFX such as liquids and fire-smoke. See (SurgSim_Lite
,Pilot_Episode
andDungGine
for examples).RC.h
: A struct representing the row and column position on the screen or in a texture or bounding box to mention a few.Rectangle.h
: A rectangle struct that can be used for bounding boxes etc.ScreenUtils.h
: A collection of functions for rendering dialogs and such:- Low-level functions:
clear_screen()
,return_cursor()
,restore_cursor()
,hide_cursor()
,show_cursor()
,gotorc()
. - Medium-level functions:
get_terminal_window_size()
,resize_terminal_window()
,save_terminal_colors()
,restore_terminal_colors()
. - High-level functions:
begin_screen()
,end_screen()
. These take care of color restoration, clearing screen, hiding the cursor etc, except for the resizing of the terminal window. draw_frame()
: Draws a simple frame around your frame buffer.draw_game_over()
,draw_you_won()
: Draws wavy banners in the FIGlet font Grafitti. Used byGameEngine
if those features are enabled.
- Low-level functions:
Text.h
:Text
handles text output and translates Color enum items to corresponding color values depending on platform compiled. Is also responsible for creating the appropriate ANDI escape sequences for the TTY and such.Styles.h
:Style
and its derivatives are just fancy structs grouping a foreground colour with a background colour.Texture.h
: TheTexture
struct allows you to save and load text-based texture in text format to and from disk. There are four parts in a texture: characters, foreground colors, background colors and material IDs. Header also contains texture elementTextel
(humouristic portmantau of "text" and "texel" suggested by my dear colleague Göran Wallgren).ScreenHandler.h
: Contains the screen buffers (char / fg-color / bg-color) and manages transparency etc. It outputs the contents to the terminal via a privatly ownedText
object.SpriteHandler.h
: Manages bitmap sprites (BitmapSprite
) and vector sprites (VectorSprite
). A sprite can be controlled programmatically or be attached to aRigidBody
object. Both sprite classes support sprite animations.UI.h
: Contains structs such asTextBox
andTextBoxDebug
to make it easy to display info on the screen and such.MessageHandler
usesTextBox
.Dynamics
: Headers concerning rigid body physics.RigidBody.h
: A class that represents a rigid body. You attach a sprite to it if you want the sprite to be physically dynamic. The sprite also determines the "pixels" that make out the collison surface.DynamicsSystem.h
: A class that governs the dynamical motions of the rigid bodies that are created from it.CollisionHandler.h
: A class that governs collison detection and collison response between the rigid bodies created via theDynamicsSystem
class. Broad-phase uses an AABB BVH and narrow-phase checks overlaps beteen sprite characters of a specified material index. Collision response uses an impulse equation as a function of the velocities of the two bodies and their collision normals.