Metropolis is an easy to use high level graphics renderer written in rust, utilizing vulkano and winit, I still have some work to do on it and I am currently still developing it and would love community input. Later I hope to develop a game engine using it but first I'll finish the renderer.
console
:~$ cargo install metropolis
console
:~$ apt install libvulkan1 mesa-vulkan-drivers vulkan-utils
```console
```
```console
```
console
:~$ xcode-select --install
:~$ brew install cmake
Add the following to your Cargo.toml:
rust
[dependencies]
metropolis = "0.3.0"
First use import the crate:
rust
extern crate metro;
use metropolis::*;
use metropolis::color::*;
//if you want some math functions use math as well
use metropolis::math::*;
Then you use the funcion size that creates a canvas(I wwould suggest to save height and width as variables so you can use them later
rust
fn main(){
let height = 600;
let width = 800;
size(width,height);
Next comes the setup(here I declare the varibles I will be using insode the looped function):
rust
let mut spd = 0;
let mut acc = 1;
let mut posy = 0;
background(grayscale(220));
Next comes the draw function, this function gets looped over so what's in it should be decided accordingly
rust
let draw =move || {
spd+=1;
if posy+50< height{
posy+=spd;
}
fill(rgb(255,0.1.3));
ellipse(400,posy,200,100);
};
Finally use the show() function to run the whole thing:
rust
show(draw);
}
If you noticed - this program displays gravity working on an ellipse
1 - there is a mapping function called map 2 - there is a factorial function called factorial 3 - there is a function called linspace that create evenly spaced floats between two numbers 4 - there are curves - using the catmull rom chain algorithm there is are functions to create a curves: curve, curveVertex, catmullromchain
1)dynamic line width. 2)up the curve, circle and ellipse efficiency. 3)vector operations(scalar mult, vec dot, vec to vec add...). 4)add more drawing functions. 5)add a text module. 6)adding unit tests. 7)3D. 8)anithyng else from community feedback!
This crate is primarily distributed under the terms of the MIT license See LICENSE-MIT for details.