Crate rltk

source · []

Modules

Macros

Declare an embedded resource.
Creates a SmallVec containing the arguments.

Structs

Implements an Alpha-Only Lerp as an iterator
A BTerm context.
Provides a builder mechanism for initializing BTerm. You can chain builders together, and and with a call to .build(). This allows you to provide settings if you want to, or just use a simple initializer if you are in a hurry.
Provides a base abstract platform for BTerm to run on, with specialized content.
Line-drawing iterator
An implementation of [Bresenham’s circle algorithm]. [Bresenham’s circle algorithm]: http://members.chello.at/~easyfilter/bresenham.html Derived from the line_drawing crate, but specialized to use BTerm’s types.
A version of the Bresenham circle that does not make diagonal jumps
New type over Bresenham which include the end points when iterated over.
Represents two colors together, a foreground and a background. Frequently used to represent a glyph rendered on a console with a solid background color.
Convenience type: you can define an angle in Degrees and it is convertible to Radians (and vice versa)
Representation of a Dijkstra flow map. map is a vector of floats, having a size equal to size_x * size_y (one per tile). size_x and size_y are stored for overflow avoidance. max_depth is the maximum number of iterations this search shall support.
A display console, used internally to provide console render support. Public in case you want to play with it, or access it directly.
Represents a batch of drawing commands, designed to be submitted together.
A sparse console. Rather than storing every cell on the screen, it stores just cells that have data.
Internal storage structure for sparse tiles.
BTerm’s representation of a font or tileset file.
Represents an H/S/V triplet, in the range 0..1 (32-bit float) This can provide for a more natural color progression, and provides compatibility with HSV-based color systems.
An HSV Lerp - transition from one HSV color to another in a set number of steps.
Represents the current input state. The old key/mouse fields remain available for compatibility.
Represents a sprite consisting of multiple glyphs/colors, occupying multiple console locations.
Holds the result of an A-Star navigation query. destination is the index of the target tile. success is true if it reached the target, false otherwise. steps is a vector of each step towards the target, including the starting position.
Helper struct defining a 2D point in space.
Helper struct defining a 2D point in space.
Represents an R/G/B triplet, in the range 0..1 (32-bit float)
Represents an R/G/B triplet, in the range 0..1 (32-bit float)
Convenience type: you can define an angle in Radians and it is convertible to Degrees (and vice versa)
Defines a two-dimensional rectangle.
Defines a rectangle with floating-point coordinates.
Internal storage structure for sparse tiles.
Implements an RGB Lerp as an iterator
Implements an RGBA Lerp as an iterator
A BTerm context.
Provides a builder mechanism for initializing BTerm. You can chain builders together, and and with a call to .build(). This allows you to provide settings if you want to, or just use a simple initializer if you are in a hurry.
A simple console with background color.
A Vec-like container that can store a small number of elements inline.
A sparse console. Rather than storing every cell on the screen, it stores just cells that have data.
Internal storage structure for sparse tiles.
A sparse console. Rather than storing every cell on the screen, it stores just cells that have data.
The internal storage type for tiles in a simple console.
Define a line using a fast 2D vector. It may not be as pixel-perfect as Bresenham, but with vectorization it is sometimes faster for a quick line solution.
Structure representing a character and its foreground/background color
Structure representing the components of one color
Structure representing a REXPaint image file which is a stack of layers
Structure representing a layer Cells are in the same order as in the file, in column-major order (index of position x,y is y*height + x).

Enums

Available device events
Cellular noise distance function to use
What type of cellular noise result do you want
Enumeration of available 2D Distance algorithms
Represents a buffered drawing command that can be asynchronously submitted to the drawing buffer, for application at the end of the frame.
Enumeration of available FOV algorithms
Fractal function to use
Error message type when failing to convert a hex code to RGB.
Interpolation function to use
Enumeration of available 2D Distance algorithms
Type of noise to generate
Symbolic name for a keyboard key.

Constants

Traits

Implement these for handling conversion to/from 2D coordinates (they are separate, because you might want Dwarf Fortress style 3D!)
Implement these for handling conversion to/from 2D coordinates (they are separate, because you might want Dwarf Fortress style 3D!)
Implement this trait to support path-finding functions.
Trait that must be implemented by console types.
Implement this trait on your state struct, so the engine knows what to call on each tick.

Functions

Request an A-Star search. The start and end are specified as index numbers (compatible with your BaseMap implementation), and it requires access to your map so as to call distance and exit determinations.
Insert all named W3C colors into the palette
Clears the global command buffer. This is called internally by BTerm at the end of each frame. You really shouldn’t need to call this yourself.
Empties the palette
Draws a horizontal progress bar
Draws a vertical progress bar
Draws a box, starting at x/y with the extents width/height using CP437 line characters
Draws a box, starting at x/y with the extents width/height using CP437 line characters
Draw a single-lined box without filling in the middle
Draws a box, starting at x/y with the extents width/height using CP437 line characters
Calculates field-of-view for a map that supports Algorithm2D.
Calculates field-of-view for a map that supports Algorithm2D, returning a HashSet. This is a bit faster than coercing the results into a vector, since internally it uses the set for de-duplication.
For A-Z menus, translates the keys A through Z into 0..25
Plots a line between two 2D points and returns a vector of points along the line.
Uses a Bresenham’s algorithm to plot a line between two points. On some CPUs, this is faster than Bresenham.
Uses a 2D vector algorithm to plot a line between two points. On some CPUs, this is faster than Bresenham.
Runs the BTerm application, calling into the provided gamestate handler every tick.
Retrieve a palette color by name from the global registry. Returns Some(RGBA) if the color is registered, None if it is not.
From a given start point, project forward radius units at an angle of angle_radians degrees. 0 Degrees is north (negative Y), 90 degrees is east (positive X)
Register a palette color by name with the global registry.
Submits the current batch to the BTerm buffer and empties it
Converts a string into a vector of u8, CP437 representations of the string
Converts a unicode character to a CP437 equivalent, returning 0 if it didn’t have a match
Applies an XpFile to a given console, with 0,0 offset by offset_x and offset-y.
Applies an XpFile to a given draw batch, with 0,0 offset by offset_x and offset-y.

Type Definitions