GithubHelp home page GithubHelp logo

greluc / rust-xplm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samcrow/rust-xplm

0.0 0.0 0.0 1.12 MB

Rust interfaces to the X-Plane plugin SDK

License: Apache License 2.0

Rust 100.00%

rust-xplm's Introduction

X-Plane plugin APIs for Rust

Crates.io Version Documentation License

Purpose

Rust XPLM provides a convenient interface for X-Plane plugin development in the Rust programming language for all platforms.

As we use the X-Plane SDK version 3.0, any plugin created with this library supports X-Plane version 11.10 or later.

Status

The library is still in an incomplete state. As a result some parts of the SDK may only be sparsely covered or missing completely.

  • Compiles and is callable from X-Plane
  • Debug logging to the console / log file
  • DataRef reading and writing
  • Commands
  • GUI - Needs further work
  • Drawing - Needs further work

Example

Some more examples can be found in the examples/ directory.

This small snippet is the minimal boilerplate needed to make your plugin compile.

extern crate xplm;

use xplm::plugin::{Plugin, PluginInfo};
use xplm::{debugln, xplane_plugin};

struct MinimalPlugin;

impl Plugin for MinimalPlugin {
    type Error = std::convert::Infallible;

    fn start() -> Result<Self, Self::Error> {
        // The following message should be visible in the developer console and the Log.txt file
        debugln!("Hello, World! From the Minimal Rust Plugin");
        Ok(MinimalPlugin)
    }

    fn info(&self) -> PluginInfo {
        PluginInfo {
            name: String::from("Minimal Rust Plugin"),
            signature: String::from("org.samcrow.xplm.examples.minimal"),
            description: String::from("A plugin written in Rust"),
        }
    }
}

xplane_plugin!(MinimalPlugin);

Compiling and installing a plugin

cargo new --lib my-rxplm-project
cd my-rxplm-project
cargo add xplm

Then add to Cargo.toml:

[lib]
crate-type = ["cdylib"]

Copy minimal example from above into src/lib.rs

cargo build

Rename target/debug/my_rxplm_project.dll to win.xpl (or my_rxplm_project.so to lin.xpl, etc) and copy to the aircraft/scenery/sim plugins folder

Cross-compiling

The cross tool may help compile plugins for multiple operating systems/architectures.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

rust-xplm's People

Contributors

samcrow avatar constvoidptr avatar jdeeth avatar greluc avatar pavlos1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.