realms

Crates.iorealms
lib.rsrealms
version3.4.4
created_at2024-05-26 17:00:55.39434+00
updated_at2025-07-24 08:51:53.347228+00
descriptionA powerful and lightweight graphics library for making Rust games
homepagehttps://github.com/dylanopen/realms
repositoryhttps://github.com/dylanopen/realms
max_upload_size
id1252703
size94,203
Dylan Rogers (dylanopen)

documentation

https://docs.rs/realms

README

Welcome to Realms - the lightweight Rust game library

Realms is a library that allows you to easily make games, animations and any 2D or 3D graphics using Rust.

As of version 1.1.1, Realms now uses OpenGL as a backend. This is a huge API change, and most things have changed since 0.2.1. Get up to date by reading the examples.

Documentation

For extensive documentation on specific fields, structs and functions, see the documentation on docs.rs.

Examples

You can find a list of examples for how to use Realms at github.com/dylanopen/realms/tree/main/examples

Here's the code needed to create a window:

use realms::window::Window; // don't accidentally import realms::glfw::Window!
use realms::data::Color;
use realms::input::{Event, Key}; // again, don't import from realms::glfw

fn main() {
    // create the window and unwrap the result:
    let mut window = Window::new(800, 600, "Hello Window!")
        .expect("Failed to create window");

    // loop until the user closes the window or the 'Q' key is pressed
    while window.is_running() {
        window.new_frame(); // swap the buffers (draw to the screen)
        window.fill(Color::rgb(20, 34, 40)); // fill the screen dark blue

        for event in window.events() { // loop over all window events
            match event {
                Event::KeyDown(Key::Q) => window.close(), // if Q pressed, exit loop
                _ => {}, // otherwise do nothing
            }
        }
    }
}

Useful resources

Realms is based on OpenGL. For this reason, it is very helpful to have at least some knowledge of the basics of OpenGL; in particular with vertex buffers (VAOs, VBOs and EBOs/IBOs) and shaders in the GLSL programming language.

Below is a list of useful resources for learning OpenGL, the Realms library APIs and game development in general:

Thanks for choosing Realms to build your next great game!

Commit count: 56

cargo fmt