~vpzom/savg

fa9ae5a030dd11018f1fed627b5202597c964065 — Colin Reeder 5 years ago
Initial commit
6 files changed, 510 insertions(+), 0 deletions(-)

A .gitignore
A Cargo.lock
A Cargo.toml
A src/document.rs
A src/main.rs
A src/types.rs
A  => .gitignore +2 -0
@@ 1,2 @@
/target
**/*.rs.bk

A  => Cargo.lock +314 -0
@@ 1,314 @@
[[package]]
name = "atk-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "bitflags"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "cairo-rs"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "cairo-sys-rs"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "cc"
version = "1.0.25"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "fragile"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "gdk"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk-pixbuf"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk-pixbuf-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gdk-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gio"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gio-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "glib"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "glib-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gobject-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gtk"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "gtk-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "lazy_static"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "libc"
version = "0.2.43"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "pango"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "pango-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
 "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "pkg-config"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "savg"
version = "0.1.0"
dependencies = [
 "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "version_check"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "winapi"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[metadata]
"checksum atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7017e53393e713212aed7aea336b6553be4927f58c37070a56c2fe3d107e489"
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd940f0d609699e343ef71c4af5f66423afbf30d666f796dabd8fd15229cf5b6"
"checksum cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d25596627380be4381247dba06c69ad05ca21b3b065bd9827e416882ac41dcd2"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9"
"checksum gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc52c7244046df9d959df87289f1fc5cca23f9f850bab0c967963e2ecb83a96"
"checksum gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc3aa730cb4df3de5d9fed59f43afdf9e5fb2d3d10bfcbd04cec031435ce87f5"
"checksum gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08284f16ce4d909b10d785a763ba190e222d2c1557b29908bf0a661e27a8ac3b"
"checksum gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "108548ebf5329b551f2b97ab356908d14627905abb74b936c3372de1535aee81"
"checksum gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "29a44b051990573448edc80b1995237f8b97b5734d2aec05105b9242aa10af11"
"checksum gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6975ada29f7924dc1c90b30ed3b32d777805a275556c05e420da4fbdc22eb250"
"checksum glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740f7fda8dde5f5e3944dabdb4a73ac6094a8a7fdf0af377468e98ca93733e61"
"checksum glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3573351e846caed9f11207b275cd67bc07f0c2c94fb628e5d7c92ca056c7882d"
"checksum gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08475e4a08f27e6e2287005950114735ed61cec2cb8c1187682a5aec8c69b715"
"checksum gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a6b30f194f09a17bb7ffa95c3ecdb405abd3b75ff981f831b1f6d18fe115ff"
"checksum gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d487d333a4b87072e6bf9f2e55befa0ebef01b9496c2e263c0f4a1ff3d6c04b1"
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
"checksum pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c2cb169402a3eb1ba034a7cc7d95b8b1c106e9be5ba4be79a5a93dc1a2795f4"
"checksum pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6eb49268e69dd0c1da5d3001a61aac08e2e9d2bfbe4ae4b19b9963c998f6453"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

A  => Cargo.toml +11 -0
@@ 1,11 @@
[package]
name = "savg"
version = "0.1.0"
authors = ["Colin Reeder <vpzomtrrfrt@gmail.com>"]

[dependencies]
gtk = "0.5.0"
cairo-rs = "0.5.0"
gdk = "0.9.0"
glib = "0.6.0"
fragile = "0.3.0"

A  => src/document.rs +47 -0
@@ 1,47 @@
use cairo;

use types::*;

pub struct Document {
    pub content: Vec<Element>,
    pub size: Size2,
}

impl Document {
    pub fn new(size: Size2) -> Self {
        Self {
            content: Vec::new(),
            size,
        }
    }
}

pub enum Element {
    Rect(Rect)
}

impl Element {
    pub fn get_aabb(&self) -> AABB {
        match self {
            Element::Rect(rect) => AABB {
                position: rect.position.clone(),
                size: rect.size.clone(),
            }
        }
    }
    pub fn draw(&self, ctx: &cairo::Context) {
        match self {
            Element::Rect(rect) => {
                ctx.set_source_rgb(1.0, 0.0, 0.0); // TODO not this
                ctx.rectangle(rect.position.x, rect.position.y, rect.size.width, rect.size.height);
                ctx.fill();
            }
        }
    }
}

#[derive(Clone)]
pub struct Rect {
    pub position: Point2,
    pub size: Size2,
}

A  => src/main.rs +111 -0
@@ 1,111 @@
extern crate cairo;
extern crate fragile;
extern crate gdk;
extern crate gtk;

mod document;
mod types;

use document::*;
use types::*;

use gtk::prelude::*;

use std::ops::Deref;
use std::sync::Arc;
use std::sync::RwLock;
use std::sync::atomic::AtomicBool;

fn main() {
    gtk::init().expect("Failed to init GTK");

    let area = gtk::DrawingArea::new();
    area.set_events(area.get_events() | (
            gdk::EventMask::POINTER_MOTION_MASK |
            gdk::EventMask::BUTTON_PRESS_MASK
            ).bits() as i32);

    let window = gtk::Window::new(gtk::WindowType::Toplevel);
    window.add(&area);
    window.set_title("Savg");
    window.show_all();

    let instance = Arc::new(EditInstance {
        document: RwLock::new(Document::new(Size2::new(400.0, 400.0))),
        repaint: AtomicBool::new(false),
    });

    {
        let instance = instance.clone();
        area.connect_draw(move |_, ctx| {
            ctx.set_source_rgb(1.0, 1.0, 1.0);

            {
                let document = instance.document.read().unwrap();

                ctx.rectangle(0.0, 0.0, document.size.width, document.size.height);
                ctx.fill();

                for elem in &document.content {
                    elem.draw(ctx);
                }
            }

            Inhibit(true)
        });
    }

    {
        let instance = instance.clone();
        area.connect_button_press_event(move |_, ev| {
            let (pos_x, pos_y) = ev.get_position();

            {
                let mut document = instance.document.write().unwrap();

                document.content.push(Element::Rect(Rect {
                    position: Point2 {
                        x: pos_x,
                        y: pos_y,
                    },
                    size: Size2 {
                        width: 100.0,
                        height: 50.0,
                    },
                }));
            }

            instance.repaint.store(true, std::sync::atomic::Ordering::Release);

            Inhibit(true)
        });
    }

    window.connect_delete_event(|_, _| {
        gtk::main_quit();
        Inhibit(true)
    });

    let area = Arc::new(fragile::Fragile::new(area));

    std::thread::spawn(move || {
        loop {
            if instance.repaint.compare_and_swap(true, false, std::sync::atomic::Ordering::Acquire) {
                println!("repainting");
                let area = area.clone();
                glib::idle_add(move || {
                    area.get().queue_draw();

                    Continue(false)
                });
            }
        }
    });

    gtk::main();
}

struct EditInstance {
    document: RwLock<Document>,
    repaint: AtomicBool,
}

A  => src/types.rs +25 -0
@@ 1,25 @@
#[derive(Clone)]
pub struct Point2 {
    pub x: f64,
    pub y: f64,
}

#[derive(Clone)]
pub struct Size2 {
    pub width: f64,
    pub height: f64,
}

impl Size2 {
    pub fn new(width: f64, height: f64) -> Self {
        Size2 {
            width,
            height,
        }
    }
}

pub struct AABB {
    pub position: Point2,
    pub size: Size2,
}