You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+14-8Lines changed: 14 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,21 @@
1
1
# SimConnect Bindings for Rust
2
+
## Using
3
+
Add this to your `Cargo.toml`
4
+
```toml
5
+
[dependencies]
6
+
simconnect = "0.1"
7
+
```
2
8
## Building
3
9
*The SimConnect binaries are included within this repository, but they may not be up to date.*
4
10
5
11
1. Install [CLang](https://clang.llvm.org/get_started.html). More information available at the [Rust Bindgen Documentation](https://rust-lang.github.io/rust-bindgen/requirements.html).
6
12
2. run `cargo build`
7
-
3.`use simconnectsdk`
13
+
3.`use simconnect`
8
14
9
15
### Sample Program
10
16
*Note: You must have SimConnect.dll in your current working directory to be able to successfully use SimConnect*
11
17
```rust
12
-
usesimconnectsdk;
18
+
usesimconnect;
13
19
usestd::time::Duration;
14
20
usestd::thread::sleep;
15
21
usestd::mem::transmute_copy;
@@ -20,16 +26,16 @@ struct DataStruct {
20
26
alt:f64,
21
27
}
22
28
23
-
letmutconn=simconnectsdk::SimConnector::new();
29
+
letmutconn=simconnect::SimConnector::new();
24
30
conn.connect("Simple Program"); // Intialize connection with SimConnect
25
-
conn.add_data_definition(0, "PLANE LATITUDE", "Degrees", simconnectsdk::SIMCONNECT_DATATYPE_SIMCONNECT_DATATYPE_FLOAT64, u32::MAX); // Assign a sim variable to a client defined id
conn.request_data_on_sim_object(0, 0, 0, simconnectsdk::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_SIM_FRAME); //request_id, define_id, object_id (user), period - tells simconnect to send data for the defined id and on the user aircraft
31
+
conn.add_data_definition(0, "PLANE LATITUDE", "Degrees", simconnect::SIMCONNECT_DATATYPE_SIMCONNECT_DATATYPE_FLOAT64, u32::MAX); // Assign a sim variable to a client defined id
conn.request_data_on_sim_object(0, 0, 0, simconnect::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_SIM_FRAME); //request_id, define_id, object_id (user), period - tells simconnect to send data for the defined id and on the user aircraft
Copy file name to clipboardExpand all lines: src/lib.rs
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
1
/*!
2
-
The simconnectsdk crate provides rust bindings to retrieve and send information through SimConnect.
2
+
The simconnect crate provides rust bindings to retrieve and send information through SimConnect.
3
3
4
4
Documentation for SimConnect can be found by downloading the SDK for FS2020 or using P3D/FSX SDK documentations for reference (although some of their documentation does not apply for FS2020).
5
5
6
6
# Setup
7
7
Add this to your `Cargo.toml`
8
8
```toml
9
9
[dependencies]
10
-
simconnectsdk = "0.1"
10
+
simconnect = "0.1"
11
11
```
12
12
13
13
# Simple Example
14
14
*Note: You must have SimConnect.dll in your current working directory to be able to successfully use SimConnect*
15
15
```rust
16
-
use simconnectsdk;
16
+
use simconnect;
17
17
use std::time::Duration;
18
18
use std::thread::sleep;
19
19
use std::mem::transmute_copy;
@@ -24,16 +24,16 @@ struct DataStruct {
24
24
alt: f64,
25
25
}
26
26
27
-
let mut conn = simconnectsdk::SimConnector::new();
27
+
let mut conn = simconnect::SimConnector::new();
28
28
conn.connect("Simple Program"); // Intialize connection with SimConnect
29
-
conn.add_data_definition(0, "PLANE LATITUDE", "Degrees", simconnectsdk::SIMCONNECT_DATATYPE_SIMCONNECT_DATATYPE_FLOAT64, u32::MAX); // Assign a sim variable to a client defined id
conn.request_data_on_sim_object(0, 0, 0, simconnectsdk::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_SIM_FRAME); //request_id, define_id, object_id (user), period - tells simconnect to send data for the defined id and on the user aircraft
29
+
conn.add_data_definition(0, "PLANE LATITUDE", "Degrees", simconnect::SIMCONNECT_DATATYPE_SIMCONNECT_DATATYPE_FLOAT64, u32::MAX); // Assign a sim variable to a client defined id
conn.request_data_on_sim_object(0, 0, 0, simconnect::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_SIM_FRAME); //request_id, define_id, object_id (user), period - tells simconnect to send data for the defined id and on the user aircraft
0 commit comments