flybywiresim
msfs-rs
Rust

A Rusty way to interact with Microsoft Flight Simulator 2020

Last updated Jul 3, 2026
79
Stars
28
Forks
6
Issues
+1
Stars/day
Attention Score
47
Language breakdown
Rust 99.2%
C 0.6%
Shell 0.2%
โ–ธ Files click to expand
README

FlyByWire Simulations

โœˆ๏ธ msfs-rs ๐Ÿฆ€

Use Rust to interact with Microsoft Flight Simulator

As seen in the FlyByWire A32NX and A380X!

  • Write custom aircraft logic in Rust
* Systems * Gauges * Instrument panels (NanoVG) * Replace aircraft code * RPL * C++ * JavaScript * TypeScript * WASM
  • Interact with the Microsoft SDK
  • Create external applications that interact with MSFS using SimConnect
Discord X YouTube Facebook Instagram Bluesky

Example

Drawing a red rectangle on a glass instrument panel inside an aircraft cockpit:
// gauge_logic.rs
use msfs::{nvg, MSFSEvent};

#[msfs::gauge(name=Demo)] async fn demo(mut gauge: msfs::Gauge) -> Result<(), Box<dyn std::error::Error>> { // Use NanoVG to draw let nvg = gauge.create_nanovg().unwrap();

let black = nvg::Style::default().fill(nvg::Color::from_rgb(0, 0, 0)); let red = nvg::Style::default().fill(nvg::Color::from_rgb(255, 0, 0));

// Reacting to MSFS events while let Some(event) = gauge.next_event().await { match event { MSFSEvent::PreDraw(d) => { nvg.draw_frame(d.width(), d.height(), |f| { // Red rectangle f.draw_path(&red, |p| { p.rect(20.0, 20.0, 40.0, 40.0); println!("Hello rusty world!");

Ok(()) })?;

Ok(()) }); } _ => {} } } Ok(()) }

[VCockpit01]
size_mm=1024,768
pixel_size=1024,768
texture=$SCREEN_1
background_color=0,0,255
htmlgauge00=WasmInstrument/WasmInstrument.html?wasmmodule=gaugelogic.wasm&wasm_gauge=Demo, 0,0,1024,768
Screenshot showing a Rust output in the ingame console

Getting started

$ cd examples/nvg
$ cargo build --target wasm32-wasip1

Further reading

* Creating an aircraft with custom logic * Programming APIs * Microsoft's Samples and Examples * External interaction with SimConnect

Help

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท flybywiresim/msfs-rs ยท Updated daily from GitHub