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
|
use macroquad::prelude::*;
mod gate;
mod input_layout;
use gate::*;
use input_layout::*;
#[macroquad::main("lgsim")]
async fn main() {
let mut gate = Gate::new(
Rec::new(500., 500., 120., 80., RED),
vec![Connection::new(10., GREEN, false); 2],
"GATE",
Connection::new(10., GREEN, false),
);
let input_layout = InputLayout::new(vec![Connection::new(10., 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();
gate.draw();
// egui_macroquad::draw();
// Draw things after egui
next_frame().await;
}
}
|