SDK Advanced Examples
From X-Plane SDK
Contents |
X-Plane SDK Advanced Examples
EngineStarter, ShowEvents and TestEnums will be added as Delphi/Kylix projects when time permits.
TestWidgets is C only at the moment as it uses the new XPWidgetsEx.lib which is a static library.
18th April, 2007
- The ExampleGauge plugin source has been changed so it will work on an Intel Mac.
(Contains C code, project files for MSVC6, X-Code, CodeWarrior, GCC makefile, and some ports to Delphi/pascal.)
Setup
There are project files for Microsoft VC6, Metrowerks CW8, XCode 2.2 and make files for gcc. The Delphi projects have been modified so that they will build under Delphi on Windows or Kylix on Linux.
Important Note: to ensure that the sample projects on this page will find the correct headers and libraries first create a new folder, XPSDK102.
Download and expand XPSDK1.0.2 from the downloads page, creating an SDK folder.
Put this and the expanded plugin example files found below on this page into the newly created XPSDK102 folder.
e.g.
\XPSDK102
\SDK
\SDKExamples
\AdvancedSDKExamples
\WidgetLibraryExample
I have personally built all projects using this layout on all platforms.
Notes
EngineStarter
plugin added 01/10/2005.
This examples shows how to start the engines in V8. Setting the Starter Duration in V8 does not work.
It also shows some fancy widgetry. The widget windows will resize depending on how many engines there are.
5 New plugins added 08/2005
TestWidgets
This example shows how to use the two new widgets, popups and listbox, that are in the XPWidgetsEx.lib.
[WidgetLibraryExample.zip |http://www.xsquawkbox.net/xpsdk/lib/std_examples/WidgetLibraryExample.zip]
We have packaged this separately in a static library so that it can be used now. %%%Eventually these will make their way into the XPWidgets DLL. %%%They way they are accessed should ensure that a rebuild is all that is required when they appear in the next XPWidgets release. %%%Other widgets will be added to the static lib as they come along.
We have included the library as a complete set of projects. %%%These are for VC6, CW8 and GCC and includes the source files. %%%The reason for including the source files is to allow developers to use other compilers. %%%These are also a good starting point for developers who want to create their own widgets.
This is an addition to the SDK Widgets so please respect the copyright and license that comes with this library.
FMSUtility
This example shows how to access the FMS from within a plugin. %%%It uses all the FMS Get and Set functions. %%%This is just a basic example but I am sure it could be expanded into a more complex example.
ExampleGauges
This example shows how to use OpenGL to display a floating panel that contains a gauge. %%%The gauge show N1 and can be moved around the cockpit.
This plugin has a directory that has to be copied as a child directory of plugins. %%%It contains the bitmaps used by this plugin.
You will find it in the "AdvancedSDKExamples.zip" file. %%%e.g. this is the zip contents.
AdvancedSDKExamples
Delphi ExampleGauge (Copy this whole directory to plugins) Projects SampleCode
This plugin will work on all platforms and there is a project file for Delphi/Kylix. %%%It relies on cross platform bitmap loader code that I have supplied. %%%It originally used Glaux, but this was not available for all cases so I removed it.
ShowEvents
This shows all the drawing phases.
TestEnums
This shows how to send key and joystick command enums.
Older Advanced Examples
ReloadPlugins
Use this when developing and you don't want to keep stopping and starting XPlane. %%%In select reload plugins and then wait for the message box to appear, once the plugin has been copied press OK. %%%On the Mac copy the plugin and then select the reload plugin option. %%%This does not work on Linux yet. %%%On later versions of V8 this now works the same on all 3 platforms.
NOTE %%%THIS PLUGIN IS MEANT FOR DEBUGGING PURPOSES ONLY. %%%WE ADVISE YOU NOT TO USE THIS IN A RELEASE ENVIRONMENT AS IT CAN INTRODUCE SIDE EFFECTS.
InputOutput
Show reading datarefs and then writing a dateref depending on input criteria.
PluginMessaging.
Shows inter plugin messaging, just copy over all the messaging plugins and you will be able to test messaging between 8 plugins.
"Override", "Control", "Position"
Shows how to override and then position the aircraft or move the control surfaces.
X-Plane SDK