LeafRender
LeafRender is a simply, easy to use library to just get pixels onto the screen, regardless of your platform.
Supported on Windows, Linux and the Raspberry Pi.
Other libraries often require huge amounts of bootstrap which simply doesn't make sense for WIP or hobby projects.
Some support is also included for image formats and input.
Basic usage
Import the crate in your Cargo.toml with (assuming Windows/Linux OpenGL):
= "0.1.0"
In your code, have something like:
use Input;
use Drawer;
use Rect;
use Color;
use PlatformDrawer;
use PlatformInput;
let mut drawer = new
.expect;
let mut input = new;
while
More examples
Want some text?
use crate FontCache;
use crate Position;
let mut font = from_bytes
.expect;
// [...]
// Inside your main loop, ensuring that blending is enabled (simple example above):
font.draw
Or an image?
use image; // image crate
let image = load_from_memory
.expect
.to_rgba;
let image = drawer.convert_image;
// [...]
// Inside your main loop, ensuring that blending is enabled (simple example above):
drawer.draw_texture;
Features
- Drawing of rectangles, vertices w/ colors
- Drawing of fonts using
rusttype
- Drawing of images using
image
- Basic input handling (mouse)
Wishlist
- More complete input handling (keyboard)
- Clean up a few error handling edge cases
- Few bits of safety could be cleaned up
Non-features
- 3D (too much to control here)
- Custom shaders
License
LeafRender is licensed under the Apache 2.0 license, available here.