Macroquad Canvas 2D

Macroquad Canvas 2D is a simple resolution-handling library that allows you to focus on making your game with a fixed resolution.

It is heavily inspired by Push

How to use it

Import the library. rust use macroquad_canvas_2d::*;

Create a new Canvas2D. rust let canvas = Canvas2D::new(WIDTH as f32, HEIGHT as f32);

Draw! ``` rust loop { // Push canvas canvas.setcamera(); { // Draw something inside the canvas // Clear background clearbackground(WHITE); // Top left drawrectangle(0.0, 0.0, 60.0, 60.0, RED); // Top right drawrectangle(WIDTH as f32 - 60.0, 0.0, 60.0, 60.0, GRAY); // Bottom left drawrectangle(0.0, HEIGHT as f32 - 60.0, 60.0, 60.0, GREEN); // Bottom right drawrectangle(WIDTH as f32 - 60.0, HEIGHT as f32 - 60.0, 60.0, 60.0, BLUE); } // Pop canvas setdefaultcamera();

// Draw canvas on screen canvas.drawtoscreen();

next_frame().await }

```

For more information check out the examples!

TODO

◻ Function to transform canvas coordinates to screen coordinates.

◻ Simple post processing effects.

✅ Mouse position, and transform.