Skip to content

MasonFeurer/RUG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RUG - Rust Graphics Library

RUG is a Rust library for easily prototyping graphics using a canvas like API. RUG is not ideal for creating full-fledged apps because:

  • RUG is not super efficient (it's not awfully slow though)
  • RUG is maintained by me (this project will likely not be actively maintained)
  • There are far better libraries (bevy, eframe, tauri)

Hello, World

To create an app, you must implement CanvasApp for some structure that would store the app's state. Then you can call run_canvas_app with an instance of the app and some window configurations.

NOTE: Ideally, the example would display "Hello, World!" on screen, but text graphics is not implemented yet.

use rug::*;

struct AppState;
impl CanvasApp for AppState {
    fn setup(&mut self, _window: &mut Window) {}

    fn render(&mut self, g: &mut Graphics, _window: &mut Window) {
        g.fill(Color::shade(220));
    }
}

fn main() {
    let config = CanvasConfig::new()
        .with_title("Hello, World!")
        .with_size(Vec2::new(400, 400));

    run_canvas_app(AppState, config);
}

About

Rust Graphics library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages