mygame 0.1.2

Best game. legit.
use raylib::ffi::{GetKeyPressed, GetMousePosition, IsKeyDown, IsKeyPressed, IsMouseButtonDown, IsMouseButtonPressed};
use raylib::prelude::*;
use rand;
use rand::prelude::SliceRandom;
use rand::rngs::ThreadRng;


struct Data {
    x: i32,
    y: i32,
    color: Color
}

fn main() {
    let mut game = init()
        .size(640 * 2, 480 * 2)
        .title("Coloring Game")
        .build();

    let mut rl = game.0;
    let mut thread = game.1;
    let colors: Vec<Color> = vec!(Color::BLACK,
                                  Color::BLUE,
                                  Color::RED,
                                  Color::GREEN,
                                  Color::ORANGE,
                                  Color::YELLOW,
                                  Color::LIME,
                                  Color::PURPLE,
                                  Color::MAGENTA,
                                  Color::PINK,
                                  Color::BROWN,
                                  Color::GOLD,
                                  Color::BEIGE,
                                  Color::SKYBLUE,
                                  Color::RAYWHITE,
                                  Color::GRAY,
                                  Color::VIOLET,
                                  Color::MAROON);

    let mut drawing: Vec<Data> = vec![];
    let mut rng = rand::thread_rng();


    let mut color = colors.choose(&mut rng).expect("fail").to_owned();

    while !rl.window_should_close() {
        let mut draw = rl.begin_drawing(&thread);
        let mouse_pos = draw.get_mouse_position();


        draw.clear_background(Color::WHITE);


        for v in &drawing {
            draw.draw_circle(v.x, v.y, 25.0, v.color);
        }


        unsafe {
            if IsKeyPressed(KeyboardKey::KEY_ONE as i32) {
                color = colors.choose(&mut rng).expect("fail").to_owned();
            }

            if IsKeyPressed(KeyboardKey::KEY_TWO as i32) {
                color = Color::WHITE;
            }

            if IsKeyPressed(KeyboardKey::KEY_ZERO as i32) {
                drawing.clear();
            }
        }

        unsafe {
            if IsMouseButtonDown(0) {
                let data = Data {x: mouse_pos.x as i32, y: mouse_pos.y as i32, color };

                drawing.insert(drawing.len(), data);
            }
        }

        // cursor and instructions
        draw.draw_text("1 = Draw (New Color), 2 = Erase, 0 = Clear", 0, 0, 32, Color::BLACK);
        draw.draw_circle(mouse_pos.x as i32, mouse_pos.y as i32, 25.0, color);

        // i make best game^2
    }
}