Git Product home page Git Product logo

goplane's Introduction

goplane

GoDoc

Implementierung des X-Plane SDKs auf der Basis von GO

Voraussetzungen

  1. GO Version 1.5 muss installiert sein
  2. Das X-Plane SDK (min. Version 2.1.3) muss heruntergeladen und in einem Ordner entpackt sein.

Beispiel-Plugin

package main
import (
	"github.com/abieberbach/goplane/extra"
	"github.com/abieberbach/goplane/extra/logging"
)

func main() {
}

func init() {
	plugin := extra.NewPlugin("TestPlugin", "com.github.abieberbach.goplane.TestPlugin", "TestPlugin")
	plugin.SetPluginStateCallback(onPluginStateChanged)
	logging.MinLevel = logging.Info_Level
}

func onPluginStateChanged(state extra.PluginState, plugin *extra.XPlanePlugin) {
	switch state {
	case extra.PluginStart:
		onPluginStart()
	case extra.PluginEnable:
		onPluginEnable()
	}
}

func onPluginStart() {
	logging.Info("Plugin start")
}


func onPluginEnable() {
	logging.Info("Plugin enable")
}

Plugin kompilieren

Damit das Plugin kompiliert werden kann, muss dem System mitgeteilt werden, wo sich die Include-Dateien des SDKs befinden. Dazu muss die Umgebungsvariable "CGO_CFLAGS" auf den Pfad des SDKs gesetzt werden.

Linux: export CGO_CFLAGS='-I <Pfad zum SDK>/CHeaders'

Im Anschluss kann das Plugin mit dem go Tool gebaut werden:

Linux: go build -o lin.xpl -buildmode=c-shared  TestPlugin.go

Unterstütze Plattformen

  • Linux: x64
  • Mac: nicht getestet
  • Windows: nicht unterstützt (siehe offenen Issue bei GO golang/go#11058)

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.