#cli #api #gui #gamedev #graphics


A high level easy to use graphics renderer

23 releases (8 breaking)

0.9.1 Jan 27, 2020
0.8.0 Jan 12, 2020
0.7.0 Dec 15, 2019
0.4.1 Nov 28, 2019

#251 in Game dev

Download history 1/week @ 2021-05-27 1/week @ 2021-06-03 24/week @ 2021-06-10 1/week @ 2021-06-24 1/week @ 2021-07-01 1/week @ 2021-07-08 25/week @ 2021-07-15 46/week @ 2021-07-29 24/week @ 2021-08-05 24/week @ 2021-08-12 4/week @ 2021-08-19 1/week @ 2021-08-26 2/week @ 2021-09-02

122 downloads per month

MIT license

4.5K SLoC


crates.io License: MIT doc.rs

What is it and what is it for?

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.

How to install it?

you can use cargo(the preferable and much easier and safe way):

:~$ cargo install metropolis

then install the vulkan required dependencies:

if you have linux debian/ubuntu:

:~$ apt install libvulkan1 mesa-vulkan-drivers vulkan-utils

if you have fedora:

# dnf install vulkan vulkan-info

if you have arch linux:

# pacman -S vulkan-radeon lib32-vulkan-radeon

if you have mac:

:~$ xcode-select --install
:~$ brew install cmake

for windows just install ninja.


Add the following to your Cargo.toml:

metropolis = "0.9.1"

First use import the crate:

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

fn main(){                                                             
	let height = 600;
	let width = 800;

Next comes the setup(here I declare the varibles I will be using insode the looped function):

	let mut spd = 0;
	let mut acc = 1;
	let mut posy = 0;

Next comes the draw function, this function gets looped over so what's in it should be decided accordingly

    	let draw =move || {
        	if posy+50< height{

Finally use the show() function to run the whole thing:


If you noticed - this program displays gravity working on an ellipse

release notes:

a patch version to fix the text module laggines:

now the text module functions ok and on par with the rest of the crates FPS, the text can be between size 1 and 128.

former versions release notes:


I finally fixed the image module and now it could be used to place a png image wherever you want in the page in the same size as it was(the resize is on you...)


I improved the text fps by a bit, added a Vector struct that allowes for some linear algebra related calculations, added from trait,display trait, and debug trait to color.
changed image functions: now only takes png images, and displays the whole image, I still have problems with it that I'm fixing.
changed the curve to work with bezier by default(beacuse of problems with te catmull rom chain)


added the possiblity to use keyboard events see the examples:key_event and key_event_glob. I added mouse position getters and mouse scroll delta getters.


you can now use a public mutithreading safe canvas struct, the matching example is called canvas_struct


fixed a bug that caused the text vertecies to not be cleared at he end of each iteration of the draw function


some of the math functions were deprecated due to community feedback:sin,cos,tan,abs I added an image module that allows you to load an image and display it(see the example for more details)


fixed the text module slowdown for the non-text using canvases added FPS unsafe static added WIDTH/HEIGHT unsafe statics


1 - added a text module - uses text() and textSize() 2 - added abs() and absf() functions to math


1 - changed map to recieve generic variable 2 - added quad and square functions


ported to vulkano 0.16, fixed the problem with the unclosing window!


there is a bezier curve, 2 function - one for vertex(4 x's and y's) and one for a chain(should have amout of values of 4+3*i such as 4,7,10,13...)


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, catmull_rom_chain

If you want to checkout the crate further that you should take a look in the examples folder.

Currently being developed:

1)dynamic line width.
2)page elements and multicanvas module
3)making the static mut into a lazy_static(in development).
5)HTML type file parsing into elements.
6)anithyng else from community feedback!


This crate is primarily distributed under the terms of the MIT license See LICENSE-MIT for details.


~693K SLoC