Expand description
§Rhachis
Rhachis is a Rust framework primarily intended for making games. It intends to be as simple as possible, while still allowing all of the customisation you could want.
The core of the framework is its Game trait and GameData struct. The Game trait is the root of your project. Functions on it are called by the engine to perform many things like update game logic or initialise the game. A reference to the GameData struct is passed to these functions to access core components of the engine. These core components are all thread-safe, locked behind RwLocks if necessary.
§Basic Usage
To start using Rhachis run cargo add rhachis to add the latest version to your Cargo.toml.
The code below shows the basic structure of a Rhachis project.
use rhachis::{graphics::EmptyRenderer, *};
// A procedural macro that starts the game from your struct.
#[run]
// The EmptyRenderer is a renderer that does nothing and acts as a placeholder.
struct Window(EmptyRenderer);
// The Game trait handles the core event loop.
impl Game for Window {
// Called to initialise the game state after core engine starts.
fn init() -> Self {
Self(EmptyRenderer)
}
// Used to get the current renderer. It is in this function so that
// renderers can be swapped on the fly.
fn get_renderer(&mut self) -> &mut dyn graphics::Renderer {
&mut self.0
}
}More in depth examples can be found in the repository’s examples directory.
§Acknowledgements
- Open Sans font from Google Fonts
Modules§
- camera
- Camera systems for the
SimpleRenderer. - graphics
- Code specialised in handling graphics(). Most of this is universally applicable.
- input
- Interacting with user keyboard or mouse inputs.
- light
- Light systems as used by
SimpleRenderer. - math
- A collection of functions that are useful for games.
- model
- postprocess
- A renderer to wrap around other renderers to modify their output.
- rand
- Random generation functions convenient for game development.
- renderers
- A collection of rendering structs that could be used for simple or temporary parts of a pipeline.
- text
- Simple text rendering.
- texture
- Texture systems for the
SimpleRenderer. - ui
- UI rendering structs.
Macros§
- idmap
- Shorthand for creating and filling an
IdMap. - self_
set_ with - Creates functions that are useful for updating an object.
Structs§
- Game
Data - A struct containing most of the global state of the engine.
- Game
Init - Configuration for a
Gamerequired beforeGame::initis called. Mostly used for special graphics configuration. - IdMap
- A collection of data and an associated ID. Provides many convenience functions over
FxHashMaps.
Traits§
- Game
- A trait that all games must implement to use Rhachis
- GameExt
- Automatically implemented on everything that implements
Game.
Functions§
- game_
data - Returns the current
GameDatastate, blocking until available.
Attribute Macros§
- run
- Shorthand for making a main function.