summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 6b95a833e4a7aec2c237c2d5408b348d27fbf158 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use macroquad::prelude::*;
mod gate;
mod input_layout;
mod output_layout;
mod wire;
use gate::*;
use input_layout::*;
use output_layout::*;
use wire::*;

#[macroquad::main("lgsim")]
async fn main() {
    let mut gate = Gate::new(
        Rec::new(500., 500., 120., 80., RED),
        vec![Connection::new(10., (0.0, 0.0), GREEN, false); 2],
        "GATE",
        Connection::new(10., (0.0, 0.0), GREEN, false),
    );

    let input_layout = InputLayout::new(vec![Connection::new(10., (0.0, 0.0), GREEN, false); 16]);
    let output_layout = OutputLayout::new(vec![Connection::new(10., (0.0, 0.0), GREEN, false); 16]);

    loop {
        let playground_offset_x: f32 = screen_width() / 20.;
        let playground_offset_y: f32 = screen_height() / 14.;
        let playground_width: f32 = screen_width() - playground_offset_x * 2.0;
        let playground_height: f32 = screen_height() - playground_offset_y * 2.0;
        clear_background(color_u8!(27, 27, 27, 255));

        // Process keys, mouse etc.

        draw_rectangle_lines(
            playground_offset_x,
            playground_offset_y,
            playground_width,
            playground_height,
            6.,
            WHITE,
        );

        // Draw things before egui
        input_layout.draw();
        output_layout.draw();
        gate.draw();

        // egui_macroquad::draw();

        // Draw things after egui

        next_frame().await;
    }
}