Label builder

master
D4VID 1 month ago
parent dd5149930b
commit 4649b1aad0

@ -1 +1 @@
Subproject commit 373860674228f199c57344be19a4e32c759371e9 Subproject commit 9801e5d6c87db31a616de50195110266ed00c15c

@ -1,11 +1,11 @@
mod verilog; mod verilog;
use std::f32::consts::PI;
use std::io; use std::io;
use std::path::Path; use std::path::Path;
use logicworld_subassembly::create_subassembly; use logicworld_subassembly::create_subassembly;
use logicworld_subassembly::lw; use logicworld_subassembly::lw;
use logicworld_subassembly::lw::PegAddress;
use logicworld_subassembly::COMPONENT_MAP; use logicworld_subassembly::COMPONENT_MAP;
use verilog::compile_module; use verilog::compile_module;
use verilog::get_modules; use verilog::get_modules;
@ -22,14 +22,14 @@ fn write_subassembly() -> io::Result<()> {
outputs: vec![], outputs: vec![],
custom_data: lw::CircuitBoard::default() custom_data: lw::CircuitBoard::default()
.with_color(0, 100, 50) .with_color(0, 100, 50)
.with_size(5, 10) .with_size(5, 13)
.custom_data(), .custom_data(),
}, },
lw::Component { lw::Component {
address: 2, address: 2,
parent: 1, parent: 1,
numeric_id: COMPONENT_MAP["MHG.AndGate"], numeric_id: COMPONENT_MAP["MHG.AndGate"],
position: [150+1*300, 150, 150+2*300], position: [150 + 1 * 300, 150, 150 + 7 * 300],
rotation: quaternion::id(), rotation: quaternion::id(),
inputs: vec![lw::Input::new(1), lw::Input::new(2), lw::Input::new(3)], inputs: vec![lw::Input::new(1), lw::Input::new(2), lw::Input::new(3)],
outputs: vec![lw::Output::new(4)], outputs: vec![lw::Output::new(4)],
@ -39,16 +39,32 @@ fn write_subassembly() -> io::Result<()> {
address: 3, address: 3,
parent: 1, parent: 1,
numeric_id: COMPONENT_MAP["MHG.XorGate"], numeric_id: COMPONENT_MAP["MHG.XorGate"],
position: [150+1*300, 150, 150+5*300], position: [150 + 1 * 300, 150, 150 + 10 * 300],
rotation: quaternion::id(), rotation: quaternion::id(),
inputs: vec![lw::Input::new(5), lw::Input::new(4)], inputs: vec![lw::Input::new(5), lw::Input::new(4)],
outputs: vec![lw::Output::new(6)], outputs: vec![lw::Output::new(6)],
custom_data: vec![], custom_data: vec![],
}, },
lw::Component {
address: 4,
parent: 1,
numeric_id: COMPONENT_MAP["MHG.PanelLabel"],
position: [150 + 3 * 300, 150, 150 + 1 * 300],
rotation: quaternion::euler_angles(0.0, -PI / 2.0, 0.0),
inputs: vec![],
outputs: vec![],
custom_data: lw::Label::new("Lmao")
.mono()
.with_size(2.5)
.with_color(0, 100, 250)
.with_align(lw::HorizontalAlign::Right, lw::VerticalAlign::Bottom)
.with_dimensions(4, 3)
.custom_data(),
},
]; ];
let wires = vec![lw::Wire { let wires = vec![lw::Wire {
first_point: PegAddress::output(2, 0), first_point: lw::PegAddress::output(2, 0),
second_point: PegAddress::input(3, 1), second_point: lw::PegAddress::input(3, 1),
circuit_state_id: 4, circuit_state_id: 4,
wire_rotation: 0.0, wire_rotation: 0.0,
}]; }];
@ -78,6 +94,6 @@ fn main() {
println!("{}: {:?}", module, result); println!("{}: {:?}", module, result);
} }
// let result = write_subassembly(); let result = write_subassembly();
// println!("{:?}", result); println!("{:?}", result);
} }

Loading…
Cancel
Save