Update XPLM for ARM64
This commit is contained in:
@@ -2,42 +2,46 @@
|
||||
#define _XPLMCamera_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMCamera
|
||||
***************************************************************************/
|
||||
/*
|
||||
* XPLMCamera - THEORY OF OPERATION The XPLMCamera APIs allow plug-ins to
|
||||
* control the camera angle in X-Plane. This has a number of applications,
|
||||
* including but not limited to:
|
||||
*
|
||||
* The XPLMCamera APIs allow plug-ins to control the camera angle in X-Plane.
|
||||
* This has a number of applications, including but not limited to:
|
||||
*
|
||||
* - Creating new views (including dynamic/user-controllable views) for the
|
||||
* user.
|
||||
*
|
||||
* user.
|
||||
* - Creating applications that use X-Plane as a renderer of scenery,
|
||||
* aircrafts, or both.
|
||||
*
|
||||
* aircrafts, or both.
|
||||
*
|
||||
* The camera is controlled via six parameters: a location in OpenGL
|
||||
* coordinates and pitch, roll and yaw, similar to an airplane's position.
|
||||
* OpenGL coordinate info is described in detail in the XPLMGraphics
|
||||
* documentation; generally you should use the XPLMGraphics routines to
|
||||
* convert from world to local coordinates. The camera's orientation starts
|
||||
* facing level with the ground directly up the negative-Z axis
|
||||
* (approximately north) with the horizon horizontal. It is then rotated
|
||||
* clockwise for yaw, pitched up for positive pitch, and rolled clockwise
|
||||
* around the vector it is looking along for roll.
|
||||
*
|
||||
* convert from world to local coordinates. The camera's orientation starts
|
||||
* facing level with the ground directly up the negative-Z axis (approximately
|
||||
* north) with the horizon horizontal. It is then rotated clockwise for yaw,
|
||||
* pitched up for positive pitch, and rolled clockwise around the vector it is
|
||||
* looking along for roll.
|
||||
*
|
||||
* You control the camera either either until the user selects a new view or
|
||||
* permanently (the later being similar to how UDP camera control works). You
|
||||
* permanently (the later being similar to how UDP camera control works). You
|
||||
* control the camera by registering a callback per frame from which you
|
||||
* calculate the new camera positions. This guarantees smooth camera motion.
|
||||
*
|
||||
* calculate the new camera positions. This guarantees smooth camera motion.
|
||||
*
|
||||
* Use the XPLMDataAccess APIs to get information like the position of the
|
||||
* aircraft, etc. for complex camera positioning.
|
||||
*
|
||||
* Note: if your goal is to move the virtual pilot in the cockpit, this API is
|
||||
* not needed; simply update the datarefs for the pilot's head position.
|
||||
*
|
||||
* For custom exterior cameras, set the camera's mode to an external view
|
||||
* first to get correct sound and 2-d panel behavior.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -50,27 +54,21 @@ extern "C" {
|
||||
/***************************************************************************
|
||||
* CAMERA CONTROL
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMCameraControlDuration
|
||||
*
|
||||
*
|
||||
* This enumeration states how long you want to retain control of the camera.
|
||||
* You can retain it indefinitely or until the user selects a new view.
|
||||
* You can retain it indefinitely or until the user selects a new view.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* Control the camera until the user picks a new view. */
|
||||
xplm_ControlCameraUntilViewChanges = 1
|
||||
/* Control the camera until the user picks a new view. */
|
||||
xplm_ControlCameraUntilViewChanges = 1,
|
||||
|
||||
/* Control the camera until your plugin is disabled or another plugin
|
||||
* forcably * takes control. */
|
||||
,
|
||||
xplm_ControlCameraForever = 2
|
||||
/* Control the camera until your plugin is disabled or another plugin forcably*
|
||||
* takes control. */
|
||||
xplm_ControlCameraForever = 2,
|
||||
|
||||
|
||||
};
|
||||
@@ -78,87 +76,89 @@ typedef int XPLMCameraControlDuration;
|
||||
|
||||
/*
|
||||
* XPLMCameraPosition_t
|
||||
*
|
||||
* This structure contains a full specification of the camera. X, Y, and Z
|
||||
* are the camera's position in OpenGL coordiantes; pitch, roll, and yaw are
|
||||
* rotations from a camera facing flat north in degrees. Positive pitch means
|
||||
*
|
||||
* This structure contains a full specification of the camera. X, Y, and Z are
|
||||
* the camera's position in OpenGL coordiantes; pitch, roll, and yaw are
|
||||
* rotations from a camera facing flat north in degrees. Positive pitch means
|
||||
* nose up, positive roll means roll right, and positive yaw means yaw right,
|
||||
* all in degrees. Zoom is a zoom factor, with 1.0 meaning normal zoom and 2.0
|
||||
* magnifying by 2x (objects appear larger).
|
||||
* magnifying by 2x (objects appear larger).
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float pitch;
|
||||
float heading;
|
||||
float roll;
|
||||
float zoom;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float pitch;
|
||||
float heading;
|
||||
float roll;
|
||||
float zoom;
|
||||
} XPLMCameraPosition_t;
|
||||
|
||||
/*
|
||||
* XPLMCameraControl_f
|
||||
*
|
||||
*
|
||||
* You use an XPLMCameraControl function to provide continuous control over
|
||||
* the camera. You are passed in a structure in which to put the new camera
|
||||
* position; modify it and return 1 to reposition the camera. Return 0 to
|
||||
* the camera. You are passed in a structure in which to put the new camera
|
||||
* position; modify it and return 1 to reposition the camera. Return 0 to
|
||||
* surrender control of the camera; camera control will be handled by X-Plane
|
||||
* on this draw loop. The contents of the structure as you are called are
|
||||
* undefined.
|
||||
*
|
||||
*
|
||||
* If X-Plane is taking camera control away from you, this function will be
|
||||
* called with inIsLosingControl set to 1 and ioCameraPosition NULL.
|
||||
* called with inIsLosingControl set to 1 and ioCameraPosition NULL.
|
||||
*
|
||||
*/
|
||||
typedef int (*XPLMCameraControl_f)(
|
||||
XPLMCameraPosition_t *outCameraPosition, /* Can be NULL */
|
||||
int inIsLosingControl,
|
||||
void *inRefcon);
|
||||
typedef int (* XPLMCameraControl_f)(
|
||||
XPLMCameraPosition_t * outCameraPosition, /* Can be NULL */
|
||||
int inIsLosingControl,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMControlCamera
|
||||
*
|
||||
* This function repositions the camera on the next drawing cycle. You must
|
||||
* pass a non-null control function. Specify in inHowLong how long you'd like
|
||||
* control (indefinitely or until a key is pressed).
|
||||
*
|
||||
* This function repositions the camera on the next drawing cycle. You must
|
||||
* pass a non-null control function. Specify in inHowLong how long you'd like
|
||||
* control (indefinitely or until a new view mode is set by the user).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMControlCamera(XPLMCameraControlDuration inHowLong,
|
||||
XPLMCameraControl_f inControlFunc,
|
||||
void *inRefcon);
|
||||
XPLM_API void XPLMControlCamera(
|
||||
XPLMCameraControlDuration inHowLong,
|
||||
XPLMCameraControl_f inControlFunc,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMDontControlCamera
|
||||
*
|
||||
* This function stops you from controlling the camera. If you have a camera
|
||||
*
|
||||
* This function stops you from controlling the camera. If you have a camera
|
||||
* control function, it will not be called with an inIsLosingControl flag.
|
||||
* X-Plane will control the camera on the next cycle.
|
||||
*
|
||||
*
|
||||
* For maximum compatibility you should not use this routine unless you are in
|
||||
* posession of the camera.
|
||||
* posession of the camera.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDontControlCamera(void);
|
||||
XPLM_API void XPLMDontControlCamera(void);
|
||||
|
||||
/*
|
||||
* XPLMIsCameraBeingControlled
|
||||
*
|
||||
*
|
||||
* This routine returns 1 if the camera is being controlled, zero if it is
|
||||
* not. If it is and you pass in a pointer to a camera control duration, the
|
||||
* current control duration will be returned.
|
||||
* not. If it is and you pass in a pointer to a camera control duration, the
|
||||
* current control duration will be returned.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMIsCameraBeingControlled(
|
||||
XPLMCameraControlDuration *outCameraControlDuration); /* Can be NULL */
|
||||
XPLM_API int XPLMIsCameraBeingControlled(
|
||||
XPLMCameraControlDuration * outCameraControlDuration); /* Can be NULL */
|
||||
|
||||
/*
|
||||
* XPLMReadCameraPosition
|
||||
*
|
||||
* This function reads the current camera position.
|
||||
*
|
||||
* This function reads the current camera position.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMReadCameraPosition(XPLMCameraPosition_t *outCameraPosition);
|
||||
XPLM_API void XPLMReadCameraPosition(
|
||||
XPLMCameraPosition_t * outCameraPosition);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+253
-257
@@ -2,23 +2,23 @@
|
||||
#define _XPLMDefs_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMDefs
|
||||
***************************************************************************/
|
||||
/*
|
||||
* This file is contains the cross-platform and basic definitions for the
|
||||
* X-Plane SDK.
|
||||
*
|
||||
*
|
||||
* The preprocessor macros APL and IBM must be defined to specify the
|
||||
* compilation target; define APL to 1 and IBM 0 to compile on Macintosh and
|
||||
* APL to 0 and IBM to 1 for Windows. You must specify these macro definitions
|
||||
* before including XPLMDefs.h or any other XPLM headers. You can do this
|
||||
* using the -D command line option or a preprocessor header.
|
||||
* using the -D command line option or a preprocessor header.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -38,160 +38,157 @@ extern "C" {
|
||||
/*
|
||||
* These definitions control the importing and exporting of functions within
|
||||
* the DLL.
|
||||
*
|
||||
*
|
||||
* You can prefix your five required callbacks with the PLUGIN_API macro to
|
||||
* declare them as exported C functions. The XPLM_API macro identifies
|
||||
* declare them as exported C functions. The XPLM_API macro identifies
|
||||
* functions that are provided to you via the plugin SDK. (Link against
|
||||
* XPLM.lib to use these functions.)
|
||||
* XPLM.lib to use these functions.)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if APL
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
||||
#elif __MACH__
|
||||
#define PLUGIN_API extern "C"
|
||||
#if APL
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
||||
#elif __MACH__
|
||||
#define PLUGIN_API extern "C"
|
||||
#else
|
||||
#define PLUGIN_API extern "C" __declspec(dllexport)
|
||||
#endif
|
||||
#elif IBM
|
||||
#define PLUGIN_API extern "C" __declspec(dllexport)
|
||||
#elif LIN
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
||||
#else
|
||||
#define PLUGIN_API extern "C"
|
||||
#endif
|
||||
#else
|
||||
#error "Platform not defined!"
|
||||
#endif
|
||||
#else
|
||||
#define PLUGIN_API extern "C" __declspec(dllexport)
|
||||
#endif
|
||||
#elif IBM
|
||||
#define PLUGIN_API extern "C" __declspec(dllexport)
|
||||
#elif LIN
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
||||
#else
|
||||
#define PLUGIN_API extern "C"
|
||||
#endif
|
||||
#else
|
||||
#error "Platform not defined!"
|
||||
#endif
|
||||
#else
|
||||
#if APL
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API __attribute__((visibility("default")))
|
||||
#elif __MACH__
|
||||
#define PLUGIN_API
|
||||
#else
|
||||
#define PLUGIN_API __declspec(dllexport)
|
||||
#endif
|
||||
#elif IBM
|
||||
#define PLUGIN_API __declspec(dllexport)
|
||||
#elif LIN
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define PLUGIN_API
|
||||
#endif
|
||||
#else
|
||||
#error "Platform not defined!"
|
||||
#endif
|
||||
#if APL
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API __attribute__((visibility("default")))
|
||||
#elif __MACH__
|
||||
#define PLUGIN_API
|
||||
#else
|
||||
#define PLUGIN_API __declspec(dllexport)
|
||||
#endif
|
||||
#elif IBM
|
||||
#define PLUGIN_API __declspec(dllexport)
|
||||
#elif LIN
|
||||
#if __GNUC__ >= 4
|
||||
#define PLUGIN_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define PLUGIN_API
|
||||
#endif
|
||||
#else
|
||||
#error "Platform not defined!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if APL
|
||||
#if XPLM
|
||||
#if __GNUC__ >= 4
|
||||
#define XPLM_API __attribute__((visibility("default")))
|
||||
#elif __MACH__
|
||||
#define XPLM_API
|
||||
#else
|
||||
#define XPLM_API __declspec(dllexport)
|
||||
#endif
|
||||
#else
|
||||
#define XPLM_API
|
||||
#endif
|
||||
#if XPLM
|
||||
#if __GNUC__ >= 4
|
||||
#define XPLM_API __attribute__((visibility("default")))
|
||||
#elif __MACH__
|
||||
#define XPLM_API
|
||||
#else
|
||||
#define XPLM_API __declspec(dllexport)
|
||||
#endif
|
||||
#else
|
||||
#define XPLM_API
|
||||
#endif
|
||||
#elif IBM
|
||||
#if XPLM
|
||||
#define XPLM_API __declspec(dllexport)
|
||||
#else
|
||||
#define XPLM_API __declspec(dllimport)
|
||||
#endif
|
||||
#if XPLM
|
||||
#define XPLM_API __declspec(dllexport)
|
||||
#else
|
||||
#define XPLM_API __declspec(dllimport)
|
||||
#endif
|
||||
#elif LIN
|
||||
#if XPLM
|
||||
#if __GNUC__ >= 4
|
||||
#define XPLM_API __attribute__((visibility("default")))
|
||||
#if XPLM
|
||||
#if __GNUC__ >= 4
|
||||
#define XPLM_API __attribute__((visibility("default")))
|
||||
#else
|
||||
#define XPLM_API
|
||||
#endif
|
||||
#else
|
||||
#define XPLM_API
|
||||
#endif
|
||||
#else
|
||||
#define XPLM_API
|
||||
#endif
|
||||
#else
|
||||
#define XPLM_API
|
||||
#endif
|
||||
#else
|
||||
#error "Platform not defined!"
|
||||
#error "Platform not defined!"
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* GLOBAL DEFINITIONS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These definitions are used in all parts of the SDK.
|
||||
* These definitions are used in all parts of the SDK.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMPluginID
|
||||
*
|
||||
*
|
||||
* Each plug-in is identified by a unique integer ID. This ID can be used to
|
||||
* disable or enable a plug-in, or discover what plug-in is 'running' at the
|
||||
* time. A plug-in ID is unique within the currently running instance of
|
||||
* X-Plane unless plug-ins are reloaded. Plug-ins may receive a different
|
||||
* unique ID each time they are loaded.
|
||||
*
|
||||
* unique ID each time they are loaded. This includes the unloading and
|
||||
* reloading of plugins that are part of the user's aircraft.
|
||||
*
|
||||
* For persistent identification of plug-ins, use XPLMFindPluginBySignature in
|
||||
* XPLMUtiltiies.h
|
||||
*
|
||||
* -1 indicates no plug-in.
|
||||
*
|
||||
* -1 indicates no plug-in.
|
||||
*
|
||||
*/
|
||||
typedef int XPLMPluginID;
|
||||
|
||||
/* No plugin. */
|
||||
#define XPLM_NO_PLUGIN_ID (-1)
|
||||
/* No plugin. */
|
||||
#define XPLM_NO_PLUGIN_ID (-1)
|
||||
|
||||
/* X-Plane itself */
|
||||
#define XPLM_PLUGIN_XPLANE (0)
|
||||
/* X-Plane itself */
|
||||
#define XPLM_PLUGIN_XPLANE (0)
|
||||
|
||||
/* The current XPLM revision is 2.10 (210). */
|
||||
#define kXPLM_Version (210)
|
||||
/* The current XPLM revision is 4.00 (400). */
|
||||
#define kXPLM_Version (400)
|
||||
|
||||
/*
|
||||
* XPLMKeyFlags
|
||||
*
|
||||
*
|
||||
* These bitfields define modifier keys in a platform independent way. When a
|
||||
* key is pressed, a series of messages are sent to your plugin. The down
|
||||
* flag is set in the first of these messages, and the up flag in the last.
|
||||
* flag is set in the first of these messages, and the up flag in the last.
|
||||
* While the key is held down, messages are sent with neither to indicate that
|
||||
* the key is being held down as a repeated character.
|
||||
*
|
||||
* The control flag is mapped to the control flag on Macintosh and PC.
|
||||
*
|
||||
* The control flag is mapped to the control flag on Macintosh and PC.
|
||||
* Generally X-Plane uses the control key and not the command key on
|
||||
* Macintosh, providing a consistent interface across platforms that does not
|
||||
* necessarily match the Macintosh user interface guidelines. There is not
|
||||
* yet a way for plugins to access the Macintosh control keys without using
|
||||
* #ifdefed code.
|
||||
* #ifdefed code.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* The shift key is down */
|
||||
xplm_ShiftFlag = 1
|
||||
/* The shift key is down */
|
||||
xplm_ShiftFlag = 1,
|
||||
|
||||
/* The option or alt key is down */
|
||||
,
|
||||
xplm_OptionAltFlag = 2
|
||||
/* The option or alt key is down */
|
||||
xplm_OptionAltFlag = 2,
|
||||
|
||||
/* The control key is down* */
|
||||
,
|
||||
xplm_ControlFlag = 4
|
||||
/* The control key is down* */
|
||||
xplm_ControlFlag = 4,
|
||||
|
||||
/* The key is being pressed down */
|
||||
,
|
||||
xplm_DownFlag = 8
|
||||
/* The key is being pressed down */
|
||||
xplm_DownFlag = 8,
|
||||
|
||||
/* The key is being released */
|
||||
,
|
||||
xplm_UpFlag = 16
|
||||
/* The key is being released */
|
||||
xplm_UpFlag = 16,
|
||||
|
||||
|
||||
};
|
||||
@@ -205,52 +202,53 @@ typedef int XPLMKeyFlags;
|
||||
* codes. Not all key presses generate an ASCII value, so plugin code should
|
||||
* be prepared to see null characters come from the keyboard...this usually
|
||||
* represents a key stroke that has no equivalent ASCII, like a page-down
|
||||
* press. Use virtual key codes to find these key strokes. ASCII key codes
|
||||
* take into account modifier keys; shift keys will affect capitals and
|
||||
* punctuation; control key combinations may have no vaild ASCII and produce
|
||||
* NULL. To detect control-key combinations, use virtual key codes, not ASCII
|
||||
* keys.
|
||||
* press. Use virtual key codes to find these key strokes.
|
||||
*
|
||||
* ASCII key codes take into account modifier keys; shift keys will affect
|
||||
* capitals and punctuation; control key combinations may have no vaild ASCII
|
||||
* and produce NULL. To detect control-key combinations, use virtual key
|
||||
* codes, not ASCII keys.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define XPLM_KEY_RETURN 13
|
||||
#define XPLM_KEY_RETURN 13
|
||||
|
||||
#define XPLM_KEY_ESCAPE 27
|
||||
#define XPLM_KEY_ESCAPE 27
|
||||
|
||||
#define XPLM_KEY_TAB 9
|
||||
#define XPLM_KEY_TAB 9
|
||||
|
||||
#define XPLM_KEY_DELETE 8
|
||||
#define XPLM_KEY_DELETE 8
|
||||
|
||||
#define XPLM_KEY_LEFT 28
|
||||
#define XPLM_KEY_LEFT 28
|
||||
|
||||
#define XPLM_KEY_RIGHT 29
|
||||
#define XPLM_KEY_RIGHT 29
|
||||
|
||||
#define XPLM_KEY_UP 30
|
||||
#define XPLM_KEY_UP 30
|
||||
|
||||
#define XPLM_KEY_DOWN 31
|
||||
#define XPLM_KEY_DOWN 31
|
||||
|
||||
#define XPLM_KEY_0 48
|
||||
#define XPLM_KEY_0 48
|
||||
|
||||
#define XPLM_KEY_1 49
|
||||
#define XPLM_KEY_1 49
|
||||
|
||||
#define XPLM_KEY_2 50
|
||||
#define XPLM_KEY_2 50
|
||||
|
||||
#define XPLM_KEY_3 51
|
||||
#define XPLM_KEY_3 51
|
||||
|
||||
#define XPLM_KEY_4 52
|
||||
#define XPLM_KEY_4 52
|
||||
|
||||
#define XPLM_KEY_5 53
|
||||
#define XPLM_KEY_5 53
|
||||
|
||||
#define XPLM_KEY_6 54
|
||||
#define XPLM_KEY_6 54
|
||||
|
||||
#define XPLM_KEY_7 55
|
||||
#define XPLM_KEY_7 55
|
||||
|
||||
#define XPLM_KEY_8 56
|
||||
#define XPLM_KEY_8 56
|
||||
|
||||
#define XPLM_KEY_9 57
|
||||
#define XPLM_KEY_9 57
|
||||
|
||||
#define XPLM_KEY_DECIMAL 46
|
||||
#define XPLM_KEY_DECIMAL 46
|
||||
|
||||
/***************************************************************************
|
||||
* VIRTUAL KEY CODES
|
||||
@@ -258,258 +256,256 @@ typedef int XPLMKeyFlags;
|
||||
/*
|
||||
* These are cross-platform defines for every distinct keyboard press on the
|
||||
* computer. Every physical key on the keyboard has a virtual key code. So
|
||||
* the "two" key on the top row of the main keyboard has a different code
|
||||
* from the "two" key on the numeric key pad. But the 'w' and 'W' character
|
||||
* are indistinguishable by virtual key code because they are the same
|
||||
* physical key (one with and one without the shift key).
|
||||
*
|
||||
* the "two" key on the top row of the main keyboard has a different code from
|
||||
* the "two" key on the numeric key pad. But the 'w' and 'W' character are
|
||||
* indistinguishable by virtual key code because they are the same physical
|
||||
* key (one with and one without the shift key).
|
||||
*
|
||||
* Use virtual key codes to detect keystrokes that do not have ASCII
|
||||
* equivalents, allow the user to map the numeric keypad separately from the
|
||||
* main keyboard, and detect control key and other modifier-key combinations
|
||||
* that generate ASCII control key sequences (many of which are not available
|
||||
* directly via character keys in the SDK).
|
||||
*
|
||||
*
|
||||
* To assign virtual key codes we started with the Microsoft set but made some
|
||||
* additions and changes. A few differences:
|
||||
*
|
||||
*
|
||||
* 1. Modifier keys are not available as virtual key codes. You cannot get
|
||||
* distinct modifier press and release messages. Please do not try to use
|
||||
* modifier keys as regular keys; doing so will almost certainly interfere
|
||||
* with users' abilities to use the native x-plane key bindings.
|
||||
*
|
||||
* distinct modifier press and release messages. Please do not try to use
|
||||
* modifier keys as regular keys; doing so will almost certainly interfere
|
||||
* with users' abilities to use the native X-Plane key bindings.
|
||||
* 2. Some keys that do not exist on both Mac and PC keyboards are removed.
|
||||
*
|
||||
* 3. Do not assume that the values of these keystrokes are interchangeable
|
||||
* with MS v-keys.
|
||||
* with MS v-keys.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define XPLM_VK_BACK 0x08
|
||||
#define XPLM_VK_BACK 0x08
|
||||
|
||||
#define XPLM_VK_TAB 0x09
|
||||
#define XPLM_VK_TAB 0x09
|
||||
|
||||
#define XPLM_VK_CLEAR 0x0C
|
||||
#define XPLM_VK_CLEAR 0x0C
|
||||
|
||||
#define XPLM_VK_RETURN 0x0D
|
||||
#define XPLM_VK_RETURN 0x0D
|
||||
|
||||
#define XPLM_VK_ESCAPE 0x1B
|
||||
#define XPLM_VK_ESCAPE 0x1B
|
||||
|
||||
#define XPLM_VK_SPACE 0x20
|
||||
#define XPLM_VK_SPACE 0x20
|
||||
|
||||
#define XPLM_VK_PRIOR 0x21
|
||||
#define XPLM_VK_PRIOR 0x21
|
||||
|
||||
#define XPLM_VK_NEXT 0x22
|
||||
#define XPLM_VK_NEXT 0x22
|
||||
|
||||
#define XPLM_VK_END 0x23
|
||||
#define XPLM_VK_END 0x23
|
||||
|
||||
#define XPLM_VK_HOME 0x24
|
||||
#define XPLM_VK_HOME 0x24
|
||||
|
||||
#define XPLM_VK_LEFT 0x25
|
||||
#define XPLM_VK_LEFT 0x25
|
||||
|
||||
#define XPLM_VK_UP 0x26
|
||||
#define XPLM_VK_UP 0x26
|
||||
|
||||
#define XPLM_VK_RIGHT 0x27
|
||||
#define XPLM_VK_RIGHT 0x27
|
||||
|
||||
#define XPLM_VK_DOWN 0x28
|
||||
#define XPLM_VK_DOWN 0x28
|
||||
|
||||
#define XPLM_VK_SELECT 0x29
|
||||
#define XPLM_VK_SELECT 0x29
|
||||
|
||||
#define XPLM_VK_PRINT 0x2A
|
||||
#define XPLM_VK_PRINT 0x2A
|
||||
|
||||
#define XPLM_VK_EXECUTE 0x2B
|
||||
#define XPLM_VK_EXECUTE 0x2B
|
||||
|
||||
#define XPLM_VK_SNAPSHOT 0x2C
|
||||
#define XPLM_VK_SNAPSHOT 0x2C
|
||||
|
||||
#define XPLM_VK_INSERT 0x2D
|
||||
#define XPLM_VK_INSERT 0x2D
|
||||
|
||||
#define XPLM_VK_DELETE 0x2E
|
||||
#define XPLM_VK_DELETE 0x2E
|
||||
|
||||
#define XPLM_VK_HELP 0x2F
|
||||
#define XPLM_VK_HELP 0x2F
|
||||
|
||||
/* XPLM_VK_0 thru XPLM_VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
|
||||
#define XPLM_VK_0 0x30
|
||||
/* XPLM_VK_0 thru XPLM_VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) */
|
||||
#define XPLM_VK_0 0x30
|
||||
|
||||
#define XPLM_VK_1 0x31
|
||||
#define XPLM_VK_1 0x31
|
||||
|
||||
#define XPLM_VK_2 0x32
|
||||
#define XPLM_VK_2 0x32
|
||||
|
||||
#define XPLM_VK_3 0x33
|
||||
#define XPLM_VK_3 0x33
|
||||
|
||||
#define XPLM_VK_4 0x34
|
||||
#define XPLM_VK_4 0x34
|
||||
|
||||
#define XPLM_VK_5 0x35
|
||||
#define XPLM_VK_5 0x35
|
||||
|
||||
#define XPLM_VK_6 0x36
|
||||
#define XPLM_VK_6 0x36
|
||||
|
||||
#define XPLM_VK_7 0x37
|
||||
#define XPLM_VK_7 0x37
|
||||
|
||||
#define XPLM_VK_8 0x38
|
||||
#define XPLM_VK_8 0x38
|
||||
|
||||
#define XPLM_VK_9 0x39
|
||||
#define XPLM_VK_9 0x39
|
||||
|
||||
/* XPLM_VK_A thru XPLM_VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
|
||||
#define XPLM_VK_A 0x41
|
||||
/* XPLM_VK_A thru XPLM_VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) */
|
||||
#define XPLM_VK_A 0x41
|
||||
|
||||
#define XPLM_VK_B 0x42
|
||||
#define XPLM_VK_B 0x42
|
||||
|
||||
#define XPLM_VK_C 0x43
|
||||
#define XPLM_VK_C 0x43
|
||||
|
||||
#define XPLM_VK_D 0x44
|
||||
#define XPLM_VK_D 0x44
|
||||
|
||||
#define XPLM_VK_E 0x45
|
||||
#define XPLM_VK_E 0x45
|
||||
|
||||
#define XPLM_VK_F 0x46
|
||||
#define XPLM_VK_F 0x46
|
||||
|
||||
#define XPLM_VK_G 0x47
|
||||
#define XPLM_VK_G 0x47
|
||||
|
||||
#define XPLM_VK_H 0x48
|
||||
#define XPLM_VK_H 0x48
|
||||
|
||||
#define XPLM_VK_I 0x49
|
||||
#define XPLM_VK_I 0x49
|
||||
|
||||
#define XPLM_VK_J 0x4A
|
||||
#define XPLM_VK_J 0x4A
|
||||
|
||||
#define XPLM_VK_K 0x4B
|
||||
#define XPLM_VK_K 0x4B
|
||||
|
||||
#define XPLM_VK_L 0x4C
|
||||
#define XPLM_VK_L 0x4C
|
||||
|
||||
#define XPLM_VK_M 0x4D
|
||||
#define XPLM_VK_M 0x4D
|
||||
|
||||
#define XPLM_VK_N 0x4E
|
||||
#define XPLM_VK_N 0x4E
|
||||
|
||||
#define XPLM_VK_O 0x4F
|
||||
#define XPLM_VK_O 0x4F
|
||||
|
||||
#define XPLM_VK_P 0x50
|
||||
#define XPLM_VK_P 0x50
|
||||
|
||||
#define XPLM_VK_Q 0x51
|
||||
#define XPLM_VK_Q 0x51
|
||||
|
||||
#define XPLM_VK_R 0x52
|
||||
#define XPLM_VK_R 0x52
|
||||
|
||||
#define XPLM_VK_S 0x53
|
||||
#define XPLM_VK_S 0x53
|
||||
|
||||
#define XPLM_VK_T 0x54
|
||||
#define XPLM_VK_T 0x54
|
||||
|
||||
#define XPLM_VK_U 0x55
|
||||
#define XPLM_VK_U 0x55
|
||||
|
||||
#define XPLM_VK_V 0x56
|
||||
#define XPLM_VK_V 0x56
|
||||
|
||||
#define XPLM_VK_W 0x57
|
||||
#define XPLM_VK_W 0x57
|
||||
|
||||
#define XPLM_VK_X 0x58
|
||||
#define XPLM_VK_X 0x58
|
||||
|
||||
#define XPLM_VK_Y 0x59
|
||||
#define XPLM_VK_Y 0x59
|
||||
|
||||
#define XPLM_VK_Z 0x5A
|
||||
#define XPLM_VK_Z 0x5A
|
||||
|
||||
#define XPLM_VK_NUMPAD0 0x60
|
||||
#define XPLM_VK_NUMPAD0 0x60
|
||||
|
||||
#define XPLM_VK_NUMPAD1 0x61
|
||||
#define XPLM_VK_NUMPAD1 0x61
|
||||
|
||||
#define XPLM_VK_NUMPAD2 0x62
|
||||
#define XPLM_VK_NUMPAD2 0x62
|
||||
|
||||
#define XPLM_VK_NUMPAD3 0x63
|
||||
#define XPLM_VK_NUMPAD3 0x63
|
||||
|
||||
#define XPLM_VK_NUMPAD4 0x64
|
||||
#define XPLM_VK_NUMPAD4 0x64
|
||||
|
||||
#define XPLM_VK_NUMPAD5 0x65
|
||||
#define XPLM_VK_NUMPAD5 0x65
|
||||
|
||||
#define XPLM_VK_NUMPAD6 0x66
|
||||
#define XPLM_VK_NUMPAD6 0x66
|
||||
|
||||
#define XPLM_VK_NUMPAD7 0x67
|
||||
#define XPLM_VK_NUMPAD7 0x67
|
||||
|
||||
#define XPLM_VK_NUMPAD8 0x68
|
||||
#define XPLM_VK_NUMPAD8 0x68
|
||||
|
||||
#define XPLM_VK_NUMPAD9 0x69
|
||||
#define XPLM_VK_NUMPAD9 0x69
|
||||
|
||||
#define XPLM_VK_MULTIPLY 0x6A
|
||||
#define XPLM_VK_MULTIPLY 0x6A
|
||||
|
||||
#define XPLM_VK_ADD 0x6B
|
||||
#define XPLM_VK_ADD 0x6B
|
||||
|
||||
#define XPLM_VK_SEPARATOR 0x6C
|
||||
#define XPLM_VK_SEPARATOR 0x6C
|
||||
|
||||
#define XPLM_VK_SUBTRACT 0x6D
|
||||
#define XPLM_VK_SUBTRACT 0x6D
|
||||
|
||||
#define XPLM_VK_DECIMAL 0x6E
|
||||
#define XPLM_VK_DECIMAL 0x6E
|
||||
|
||||
#define XPLM_VK_DIVIDE 0x6F
|
||||
#define XPLM_VK_DIVIDE 0x6F
|
||||
|
||||
#define XPLM_VK_F1 0x70
|
||||
#define XPLM_VK_F1 0x70
|
||||
|
||||
#define XPLM_VK_F2 0x71
|
||||
#define XPLM_VK_F2 0x71
|
||||
|
||||
#define XPLM_VK_F3 0x72
|
||||
#define XPLM_VK_F3 0x72
|
||||
|
||||
#define XPLM_VK_F4 0x73
|
||||
#define XPLM_VK_F4 0x73
|
||||
|
||||
#define XPLM_VK_F5 0x74
|
||||
#define XPLM_VK_F5 0x74
|
||||
|
||||
#define XPLM_VK_F6 0x75
|
||||
#define XPLM_VK_F6 0x75
|
||||
|
||||
#define XPLM_VK_F7 0x76
|
||||
#define XPLM_VK_F7 0x76
|
||||
|
||||
#define XPLM_VK_F8 0x77
|
||||
#define XPLM_VK_F8 0x77
|
||||
|
||||
#define XPLM_VK_F9 0x78
|
||||
#define XPLM_VK_F9 0x78
|
||||
|
||||
#define XPLM_VK_F10 0x79
|
||||
#define XPLM_VK_F10 0x79
|
||||
|
||||
#define XPLM_VK_F11 0x7A
|
||||
#define XPLM_VK_F11 0x7A
|
||||
|
||||
#define XPLM_VK_F12 0x7B
|
||||
#define XPLM_VK_F12 0x7B
|
||||
|
||||
#define XPLM_VK_F13 0x7C
|
||||
#define XPLM_VK_F13 0x7C
|
||||
|
||||
#define XPLM_VK_F14 0x7D
|
||||
#define XPLM_VK_F14 0x7D
|
||||
|
||||
#define XPLM_VK_F15 0x7E
|
||||
#define XPLM_VK_F15 0x7E
|
||||
|
||||
#define XPLM_VK_F16 0x7F
|
||||
#define XPLM_VK_F16 0x7F
|
||||
|
||||
#define XPLM_VK_F17 0x80
|
||||
#define XPLM_VK_F17 0x80
|
||||
|
||||
#define XPLM_VK_F18 0x81
|
||||
#define XPLM_VK_F18 0x81
|
||||
|
||||
#define XPLM_VK_F19 0x82
|
||||
#define XPLM_VK_F19 0x82
|
||||
|
||||
#define XPLM_VK_F20 0x83
|
||||
#define XPLM_VK_F20 0x83
|
||||
|
||||
#define XPLM_VK_F21 0x84
|
||||
#define XPLM_VK_F21 0x84
|
||||
|
||||
#define XPLM_VK_F22 0x85
|
||||
#define XPLM_VK_F22 0x85
|
||||
|
||||
#define XPLM_VK_F23 0x86
|
||||
#define XPLM_VK_F23 0x86
|
||||
|
||||
#define XPLM_VK_F24 0x87
|
||||
#define XPLM_VK_F24 0x87
|
||||
|
||||
/* The following definitions are extended and are not based on the Microsoft *
|
||||
* key set. */
|
||||
#define XPLM_VK_EQUAL 0xB0
|
||||
/* The following definitions are extended and are not based on the Microsoft *
|
||||
* key set. */
|
||||
#define XPLM_VK_EQUAL 0xB0
|
||||
|
||||
#define XPLM_VK_MINUS 0xB1
|
||||
#define XPLM_VK_MINUS 0xB1
|
||||
|
||||
#define XPLM_VK_RBRACE 0xB2
|
||||
#define XPLM_VK_RBRACE 0xB2
|
||||
|
||||
#define XPLM_VK_LBRACE 0xB3
|
||||
#define XPLM_VK_LBRACE 0xB3
|
||||
|
||||
#define XPLM_VK_QUOTE 0xB4
|
||||
#define XPLM_VK_QUOTE 0xB4
|
||||
|
||||
#define XPLM_VK_SEMICOLON 0xB5
|
||||
#define XPLM_VK_SEMICOLON 0xB5
|
||||
|
||||
#define XPLM_VK_BACKSLASH 0xB6
|
||||
#define XPLM_VK_BACKSLASH 0xB6
|
||||
|
||||
#define XPLM_VK_COMMA 0xB7
|
||||
#define XPLM_VK_COMMA 0xB7
|
||||
|
||||
#define XPLM_VK_SLASH 0xB8
|
||||
#define XPLM_VK_SLASH 0xB8
|
||||
|
||||
#define XPLM_VK_PERIOD 0xB9
|
||||
#define XPLM_VK_PERIOD 0xB9
|
||||
|
||||
#define XPLM_VK_BACKQUOTE 0xBA
|
||||
#define XPLM_VK_BACKQUOTE 0xBA
|
||||
|
||||
#define XPLM_VK_ENTER 0xBB
|
||||
#define XPLM_VK_ENTER 0xBB
|
||||
|
||||
#define XPLM_VK_NUMPAD_ENT 0xBC
|
||||
#define XPLM_VK_NUMPAD_ENT 0xBC
|
||||
|
||||
#define XPLM_VK_NUMPAD_EQ 0xBD
|
||||
#define XPLM_VK_NUMPAD_EQ 0xBD
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+1364
-449
File diff suppressed because it is too large
Load Diff
+248
-224
@@ -2,44 +2,43 @@
|
||||
#define _XPLMGraphics_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMGraphics
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Graphics routines for X-Plane and OpenGL.
|
||||
*
|
||||
* A few notes on coordinate systems:
|
||||
*
|
||||
*
|
||||
* X-Plane uses three kinds of coordinates. Global coordinates are specified
|
||||
* as latitude, longitude and elevation. This coordinate system never changes
|
||||
* but is not very precise.
|
||||
*
|
||||
* OpenGL (or 'local') coordinates are cartesian and shift with the plane.
|
||||
*
|
||||
* OpenGL (or 'local') coordinates are cartesian and shift with the plane.
|
||||
* They offer more precision and are used for 3-d OpenGL drawing. The X axis
|
||||
* is aligned east-west with positive X meaning east. The Y axis is aligned
|
||||
* straight up and down at the point 0,0,0 (but since the earth is round it is
|
||||
* not truly straight up and down at other points). The Z axis is aligned
|
||||
* north-south at 0, 0, 0 with positive Z pointing south (but since the earth
|
||||
* is round it isn't exactly north-south as you move east or west of 0, 0, 0).
|
||||
* One unit is one meter and the point 0,0,0 is on the surface of the earth
|
||||
* at sea level for some latitude and longitude picked by the sim such that
|
||||
* the user's aircraft is reasonably nearby.
|
||||
*
|
||||
* Cockpit coordinates are 2d, with the X axis horizontal and the Y axis
|
||||
* vertical. The point 0,0 is the bottom left and 1024,768 is the upper right
|
||||
* of the screen. This is true no matter what resolution the user's monitor is
|
||||
* in; when running in higher resolution, graphics will be scaled.
|
||||
*
|
||||
* One unit is one meter and the point 0,0,0 is on the surface of the earth at
|
||||
* sea level for some latitude and longitude picked by the sim such that the
|
||||
* user's aircraft is reasonably nearby.
|
||||
*
|
||||
* 2-d Panel coordinates are 2d, with the X axis horizontal and the Y axis
|
||||
* vertical. The point 0,0 is the bottom left and 1024,768 is the upper
|
||||
* right of the screen. This is true no matter what resolution the user's
|
||||
* monitor is in; when running in higher resolution, graphics will be
|
||||
* scaled.
|
||||
*
|
||||
* Use X-Plane's routines to convert between global and local coordinates. Do
|
||||
* not attempt to do this conversion yourself; the precise 'roundness' of
|
||||
* X-Plane's physics model may not match your own, and (to make things
|
||||
* X-Plane's physics model may not match your own, and (to make things
|
||||
* weirder) the user can potentially customize the physics of the current
|
||||
* planet.
|
||||
* planet.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -53,286 +52,306 @@ extern "C" {
|
||||
* X-PLANE GRAPHICS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These routines allow you to use OpenGL with X-Plane.
|
||||
* These routines allow you to use OpenGL with X-Plane.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMTextureID
|
||||
*
|
||||
*
|
||||
* XPLM Texture IDs name well-known textures in the sim for you to use. This
|
||||
* allows you to recycle textures from X-Plane, saving VRAM.
|
||||
*
|
||||
* *Warning*: do not use these enums. The only remaining use they have is to
|
||||
* access the legacy compatibility v10 UI texture; if you need this, get it
|
||||
* via the Widgets library.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* The bitmap that contains window outlines, button outlines, fonts, etc. */
|
||||
xplm_Tex_GeneralInterface = 0
|
||||
/* The bitmap that contains window outlines, button outlines, fonts, etc. */
|
||||
xplm_Tex_GeneralInterface = 0,
|
||||
|
||||
/* The exterior paint for the user's aircraft (daytime). */
|
||||
,
|
||||
xplm_Tex_AircraftPaint = 1
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* The exterior paint for the user's aircraft (daytime). */
|
||||
xplm_Tex_AircraftPaint = 1,
|
||||
|
||||
/* The exterior light map for the user's aircraft. */
|
||||
,
|
||||
xplm_Tex_AircraftLiteMap = 2
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* The exterior light map for the user's aircraft. */
|
||||
xplm_Tex_AircraftLiteMap = 2,
|
||||
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
|
||||
};
|
||||
typedef int XPLMTextureID;
|
||||
|
||||
/*
|
||||
* XPLMSetGraphicsState
|
||||
*
|
||||
* XPLMSetGraphicsState changes OpenGL's graphics state in a number of ways:
|
||||
*
|
||||
* inEnableFog - enables or disables fog, equivalent to: glEnable(GL_FOG);
|
||||
*
|
||||
* inNumberTexUnits - enables or disables a number of multitexturing units. If
|
||||
* the number is 0, 2d texturing is disabled entirely, as in
|
||||
* glDisable(GL_TEXTURE_2D); Otherwise, 2d texturing is enabled, and a
|
||||
* number of multitexturing units are enabled sequentially, starting with
|
||||
* unit 0, e.g. glActiveTextureARB(GL_TEXTURE0_ARB); glEnable
|
||||
* (GL_TEXTURE_2D);
|
||||
*
|
||||
* inEnableLighting - enables or disables OpenGL lighting, e.g.
|
||||
* glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);
|
||||
*
|
||||
* inEnableAlphaTesting - enables or disables the alpha test per pixel, e.g.
|
||||
* glEnable(GL_ALPHA_TEST);
|
||||
*
|
||||
* inEnableAlphaBlending - enables or disables alpha blending per pixel, e.g.
|
||||
* glEnable(GL_BLEND);
|
||||
*
|
||||
* inEnableDepthTesting - enables per pixel depth testing, as in
|
||||
* glEnable(GL_DEPTH_TEST);
|
||||
*
|
||||
* inEnableDepthWriting - enables writing back of depth information to the
|
||||
* depth bufffer, as in glDepthMask(GL_TRUE);
|
||||
*
|
||||
*
|
||||
* XPLMSetGraphicsState changes OpenGL's fixed function pipeline state. You
|
||||
* are not responsible for restoring any state that is accessed via
|
||||
* XPLMSetGraphicsState, but you are responsible for not accessing this state
|
||||
* directly.
|
||||
*
|
||||
* - inEnableFog - enables or disables fog, equivalent to: glEnable(GL_FOG);
|
||||
* - inNumberTexUnits - enables or disables a number of multitexturing units.
|
||||
* If the number is 0, 2d texturing is disabled entirely, as in
|
||||
* glDisable(GL_TEXTURE_2D); Otherwise, 2d texturing is enabled, and a
|
||||
* number of multitexturing units are enabled sequentially, starting with
|
||||
* unit 0, e.g. glActiveTextureARB(GL_TEXTURE0_ARB); glEnable
|
||||
* (GL_TEXTURE_2D);
|
||||
* - inEnableLighting - enables or disables OpenGL lighting, e.g.
|
||||
* glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);
|
||||
* - inEnableAlphaTesting - enables or disables the alpha test per pixel, e.g.
|
||||
* glEnable(GL_ALPHA_TEST);
|
||||
* - inEnableAlphaBlending - enables or disables alpha blending per pixel,
|
||||
* e.g. glEnable(GL_BLEND);
|
||||
* - inEnableDepthTesting - enables per pixel depth testing, as in
|
||||
* glEnable(GL_DEPTH_TEST);
|
||||
* - inEnableDepthWriting - enables writing back of depth information to the
|
||||
* depth bufffer, as in glDepthMask(GL_TRUE);
|
||||
*
|
||||
* The purpose of this function is to change OpenGL state while keeping
|
||||
* X-Plane aware of the state changes; this keeps X-Plane from getting
|
||||
* surprised by OGL state changes, and prevents X-Plane and plug-ins from
|
||||
* having to set all state before all draws; XPLMSetGraphicsState internally
|
||||
* skips calls to change state that is already properly enabled.
|
||||
*
|
||||
* X-Plane does not have a 'default' OGL state to plug-ins; plug-ins should
|
||||
* totally set OGL state before drawing. Use XPLMSetGraphicsState instead of
|
||||
* any of the above OpenGL calls.
|
||||
*
|
||||
*
|
||||
* X-Plane does not have a 'default' OGL state for plug-ins with respect to
|
||||
* the above state vector; plug-ins should totally set OGL state using this
|
||||
* API before drawing. Use XPLMSetGraphicsState instead of any of the above
|
||||
* OpenGL calls.
|
||||
*
|
||||
* WARNING: Any routine that performs drawing (e.g. XPLMDrawString or widget
|
||||
* code) may change X-Plane's state. Always set state before drawing after
|
||||
* unknown code has executed.
|
||||
*
|
||||
* *Deprecation Warnings*: X-Plane's lighting and fog environemnt is
|
||||
* significantly more complex than the fixed function pipeline can express;
|
||||
* do not assume that lighting and fog state is a good approximation for 3-d
|
||||
* drawing. Prefer to use XPLMInstancing to draw objects. All calls to
|
||||
* XPLMSetGraphicsState should have no fog or lighting.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetGraphicsState(int inEnableFog,
|
||||
int inNumberTexUnits,
|
||||
int inEnableLighting,
|
||||
int inEnableAlphaTesting,
|
||||
int inEnableAlphaBlending,
|
||||
int inEnableDepthTesting,
|
||||
int inEnableDepthWriting);
|
||||
XPLM_API void XPLMSetGraphicsState(
|
||||
int inEnableFog,
|
||||
int inNumberTexUnits,
|
||||
int inEnableLighting,
|
||||
int inEnableAlphaTesting,
|
||||
int inEnableAlphaBlending,
|
||||
int inEnableDepthTesting,
|
||||
int inEnableDepthWriting);
|
||||
|
||||
/*
|
||||
* XPLMBindTexture2d
|
||||
*
|
||||
* XPLMBindTexture2d changes what texture is bound to the 2d texturing target.
|
||||
* This routine caches the current 2d texture across all texturing units in
|
||||
* the sim and plug-ins, preventing extraneous binding. For example, consider
|
||||
* several plug-ins running in series; if they all use the 'general interface'
|
||||
* bitmap to do UI, calling this function will skip the rebinding of the
|
||||
* general interface texture on all but the first plug-in, which can provide
|
||||
* better frame rate son some graphics cards.
|
||||
*
|
||||
*
|
||||
* XPLMBindTexture2d changes what texture is bound to the 2d texturing
|
||||
* target. This routine caches the current 2d texture across all texturing
|
||||
* units in the sim and plug-ins, preventing extraneous binding. For
|
||||
* example, consider several plug-ins running in series; if they all use the
|
||||
* 'general interface' bitmap to do UI, calling this function will skip the
|
||||
* rebinding of the general interface texture on all but the first plug-in,
|
||||
* which can provide better frame rate son some graphics cards.
|
||||
*
|
||||
* inTextureID is the ID of the texture object to bind; inTextureUnit is a
|
||||
* zero-based texture unit (e.g. 0 for the first one), up to a maximum of 4
|
||||
* units. (This number may increase in future versions of x-plane.)
|
||||
*
|
||||
* Use this routine instead of glBindTexture(GL_TEXTURE_2D, ....);
|
||||
* zero-based texture unit (e.g. 0 for the first one), up to a maximum of 4
|
||||
* units. (This number may increase in future versions of X-Plane.)
|
||||
*
|
||||
* Use this routine instead of glBindTexture(GL_TEXTURE_2D, ....);
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMBindTexture2d(int inTextureNum, int inTextureUnit);
|
||||
XPLM_API void XPLMBindTexture2d(
|
||||
int inTextureNum,
|
||||
int inTextureUnit);
|
||||
|
||||
/*
|
||||
* XPLMGenerateTextureNumbers
|
||||
*
|
||||
* This routine generates unused texture numbers that a plug-in can use to
|
||||
* safely bind textures. Use this routine instead of glGenTextures;
|
||||
* glGenTextures will allocate texture numbers in ranges that X-Plane reserves
|
||||
* for its own use but does not always use; for example, it might provide an
|
||||
* ID within the range of textures reserved for terrain...loading a new .env
|
||||
* file as the plane flies might then cause X-Plane to use this texture ID.
|
||||
* X-Plane will then overwrite the plug-ins texture. This routine returns
|
||||
* texture IDs that are out of X-Plane's usage range.
|
||||
*
|
||||
* Use this routine instead of glGenTextures to generate new texture object
|
||||
* IDs. This routine historically ensured that plugins don't use texure IDs
|
||||
* that X-Plane is reserving for its own use.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMGenerateTextureNumbers(int *outTextureIDs, int inCount);
|
||||
XPLM_API void XPLMGenerateTextureNumbers(
|
||||
int * outTextureIDs,
|
||||
int inCount);
|
||||
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/*
|
||||
* XPLMGetTexture
|
||||
*
|
||||
* XPLMGetTexture returns the OpenGL texture enumeration of an X-Plane texture
|
||||
* based on a generic identifying code. For example, you can get the texture
|
||||
* for X-Plane's UI bitmaps. This allows you to build new gauges that take
|
||||
* advantage of x-plane's textures, for smooth artwork integration and also
|
||||
* saving texture memory. Note that the texture might not be loaded yet,
|
||||
* depending on what the plane's panel contains.
|
||||
*
|
||||
* OPEN ISSUE: We really need a way to make sure X-Plane loads this texture if
|
||||
* it isn't around, or at least a way to find out whether it is loaded or not.
|
||||
*
|
||||
* XPLMGetTexture returns the OpenGL texture ID of an X-Plane texture based on
|
||||
* a generic identifying code. For example, you can get the texture for
|
||||
* X-Plane's UI bitmaps.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMGetTexture(XPLMTextureID inTexture);
|
||||
XPLM_API int XPLMGetTexture(
|
||||
XPLMTextureID inTexture);
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
|
||||
/*
|
||||
* XPLMWorldToLocal
|
||||
*
|
||||
*
|
||||
* This routine translates coordinates from latitude, longitude, and altitude
|
||||
* to local scene coordinates. Latitude and longitude are in decimal degrees,
|
||||
* and altitude is in meters MSL (mean sea level). The XYZ coordinates are in
|
||||
* meters in the local OpenGL coordinate system.
|
||||
* meters in the local OpenGL coordinate system.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMWorldToLocal(double inLatitude,
|
||||
double inLongitude,
|
||||
double inAltitude,
|
||||
double *outX,
|
||||
double *outY,
|
||||
double *outZ);
|
||||
XPLM_API void XPLMWorldToLocal(
|
||||
double inLatitude,
|
||||
double inLongitude,
|
||||
double inAltitude,
|
||||
double * outX,
|
||||
double * outY,
|
||||
double * outZ);
|
||||
|
||||
/*
|
||||
* XPLMLocalToWorld
|
||||
*
|
||||
*
|
||||
* This routine translates a local coordinate triplet back into latitude,
|
||||
* longitude, and altitude. Latitude and longitude are in decimal degrees,
|
||||
* and altitude is in meters MSL (mean sea level). The XYZ coordinates are in
|
||||
* meters in the local OpenGL coordinate system.
|
||||
*
|
||||
*
|
||||
* NOTE: world coordinates are less precise than local coordinates; you should
|
||||
* try to avoid round tripping from local to world and back.
|
||||
* try to avoid round tripping from local to world and back.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMLocalToWorld(double inX,
|
||||
double inY,
|
||||
double inZ,
|
||||
double *outLatitude,
|
||||
double *outLongitude,
|
||||
double *outAltitude);
|
||||
XPLM_API void XPLMLocalToWorld(
|
||||
double inX,
|
||||
double inY,
|
||||
double inZ,
|
||||
double * outLatitude,
|
||||
double * outLongitude,
|
||||
double * outAltitude);
|
||||
|
||||
/*
|
||||
* XPLMDrawTranslucentDarkBox
|
||||
*
|
||||
*
|
||||
* This routine draws a translucent dark box, partially obscuring parts of the
|
||||
* screen but making text easy to read. This is the same graphics primitive
|
||||
* used by X-Plane to show text files and ATC info.
|
||||
* used by X-Plane to show text files and ATC info.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawTranslucentDarkBox(int inLeft,
|
||||
int inTop,
|
||||
int inRight,
|
||||
int inBottom);
|
||||
XPLM_API void XPLMDrawTranslucentDarkBox(
|
||||
int inLeft,
|
||||
int inTop,
|
||||
int inRight,
|
||||
int inBottom);
|
||||
|
||||
/***************************************************************************
|
||||
* X-PLANE TEXT
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMFontID
|
||||
*
|
||||
*
|
||||
* X-Plane features some fixed-character fonts. Each font may have its own
|
||||
* metrics.
|
||||
*
|
||||
*
|
||||
* WARNING: Some of these fonts are no longer supported or may have changed
|
||||
* geometries. For maximum copmatibility, see the comments below.
|
||||
*
|
||||
*
|
||||
* Note: X-Plane 7 supports proportional-spaced fonts. Since no measuring
|
||||
* routine is available yet, the SDK will normally draw using a fixed-width
|
||||
* font. You can use a dataref to enable proportional font drawing on XP7 if
|
||||
* you want to.
|
||||
* you want to.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* Mono-spaced font for user interface. Available in all versions of the
|
||||
SDK. */
|
||||
xplmFont_Basic = 0
|
||||
/* Mono-spaced font for user interface. Available in all versions of the SDK.*/
|
||||
xplmFont_Basic = 0,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_Menus = 1
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_Menus = 1,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_Metal = 2
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_Metal = 2,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_Led = 3
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_Led = 3,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_LedWide = 4
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_LedWide = 4,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_PanelHUD = 5
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_PanelHUD = 5,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_PanelEFIS = 6
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_PanelEFIS = 6,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_PanelGPS = 7
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_PanelGPS = 7,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_RadiosGA = 8
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_RadiosGA = 8,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_RadiosBC = 9
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_RadiosBC = 9,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_RadiosHM = 10
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_RadiosHM = 10,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_RadiosGANarrow = 11
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_RadiosGANarrow = 11,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_RadiosBCNarrow = 12
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_RadiosBCNarrow = 12,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_RadiosHMNarrow = 13
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_RadiosHMNarrow = 13,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_Timer = 14
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_Timer = 14,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_FullRound = 15
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_FullRound = 15,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_SmallRound = 16
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_SmallRound = 16,
|
||||
|
||||
/* Deprecated, do not use. */
|
||||
,
|
||||
xplmFont_Menus_Localized = 17
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/* Deprecated, do not use. */
|
||||
xplmFont_Menus_Localized = 17,
|
||||
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
#if defined(XPLM200)
|
||||
/* Proportional UI font. */
|
||||
,
|
||||
xplmFont_Proportional = 18
|
||||
/* Proportional UI font. */
|
||||
xplmFont_Proportional = 18,
|
||||
|
||||
#endif /* XPLM200 */
|
||||
|
||||
@@ -341,69 +360,74 @@ typedef int XPLMFontID;
|
||||
|
||||
/*
|
||||
* XPLMDrawString
|
||||
*
|
||||
*
|
||||
* This routine draws a NULL termianted string in a given font. Pass in the
|
||||
* lower left pixel that the character is to be drawn onto. Also pass the
|
||||
* character and font ID. This function returns the x offset plus the width of
|
||||
* all drawn characters. The color to draw in is specified as a pointer to an
|
||||
* array of three floating point colors, representing RGB intensities from 0.0
|
||||
* to 1.0.
|
||||
* to 1.0.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawString(float *inColorRGB,
|
||||
int inXOffset,
|
||||
int inYOffset,
|
||||
char *inChar,
|
||||
int *inWordWrapWidth, /* Can be NULL */
|
||||
XPLMFontID inFontID);
|
||||
XPLM_API void XPLMDrawString(
|
||||
float * inColorRGB,
|
||||
int inXOffset,
|
||||
int inYOffset,
|
||||
char * inChar,
|
||||
int * inWordWrapWidth, /* Can be NULL */
|
||||
XPLMFontID inFontID);
|
||||
|
||||
/*
|
||||
* XPLMDrawNumber
|
||||
*
|
||||
*
|
||||
* This routine draws a number similar to the digit editing fields in
|
||||
* PlaneMaker and data output display in X-Plane. Pass in a color, a
|
||||
* position, a floating point value, and formatting info. Specify how many
|
||||
* integer and how many decimal digits to show and whether to show a sign, as
|
||||
* integer and how many decimal digits to show and whether to show a sign, as
|
||||
* well as a character set. This routine returns the xOffset plus width of the
|
||||
* string drawn.
|
||||
* string drawn.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawNumber(float *inColorRGB,
|
||||
int inXOffset,
|
||||
int inYOffset,
|
||||
double inValue,
|
||||
int inDigits,
|
||||
int inDecimals,
|
||||
int inShowSign,
|
||||
XPLMFontID inFontID);
|
||||
XPLM_API void XPLMDrawNumber(
|
||||
float * inColorRGB,
|
||||
int inXOffset,
|
||||
int inYOffset,
|
||||
double inValue,
|
||||
int inDigits,
|
||||
int inDecimals,
|
||||
int inShowSign,
|
||||
XPLMFontID inFontID);
|
||||
|
||||
/*
|
||||
* XPLMGetFontDimensions
|
||||
*
|
||||
*
|
||||
* This routine returns the width and height of a character in a given font.
|
||||
* It also tells you if the font only supports numeric digits. Pass NULL if
|
||||
* you don't need a given field. Note that for a proportional font the width
|
||||
* will be an arbitrary, hopefully average width.
|
||||
* will be an arbitrary, hopefully average width.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMGetFontDimensions(XPLMFontID inFontID,
|
||||
int *outCharWidth, /* Can be NULL */
|
||||
int *outCharHeight, /* Can be NULL */
|
||||
int *outDigitsOnly); /* Can be NULL */
|
||||
XPLM_API void XPLMGetFontDimensions(
|
||||
XPLMFontID inFontID,
|
||||
int * outCharWidth, /* Can be NULL */
|
||||
int * outCharHeight, /* Can be NULL */
|
||||
int * outDigitsOnly); /* Can be NULL */
|
||||
|
||||
#if defined(XPLM200)
|
||||
/*
|
||||
* XPLMMeasureString
|
||||
*
|
||||
* This routine returns the width in pixels of a string using a given font.
|
||||
*
|
||||
* This routine returns the width in pixels of a string using a given font.
|
||||
* The string is passed as a pointer plus length (and does not need to be null
|
||||
* terminated); this is used to allow for measuring substrings. The return
|
||||
* value is floating point; it is possible that future font drawing may allow
|
||||
* for fractional pixels.
|
||||
* for fractional pixels.
|
||||
*
|
||||
*/
|
||||
XPLM_API float
|
||||
XPLMMeasureString(XPLMFontID inFontID, const char *inChar, int inNumChars);
|
||||
XPLM_API float XPLMMeasureString(
|
||||
XPLMFontID inFontID,
|
||||
const char * inChar,
|
||||
int inNumChars);
|
||||
#endif /* XPLM200 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
#ifndef _XPLMInstance_h_
|
||||
#define _XPLMInstance_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMInstance
|
||||
***************************************************************************/
|
||||
/*
|
||||
* This API provides instanced drawing of X-Plane objects (.obj files). In
|
||||
* contrast to old drawing APIs, which required you to draw your own objects
|
||||
* per-frame, the instancing API allows you to simply register an OBJ for
|
||||
* drawing, then move or manipulate it later (as needed).
|
||||
*
|
||||
* This provides one tremendous benefit: it keeps all dataref operations for
|
||||
* your object in one place. Because datarefs are main thread only, allowing
|
||||
* dataref access anywhere is a serious performance bottleneck for the
|
||||
* simulator---the whole simulator has to pause and wait for each dataref
|
||||
* access. This performance penalty will only grow worse as X-Plane moves
|
||||
* toward an ever more heavily multithreaded engine.
|
||||
*
|
||||
* The instancing API allows X-Plane to isolate all dataref manipulations for
|
||||
* all plugin object drawing to one place, potentially providing huge
|
||||
* performance gains.
|
||||
*
|
||||
* Here's how it works:
|
||||
*
|
||||
* When an instance is created, it provides a list of all datarefs you want to
|
||||
* manipulate in for the OBJ in the future. This list of datarefs replaces the
|
||||
* ad-hoc collections of dataref objects previously used by art assets. Then,
|
||||
* per-frame, you can manipulate the instance by passing in a "block" of
|
||||
* packed floats representing the current values of the datarefs for your
|
||||
* instance. (Note that the ordering of this set of packed floats must exactly
|
||||
* match the ordering of the datarefs when you created your instance.)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "XPLMDefs.h"
|
||||
#include "XPLMScenery.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* Instance Creation and Destruction
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Registers and unregisters instances.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMInstanceRef
|
||||
*
|
||||
* An opaque handle to an instance.
|
||||
*
|
||||
*/
|
||||
typedef void * XPLMInstanceRef;
|
||||
|
||||
/*
|
||||
* XPLMCreateInstance
|
||||
*
|
||||
* XPLMCreateInstance creates a new instance, managed by your plug-in, and
|
||||
* returns a handle to the instance. A few important requirements:
|
||||
*
|
||||
* * The object passed in must be fully loaded and returned from the XPLM
|
||||
* before you can create your instance; you cannot pass a null obj ref, nor
|
||||
* can you change the ref later.
|
||||
*
|
||||
* * If you use any custom datarefs in your object, they must be registered
|
||||
* before the object is loaded. This is true even if their data will be
|
||||
* provided via the instance dataref list.
|
||||
*
|
||||
* * The instance dataref array must be a valid ptr to an array of at least
|
||||
* one item that is null terminated. That is, if you do not want any
|
||||
* datarefs, you must passa ptr to an array with a null item. You cannot
|
||||
* pass null for this.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMInstanceRef XPLMCreateInstance(
|
||||
XPLMObjectRef obj,
|
||||
const char ** datarefs);
|
||||
|
||||
/*
|
||||
* XPLMDestroyInstance
|
||||
*
|
||||
* XPLMDestroyInstance destroys and deallocates your instance; once called,
|
||||
* you are still responsible for releasing the OBJ ref.
|
||||
*
|
||||
* Tip: you can release your OBJ ref after you call XPLMCreateInstance as long
|
||||
* as you never use it again; the instance will maintain its own reference to
|
||||
* the OBJ and the object OBJ be deallocated when the instance is destroyed.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDestroyInstance(
|
||||
XPLMInstanceRef instance);
|
||||
|
||||
/***************************************************************************
|
||||
* Instance Manipulation
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
* XPLMInstanceSetPosition
|
||||
*
|
||||
* Updates both the position of the instance and all datarefs you registered
|
||||
* for it. Call this from a flight loop callback or UI callback.
|
||||
*
|
||||
* __DO NOT__ call XPLMInstanceSetPosition from a drawing callback; the whole
|
||||
* point of instancing is that you do not need any drawing callbacks. Setting
|
||||
* instance data from a drawing callback may have undefined consequences, and
|
||||
* the drawing callback hurts FPS unnecessarily.
|
||||
*
|
||||
* The memory pointed to by the data pointer must be large enough to hold one
|
||||
* float for every data ref you have registered, and must contain valid
|
||||
* floating point data.
|
||||
*
|
||||
* BUG: before X-Plane 11.50, if you have no dataref registered, you must
|
||||
* still pass a valid pointer for data and not null.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMInstanceSetPosition(
|
||||
XPLMInstanceRef instance,
|
||||
const XPLMDrawInfo_t * new_position,
|
||||
const float * data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,628 @@
|
||||
#ifndef _XPLMMap_h_
|
||||
#define _XPLMMap_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMMap
|
||||
***************************************************************************/
|
||||
/*
|
||||
* This API allows you to create new layers within X-Plane maps. Your layers
|
||||
* can draw arbitrary OpenGL, but they conveniently also have access to
|
||||
* X-Plane's built-in icon and label drawing functions.
|
||||
*
|
||||
* As of X-Plane 11, map drawing happens in three stages:
|
||||
*
|
||||
* 1. backgrounds and "fill,"
|
||||
* 2. icons, and
|
||||
* 3. labels.
|
||||
*
|
||||
* Thus, all background drawing gets layered beneath all icons, which likewise
|
||||
* get layered beneath all labels. Within each stage, the map obeys a
|
||||
* consistent layer ordering, such that "fill" layers (layers that cover a
|
||||
* large amount of map area, like the terrain and clouds) appear beneath
|
||||
* "markings" layers (like airport icons). This ensures that layers with fine
|
||||
* details don't get obscured by layers with larger details.
|
||||
*
|
||||
* The XPLM map API reflects both aspects of this draw layering: you can
|
||||
* register a layer as providing either markings or fill, and X-Plane will
|
||||
* draw your fill layers beneath your markings layers (regardless of
|
||||
* registration order). Likewise, you are guaranteed that your layer's icons
|
||||
* (added from within an icon callback) will go above your layer's OpenGL
|
||||
* drawing, and your labels will go above your icons.
|
||||
*
|
||||
* The XPLM guarantees that all plugin-created fill layers go on top of all
|
||||
* native X-Plane fill layers, and all plugin-created markings layers go on
|
||||
* top of all X-Plane markings layers (with the exception of the aircraft
|
||||
* icons). It also guarantees that the draw order of your own plugin's layers
|
||||
* will be consistent. But, for layers created by different plugins, the only
|
||||
* guarantee is that we will draw all of one plugin's layers of each type
|
||||
* (fill, then markings), then all of the others'; we don't guarantee which
|
||||
* plugin's fill and markings layers go on top of the other's.
|
||||
*
|
||||
* As of X-Plane 11, maps use true cartographic projections for their drawing,
|
||||
* and different maps may use different projections. For that reason, all
|
||||
* drawing calls include an opaque handle for the projection you should use to
|
||||
* do the drawing. Any time you would draw at a particular latitude/longitude,
|
||||
* you'll need to ask the projection to translate that position into "map
|
||||
* coordinates." (Note that the projection is guaranteed not to change between
|
||||
* calls to your prepare-cache hook, so if you cache your map coordinates
|
||||
* ahead of time, there's no need to re-project them when you actually draw.)
|
||||
*
|
||||
* In addition to mapping normal latitude/longitude locations into map
|
||||
* coordinates, the projection APIs also let you know the current heading for
|
||||
* north. (Since X-Plane 11 maps can rotate to match the heading of the user's
|
||||
* aircraft, it's not safe to assume that north is at zero degrees rotation.)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "XPLMDefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(XPLM300)
|
||||
/***************************************************************************
|
||||
* DRAWING CALLBACKS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* When you create a new map layer (using XPLMCreateMapLayer), you can provide
|
||||
* any or all of these callbacks. They allow you to insert your own OpenGL
|
||||
* drawing, text labels, and icons into the X-Plane map at the appropriate
|
||||
* places, allowing your layer to behave as similarly to X-Plane's built-in
|
||||
* layers as possible.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMMapLayerID
|
||||
*
|
||||
* This is an opaque handle for a plugin-created map layer. Pass it to the map
|
||||
* drawing APIs from an appropriate callback to draw in the layer you created.
|
||||
*
|
||||
*/
|
||||
typedef void * XPLMMapLayerID;
|
||||
|
||||
/*
|
||||
* XPLMMapProjectionID
|
||||
*
|
||||
* This is an opaque handle for a map projection. Pass it to the projection
|
||||
* APIs to translate between map coordinates and latitude/longitudes.
|
||||
*
|
||||
*/
|
||||
typedef void * XPLMMapProjectionID;
|
||||
|
||||
/*
|
||||
* XPLMMapStyle
|
||||
*
|
||||
* Indicates the visual style being drawn by the map. In X-Plane, the user can
|
||||
* choose between a number of map types, and different map types may have use
|
||||
* a different visual representation for the same elements (for instance, the
|
||||
* visual style of the terrain layer changes drastically between the VFR and
|
||||
* IFR layers), or certain layers may be disabled entirely in some map types
|
||||
* (e.g., localizers are only visible in the IFR low-enroute style).
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
xplm_MapStyle_VFR_Sectional = 0,
|
||||
|
||||
xplm_MapStyle_IFR_LowEnroute = 1,
|
||||
|
||||
xplm_MapStyle_IFR_HighEnroute = 2,
|
||||
|
||||
|
||||
};
|
||||
typedef int XPLMMapStyle;
|
||||
|
||||
/*
|
||||
* XPLMMapDrawingCallback_f
|
||||
*
|
||||
* This is the OpenGL map drawing callback for plugin-created map layers. You
|
||||
* can perform arbitrary OpenGL drawing from this callback, with one
|
||||
* exception: changes to the Z-buffer are not permitted, and will result in
|
||||
* map drawing errors.
|
||||
*
|
||||
* All drawing done from within this callback appears beneath all built-in
|
||||
* X-Plane icons and labels, but above the built-in "fill" layers (layers
|
||||
* providing major details, like terrain and water). Note, however, that the
|
||||
* relative ordering between the drawing callbacks of different plugins is not
|
||||
* guaranteed.
|
||||
*
|
||||
*/
|
||||
typedef void (* XPLMMapDrawingCallback_f)(
|
||||
XPLMMapLayerID inLayer,
|
||||
const float * inMapBoundsLeftTopRightBottom,
|
||||
float zoomRatio,
|
||||
float mapUnitsPerUserInterfaceUnit,
|
||||
XPLMMapStyle mapStyle,
|
||||
XPLMMapProjectionID projection,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMMapIconDrawingCallback_f
|
||||
*
|
||||
* This is the icon drawing callback that enables plugin-created map layers to
|
||||
* draw icons using X-Plane's built-in icon drawing functionality. You can
|
||||
* request an arbitrary number of PNG icons to be drawn via
|
||||
* XPLMDrawMapIconFromSheet() from within this callback, but you may not
|
||||
* perform any OpenGL drawing here.
|
||||
*
|
||||
* Icons enqueued by this function will appear above all OpenGL drawing
|
||||
* (performed by your optional XPLMMapDrawingCallback_f), and above all
|
||||
* built-in X-Plane map icons of the same layer type ("fill" or "markings," as
|
||||
* determined by the XPLMMapLayerType in your XPLMCreateMapLayer_t). Note,
|
||||
* however, that the relative ordering between the drawing callbacks of
|
||||
* different plugins is not guaranteed.
|
||||
*
|
||||
*/
|
||||
typedef void (* XPLMMapIconDrawingCallback_f)(
|
||||
XPLMMapLayerID inLayer,
|
||||
const float * inMapBoundsLeftTopRightBottom,
|
||||
float zoomRatio,
|
||||
float mapUnitsPerUserInterfaceUnit,
|
||||
XPLMMapStyle mapStyle,
|
||||
XPLMMapProjectionID projection,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMMapLabelDrawingCallback_f
|
||||
*
|
||||
* This is the label drawing callback that enables plugin-created map layers
|
||||
* to draw text labels using X-Plane's built-in labeling functionality. You
|
||||
* can request an arbitrary number of text labels to be drawn via
|
||||
* XPLMDrawMapLabel() from within this callback, but you may not perform any
|
||||
* OpenGL drawing here.
|
||||
*
|
||||
* Labels enqueued by this function will appear above all OpenGL drawing
|
||||
* (performed by your optional XPLMMapDrawingCallback_f), and above all
|
||||
* built-in map icons and labels of the same layer type ("fill" or "markings,"
|
||||
* as determined by the XPLMMapLayerType in your XPLMCreateMapLayer_t). Note,
|
||||
* however, that the relative ordering between the drawing callbacks of
|
||||
* different plugins is not guaranteed.
|
||||
*
|
||||
*/
|
||||
typedef void (* XPLMMapLabelDrawingCallback_f)(
|
||||
XPLMMapLayerID inLayer,
|
||||
const float * inMapBoundsLeftTopRightBottom,
|
||||
float zoomRatio,
|
||||
float mapUnitsPerUserInterfaceUnit,
|
||||
XPLMMapStyle mapStyle,
|
||||
XPLMMapProjectionID projection,
|
||||
void * inRefcon);
|
||||
|
||||
#endif /* XPLM300 */
|
||||
#if defined(XPLM300)
|
||||
/***************************************************************************
|
||||
* LAYER MANAGEMENT CALLBACKS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These are various "bookkeeping" callbacks that your map layer can receive
|
||||
* (if you provide the callback in your XPLMCreateMapLayer_t). They allow you
|
||||
* to manage the lifecycle of your layer, as well as cache any
|
||||
* computationally-intensive preparation you might need for drawing.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMMapPrepareCacheCallback_f
|
||||
*
|
||||
* A callback used to allow you to cache whatever information your layer needs
|
||||
* to draw in the current map area.
|
||||
*
|
||||
* This is called each time the map's total bounds change. This is typically
|
||||
* triggered by new DSFs being loaded, such that X-Plane discards old,
|
||||
* now-distant DSFs and pulls in new ones. At that point, the available bounds
|
||||
* of the map also change to match the new DSF area.
|
||||
*
|
||||
* By caching just the information you need to draw in this area, your future
|
||||
* draw calls can be made faster, since you'll be able to simply "splat" your
|
||||
* precomputed information each frame.
|
||||
*
|
||||
* We guarantee that the map projection will not change between successive
|
||||
* prepare cache calls, nor will any draw call give you bounds outside these
|
||||
* total map bounds. So, if you cache the projected map coordinates of all the
|
||||
* items you might want to draw in the total map area, you can be guaranteed
|
||||
* that no draw call will be asked to do any new work.
|
||||
*
|
||||
*/
|
||||
typedef void (* XPLMMapPrepareCacheCallback_f)(
|
||||
XPLMMapLayerID inLayer,
|
||||
const float * inTotalMapBoundsLeftTopRightBottom,
|
||||
XPLMMapProjectionID projection,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMMapWillBeDeletedCallback_f
|
||||
*
|
||||
* Called just before your map layer gets deleted. Because SDK-created map
|
||||
* layers have the same lifetime as the X-Plane map that contains them, if the
|
||||
* map gets unloaded from memory, your layer will too.
|
||||
*
|
||||
*/
|
||||
typedef void (* XPLMMapWillBeDeletedCallback_f)(
|
||||
XPLMMapLayerID inLayer,
|
||||
void * inRefcon);
|
||||
|
||||
#endif /* XPLM300 */
|
||||
#if defined(XPLM300)
|
||||
/***************************************************************************
|
||||
* MAP LAYER CREATION AND DESTRUCTION
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Enables the creation of new map layers. Layers are created for a particular
|
||||
* instance of the X-Plane map. For instance, if you want your layer to appear
|
||||
* in both the normal map interface and the Instructor Operator Station (IOS),
|
||||
* you would need two separate calls to XPLMCreateMapLayer(), with two
|
||||
* different values for your XPLMCreateMapLayer_t::layer_name.
|
||||
*
|
||||
* Your layer's lifetime will be determined by the lifetime of the map it is
|
||||
* created in. If the map is destroyed (on the X-Plane side), your layer will
|
||||
* be too, and you'll receive a callback to your
|
||||
* XPLMMapWillBeDeletedCallback_f.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMMapLayerType
|
||||
*
|
||||
* Indicates the type of map layer you are creating. Fill layers will always
|
||||
* be drawn beneath markings layers.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* A layer that draws "fill" graphics, like weather patterns, terrain, etc. *
|
||||
* Fill layers frequently cover a large portion of the visible map area. */
|
||||
xplm_MapLayer_Fill = 0,
|
||||
|
||||
/* A layer that provides markings for particular map features, like NAVAIDs, *
|
||||
* airports, etc. Even dense markings layers cover a small portion of the *
|
||||
* total map area. */
|
||||
xplm_MapLayer_Markings = 1,
|
||||
|
||||
|
||||
};
|
||||
typedef int XPLMMapLayerType;
|
||||
|
||||
/* Globally unique identifier for X-Plane's Map window, used as the *
|
||||
* mapToCreateLayerIn parameter in XPLMCreateMapLayer_t */
|
||||
#define XPLM_MAP_USER_INTERFACE "XPLM_MAP_USER_INTERFACE"
|
||||
|
||||
/* Globally unique identifier for X-Plane's Instructor Operator Station *
|
||||
* window, used as the mapToCreateLayerIn parameter in XPLMCreateMapLayer_t */
|
||||
#define XPLM_MAP_IOS "XPLM_MAP_IOS"
|
||||
|
||||
/*
|
||||
* XPLMCreateMapLayer_t
|
||||
*
|
||||
* This structure defines all of the parameters used to create a map layer
|
||||
* using XPLMCreateMapLayer. The structure will be expanded in future SDK APIs
|
||||
* to include more features. Always set the structSize member to the size of
|
||||
* your struct in bytes!
|
||||
*
|
||||
* Each layer must be associated with exactly one map instance in X-Plane.
|
||||
* That map, and that map alone, will call your callbacks. Likewise, when that
|
||||
* map is deleted, your layer will be as well.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
/* Used to inform XPLMCreateMapLayer() of the SDK version you compiled *
|
||||
* against; should always be set to sizeof(XPLMCreateMapLayer_t) */
|
||||
int structSize;
|
||||
/* Globally unique string identifying the map you want this layer to appear *
|
||||
* in. As of XPLM300, this is limited to one of XPLM_MAP_USER_INTERFACE or *
|
||||
* XPLM_MAP_IOS */
|
||||
const char * mapToCreateLayerIn;
|
||||
/* The type of layer you are creating, used to determine draw order (all *
|
||||
* plugin-created markings layers are drawn above all plugin-created fill *
|
||||
* layers) */
|
||||
XPLMMapLayerType layerType;
|
||||
/* Optional callback to inform you this layer is being deleted (due to its *
|
||||
* owning map being destroyed) */
|
||||
XPLMMapWillBeDeletedCallback_f willBeDeletedCallback;
|
||||
/* Optional callback you want to use to prepare your draw cache when the map *
|
||||
* bounds change (set to NULL if you don't want this callback) */
|
||||
XPLMMapPrepareCacheCallback_f prepCacheCallback;
|
||||
/* Optional callback you want to use for arbitrary OpenGL drawing, which goes *
|
||||
* beneath all icons in the map's layering system (set to NULL if you don't *
|
||||
* want this callback) */
|
||||
XPLMMapDrawingCallback_f drawCallback;
|
||||
/* Optional callback you want to use for drawing icons, which go above all *
|
||||
* built-in X-Plane icons (except the aircraft) in the map's layering system *
|
||||
* (set to NULL if you don't want this callback) */
|
||||
XPLMMapIconDrawingCallback_f iconCallback;
|
||||
/* Optional callback you want to use for drawing map labels, which go above *
|
||||
* all built-in X-Plane icons and labels (except those of aircraft) in the *
|
||||
* map's layering system (set to NULL if you don't want this callback) */
|
||||
XPLMMapLabelDrawingCallback_f labelCallback;
|
||||
/* True if you want a checkbox to be created in the map UI to toggle this *
|
||||
* layer on and off; false if the layer should simply always be enabled */
|
||||
int showUiToggle;
|
||||
/* Short label to use for this layer in the user interface */
|
||||
const char * layerName;
|
||||
/* A reference to arbitrary data that will be passed to your callbacks */
|
||||
void * refcon;
|
||||
} XPLMCreateMapLayer_t;
|
||||
|
||||
/*
|
||||
* XPLMCreateMapLayer
|
||||
*
|
||||
* This routine creates a new map layer. You pass in an XPLMCreateMapLayer_t
|
||||
* structure with all of the fields set in. You must set the structSize of
|
||||
* the structure to the size of the actual structure you used.
|
||||
*
|
||||
* Returns NULL if the layer creation failed. This happens most frequently
|
||||
* because the map you specified in your
|
||||
* XPLMCreateMapLayer_t::mapToCreateLayerIn field doesn't exist (that is, if
|
||||
* XPLMMapExists() returns 0 for the specified map). You can use
|
||||
* XPLMRegisterMapCreationHook() to get a notification each time a new map is
|
||||
* opened in X-Plane, at which time you can create layers in it.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMMapLayerID XPLMCreateMapLayer(
|
||||
XPLMCreateMapLayer_t * inParams);
|
||||
|
||||
/*
|
||||
* XPLMDestroyMapLayer
|
||||
*
|
||||
* Destroys a map layer you created (calling your
|
||||
* XPLMMapWillBeDeletedCallback_f if applicable). Returns true if a deletion
|
||||
* took place.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMDestroyMapLayer(
|
||||
XPLMMapLayerID inLayer);
|
||||
|
||||
/*
|
||||
* XPLMMapCreatedCallback_f
|
||||
*
|
||||
* A callback to notify your plugin that a new map has been created in
|
||||
* X-Plane. This is the best time to add a custom map layer using
|
||||
* XPLMCreateMapLayer().
|
||||
*
|
||||
* No OpenGL drawing is permitted within this callback.
|
||||
*
|
||||
*/
|
||||
typedef void (* XPLMMapCreatedCallback_f)(
|
||||
const char * mapIdentifier,
|
||||
void * refcon);
|
||||
|
||||
/*
|
||||
* XPLMRegisterMapCreationHook
|
||||
*
|
||||
* Registers your callback to receive a notification each time a new map is
|
||||
* constructed in X-Plane. This callback is the best time to add your custom
|
||||
* map layer using XPLMCreateMapLayer().
|
||||
*
|
||||
* Note that you will not be notified about any maps that already exist---you
|
||||
* can use XPLMMapExists() to check for maps that were created previously.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMRegisterMapCreationHook(
|
||||
XPLMMapCreatedCallback_f callback,
|
||||
void * refcon);
|
||||
|
||||
/*
|
||||
* XPLMMapExists
|
||||
*
|
||||
* Returns 1 if the map with the specified identifier already exists in
|
||||
* X-Plane. In that case, you can safely call XPLMCreateMapLayer() specifying
|
||||
* that your layer should be added to that map.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMMapExists(
|
||||
const char * mapIdentifier);
|
||||
|
||||
#endif /* XPLM300 */
|
||||
#if defined(XPLM300)
|
||||
/***************************************************************************
|
||||
* MAP DRAWING
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These APIs are only valid from within a map drawing callback (one of
|
||||
* XPLMIconDrawingCallback_t or XPLMMapLabelDrawingCallback_f). Your drawing
|
||||
* callbacks are registered when you create a new map layer as part of your
|
||||
* XPLMCreateMapLayer_t. The functions here hook into X-Plane's built-in map
|
||||
* drawing functionality for icons and labels, so that you get a consistent
|
||||
* style with the rest of the X-Plane map.
|
||||
*
|
||||
* Note that the X-Plane 11 map introduces a strict ordering: layers of type
|
||||
* xplm_MapLayer_Fill get drawn beneath all xplm_MapLayer_Markings layers.
|
||||
* Likewise, all OpenGL drawing (performed in your layer's
|
||||
* XPLMMapDrawingCallback_f) will appear beneath any icons and labels you
|
||||
* draw.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMMapOrientation
|
||||
*
|
||||
* Indicates whether a map element should be match its rotation to the map
|
||||
* itself, or to the user interface. For instance, the map itself may be
|
||||
* rotated such that "up" matches the user's aircraft, but you may want to
|
||||
* draw a text label such that it is always rotated zero degrees relative to
|
||||
* the user's perspective. In that case, you would have it draw with UI
|
||||
* orientation.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* Orient such that a 0 degree rotation matches the map's north */
|
||||
xplm_MapOrientation_Map = 0,
|
||||
|
||||
/* Orient such that a 0 degree rotation is "up" relative to the user interface*/
|
||||
xplm_MapOrientation_UI = 1,
|
||||
|
||||
|
||||
};
|
||||
typedef int XPLMMapOrientation;
|
||||
|
||||
/*
|
||||
* XPLMDrawMapIconFromSheet
|
||||
*
|
||||
* Enables plugin-created map layers to draw PNG icons using X-Plane's
|
||||
* built-in icon drawing functionality. Only valid from within an
|
||||
* XPLMIconDrawingCallback_t (but you can request an arbitrary number of icons
|
||||
* to be drawn from within your callback).
|
||||
*
|
||||
* X-Plane will automatically manage the memory for your texture so that it
|
||||
* only has to be loaded from disk once as long as you continue drawing it
|
||||
* per-frame. (When you stop drawing it, the memory may purged in a "garbage
|
||||
* collection" pass, require a load from disk in the future.)
|
||||
*
|
||||
* Instead of having X-Plane draw a full PNG, this method allows you to use UV
|
||||
* coordinates to request a portion of the image to be drawn. This allows you
|
||||
* to use a single texture load (of an icon sheet, for example) to draw many
|
||||
* icons. Doing so is much more efficient than drawing a dozen different small
|
||||
* PNGs.
|
||||
*
|
||||
* The UV coordinates used here treat the texture you load as being comprised
|
||||
* of a number of identically sized "cells." You specify the width and height
|
||||
* in cells (ds and dt, respectively), as well as the coordinates within the
|
||||
* cell grid for the sub-image you'd like to draw.
|
||||
*
|
||||
* Note that you can use different ds and dt values in subsequent calls with
|
||||
* the same texture sheet. This enables you to use icons of different sizes in
|
||||
* the same sheet if you arrange them properly in the PNG.
|
||||
*
|
||||
* This function is only valid from within an XPLMIconDrawingCallback_t (but
|
||||
* you can request an arbitrary number of icons to be drawn from within your
|
||||
* callback).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawMapIconFromSheet(
|
||||
XPLMMapLayerID layer,
|
||||
const char * inPngPath,
|
||||
int s,
|
||||
int t,
|
||||
int ds,
|
||||
int dt,
|
||||
float mapX,
|
||||
float mapY,
|
||||
XPLMMapOrientation orientation,
|
||||
float rotationDegrees,
|
||||
float mapWidth);
|
||||
|
||||
/*
|
||||
* XPLMDrawMapLabel
|
||||
*
|
||||
* Enables plugin-created map layers to draw text labels using X-Plane's
|
||||
* built-in labeling functionality. Only valid from within an
|
||||
* XPLMMapLabelDrawingCallback_f (but you can request an arbitrary number of
|
||||
* text labels to be drawn from within your callback).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawMapLabel(
|
||||
XPLMMapLayerID layer,
|
||||
const char * inText,
|
||||
float mapX,
|
||||
float mapY,
|
||||
XPLMMapOrientation orientation,
|
||||
float rotationDegrees);
|
||||
|
||||
#endif /* XPLM300 */
|
||||
#if defined(XPLM300)
|
||||
/***************************************************************************
|
||||
* MAP PROJECTIONS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* As of X-Plane 11, the map draws using true cartographic projections, and
|
||||
* different maps may use different projections. Thus, to draw at a particular
|
||||
* latitude and longitude, you must first transform your real-world
|
||||
* coordinates into map coordinates.
|
||||
*
|
||||
* The map projection is also responsible for giving you the current scale of
|
||||
* the map. That is, the projection can tell you how many map units correspond
|
||||
* to 1 meter at a given point.
|
||||
*
|
||||
* Finally, the map projection can give you the current rotation of the map.
|
||||
* Since X-Plane 11 maps can rotate to match the heading of the aircraft, the
|
||||
* map's rotation can potentially change every frame.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMMapProject
|
||||
*
|
||||
* Projects a latitude/longitude into map coordinates. This is the inverse of
|
||||
* XPLMMapUnproject().
|
||||
*
|
||||
* Only valid from within a map layer callback (one of
|
||||
* XPLMMapPrepareCacheCallback_f, XPLMMapDrawingCallback_f,
|
||||
* XPLMMapIconDrawingCallback_f, or XPLMMapLabelDrawingCallback_f.)
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMMapProject(
|
||||
XPLMMapProjectionID projection,
|
||||
double latitude,
|
||||
double longitude,
|
||||
float * outX,
|
||||
float * outY);
|
||||
|
||||
/*
|
||||
* XPLMMapUnproject
|
||||
*
|
||||
* Transforms map coordinates back into a latitude and longitude. This is the
|
||||
* inverse of XPLMMapProject().
|
||||
*
|
||||
* Only valid from within a map layer callback (one of
|
||||
* XPLMMapPrepareCacheCallback_f, XPLMMapDrawingCallback_f,
|
||||
* XPLMMapIconDrawingCallback_f, or XPLMMapLabelDrawingCallback_f.)
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMMapUnproject(
|
||||
XPLMMapProjectionID projection,
|
||||
float mapX,
|
||||
float mapY,
|
||||
double * outLatitude,
|
||||
double * outLongitude);
|
||||
|
||||
/*
|
||||
* XPLMMapScaleMeter
|
||||
*
|
||||
* Returns the number of map units that correspond to a distance of one meter
|
||||
* at a given set of map coordinates.
|
||||
*
|
||||
* Only valid from within a map layer callback (one of
|
||||
* XPLMMapPrepareCacheCallback_f, XPLMMapDrawingCallback_f,
|
||||
* XPLMMapIconDrawingCallback_f, or XPLMMapLabelDrawingCallback_f.)
|
||||
*
|
||||
*/
|
||||
XPLM_API float XPLMMapScaleMeter(
|
||||
XPLMMapProjectionID projection,
|
||||
float mapX,
|
||||
float mapY);
|
||||
|
||||
/*
|
||||
* XPLMMapGetNorthHeading
|
||||
*
|
||||
* Returns the heading (in degrees clockwise) from the positive Y axis in the
|
||||
* cartesian mapping coordinate system to true north at the point passed in.
|
||||
* You can use it as a clockwise rotational offset to align icons and other
|
||||
* 2-d drawing with true north on the map, compensating for rotations in the
|
||||
* map due to projection.
|
||||
*
|
||||
* Only valid from within a map layer callback (one of
|
||||
* XPLMMapPrepareCacheCallback_f, XPLMMapDrawingCallback_f,
|
||||
* XPLMMapIconDrawingCallback_f, or XPLMMapLabelDrawingCallback_f.)
|
||||
*
|
||||
*/
|
||||
XPLM_API float XPLMMapGetNorthHeading(
|
||||
XPLMMapProjectionID projection,
|
||||
float mapX,
|
||||
float mapY);
|
||||
|
||||
#endif /* XPLM300 */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+164
-84
@@ -2,27 +2,46 @@
|
||||
#define _XPLMMenus_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMMenus
|
||||
***************************************************************************/
|
||||
/*
|
||||
* XPLMMenus - Theory of Operation
|
||||
*
|
||||
* Plug-ins can create menus in the menu bar of X-Plane. This is done by
|
||||
* Plug-ins can create menus in the menu bar of X-Plane. This is done by
|
||||
* creating a menu and then creating items. Menus are referred to by an
|
||||
* opaque ID. Items are referred to by index number. For each menu and item
|
||||
* you specify a void *. Per menu you specify a handler function that is
|
||||
* called with each void * when the menu item is picked. Menu item indices
|
||||
* are zero based.
|
||||
* opaque ID. Items are referred to by (zero-based) index number.
|
||||
*
|
||||
* Menus are "sandboxed" between plugins---no plugin can access the menus of
|
||||
* any other plugin. Furthermore, all menu indices are relative to your
|
||||
* plugin's menus only; if your plugin creates two sub-menus in the Plugins
|
||||
* menu at different times, it doesn't matter how many other plugins also
|
||||
* create sub-menus of Plugins in the intervening time: your sub-menus will be
|
||||
* given menu indices 0 and 1. (The SDK does some work in the back-end to
|
||||
* filter out menus that are irrelevant to your plugin in order to deliver
|
||||
* this consistency for each plugin.)
|
||||
*
|
||||
* When you create a menu item, you specify how we should handle clicks on
|
||||
* that menu item. You can either have the XPLM trigger a callback (the
|
||||
* XPLMMenuHandler_f associated with the menu that contains the item), or you
|
||||
* can simply have a command be triggered (with no associated call to your
|
||||
* menu handler). The advantage of the latter method is that X-Plane will
|
||||
* display any keyboard shortcuts associated with the command. (In contrast,
|
||||
* there are no keyboard shortcuts associated with menu handler callbacks with
|
||||
* specific parameters.)
|
||||
*
|
||||
* Menu text in X-Plane is UTF8; X-Plane's character set covers latin, greek
|
||||
* and cyrillic characters, Katakana, as well as some Japanese symbols. Some
|
||||
* APIs have a inDeprecatedAndIgnored parameter that used to select a
|
||||
* character set; since X-Plane 9 all localization is done via UTF-8 only.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "XPLMDefs.h"
|
||||
#include "XPLMUtilities.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -31,31 +50,24 @@ extern "C" {
|
||||
/***************************************************************************
|
||||
* XPLM MENUS
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMMenuCheck
|
||||
*
|
||||
* These enumerations define the various 'check' states for an X-Plane menu.
|
||||
* 'checking' in x-plane actually appears as a light which may or may not be
|
||||
* lit. So there are three possible states.
|
||||
*
|
||||
* These enumerations define the various 'check' states for an X-Plane menu.
|
||||
* 'checking' in X-Plane actually appears as a light which may or may not be
|
||||
* lit. So there are three possible states.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* there is no symbol to the left of the menu item. */
|
||||
xplm_Menu_NoCheck = 0
|
||||
/* there is no symbol to the left of the menu item. */
|
||||
xplm_Menu_NoCheck = 0,
|
||||
|
||||
/* the menu has a mark next to it that is unmarked (not lit). */
|
||||
,
|
||||
xplm_Menu_Unchecked = 1
|
||||
/* the menu has a mark next to it that is unmarked (not lit). */
|
||||
xplm_Menu_Unchecked = 1,
|
||||
|
||||
/* the menu has a mark next to it that is checked (lit). */
|
||||
,
|
||||
xplm_Menu_Checked = 2
|
||||
/* the menu has a mark next to it that is checked (lit). */
|
||||
xplm_Menu_Checked = 2,
|
||||
|
||||
|
||||
};
|
||||
@@ -63,34 +75,55 @@ typedef int XPLMMenuCheck;
|
||||
|
||||
/*
|
||||
* XPLMMenuID
|
||||
*
|
||||
* This is a unique ID for each menu you create.
|
||||
*
|
||||
* This is a unique ID for each menu you create.
|
||||
*
|
||||
*/
|
||||
typedef void *XPLMMenuID;
|
||||
typedef void * XPLMMenuID;
|
||||
|
||||
/*
|
||||
* XPLMMenuHandler_f
|
||||
*
|
||||
*
|
||||
* A menu handler function takes two reference pointers, one for the menu
|
||||
* (specified when the menu was created) and one for the item (specified when
|
||||
* the item was created).
|
||||
* the item was created).
|
||||
*
|
||||
*/
|
||||
typedef void (*XPLMMenuHandler_f)(void *inMenuRef, void *inItemRef);
|
||||
typedef void (* XPLMMenuHandler_f)(
|
||||
void * inMenuRef,
|
||||
void * inItemRef);
|
||||
|
||||
/*
|
||||
* XPLMFindPluginsMenu
|
||||
*
|
||||
*
|
||||
* This function returns the ID of the plug-ins menu, which is created for you
|
||||
* at startup.
|
||||
* at startup.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMMenuID XPLMFindPluginsMenu(void);
|
||||
|
||||
#if defined(XPLM300)
|
||||
/*
|
||||
* XPLMFindAircraftMenu
|
||||
*
|
||||
* This function returns the ID of the menu for the currently-loaded aircraft,
|
||||
* used for showing aircraft-specific commands.
|
||||
*
|
||||
* The aircraft menu is created by X-Plane at startup, but it remains hidden
|
||||
* until it is populated via XPLMAppendMenuItem() or
|
||||
* XPLMAppendMenuItemWithCommand().
|
||||
*
|
||||
* Only plugins loaded with the user's current aircraft are allowed to access
|
||||
* the aircraft menu. For all other plugins, this will return NULL, and any
|
||||
* attempts to add menu items to it will fail.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMMenuID XPLMFindAircraftMenu(void);
|
||||
#endif /* XPLM300 */
|
||||
|
||||
/*
|
||||
* XPLMCreateMenu
|
||||
*
|
||||
*
|
||||
* This function creates a new menu and returns its ID. It returns NULL if
|
||||
* the menu cannot be created. Pass in a parent menu ID and an item index to
|
||||
* create a submenu, or NULL for the parent menu to put the menu in the menu
|
||||
@@ -98,109 +131,156 @@ XPLM_API XPLMMenuID XPLMFindPluginsMenu(void);
|
||||
* pass a handler function and a menu reference value. Pass NULL for the
|
||||
* handler if you do not need callbacks from the menu (for example, if it only
|
||||
* contains submenus).
|
||||
*
|
||||
*
|
||||
* Important: you must pass a valid, non-empty menu title even if the menu is
|
||||
* a submenu where the title is not visible.
|
||||
* a submenu where the title is not visible.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMMenuID XPLMCreateMenu(const char *inName,
|
||||
XPLMMenuID inParentMenu,
|
||||
int inParentItem,
|
||||
XPLMMenuHandler_f inHandler,
|
||||
void *inMenuRef);
|
||||
XPLM_API XPLMMenuID XPLMCreateMenu(
|
||||
const char * inName,
|
||||
XPLMMenuID inParentMenu,
|
||||
int inParentItem,
|
||||
XPLMMenuHandler_f inHandler,
|
||||
void * inMenuRef);
|
||||
|
||||
/*
|
||||
* XPLMDestroyMenu
|
||||
*
|
||||
*
|
||||
* This function destroys a menu that you have created. Use this to remove a
|
||||
* submenu if necessary. (Normally this function will not be necessary.)
|
||||
* submenu if necessary. (Normally this function will not be necessary.)
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDestroyMenu(XPLMMenuID inMenuID);
|
||||
XPLM_API void XPLMDestroyMenu(
|
||||
XPLMMenuID inMenuID);
|
||||
|
||||
/*
|
||||
* XPLMClearAllMenuItems
|
||||
*
|
||||
*
|
||||
* This function removes all menu items from a menu, allowing you to rebuild
|
||||
* it. Use this function if you need to change the number of items on a menu.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMClearAllMenuItems(XPLMMenuID inMenuID);
|
||||
XPLM_API void XPLMClearAllMenuItems(
|
||||
XPLMMenuID inMenuID);
|
||||
|
||||
/*
|
||||
* XPLMAppendMenuItem
|
||||
*
|
||||
*
|
||||
* This routine appends a new menu item to the bottom of a menu and returns
|
||||
* its index. Pass in the menu to add the item to, the items name, and a void
|
||||
* * ref for this item. If you pass in inForceEnglish, this menu item will be
|
||||
* drawn using the english character set no matter what language x-plane is
|
||||
* running in. Otherwise the menu item will be drawn localized. (An example
|
||||
* of why you'd want to do this is for a proper name.) See XPLMUtilities for
|
||||
* determining the current langauge.
|
||||
* * ref for this item.
|
||||
*
|
||||
* Returns a negative index if the append failed (due to an invalid parent
|
||||
* menu argument).
|
||||
*
|
||||
* Note that all menu indices returned are relative to your plugin's menus
|
||||
* only; if your plugin creates two sub-menus in the Plugins menu at different
|
||||
* times, it doesn't matter how many other plugins also create sub-menus of
|
||||
* Plugins in the intervening time: your sub-menus will be given menu indices
|
||||
* 0 and 1. (The SDK does some work in the back-end to filter out menus that
|
||||
* are irrelevant to your plugin in order to deliver this consistency for each
|
||||
* plugin.)
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMAppendMenuItem(XPLMMenuID inMenu,
|
||||
const char *inItemName,
|
||||
void *inItemRef,
|
||||
int inForceEnglish);
|
||||
XPLM_API int XPLMAppendMenuItem(
|
||||
XPLMMenuID inMenu,
|
||||
const char * inItemName,
|
||||
void * inItemRef,
|
||||
int inDeprecatedAndIgnored);
|
||||
|
||||
#if defined(XPLM300)
|
||||
/*
|
||||
* XPLMAppendMenuItemWithCommand
|
||||
*
|
||||
* Like XPLMAppendMenuItem(), but instead of the new menu item triggering the
|
||||
* XPLMMenuHandler_f of the containiner menu, it will simply execute the
|
||||
* command you pass in. Using a command for your menu item allows the user to
|
||||
* bind a keyboard shortcut to the command and see that shortcut represented
|
||||
* in the menu.
|
||||
*
|
||||
* Returns a negative index if the append failed (due to an invalid parent
|
||||
* menu argument).
|
||||
*
|
||||
* Like XPLMAppendMenuItem(), all menu indices are relative to your plugin's
|
||||
* menus only.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMAppendMenuItemWithCommand(
|
||||
XPLMMenuID inMenu,
|
||||
const char * inItemName,
|
||||
XPLMCommandRef inCommandToExecute);
|
||||
#endif /* XPLM300 */
|
||||
|
||||
/*
|
||||
* XPLMAppendMenuSeparator
|
||||
*
|
||||
* This routine adds a seperator to the end of a menu.
|
||||
*
|
||||
* This routine adds a separator to the end of a menu.
|
||||
*
|
||||
* Returns a negative index if the append failed (due to an invalid parent
|
||||
* menu argument).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMAppendMenuSeparator(XPLMMenuID inMenu);
|
||||
XPLM_API void XPLMAppendMenuSeparator(
|
||||
XPLMMenuID inMenu);
|
||||
|
||||
/*
|
||||
* XPLMSetMenuItemName
|
||||
*
|
||||
*
|
||||
* This routine changes the name of an existing menu item. Pass in the menu
|
||||
* ID and the index of the menu item.
|
||||
* ID and the index of the menu item.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetMenuItemName(XPLMMenuID inMenu,
|
||||
int inIndex,
|
||||
const char *inItemName,
|
||||
int inForceEnglish);
|
||||
XPLM_API void XPLMSetMenuItemName(
|
||||
XPLMMenuID inMenu,
|
||||
int inIndex,
|
||||
const char * inItemName,
|
||||
int inDeprecatedAndIgnored);
|
||||
|
||||
/*
|
||||
* XPLMCheckMenuItem
|
||||
*
|
||||
* Set whether a menu item is checked. Pass in the menu ID and item index.
|
||||
*
|
||||
* Set whether a menu item is checked. Pass in the menu ID and item index.
|
||||
*
|
||||
*/
|
||||
XPLM_API void
|
||||
XPLMCheckMenuItem(XPLMMenuID inMenu, int index, XPLMMenuCheck inCheck);
|
||||
XPLM_API void XPLMCheckMenuItem(
|
||||
XPLMMenuID inMenu,
|
||||
int index,
|
||||
XPLMMenuCheck inCheck);
|
||||
|
||||
/*
|
||||
* XPLMCheckMenuItemState
|
||||
*
|
||||
*
|
||||
* This routine returns whether a menu item is checked or not. A menu item's
|
||||
* check mark may be on or off, or a menu may not have an icon at all.
|
||||
* check mark may be on or off, or a menu may not have an icon at all.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMCheckMenuItemState(XPLMMenuID inMenu,
|
||||
int index,
|
||||
XPLMMenuCheck *outCheck);
|
||||
XPLM_API void XPLMCheckMenuItemState(
|
||||
XPLMMenuID inMenu,
|
||||
int index,
|
||||
XPLMMenuCheck * outCheck);
|
||||
|
||||
/*
|
||||
* XPLMEnableMenuItem
|
||||
*
|
||||
* Sets whether this menu item is enabled. Items start out enabled.
|
||||
*
|
||||
* Sets whether this menu item is enabled. Items start out enabled.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMEnableMenuItem(XPLMMenuID inMenu, int index, int enabled);
|
||||
XPLM_API void XPLMEnableMenuItem(
|
||||
XPLMMenuID inMenu,
|
||||
int index,
|
||||
int enabled);
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMRemoveMenuItem
|
||||
*
|
||||
*
|
||||
* Removes one item from a menu. Note that all menu items below are moved up
|
||||
* one; your plugin must track the change in index numbers.
|
||||
* one; your plugin must track the change in index numbers.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMRemoveMenuItem(XPLMMenuID inMenu, int inIndex);
|
||||
XPLM_API void XPLMRemoveMenuItem(
|
||||
XPLMMenuID inMenu,
|
||||
int inIndex);
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -2,25 +2,23 @@
|
||||
#define _XPLMNavigation_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMNavigation
|
||||
***************************************************************************/
|
||||
/*
|
||||
* XPLMNavigation - THEORY OF OPERATION
|
||||
*
|
||||
* The XPLM Navigation APIs give you some access to the navigation databases
|
||||
* inside X-Plane. X-Plane stores all navigation information in RAM, so by
|
||||
* using these APIs you can gain access to most information without having to
|
||||
* go to disk or parse the files yourself.
|
||||
*
|
||||
*
|
||||
* You can also use this API to program the FMS. You must use the navigation
|
||||
* APIs to find the nav-aids you want to program into the FMS, since the FMS
|
||||
* is powered internally by x-plane's navigation database.
|
||||
* is powered internally by X-Plane's navigation database.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -33,63 +31,46 @@ extern "C" {
|
||||
/***************************************************************************
|
||||
* NAVIGATION DATABASE ACCESS
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMNavType
|
||||
*
|
||||
*
|
||||
* These enumerations define the different types of navaids. They are each
|
||||
* defined with a separate bit so that they may be bit-wise added together to
|
||||
* form sets of nav-aid types.
|
||||
*
|
||||
*
|
||||
* NOTE: xplm_Nav_LatLon is a specific lat-lon coordinate entered into the
|
||||
* FMS. It will not exist in the database, and cannot be programmed into the
|
||||
* FMS. Querying the FMS for navaids will return it. Use
|
||||
* XPLMSetFMSEntryLatLon to set a lat/lon waypoint.
|
||||
* XPLMSetFMSEntryLatLon to set a lat/lon waypoint.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
xplm_Nav_Unknown = 0
|
||||
xplm_Nav_Unknown = 0,
|
||||
|
||||
,
|
||||
xplm_Nav_Airport = 1
|
||||
xplm_Nav_Airport = 1,
|
||||
|
||||
,
|
||||
xplm_Nav_NDB = 2
|
||||
xplm_Nav_NDB = 2,
|
||||
|
||||
,
|
||||
xplm_Nav_VOR = 4
|
||||
xplm_Nav_VOR = 4,
|
||||
|
||||
,
|
||||
xplm_Nav_ILS = 8
|
||||
xplm_Nav_ILS = 8,
|
||||
|
||||
,
|
||||
xplm_Nav_Localizer = 16
|
||||
xplm_Nav_Localizer = 16,
|
||||
|
||||
,
|
||||
xplm_Nav_GlideSlope = 32
|
||||
xplm_Nav_GlideSlope = 32,
|
||||
|
||||
,
|
||||
xplm_Nav_OuterMarker = 64
|
||||
xplm_Nav_OuterMarker = 64,
|
||||
|
||||
,
|
||||
xplm_Nav_MiddleMarker = 128
|
||||
xplm_Nav_MiddleMarker = 128,
|
||||
|
||||
,
|
||||
xplm_Nav_InnerMarker = 256
|
||||
xplm_Nav_InnerMarker = 256,
|
||||
|
||||
,
|
||||
xplm_Nav_Fix = 512
|
||||
xplm_Nav_Fix = 512,
|
||||
|
||||
,
|
||||
xplm_Nav_DME = 1024
|
||||
xplm_Nav_DME = 1024,
|
||||
|
||||
,
|
||||
xplm_Nav_LatLon = 2048
|
||||
xplm_Nav_LatLon = 2048,
|
||||
|
||||
|
||||
};
|
||||
@@ -97,140 +78,133 @@ typedef int XPLMNavType;
|
||||
|
||||
/*
|
||||
* XPLMNavRef
|
||||
*
|
||||
*
|
||||
* XPLMNavRef is an iterator into the navigation database. The navigation
|
||||
* database is essentially an array, but it is not necessarily densely
|
||||
* populated. The only assumption you can safely make is that like-typed
|
||||
* nav-aids are grouped together.
|
||||
*
|
||||
* nav-aids are grouped together.
|
||||
*
|
||||
* Use XPLMNavRef to refer to a nav-aid.
|
||||
*
|
||||
*
|
||||
* XPLM_NAV_NOT_FOUND is returned by functions that return an XPLMNavRef when
|
||||
* the iterator must be invalid.
|
||||
* the iterator must be invalid.
|
||||
*
|
||||
*/
|
||||
typedef int XPLMNavRef;
|
||||
|
||||
#define XPLM_NAV_NOT_FOUND -1
|
||||
#define XPLM_NAV_NOT_FOUND -1
|
||||
|
||||
/*
|
||||
* XPLMGetFirstNavAid
|
||||
*
|
||||
*
|
||||
* This returns the very first navaid in the database. Use this to traverse
|
||||
* the entire database. Returns XPLM_NAV_NOT_FOUND if the nav database is
|
||||
* empty.
|
||||
* empty.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavRef XPLMGetFirstNavAid(void);
|
||||
|
||||
/*
|
||||
* XPLMGetNextNavAid
|
||||
*
|
||||
* Given a nav aid ref, this routine returns the next navaid. It returns
|
||||
* XPLM_NAV_NOT_FOUND if the nav aid passed in was invalid or if the navaid
|
||||
* passed in was the last one in the database. Use this routine to iterate
|
||||
* across all like-typed navaids or the entire database.
|
||||
*
|
||||
* WARNING: due to a bug in the SDK, when fix loading is disabled in the
|
||||
* rendering settings screen, calling this routine with the last airport
|
||||
* returns a bogus nav aid. Using this nav aid can crash x-plane.
|
||||
*
|
||||
* Given a valid nav aid ref, this routine returns the next navaid. It
|
||||
* returns XPLM_NAV_NOT_FOUND if the nav aid passed in was invalid or if the
|
||||
* navaid passed in was the last one in the database. Use this routine to
|
||||
* iterate across all like-typed navaids or the entire database.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavRef XPLMGetNextNavAid(XPLMNavRef inNavAidRef);
|
||||
XPLM_API XPLMNavRef XPLMGetNextNavAid(
|
||||
XPLMNavRef inNavAidRef);
|
||||
|
||||
/*
|
||||
* XPLMFindFirstNavAidOfType
|
||||
*
|
||||
*
|
||||
* This routine returns the ref of the first navaid of the given type in the
|
||||
* database or XPLM_NAV_NOT_FOUND if there are no navaids of that type in the
|
||||
* database. You must pass exactly one nav aid type to this routine.
|
||||
*
|
||||
* WARNING: due to a bug in the SDK, when fix loading is disabled in the
|
||||
* rendering settings screen, calling this routine with fixes returns a bogus
|
||||
* nav aid. Using this nav aid can crash x-plane.
|
||||
* database. You must pass exactly one nav aid type to this routine.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavRef XPLMFindFirstNavAidOfType(XPLMNavType inType);
|
||||
XPLM_API XPLMNavRef XPLMFindFirstNavAidOfType(
|
||||
XPLMNavType inType);
|
||||
|
||||
/*
|
||||
* XPLMFindLastNavAidOfType
|
||||
*
|
||||
*
|
||||
* This routine returns the ref of the last navaid of the given type in the
|
||||
* database or XPLM_NAV_NOT_FOUND if there are no navaids of that type in the
|
||||
* database. You must pass exactly one nav aid type to this routine.
|
||||
*
|
||||
* WARNING: due to a bug in the SDK, when fix loading is disabled in the
|
||||
* rendering settings screen, calling this routine with fixes returns a bogus
|
||||
* nav aid. Using this nav aid can crash x-plane.
|
||||
* database. You must pass exactly one nav aid type to this routine.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavRef XPLMFindLastNavAidOfType(XPLMNavType inType);
|
||||
XPLM_API XPLMNavRef XPLMFindLastNavAidOfType(
|
||||
XPLMNavType inType);
|
||||
|
||||
/*
|
||||
* XPLMFindNavAid
|
||||
*
|
||||
*
|
||||
* This routine provides a number of searching capabilities for the nav
|
||||
* database. XPLMFindNavAid will search through every nav aid whose type is
|
||||
* within inType (multiple types may be added together) and return any
|
||||
* nav-aids found based on the following rules:
|
||||
*
|
||||
* If inLat and inLon are not NULL, the navaid nearest to that lat/lon will be
|
||||
* returned, otherwise the last navaid found will be returned.
|
||||
*
|
||||
* If inFrequency is not NULL, then any navaids considered must match this
|
||||
* frequency. Note that this will screen out radio beacons that do not have
|
||||
* frequency data published (like inner markers) but not fixes and airports.
|
||||
*
|
||||
* If inNameFragment is not NULL, only navaids that contain the fragment in
|
||||
* their name will be returned.
|
||||
*
|
||||
* If inIDFragment is not NULL, only navaids that contain the fragment in
|
||||
* their IDs will be returned.
|
||||
*
|
||||
* nav-aids found based on the following rules:
|
||||
*
|
||||
* * If inLat and inLon are not NULL, the navaid nearest to that lat/lon will
|
||||
* be returned, otherwise the last navaid found will be returned.
|
||||
*
|
||||
* * If inFrequency is not NULL, then any navaids considered must match this
|
||||
* frequency. Note that this will screen out radio beacons that do not have
|
||||
* frequency data published (like inner markers) but not fixes and airports.
|
||||
*
|
||||
* * If inNameFragment is not NULL, only navaids that contain the fragment in
|
||||
* their name will be returned.
|
||||
*
|
||||
* * If inIDFragment is not NULL, only navaids that contain the fragment in
|
||||
* their IDs will be returned.
|
||||
*
|
||||
* This routine provides a simple way to do a number of useful searches:
|
||||
*
|
||||
* Find the nearest navaid on this frequency. Find the nearest airport. Find
|
||||
* the VOR whose ID is "KBOS". Find the nearest airport whose name contains
|
||||
* "Chicago".
|
||||
* * Find the nearest navaid on this frequency.
|
||||
* * Find the nearest airport.
|
||||
* * Find the VOR whose ID is "KBOS".
|
||||
* * Find the nearest airport whose name contains "Chicago".
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavRef XPLMFindNavAid(const char *inNameFragment, /* Can be NULL */
|
||||
const char *inIDFragment, /* Can be NULL */
|
||||
float *inLat, /* Can be NULL */
|
||||
float *inLon, /* Can be NULL */
|
||||
int *inFrequency, /* Can be NULL */
|
||||
XPLMNavType inType);
|
||||
XPLM_API XPLMNavRef XPLMFindNavAid(
|
||||
const char * inNameFragment, /* Can be NULL */
|
||||
const char * inIDFragment, /* Can be NULL */
|
||||
float * inLat, /* Can be NULL */
|
||||
float * inLon, /* Can be NULL */
|
||||
int * inFrequency, /* Can be NULL */
|
||||
XPLMNavType inType);
|
||||
|
||||
/*
|
||||
* XPLMGetNavAidInfo
|
||||
*
|
||||
*
|
||||
* This routine returns information about a navaid. Any non-null field is
|
||||
* filled out with information if it is available.
|
||||
*
|
||||
*
|
||||
* Frequencies are in the nav.dat convention as described in the X-Plane nav
|
||||
* database FAQ: NDB frequencies are exact, all others are multiplied by 100.
|
||||
*
|
||||
*
|
||||
* The buffer for IDs should be at least 6 chars and the buffer for names
|
||||
* should be at least 41 chars, but since these values are likely to go up, I
|
||||
* recommend passing at least 32 chars for IDs and 256 chars for names when
|
||||
* possible.
|
||||
*
|
||||
*
|
||||
* The outReg parameter tells if the navaid is within the local "region" of
|
||||
* loaded DSFs. (This information may not be particularly useful to plugins.)
|
||||
* The parameter is a single byte value 1 for true or 0 for false, not a C
|
||||
* string.
|
||||
* string.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMGetNavAidInfo(XPLMNavRef inRef,
|
||||
XPLMNavType *outType, /* Can be NULL */
|
||||
float *outLatitude, /* Can be NULL */
|
||||
float *outLongitude, /* Can be NULL */
|
||||
float *outHeight, /* Can be NULL */
|
||||
int *outFrequency, /* Can be NULL */
|
||||
float *outHeading, /* Can be NULL */
|
||||
char *outID, /* Can be NULL */
|
||||
char *outName, /* Can be NULL */
|
||||
char *outReg); /* Can be NULL */
|
||||
XPLM_API void XPLMGetNavAidInfo(
|
||||
XPLMNavRef inRef,
|
||||
XPLMNavType * outType, /* Can be NULL */
|
||||
float * outLatitude, /* Can be NULL */
|
||||
float * outLongitude, /* Can be NULL */
|
||||
float * outHeight, /* Can be NULL */
|
||||
int * outFrequency, /* Can be NULL */
|
||||
float * outHeading, /* Can be NULL */
|
||||
char * outID, /* Can be NULL */
|
||||
char * outName, /* Can be NULL */
|
||||
char * outReg); /* Can be NULL */
|
||||
|
||||
/***************************************************************************
|
||||
* FLIGHT MANAGEMENT COMPUTER
|
||||
@@ -239,129 +213,144 @@ XPLM_API void XPLMGetNavAidInfo(XPLMNavRef inRef,
|
||||
* Note: the FMS works based on an array of entries. Indices into the array
|
||||
* are zero-based. Each entry is a nav-aid plus an altitude. The FMS tracks
|
||||
* the currently displayed entry and the entry that it is flying to.
|
||||
*
|
||||
*
|
||||
* The FMS must be programmed with contiguous entries, so clearing an entry at
|
||||
* the end shortens the effective flight plan. There is a max of 100
|
||||
* waypoints in the flight plan.
|
||||
* waypoints in the flight plan.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMCountFMSEntries
|
||||
*
|
||||
* This routine returns the number of entries in the FMS.
|
||||
*
|
||||
* This routine returns the number of entries in the FMS.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMCountFMSEntries(void);
|
||||
XPLM_API int XPLMCountFMSEntries(void);
|
||||
|
||||
/*
|
||||
* XPLMGetDisplayedFMSEntry
|
||||
*
|
||||
* This routine returns the index of the entry the pilot is viewing.
|
||||
*
|
||||
* This routine returns the index of the entry the pilot is viewing.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMGetDisplayedFMSEntry(void);
|
||||
XPLM_API int XPLMGetDisplayedFMSEntry(void);
|
||||
|
||||
/*
|
||||
* XPLMGetDestinationFMSEntry
|
||||
*
|
||||
* This routine returns the index of the entry the FMS is flying to.
|
||||
*
|
||||
* This routine returns the index of the entry the FMS is flying to.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMGetDestinationFMSEntry(void);
|
||||
XPLM_API int XPLMGetDestinationFMSEntry(void);
|
||||
|
||||
/*
|
||||
* XPLMSetDisplayedFMSEntry
|
||||
*
|
||||
*
|
||||
* This routine changes which entry the FMS is showing to the index specified.
|
||||
* *
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetDisplayedFMSEntry(int inIndex);
|
||||
XPLM_API void XPLMSetDisplayedFMSEntry(
|
||||
int inIndex);
|
||||
|
||||
/*
|
||||
* XPLMSetDestinationFMSEntry
|
||||
*
|
||||
* This routine changes which entry the FMS is flying the aircraft toward.
|
||||
*
|
||||
* This routine changes which entry the FMS is flying the aircraft toward.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetDestinationFMSEntry(int inIndex);
|
||||
XPLM_API void XPLMSetDestinationFMSEntry(
|
||||
int inIndex);
|
||||
|
||||
/*
|
||||
* XPLMGetFMSEntryInfo
|
||||
*
|
||||
* This routine returns information about a given FMS entry. A reference to a
|
||||
* navaid can be returned allowing you to find additional information (such as
|
||||
* a frequency, ILS heading, name, etc.). Some information is available
|
||||
* immediately. For a lat/lon entry, the lat/lon is returned by this routine
|
||||
* but the navaid cannot be looked up (and the reference will be
|
||||
* XPLM_NAV_NOT_FOUND. FMS name entry buffers should be at least 256 chars in
|
||||
* length.
|
||||
*
|
||||
* This routine returns information about a given FMS entry. If the entry is
|
||||
* an airport or navaid, a reference to a nav entry can be returned allowing
|
||||
* you to find additional information (such as a frequency, ILS heading, name,
|
||||
* etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the
|
||||
* information has been looked up asynchronously, so after flightplan changes,
|
||||
* it might take up to a second for this field to become populated. The other
|
||||
* information is available immediately. For a lat/lon entry, the lat/lon is
|
||||
* returned by this routine but the navaid cannot be looked up (and the
|
||||
* reference will be XPLM_NAV_NOT_FOUND). FMS name entry buffers should be at
|
||||
* least 256 chars in length.
|
||||
*
|
||||
* WARNING: Due to a bug in X-Plane prior to 11.31, the navaid reference will
|
||||
* not be set to XPLM_NAV_NOT_FOUND while no data is available, and instead
|
||||
* just remain the value of the variable that you passed the pointer to.
|
||||
* Therefore, always initialize the variable to XPLM_NAV_NOT_FOUND before
|
||||
* passing the pointer to this function.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMGetFMSEntryInfo(int inIndex,
|
||||
XPLMNavType *outType, /* Can be NULL */
|
||||
char *outID, /* Can be NULL */
|
||||
XPLMNavRef *outRef, /* Can be NULL */
|
||||
int *outAltitude, /* Can be NULL */
|
||||
float *outLat, /* Can be NULL */
|
||||
float *outLon); /* Can be NULL */
|
||||
XPLM_API void XPLMGetFMSEntryInfo(
|
||||
int inIndex,
|
||||
XPLMNavType * outType, /* Can be NULL */
|
||||
char * outID, /* Can be NULL */
|
||||
XPLMNavRef * outRef, /* Can be NULL */
|
||||
int * outAltitude, /* Can be NULL */
|
||||
float * outLat, /* Can be NULL */
|
||||
float * outLon); /* Can be NULL */
|
||||
|
||||
/*
|
||||
* XPLMSetFMSEntryInfo
|
||||
*
|
||||
*
|
||||
* This routine changes an entry in the FMS to have the destination navaid
|
||||
* passed in and the altitude specified. Use this only for airports, fixes,
|
||||
* and radio-beacon navaids. Currently of radio beacons, the FMS can only
|
||||
* support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
|
||||
*
|
||||
*/
|
||||
XPLM_API void
|
||||
XPLMSetFMSEntryInfo(int inIndex, XPLMNavRef inRef, int inAltitude);
|
||||
XPLM_API void XPLMSetFMSEntryInfo(
|
||||
int inIndex,
|
||||
XPLMNavRef inRef,
|
||||
int inAltitude);
|
||||
|
||||
/*
|
||||
* XPLMSetFMSEntryLatLon
|
||||
*
|
||||
*
|
||||
* This routine changes the entry in the FMS to a lat/lon entry with the given
|
||||
* coordinates.
|
||||
* coordinates.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetFMSEntryLatLon(int inIndex,
|
||||
float inLat,
|
||||
float inLon,
|
||||
int inAltitude);
|
||||
XPLM_API void XPLMSetFMSEntryLatLon(
|
||||
int inIndex,
|
||||
float inLat,
|
||||
float inLon,
|
||||
int inAltitude);
|
||||
|
||||
/*
|
||||
* XPLMClearFMSEntry
|
||||
*
|
||||
*
|
||||
* This routine clears the given entry, potentially shortening the flight
|
||||
* plan.
|
||||
* plan.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMClearFMSEntry(int inIndex);
|
||||
XPLM_API void XPLMClearFMSEntry(
|
||||
int inIndex);
|
||||
|
||||
/***************************************************************************
|
||||
* GPS RECEIVER
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These APIs let you read data from the GPS unit.
|
||||
* These APIs let you read data from the GPS unit.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMGetGPSDestinationType
|
||||
*
|
||||
*
|
||||
* This routine returns the type of the currently selected GPS destination,
|
||||
* one of fix, airport, VOR or NDB.
|
||||
* one of fix, airport, VOR or NDB.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavType XPLMGetGPSDestinationType(void);
|
||||
|
||||
/*
|
||||
* XPLMGetGPSDestination
|
||||
*
|
||||
* This routine returns the current GPS destination.
|
||||
*
|
||||
* This routine returns the current GPS destination.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMNavRef XPLMGetGPSDestination(void);
|
||||
|
||||
+149
-107
@@ -2,17 +2,21 @@
|
||||
#define _XPLMPlanes_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMPlanes
|
||||
***************************************************************************/
|
||||
/*
|
||||
* The XPLMPlanes APIs allow you to control the various aircraft in x-plane,
|
||||
* The XPLMPlanes APIs allow you to control the various aircraft in X-Plane,
|
||||
* both the user's and the sim's.
|
||||
*
|
||||
* *Note*: unlike almost all other APIs in the SDK, aircraft paths are _full_
|
||||
* file system paths for historical reasons. You'll need to prefix all
|
||||
* relative paths with the X-Plane path as accessed via XPLMGetSystemPath.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -25,218 +29,256 @@ extern "C" {
|
||||
/***************************************************************************
|
||||
* USER AIRCRAFT ACCESS
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMSetUsersAircraft
|
||||
*
|
||||
*
|
||||
* This routine changes the user's aircraft. Note that this will reinitialize
|
||||
* the user to be on the nearest airport's first runway. Pass in a full path
|
||||
* (hard drive and everything including the .acf extension) to the .acf file.
|
||||
* (hard drive and everything including the .acf extension) to the .acf file.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetUsersAircraft(const char *inAircraftPath);
|
||||
XPLM_API void XPLMSetUsersAircraft(
|
||||
const char * inAircraftPath);
|
||||
/*
|
||||
* XPLMPlaceUserAtAirport
|
||||
*
|
||||
*
|
||||
* This routine places the user at a given airport. Specify the airport by
|
||||
* its ICAO code (e.g. 'KBOS').
|
||||
* its X-Plane airport ID (e.g. 'KBOS').
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMPlaceUserAtAirport(const char *inAirportCode);
|
||||
XPLM_API void XPLMPlaceUserAtAirport(
|
||||
const char * inAirportCode);
|
||||
#if defined(XPLM300)
|
||||
/*
|
||||
* XPLMPlaceUserAtLocation
|
||||
*
|
||||
* Places the user at a specific location after performing any necessary
|
||||
* scenery loads.
|
||||
*
|
||||
* As with in-air starts initiated from the X-Plane user interface, the
|
||||
* aircraft will always start with its engines running, regardless of the
|
||||
* user's preferences (i.e., regardless of what the dataref
|
||||
* `sim/operation/prefs/startup_running` says).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMPlaceUserAtLocation(
|
||||
double latitudeDegrees,
|
||||
double longitudeDegrees,
|
||||
float elevationMetersMSL,
|
||||
float headingDegreesTrue,
|
||||
float speedMetersPerSecond);
|
||||
#endif /* XPLM300 */
|
||||
/***************************************************************************
|
||||
* GLOBAL AIRCRAFT ACCESS
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* The user's aircraft is always index 0. */
|
||||
#define XPLM_USER_AIRCRAFT 0
|
||||
/* The user's aircraft is always index 0. */
|
||||
#define XPLM_USER_AIRCRAFT 0
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/*
|
||||
* XPLMPlaneDrawState_t
|
||||
*
|
||||
*
|
||||
* This structure contains additional plane parameter info to be passed to
|
||||
* draw plane. Make sure to fill in the size of the structure field with
|
||||
* sizeof(XPLMDrawPlaneState_t) so that the XPLM can tell how many fields you
|
||||
* knew about when compiling your plugin (since more fields may be added
|
||||
* later).
|
||||
*
|
||||
*
|
||||
* Most of these fields are ratios from 0 to 1 for control input. X-Plane
|
||||
* calculates what the actual controls look like based on the .acf file for
|
||||
* that airplane. Note for the yoke inputs, this is what the pilot of the
|
||||
* plane has commanded (post artificial stability system if there were one)
|
||||
* and affects aelerons, rudder, etc. It is not necessarily related to the
|
||||
* actual position of the plane!
|
||||
* and affects aelerons, rudder, etc. It is not necessarily related to the
|
||||
* actual position of the plane!
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
/* The size of the draw state struct. */
|
||||
int structSize;
|
||||
/* A ratio from [0..1] describing how far the landing gear is extended. */
|
||||
float gearPosition;
|
||||
/* Ratio of flap deployment, 0 = up, 1 = full deploy. */
|
||||
float flapRatio;
|
||||
/* Ratio of spoiler deployment, 0 = none, 1 = full deploy. */
|
||||
float spoilerRatio;
|
||||
/* Ratio of speed brake deployment, 0 = none, 1 = full deploy. */
|
||||
float speedBrakeRatio;
|
||||
/* Ratio of slat deployment, 0 = none, 1 = full deploy. */
|
||||
float slatRatio;
|
||||
/* Wing sweep ratio, 0 = forward, 1 = swept. */
|
||||
float wingSweep;
|
||||
/* Thrust power, 0 = none, 1 = full fwd, -1 = full reverse. */
|
||||
float thrust;
|
||||
/* Total pitch input for this plane. */
|
||||
float yokePitch;
|
||||
/* Total Heading input for this plane. */
|
||||
float yokeHeading;
|
||||
/* Total Roll input for this plane. */
|
||||
float yokeRoll;
|
||||
/* The size of the draw state struct. */
|
||||
int structSize;
|
||||
/* A ratio from [0..1] describing how far the landing gear is extended. */
|
||||
float gearPosition;
|
||||
/* Ratio of flap deployment, 0 = up, 1 = full deploy. */
|
||||
float flapRatio;
|
||||
/* Ratio of spoiler deployment, 0 = none, 1 = full deploy. */
|
||||
float spoilerRatio;
|
||||
/* Ratio of speed brake deployment, 0 = none, 1 = full deploy. */
|
||||
float speedBrakeRatio;
|
||||
/* Ratio of slat deployment, 0 = none, 1 = full deploy. */
|
||||
float slatRatio;
|
||||
/* Wing sweep ratio, 0 = forward, 1 = swept. */
|
||||
float wingSweep;
|
||||
/* Thrust power, 0 = none, 1 = full fwd, -1 = full reverse. */
|
||||
float thrust;
|
||||
/* Total pitch input for this plane. */
|
||||
float yokePitch;
|
||||
/* Total Heading input for this plane. */
|
||||
float yokeHeading;
|
||||
/* Total Roll input for this plane. */
|
||||
float yokeRoll;
|
||||
} XPLMPlaneDrawState_t;
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
/*
|
||||
* XPLMCountAircraft
|
||||
*
|
||||
*
|
||||
* This function returns the number of aircraft X-Plane is capable of having,
|
||||
* as well as the number of aircraft that are currently active. These numbers
|
||||
* count the user's aircraft. It can also return the plugin that is currently
|
||||
* controlling aircraft. In X-Plane 7, this routine reflects the number of
|
||||
* aircraft the user has enabled in the rendering options window.
|
||||
* aircraft the user has enabled in the rendering options window.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMCountAircraft(int *outTotalAircraft,
|
||||
int *outActiveAircraft,
|
||||
XPLMPluginID *outController);
|
||||
XPLM_API void XPLMCountAircraft(
|
||||
int * outTotalAircraft,
|
||||
int * outActiveAircraft,
|
||||
XPLMPluginID * outController);
|
||||
/*
|
||||
* XPLMGetNthAircraftModel
|
||||
*
|
||||
*
|
||||
* This function returns the aircraft model for the Nth aircraft. Indices are
|
||||
* zero based, with zero being the user's aircraft. The file name should be
|
||||
* at least 256 chars in length; the path should be at least 512 chars in
|
||||
* length.
|
||||
* length.
|
||||
*
|
||||
*/
|
||||
XPLM_API void
|
||||
XPLMGetNthAircraftModel(int inIndex, char *outFileName, char *outPath);
|
||||
XPLM_API void XPLMGetNthAircraftModel(
|
||||
int inIndex,
|
||||
char * outFileName,
|
||||
char * outPath);
|
||||
/***************************************************************************
|
||||
* EXCLUSIVE AIRCRAFT ACCESS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* The following routines require exclusive access to the airplane APIs. Only
|
||||
* one plugin may have this access at a time.
|
||||
* one plugin may have this access at a time.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMPlanesAvailable_f
|
||||
*
|
||||
*
|
||||
* Your airplanes available callback is called when another plugin gives up
|
||||
* access to the multiplayer planes. Use this to wait for access to
|
||||
* multiplayer.
|
||||
* multiplayer.
|
||||
*
|
||||
*/
|
||||
typedef void (*XPLMPlanesAvailable_f)(void *inRefcon);
|
||||
typedef void (* XPLMPlanesAvailable_f)(
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMAcquirePlanes
|
||||
*
|
||||
*
|
||||
* XPLMAcquirePlanes grants your plugin exclusive access to the aircraft. It
|
||||
* returns 1 if you gain access, 0 if you do not. inAircraft - pass in an
|
||||
* array of pointers to strings specifying the planes you want loaded. For
|
||||
* any plane index you do not want loaded, pass a 0-length string. Other
|
||||
* strings should be full paths with the .acf extension. NULL terminates this
|
||||
* array, or pass NULL if there are no planes you want loaded. If you pass in
|
||||
* a callback and do not receive access to the planes your callback will be
|
||||
* called when the airplanes are available. If you do receive airplane access,
|
||||
* your callback will not be called.
|
||||
* returns 1 if you gain access, 0 if you do not.
|
||||
*
|
||||
* inAircraft - pass in an array of pointers to strings specifying the planes
|
||||
* you want loaded. For any plane index you do not want loaded, pass a
|
||||
* 0-length string. Other strings should be full paths with the .acf
|
||||
* extension. NULL terminates this array, or pass NULL if there are no planes
|
||||
* you want loaded.
|
||||
*
|
||||
* If you pass in a callback and do not receive access to the planes your
|
||||
* callback will be called when the airplanes are available. If you do receive
|
||||
* airplane access, your callback will not be called.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMAcquirePlanes(char **inAircraft, /* Can be NULL */
|
||||
XPLMPlanesAvailable_f inCallback,
|
||||
void *inRefcon);
|
||||
XPLM_API int XPLMAcquirePlanes(
|
||||
char ** inAircraft, /* Can be NULL */
|
||||
XPLMPlanesAvailable_f inCallback,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMReleasePlanes
|
||||
*
|
||||
*
|
||||
* Call this function to release access to the planes. Note that if you are
|
||||
* disabled, access to planes is released for you and you must reacquire it.
|
||||
* disabled, access to planes is released for you and you must reacquire it.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMReleasePlanes(void);
|
||||
XPLM_API void XPLMReleasePlanes(void);
|
||||
|
||||
/*
|
||||
* XPLMSetActiveAircraftCount
|
||||
*
|
||||
*
|
||||
* This routine sets the number of active planes. If you pass in a number
|
||||
* higher than the total number of planes availables, only the total number of
|
||||
* planes available is actually used.
|
||||
* planes available is actually used.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetActiveAircraftCount(int inCount);
|
||||
XPLM_API void XPLMSetActiveAircraftCount(
|
||||
int inCount);
|
||||
|
||||
/*
|
||||
* XPLMSetAircraftModel
|
||||
*
|
||||
* This routine loads an aircraft model. It may only be called if you have
|
||||
* exclusive access to the airplane APIs. Pass in the path of the model with
|
||||
* the .acf extension. The index is zero based, but you may not pass in 0
|
||||
* (use XPLMSetUsersAircraft to load the user's aircracft).
|
||||
*
|
||||
* This routine loads an aircraft model. It may only be called if you have
|
||||
* exclusive access to the airplane APIs. Pass in the path of the model with
|
||||
* the .acf extension. The index is zero based, but you may not pass in 0
|
||||
* (use XPLMSetUsersAircraft to load the user's aircracft).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetAircraftModel(int inIndex, const char *inAircraftPath);
|
||||
XPLM_API void XPLMSetAircraftModel(
|
||||
int inIndex,
|
||||
const char * inAircraftPath);
|
||||
|
||||
/*
|
||||
* XPLMDisableAIForPlane
|
||||
*
|
||||
*
|
||||
* This routine turns off X-Plane's AI for a given plane. The plane will
|
||||
* continue to draw and be a real plane in X-Plane, but will not move itself.
|
||||
* continue to draw and be a real plane in X-Plane, but will not move itself.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDisableAIForPlane(int inPlaneIndex);
|
||||
XPLM_API void XPLMDisableAIForPlane(
|
||||
int inPlaneIndex);
|
||||
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/*
|
||||
* XPLMDrawAircraft
|
||||
*
|
||||
*
|
||||
* WARNING: Aircraft drawing via this API is deprecated and will not work in
|
||||
* future versions of X-Plane. Use XPLMInstance for 3-d drawing of custom
|
||||
* aircraft models.
|
||||
*
|
||||
* This routine draws an aircraft. It can only be called from a 3-d drawing
|
||||
* callback. Pass in the position of the plane in OpenGL local coordinates
|
||||
* and the orientation of the plane. A 1 for full drawing indicates that the
|
||||
* whole plane must be drawn; a 0 indicates you only need the nav lights
|
||||
* drawn. (This saves rendering time when planes are far away.)
|
||||
* drawn. (This saves rendering time when planes are far away.)
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawAircraft(int inPlaneIndex,
|
||||
float inX,
|
||||
float inY,
|
||||
float inZ,
|
||||
float inPitch,
|
||||
float inRoll,
|
||||
float inYaw,
|
||||
int inFullDraw,
|
||||
XPLMPlaneDrawState_t *inDrawStateInfo);
|
||||
XPLM_API void XPLMDrawAircraft(
|
||||
int inPlaneIndex,
|
||||
float inX,
|
||||
float inY,
|
||||
float inZ,
|
||||
float inPitch,
|
||||
float inRoll,
|
||||
float inYaw,
|
||||
int inFullDraw,
|
||||
XPLMPlaneDrawState_t * inDrawStateInfo);
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/*
|
||||
* XPLMReinitUsersPlane
|
||||
*
|
||||
*
|
||||
* WARNING: DO NOT USE. Use XPLMPlaceUserAtAirport or
|
||||
* XPLMPlaceUserAtLocation.
|
||||
*
|
||||
* This function recomputes the derived flight model data from the aircraft
|
||||
* structure in memory. If you have used the data access layer to modify the
|
||||
* aircraft structure, use this routine to resynchronize x-plane; since
|
||||
* X-plane works at least partly from derived values, the sim will not behave
|
||||
* aircraft structure, use this routine to resynchronize X-Plane; since
|
||||
* X-Plane works at least partly from derived values, the sim will not behave
|
||||
* properly until this is called.
|
||||
*
|
||||
*
|
||||
* WARNING: this routine does not necessarily place the airplane at the
|
||||
* airport; use XPLMSetUsersAircraft to be compatible. This routine is
|
||||
* provided to do special experimentation with flight models without resetting
|
||||
* flight.
|
||||
* flight.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMReinitUsersPlane(void);
|
||||
XPLM_API void XPLMReinitUsersPlane(void);
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+213
-102
@@ -2,17 +2,17 @@
|
||||
#define _XPLMPlugin_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMPlugin
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These APIs provide facilities to find and work with other plugins and
|
||||
* manage other plugins.
|
||||
* manage other plugins.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -29,129 +29,136 @@ extern "C" {
|
||||
* These APIs allow you to find another plugin or yourself, or iterate across
|
||||
* all plugins. For example, if you wrote an FMS plugin that needed to talk
|
||||
* to an autopilot plugin, you could use these APIs to locate the autopilot
|
||||
* plugin.
|
||||
* plugin.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMGetMyID
|
||||
*
|
||||
*
|
||||
* This routine returns the plugin ID of the calling plug-in. Call this to
|
||||
* get your own ID.
|
||||
* get your own ID.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMPluginID XPLMGetMyID(void);
|
||||
|
||||
/*
|
||||
* XPLMCountPlugins
|
||||
*
|
||||
*
|
||||
* This routine returns the total number of plug-ins that are loaded, both
|
||||
* disabled and enabled.
|
||||
* disabled and enabled.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMCountPlugins(void);
|
||||
XPLM_API int XPLMCountPlugins(void);
|
||||
|
||||
/*
|
||||
* XPLMGetNthPlugin
|
||||
*
|
||||
*
|
||||
* This routine returns the ID of a plug-in by index. Index is 0 based from 0
|
||||
* to XPLMCountPlugins-1, inclusive. Plugins may be returned in any arbitrary
|
||||
* order.
|
||||
* order.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMPluginID XPLMGetNthPlugin(int inIndex);
|
||||
XPLM_API XPLMPluginID XPLMGetNthPlugin(
|
||||
int inIndex);
|
||||
|
||||
/*
|
||||
* XPLMFindPluginByPath
|
||||
*
|
||||
*
|
||||
* This routine returns the plug-in ID of the plug-in whose file exists at the
|
||||
* passed in absolute file system path. XPLM_NO_PLUGIN_ID is returned if the
|
||||
* path does not point to a currently loaded plug-in.
|
||||
* path does not point to a currently loaded plug-in.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMPluginID XPLMFindPluginByPath(const char *inPath);
|
||||
XPLM_API XPLMPluginID XPLMFindPluginByPath(
|
||||
const char * inPath);
|
||||
|
||||
/*
|
||||
* XPLMFindPluginBySignature
|
||||
*
|
||||
*
|
||||
* This routine returns the plug-in ID of the plug-in whose signature matches
|
||||
* what is passed in or XPLM_NO_PLUGIN_ID if no running plug-in has this
|
||||
* signature. Signatures are the best way to identify another plug-in as they
|
||||
* are independent of the file system path of a plug-in or the human-readable
|
||||
* plug-in name, and should be unique for all plug-ins. Use this routine to
|
||||
* locate another plugin that your plugin interoperates with
|
||||
* locate another plugin that your plugin interoperates with
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMPluginID XPLMFindPluginBySignature(const char *inSignature);
|
||||
XPLM_API XPLMPluginID XPLMFindPluginBySignature(
|
||||
const char * inSignature);
|
||||
|
||||
/*
|
||||
* XPLMGetPluginInfo
|
||||
*
|
||||
*
|
||||
* This routine returns information about a plug-in. Each parameter should be
|
||||
* a pointer to a buffer of at least 256 characters, or NULL to not receive
|
||||
* the information.
|
||||
*
|
||||
* outName - the human-readable name of the plug-in. outFilePath - the
|
||||
* a pointer to a buffer of at least
|
||||
* 256 characters, or NULL to not receive the information.
|
||||
*
|
||||
* outName - the human-readable name of the plug-in. outFilePath - the
|
||||
* absolute file path to the file that contains this plug-in. outSignature - a
|
||||
* unique string that identifies this plug-in. outDescription - a
|
||||
* human-readable description of this plug-in.
|
||||
* human-readable description of this plug-in.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMGetPluginInfo(XPLMPluginID inPlugin,
|
||||
char *outName, /* Can be NULL */
|
||||
char *outFilePath, /* Can be NULL */
|
||||
char *outSignature, /* Can be NULL */
|
||||
char *outDescription); /* Can be NULL */
|
||||
XPLM_API void XPLMGetPluginInfo(
|
||||
XPLMPluginID inPlugin,
|
||||
char * outName, /* Can be NULL */
|
||||
char * outFilePath, /* Can be NULL */
|
||||
char * outSignature, /* Can be NULL */
|
||||
char * outDescription); /* Can be NULL */
|
||||
|
||||
/***************************************************************************
|
||||
* ENABLING/DISABLING PLUG-INS
|
||||
***************************************************************************/
|
||||
/*
|
||||
* These routines are used to work with plug-ins and manage them. Most
|
||||
* plugins will not need to use these APIs.
|
||||
* plugins will not need to use these APIs.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMIsPluginEnabled
|
||||
*
|
||||
* Returns whether the specified plug-in is enabled for running.
|
||||
*
|
||||
* Returns whether the specified plug-in is enabled for running.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMIsPluginEnabled(XPLMPluginID inPluginID);
|
||||
XPLM_API int XPLMIsPluginEnabled(
|
||||
XPLMPluginID inPluginID);
|
||||
|
||||
/*
|
||||
* XPLMEnablePlugin
|
||||
*
|
||||
* This routine enables a plug-in if it is not already enabled. It returns 1
|
||||
*
|
||||
* This routine enables a plug-in if it is not already enabled. It returns 1
|
||||
* if the plugin was enabled or successfully enables itself, 0 if it does not.
|
||||
* Plugins may fail to enable (for example, if resources cannot be acquired)
|
||||
* by returning 0 from their XPluginEnable callback.
|
||||
* by returning 0 from their XPluginEnable callback.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMEnablePlugin(XPLMPluginID inPluginID);
|
||||
XPLM_API int XPLMEnablePlugin(
|
||||
XPLMPluginID inPluginID);
|
||||
|
||||
/*
|
||||
* XPLMDisablePlugin
|
||||
*
|
||||
* This routine disableds an enabled plug-in.
|
||||
*
|
||||
* This routine disableds an enabled plug-in.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDisablePlugin(XPLMPluginID inPluginID);
|
||||
XPLM_API void XPLMDisablePlugin(
|
||||
XPLMPluginID inPluginID);
|
||||
|
||||
/*
|
||||
* XPLMReloadPlugins
|
||||
*
|
||||
*
|
||||
* This routine reloads all plug-ins. Once this routine is called and you
|
||||
* return from the callback you were within (e.g. a menu select callback) you
|
||||
* will receive your XPluginDisable and XPluginStop callbacks and your DLL
|
||||
* will receive your XPluginDisable and XPluginStop callbacks and your DLL
|
||||
* will be unloaded, then the start process happens as if the sim was starting
|
||||
* up.
|
||||
* up.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMReloadPlugins(void);
|
||||
XPLM_API void XPLMReloadPlugins(void);
|
||||
|
||||
/***************************************************************************
|
||||
* INTERPLUGIN MESSAGING
|
||||
@@ -159,82 +166,130 @@ XPLM_API void XPLMReloadPlugins(void);
|
||||
/*
|
||||
* Plugin messages are defined as 32-bit integers. Messages below 0x00FFFFFF
|
||||
* are reserved for X-Plane and the plugin SDK.
|
||||
*
|
||||
*
|
||||
* Messages come with a pointer parameter; the meaning of this pointer depends
|
||||
* on the message itself. In some messages, the pointer parameter contains an
|
||||
* actual typed pointer to data that can be inspected in the plugin; in these
|
||||
* cases the documentation will state that the parameter "points to"
|
||||
* information.
|
||||
*
|
||||
* in other cases, the value of the pointer is actually an integral number
|
||||
* stuffed into the pointer's storage. In these second cases, the pointer
|
||||
* parameter needs to be cast, not dereferenced. In these caess, the
|
||||
* documentation will state that the parameter "contains" a value, which will
|
||||
* always be an integral type.
|
||||
*
|
||||
* Some messages don't use the pointer parameter - in this case your plugin
|
||||
* should ignore it.
|
||||
*
|
||||
* Messages have two conceptual uses: notifications and commands. Commands
|
||||
* are sent from one plugin to another to induce behavior; notifications are
|
||||
* sent from one plugin to all others for informational purposes. It is
|
||||
* are sent from one plugin to another to induce behavior; notifications are
|
||||
* sent from one plugin to all others for informational purposes. It is
|
||||
* important that commands and notifications not have the same values because
|
||||
* this could cause a notification sent by one plugin to accidentally induce a
|
||||
* command in another.
|
||||
*
|
||||
*
|
||||
* By convention, plugin-defined notifications should have the high bit set
|
||||
* (e.g. be greater or equal to unsigned 0x8000000) while commands should have
|
||||
* this bit be cleared.
|
||||
*
|
||||
* The following messages are sent to your plugin by x-plane.
|
||||
*
|
||||
* The following messages are sent to your plugin by X-Plane.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* This message is sent to your plugin whenever the user's plane crashes. */
|
||||
/* This message is sent to your plugin whenever the user's plane crashes. The *
|
||||
* parameter is ignored. */
|
||||
#define XPLM_MSG_PLANE_CRASHED 101
|
||||
|
||||
/* This message is sent to your plugin whenever a new plane is loaded. The *
|
||||
* parameter is the number of the plane being loaded; 0 indicates the user's *
|
||||
* plane. */
|
||||
/* This message is sent to your plugin whenever a new plane is loaded. The *
|
||||
* parameter contains the index number of the plane being loaded; 0 indicates *
|
||||
* the user's plane. */
|
||||
#define XPLM_MSG_PLANE_LOADED 102
|
||||
|
||||
/* This messages is called whenever the user's plane is positioned at a new *
|
||||
* airport. */
|
||||
/* This messages is sent whenever the user's plane is positioned at a new *
|
||||
* airport. The parameter is ignored. */
|
||||
#define XPLM_MSG_AIRPORT_LOADED 103
|
||||
|
||||
/* This message is sent whenever new scenery is loaded. Use datarefs to *
|
||||
* determine the new scenery files that were loaded. */
|
||||
/* This message is sent whenever new scenery is loaded. Use datarefs to *
|
||||
* determine the new scenery files that were loaded. The parameter is ignored.*/
|
||||
#define XPLM_MSG_SCENERY_LOADED 104
|
||||
|
||||
/* This message is sent whenever the user adjusts the number of X-Plane *
|
||||
* aircraft models. You must use XPLMCountPlanes to find out how many planes *
|
||||
* are now available. This message will only be sent in XP7 and higher *
|
||||
* because in XP6 the number of aircraft is not user-adjustable. */
|
||||
/* This message is sent whenever the user adjusts the number of X-Plane *
|
||||
* aircraft models. You must use XPLMCountPlanes to find out how many planes *
|
||||
* are now available. This message will only be sent in XP7 and higher *
|
||||
* because in XP6 the number of aircraft is not user-adjustable. The parameter*
|
||||
* is ignored. */
|
||||
#define XPLM_MSG_AIRPLANE_COUNT_CHANGED 105
|
||||
|
||||
#if defined(XPLM200)
|
||||
/* This message is sent to your plugin whenever a plane is unloaded. The *
|
||||
* parameter is the number of the plane being unloaded; 0 indicates the user's *
|
||||
* plane. The parameter is of type int, passed as the value of the pointer. *
|
||||
* (That is: the parameter is an int, not a pointer to an int.) */
|
||||
/* This message is sent to your plugin whenever a plane is unloaded. The *
|
||||
* parameter contains the index number of the plane being unloaded; 0 *
|
||||
* indicates the user's plane. The parameter is of type int, passed as the *
|
||||
* value of the pointer. (That is: the parameter is an int, not a pointer to *
|
||||
* an int.) */
|
||||
#define XPLM_MSG_PLANE_UNLOADED 106
|
||||
#endif /* XPLM200 */
|
||||
|
||||
#if defined(XPLM210)
|
||||
/* This message is sent to your plugin right before X-Plane writes its *
|
||||
* preferences file. You can use this for two purposes: to write your own *
|
||||
* preferences, and to modify any datarefs to influence preferences output. *
|
||||
* For example, if your plugin temporarily modifies saved preferences, you can *
|
||||
* put them back to their default values here to avoid having the tweaks be *
|
||||
* persisted if your plugin is not loaded on the next invocation of X-Plane. */
|
||||
/* This message is sent to your plugin right before X-Plane writes its *
|
||||
* preferences file. You can use this for two purposes: to write your own *
|
||||
* preferences, and to modify any datarefs to influence preferences output. *
|
||||
* For example, if your plugin temporarily modifies saved preferences, you can*
|
||||
* put them back to their default values here to avoid having the tweaks be *
|
||||
* persisted if your plugin is not loaded on the next invocation of X-Plane. *
|
||||
* The parameter is ignored. */
|
||||
#define XPLM_MSG_WILL_WRITE_PREFS 107
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#if defined(XPLM210)
|
||||
/* This message is sent to your plugin right after a livery is loaded for an *
|
||||
* airplane. You can use this to check the new livery (via datarefs) and *
|
||||
* react accordingly. The parameter is of type int, passed as the value of a *
|
||||
* pointer and represents the aicraft plane number - 0 is the user's plane. */
|
||||
/* This message is sent to your plugin right after a livery is loaded for an *
|
||||
* airplane. You can use this to check the new livery (via datarefs) and *
|
||||
* react accordingly. The parameter contains the index number of the aircraft*
|
||||
* whose livery is changing. */
|
||||
#define XPLM_MSG_LIVERY_LOADED 108
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#if defined(XPLM301)
|
||||
/* Sent to your plugin right before X-Plane enters virtual reality mode (at *
|
||||
* which time any windows that are not positioned in VR mode will no longer be*
|
||||
* visible to the user). The parameter is unused and should be ignored. */
|
||||
#define XPLM_MSG_ENTERED_VR 109
|
||||
#endif /* XPLM301 */
|
||||
|
||||
#if defined(XPLM301)
|
||||
/* Sent to your plugin right before X-Plane leaves virtual reality mode (at *
|
||||
* which time you may want to clean up windows that are positioned in VR *
|
||||
* mode). The parameter is unused and should be ignored. */
|
||||
#define XPLM_MSG_EXITING_VR 110
|
||||
#endif /* XPLM301 */
|
||||
|
||||
#if defined(XPLM303)
|
||||
/* Sent to your plugin if another plugin wants to take over AI planes. If you *
|
||||
* are a synthetic traffic provider, that probably means a plugin for an *
|
||||
* online network has connected and wants to supply aircraft flown by real *
|
||||
* humans and you should cease to provide synthetic traffic. If however you *
|
||||
* are providing online traffic from real humans, you probably don't want to *
|
||||
* disconnect, in which case you just ignore this message. The sender is the *
|
||||
* plugin ID of the plugin asking for control of the planes now. You can use *
|
||||
* it to find out who is requesting and whether you should yield to them. *
|
||||
* Synthetic traffic providers should always yield to online networks. The *
|
||||
* parameter is unused and should be ignored. */
|
||||
#define XPLM_MSG_RELEASE_PLANES 111
|
||||
#endif /* XPLM303 */
|
||||
|
||||
/*
|
||||
* XPLMSendMessageToPlugin
|
||||
*
|
||||
*
|
||||
* This function sends a message to another plug-in or X-Plane. Pass
|
||||
* XPLM_NO_PLUGIN_ID to broadcast to all plug-ins. Only enabled plug-ins with
|
||||
* a message receive function receive the message.
|
||||
* a message receive function receive the message.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSendMessageToPlugin(XPLMPluginID inPlugin,
|
||||
int inMessage,
|
||||
void *inParam);
|
||||
XPLM_API void XPLMSendMessageToPlugin(
|
||||
XPLMPluginID inPlugin,
|
||||
int inMessage,
|
||||
void * inParam);
|
||||
|
||||
#if defined(XPLM200)
|
||||
/***************************************************************************
|
||||
@@ -245,63 +300,119 @@ XPLM_API void XPLMSendMessageToPlugin(XPLMPluginID inPlugin,
|
||||
* capabilities and plugin system features that are normally disabled for
|
||||
* backward compatibility. This allows advanced plugins to "opt-in" to new
|
||||
* behavior.
|
||||
*
|
||||
*
|
||||
* Each feature is defined by a permanent string name. The feature string
|
||||
* names will vary with the particular installation of X-Plane, so plugins
|
||||
* names will vary with the particular installation of X-Plane, so plugins
|
||||
* should not expect a feature to be guaranteed present.
|
||||
*
|
||||
* XPLM_WANTS_REFLECTIONS
|
||||
* ----------------------
|
||||
*
|
||||
* Available in the SDK 2.0 and later for X-Plane 9, enabling this capability
|
||||
* causes your plugin to receive drawing hook callbacks when X-Plane builds
|
||||
* its off-screen reflection and shadow rendering passes. Plugins should
|
||||
* enable this and examine the dataref sim/graphics/view/plane_render_type to
|
||||
* determine whether the drawing callback is for a reflection, shadow
|
||||
* calculation, or the main screen. Rendering can be simlified or omitted for
|
||||
* reflections, and non-solid drawing should be skipped for shadow
|
||||
* calculations.
|
||||
*
|
||||
* **Note**: direct drawing via draw callbacks is not recommended; use the
|
||||
* XPLMInstance API to create object models instead.
|
||||
*
|
||||
* XPLM_USE_NATIVE_PATHS
|
||||
* ---------------------
|
||||
*
|
||||
* available in the SDK 2.1 and later for X-Plane 10, this modifies the plugin
|
||||
* system to use Unix-style paths on all operating systems. With this enabled:
|
||||
*
|
||||
* * OS X paths will match the native OS X Unix.
|
||||
* * Windows will use forward slashes but preserve C:\ or another drive letter
|
||||
* when using complete file paths.
|
||||
* * Linux uses its native file system path scheme.
|
||||
*
|
||||
* Without this enabled:
|
||||
*
|
||||
* * OS X will use CFM file paths separated by a colon.
|
||||
* * Windows will use back-slashes and conventional DOS paths.
|
||||
* * Linux uses its native file system path scheme.
|
||||
*
|
||||
* All plugins should enable this feature on OS X to access the native file
|
||||
* system.
|
||||
*
|
||||
* XPLM_USE_NATIVE_WIDGET_WINDOWS
|
||||
* ------------------------------
|
||||
*
|
||||
* Available in the SDK 3.0.2 SDK, this capability tells the widgets library
|
||||
* to use new, modern X-Plane backed XPLMDisplay windows to anchor all widget
|
||||
* trees. Without it, widgets will always use legacy windows.
|
||||
*
|
||||
* Plugins should enable this to allow their widget hierarchies to respond to
|
||||
* the user's UI size settings and to map widget-based windwos to a VR HMD.
|
||||
*
|
||||
* Before enabling this, make sure any custom widget code in your plugin is
|
||||
* prepared to cope with the UI coordinate system not being th same as the
|
||||
* OpenGL window coordinate system.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMFeatureEnumerator_f
|
||||
*
|
||||
*
|
||||
* You pass an XPLMFeatureEnumerator_f to get a list of all features supported
|
||||
* by a given version running version of X-Plane. This routine is called once
|
||||
* for each feature.
|
||||
* for each feature.
|
||||
*
|
||||
*/
|
||||
typedef void (*XPLMFeatureEnumerator_f)(const char *inFeature, void *inRef);
|
||||
typedef void (* XPLMFeatureEnumerator_f)(
|
||||
const char * inFeature,
|
||||
void * inRef);
|
||||
|
||||
/*
|
||||
* XPLMHasFeature
|
||||
*
|
||||
*
|
||||
* This returns 1 if the given installation of X-Plane supports a feature, or
|
||||
* 0 if it does not.
|
||||
* 0 if it does not.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMHasFeature(const char *inFeature);
|
||||
XPLM_API int XPLMHasFeature(
|
||||
const char * inFeature);
|
||||
|
||||
/*
|
||||
* XPLMIsFeatureEnabled
|
||||
*
|
||||
*
|
||||
* This returns 1 if a feature is currently enabled for your plugin, or 0 if
|
||||
* it is not enabled. It is an error to call this routine with an unsupported
|
||||
* feature.
|
||||
* feature.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMIsFeatureEnabled(const char *inFeature);
|
||||
XPLM_API int XPLMIsFeatureEnabled(
|
||||
const char * inFeature);
|
||||
|
||||
/*
|
||||
* XPLMEnableFeature
|
||||
*
|
||||
*
|
||||
* This routine enables or disables a feature for your plugin. This will
|
||||
* change the running behavior of X-Plane and your plugin in some way,
|
||||
* depending on the feature.
|
||||
* depending on the feature.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMEnableFeature(const char *inFeature, int inEnable);
|
||||
XPLM_API void XPLMEnableFeature(
|
||||
const char * inFeature,
|
||||
int inEnable);
|
||||
|
||||
/*
|
||||
* XPLMEnumerateFeatures
|
||||
*
|
||||
*
|
||||
* This routine calls your enumerator callback once for each feature that this
|
||||
* running version of X-Plane supports. Use this routine to determine all of
|
||||
* the features that X-Plane can support.
|
||||
* the features that X-Plane can support.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMEnumerateFeatures(XPLMFeatureEnumerator_f inEnumerator,
|
||||
void *inRef);
|
||||
XPLM_API void XPLMEnumerateFeatures(
|
||||
XPLMFeatureEnumerator_f inEnumerator,
|
||||
void * inRef);
|
||||
|
||||
#endif /* XPLM200 */
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -2,23 +2,38 @@
|
||||
#define _XPLMProcessing_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMProcessing
|
||||
***************************************************************************/
|
||||
/*
|
||||
* This API allows you to get regular callbacks during the flight loop, the
|
||||
* part of X-Plane where the plane's position calculates the physics of
|
||||
* flight, etc. Use these APIs to accomplish periodic tasks like logging data
|
||||
* flight, etc. Use these APIs to accomplish periodic tasks like logging data
|
||||
* and performing I/O.
|
||||
*
|
||||
* WARNING: Do NOT use these callbacks to draw! You cannot draw during flight
|
||||
* loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
||||
* for graphics.
|
||||
*
|
||||
* You can receive a callback either just before or just after the per-frame
|
||||
* physics calculations happen - you can use post-FM callbacks to "patch" the
|
||||
* flight model after it has run.
|
||||
*
|
||||
* If the user has set the number of flight model iterations per frame greater
|
||||
* than one your plugin will _not_ see this; these integrations run on the
|
||||
* sub-section of the flight model where iterations improve responsiveness
|
||||
* (e.g. physical integration, not simple systems tracking) and are thus
|
||||
* opaque to plugins.
|
||||
*
|
||||
* Flight loop scheduling, when scheduled by time, is scheduled by a "first
|
||||
* callback after the deadline" schedule, e.g. your callbacks will always be
|
||||
* slightly late to ensure that we don't run faster than your deadline.
|
||||
*
|
||||
* WARNING: Do NOT use these callbacks to draw! You cannot draw during flight
|
||||
* loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
||||
* for graphics. (One exception: you can use a post-flight loop callback to
|
||||
* update your own off-screen FBOs.)
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -31,27 +46,21 @@ extern "C" {
|
||||
/***************************************************************************
|
||||
* FLIGHT LOOP CALLBACKS
|
||||
***************************************************************************/
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMFlightLoopPhaseType
|
||||
*
|
||||
*
|
||||
* You can register a flight loop callback to run either before or after the
|
||||
* flight model is integrated by X-Plane.
|
||||
* flight model is integrated by X-Plane.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* Your callback runs before X-Plane integrates the flight model. */
|
||||
xplm_FlightLoop_Phase_BeforeFlightModel = 0
|
||||
/* Your callback runs before X-Plane integrates the flight model. */
|
||||
xplm_FlightLoop_Phase_BeforeFlightModel = 0,
|
||||
|
||||
/* Your callback runs after X-Plane integrates the flight model. */
|
||||
,
|
||||
xplm_FlightLoop_Phase_AfterFlightModel = 1
|
||||
/* Your callback runs after X-Plane integrates the flight model. */
|
||||
xplm_FlightLoop_Phase_AfterFlightModel = 1,
|
||||
|
||||
|
||||
};
|
||||
@@ -61,184 +70,191 @@ typedef int XPLMFlightLoopPhaseType;
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMFlightLoopID
|
||||
*
|
||||
* This is an opaque identifier for a flight loop callback. You can use this
|
||||
*
|
||||
* This is an opaque identifier for a flight loop callback. You can use this
|
||||
* identifier to easily track and remove your callbacks, or to use the new
|
||||
* flight loop APIs.
|
||||
* flight loop APIs.
|
||||
*
|
||||
*/
|
||||
typedef void *XPLMFlightLoopID;
|
||||
typedef void * XPLMFlightLoopID;
|
||||
#endif /* XPLM210 */
|
||||
|
||||
/*
|
||||
* XPLMFlightLoop_f
|
||||
*
|
||||
* This is your flight loop callback. Each time the flight loop is iterated
|
||||
* through, you receive this call at the end. You receive a time since you
|
||||
* were last called and a time since the last loop, as well as a loop counter.
|
||||
* The 'phase' parameter is deprecated and should be ignored.
|
||||
*
|
||||
* Your return value controls when you will next be called. Return 0 to stop
|
||||
* receiving callbacks. Pass a positive number to specify how many seconds
|
||||
* until the next callback. (You will be called at or after this time, not
|
||||
* before.) Pass a negative number to specify how many loops must go by until
|
||||
* you are called. For example, -1.0 means call me the very next loop. Try
|
||||
* to run your flight loop as infrequently as is practical, and suspend it
|
||||
*
|
||||
* This is your flight loop callback. Each time the flight loop is iterated
|
||||
* through, you receive this call at the end.
|
||||
*
|
||||
* Flight loop callbacks receive a number of input timing parameters. These
|
||||
* input timing parameters are not particularly useful; you may need to track
|
||||
* your own timing data (e.g. by reading datarefs). The input parameters are:
|
||||
*
|
||||
* - inElapsedSinceLastCall: the wall time since your last callback.
|
||||
* - inElapsedTimeSinceLastFlightLoop: the wall time since any flight loop was
|
||||
* dispatched.
|
||||
* - inCounter: a monotonically increasing counter, bumped once per flight
|
||||
* loop dispatch from the sim.
|
||||
* - inRefcon: your own ptr constant from when you regitered yor callback.
|
||||
*
|
||||
* Your return value controls when you will next be called.
|
||||
*
|
||||
* - Return 0 to stop receiving callbacks.
|
||||
* - Pass a positive number to specify how many seconds until the next
|
||||
* callback. (You will be called at or after this time, not before.)
|
||||
* - Pass a negative number to specify how many loops must go by until you
|
||||
* are called. For example, -1.0 means call me the very next loop.
|
||||
*
|
||||
* Try to run your flight loop as infrequently as is practical, and suspend it
|
||||
* (using return value 0) when you do not need it; lots of flight loop
|
||||
* callbacks that do nothing lowers x-plane's frame rate.
|
||||
*
|
||||
* callbacks that do nothing lowers X-Plane's frame rate.
|
||||
*
|
||||
* Your callback will NOT be unregistered if you return 0; it will merely be
|
||||
* inactive.
|
||||
*
|
||||
* The reference constant you passed to your loop is passed back to you.
|
||||
* inactive.
|
||||
*
|
||||
*/
|
||||
typedef float (*XPLMFlightLoop_f)(float inElapsedSinceLastCall,
|
||||
float inElapsedTimeSinceLastFlightLoop,
|
||||
int inCounter,
|
||||
void *inRefcon);
|
||||
typedef float (* XPLMFlightLoop_f)(
|
||||
float inElapsedSinceLastCall,
|
||||
float inElapsedTimeSinceLastFlightLoop,
|
||||
int inCounter,
|
||||
void * inRefcon);
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMCreateFlightLoop_t
|
||||
*
|
||||
*
|
||||
* XPLMCreateFlightLoop_t contains the parameters to create a new flight loop
|
||||
* callback. The strsucture can be expanded in future SDKs - always set
|
||||
* structSize to the size of your structure in bytes.
|
||||
* callback. The strsucture can be expanded in future SDKs - always set
|
||||
* structSize to the size of your structure in bytes.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
int structSize;
|
||||
XPLMFlightLoopPhaseType phase;
|
||||
XPLMFlightLoop_f callbackFunc;
|
||||
void *refcon;
|
||||
int structSize;
|
||||
XPLMFlightLoopPhaseType phase;
|
||||
XPLMFlightLoop_f callbackFunc;
|
||||
void * refcon;
|
||||
} XPLMCreateFlightLoop_t;
|
||||
#endif /* XPLM210 */
|
||||
|
||||
/*
|
||||
* XPLMGetElapsedTime
|
||||
*
|
||||
*
|
||||
* This routine returns the elapsed time since the sim started up in decimal
|
||||
* seconds.
|
||||
* seconds. This is a wall timer; it keeps counting upward even if the sim is
|
||||
* pasued.
|
||||
*
|
||||
* __WARNING__: XPLMGetElapsedTime is not a very good timer! It lacks
|
||||
* precision in both its data type and its source. Do not attempt to use it
|
||||
* for timing critical applications like network multiplayer.
|
||||
*
|
||||
*/
|
||||
XPLM_API float XPLMGetElapsedTime(void);
|
||||
XPLM_API float XPLMGetElapsedTime(void);
|
||||
|
||||
/*
|
||||
* XPLMGetCycleNumber
|
||||
*
|
||||
*
|
||||
* This routine returns a counter starting at zero for each sim cycle
|
||||
* computed/video frame rendered.
|
||||
* computed/video frame rendered.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMGetCycleNumber(void);
|
||||
XPLM_API int XPLMGetCycleNumber(void);
|
||||
|
||||
/*
|
||||
* XPLMRegisterFlightLoopCallback
|
||||
*
|
||||
* This routine registers your flight loop callback. Pass in a pointer to a
|
||||
* flight loop function and a refcon. inInterval defines when you will be
|
||||
* called. Pass in a positive number to specify seconds from registration
|
||||
* time to the next callback. Pass in a negative number to indicate when you
|
||||
* will be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to
|
||||
* not be called; your callback will be inactive.
|
||||
*
|
||||
* This routine registers your flight loop callback. Pass in a pointer to a
|
||||
* flight loop function and a refcon. inInterval defines when you will be
|
||||
* called. Pass in a positive number to specify seconds from registration time
|
||||
* to the next callback. Pass in a negative number to indicate when you will
|
||||
* be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to not be
|
||||
* called; your callback will be inactive.
|
||||
*
|
||||
* (This legacy function only installs pre-flight-loop callbacks; use
|
||||
* XPLMCreateFlightLoop for more control.)
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMRegisterFlightLoopCallback(XPLMFlightLoop_f inFlightLoop,
|
||||
float inInterval,
|
||||
void *inRefcon);
|
||||
XPLM_API void XPLMRegisterFlightLoopCallback(
|
||||
XPLMFlightLoop_f inFlightLoop,
|
||||
float inInterval,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMUnregisterFlightLoopCallback
|
||||
*
|
||||
* This routine unregisters your flight loop callback. Do NOT call it from
|
||||
* your flight loop callback. Once your flight loop callback is
|
||||
* unregistered, it will not be called again.
|
||||
*
|
||||
* This routine unregisters your flight loop callback. Do NOT call it from
|
||||
* your flight loop callback. Once your flight loop callback is unregistered,
|
||||
* it will not be called again.
|
||||
*
|
||||
* Only use this on flight loops registered via
|
||||
* XPLMRegisterFlightLoopCallback.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMUnregisterFlightLoopCallback(XPLMFlightLoop_f inFlightLoop,
|
||||
void *inRefcon);
|
||||
XPLM_API void XPLMUnregisterFlightLoopCallback(
|
||||
XPLMFlightLoop_f inFlightLoop,
|
||||
void * inRefcon);
|
||||
|
||||
/*
|
||||
* XPLMSetFlightLoopCallbackInterval
|
||||
*
|
||||
* This routine sets when a callback will be called. Do NOT call it from your
|
||||
*
|
||||
* This routine sets when a callback will be called. Do NOT call it from your
|
||||
* callback; use the return value of the callback to change your callback
|
||||
* interval from inside your callback.
|
||||
*
|
||||
*
|
||||
* inInterval is formatted the same way as in XPLMRegisterFlightLoopCallback;
|
||||
* positive for seconds, negative for cycles, and 0 for deactivating the
|
||||
* callback. If inRelativeToNow is 1, times are from the time of this call;
|
||||
* callback. If inRelativeToNow is 1, times are from the time of this call;
|
||||
* otherwise they are from the time the callback was last called (or the time
|
||||
* it was registered if it has never been called.
|
||||
* it was registered if it has never been called.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMSetFlightLoopCallbackInterval(XPLMFlightLoop_f inFlightLoop,
|
||||
float inInterval,
|
||||
int inRelativeToNow,
|
||||
void *inRefcon);
|
||||
XPLM_API void XPLMSetFlightLoopCallbackInterval(
|
||||
XPLMFlightLoop_f inFlightLoop,
|
||||
float inInterval,
|
||||
int inRelativeToNow,
|
||||
void * inRefcon);
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMCreateFlightLoop
|
||||
*
|
||||
* This routine creates a flight loop callback and returns its ID. The flight
|
||||
*
|
||||
* This routine creates a flight loop callback and returns its ID. The flight
|
||||
* loop callback is created using the input param struct, and is inited to be
|
||||
* unscheduled.
|
||||
* unscheduled.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMFlightLoopID
|
||||
XPLMCreateFlightLoop(XPLMCreateFlightLoop_t *inParams);
|
||||
XPLM_API XPLMFlightLoopID XPLMCreateFlightLoop(
|
||||
XPLMCreateFlightLoop_t * inParams);
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMDestroyFlightLoop
|
||||
*
|
||||
* This routine destroys a flight loop callback by ID.
|
||||
*
|
||||
* This routine destroys a flight loop callback by ID. Only call it on flight
|
||||
* loops created with the newer XPLMCreateFlightLoop API.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDestroyFlightLoop(XPLMFlightLoopID inFlightLoopID);
|
||||
XPLM_API void XPLMDestroyFlightLoop(
|
||||
XPLMFlightLoopID inFlightLoopID);
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMScheduleFlightLoop
|
||||
*
|
||||
* This routine schedules a flight loop callback for future execution. If
|
||||
* inInterval is negative, it is run in a certain number of frames based on
|
||||
* the absolute value of the input. If the interval is positive, it is a
|
||||
*
|
||||
* This routine schedules a flight loop callback for future execution. If
|
||||
* inInterval is negative, it is run in a certain number of frames based on
|
||||
* the absolute value of the input. If the interval is positive, it is a
|
||||
* duration in seconds.
|
||||
*
|
||||
*
|
||||
* If inRelativeToNow is true, ties are interpretted relative to the time this
|
||||
* routine is called; otherwise they are relative to the last call time or the
|
||||
* time the flight loop was registered (if never called).
|
||||
*
|
||||
* THREAD SAFETY: it is legal to call this routine from any thread under the
|
||||
* following conditions:
|
||||
*
|
||||
* 1. The call must be between the beginning of an XPLMEnable and the end of
|
||||
* an XPLMDisable sequence. (That is, you must not call this routine from
|
||||
* thread activity when your plugin was supposed to be disabled. Since
|
||||
* plugins are only enabled while loaded, this also implies you cannot run
|
||||
* this routine outside an XPLMStart/XPLMStop sequence.)
|
||||
*
|
||||
* 2. You may not call this routine re-entrantly for a single flight loop ID.
|
||||
* (That is, you can't enable from multiple threads at the same time.)
|
||||
*
|
||||
* 3. You must call this routine between the time after XPLMCreateFlightLoop
|
||||
* returns a value and the time you call XPLMDestroyFlightLoop. (That is, you
|
||||
* must ensure that your threaded activity is within the life of the object.
|
||||
* The SDK does not check this for you, nor does it synchronize destruction of
|
||||
* the object.)
|
||||
*
|
||||
* 4. The object must be unscheduled if this routine is to be called from a
|
||||
* thread other than the main thread.
|
||||
* time the flight loop was registered (if never called).
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMScheduleFlightLoop(XPLMFlightLoopID inFlightLoopID,
|
||||
float inInterval,
|
||||
int inRelativeToNow);
|
||||
XPLM_API void XPLMScheduleFlightLoop(
|
||||
XPLMFlightLoopID inFlightLoopID,
|
||||
float inInterval,
|
||||
int inRelativeToNow);
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+244
-180
@@ -2,16 +2,16 @@
|
||||
#define _XPLMScenery_h_
|
||||
|
||||
/*
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
||||
*
|
||||
* All rights reserved. See license.txt for usage.
|
||||
*
|
||||
* X-Plane SDK Version: 2.1.1
|
||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||
*
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* XPLMScenery
|
||||
***************************************************************************/
|
||||
/*
|
||||
* This package contains APIs to interact with X-Plane's scenery system.
|
||||
* This package contains APIs to interact with X-Plane's scenery system.
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -26,46 +26,49 @@ extern "C" {
|
||||
* Terrain Y-Testing
|
||||
***************************************************************************/
|
||||
/*
|
||||
* The Y-testing API allows you to locate the physical scenery mesh. This
|
||||
* would be used to place dynamic graphics on top of the ground in a
|
||||
* plausible way or do physics interactions.
|
||||
*
|
||||
* The Y-testing API allows you to locate the physical scenery mesh. This
|
||||
* would be used to place dynamic graphics on top of the ground in a plausible
|
||||
* way or do physics interactions.
|
||||
*
|
||||
* The Y-test API works via probe objects, which are allocated by your plugin
|
||||
* and used to query terrain. Probe objects exist both to capture which
|
||||
* algorithm you have requested (see probe types) and also to cache query
|
||||
* information.
|
||||
*
|
||||
* Performance guidelines: It is generally faster to use the same probe for
|
||||
* nearby points and different probes for different points. Try not to
|
||||
* allocate more than "hundreds" of probes at most. Share probes if you need
|
||||
* more. Generally, probing operations are expensive, and should be avoided
|
||||
* via caching when possible.
|
||||
*
|
||||
*
|
||||
* Performance Guidelines
|
||||
* ----------------------
|
||||
*
|
||||
* It is generally faster to use the same probe for nearby points and
|
||||
* different probes for different points. Try not to allocate more than
|
||||
* "hundreds" of probes at most. Share probes if you need more. Generally,
|
||||
* probing operations are expensive, and should be avoided via caching when
|
||||
* possible.
|
||||
*
|
||||
* Y testing returns a location on the terrain, a normal vectory, and a
|
||||
* velocity vector. The normal vector tells you the slope of the terrain at
|
||||
* that point. The velocity vector tells you if that terrain is moving (and
|
||||
* is in meters/second). For example, if your Y test hits the aircraft carrier
|
||||
* velocity vector. The normal vector tells you the slope of the terrain at
|
||||
* that point. The velocity vector tells you if that terrain is moving (and is
|
||||
* in meters/second). For example, if your Y test hits the aircraft carrier
|
||||
* deck, this tells you the velocity of that point on the deck.
|
||||
*
|
||||
*
|
||||
* Note: the Y-testing API is limited to probing the loaded scenery area,
|
||||
* which is approximately 300x300 km in X-Plane 9. Probes outside this area
|
||||
* will return the height of a 0 MSL sphere.
|
||||
* which is approximately 300x300 km in X-Plane 9. Probes outside this area
|
||||
* will return the height of a 0 MSL sphere.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMProbeType
|
||||
*
|
||||
*
|
||||
* XPLMProbeType defines the type of terrain probe - each probe has a
|
||||
* different algorithm. (Only one type of probe is provided right now, but
|
||||
* future APIs will expose more flexible or poewrful or useful probes.
|
||||
* different algorithm. (Only one type of probe is provided right now, but
|
||||
* future APIs will expose more flexible or poewrful or useful probes.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* The Y probe gives you the location of the tallest physical scenery along
|
||||
* * the Y axis going through the queried point. */
|
||||
xplm_ProbeY = 0
|
||||
/* The Y probe gives you the location of the tallest physical scenery along *
|
||||
* the Y axis going through the queried point. */
|
||||
xplm_ProbeY = 0,
|
||||
|
||||
|
||||
};
|
||||
@@ -73,24 +76,21 @@ typedef int XPLMProbeType;
|
||||
|
||||
/*
|
||||
* XPLMProbeResult
|
||||
*
|
||||
* Probe results - possible results from a probe query.
|
||||
*
|
||||
* Probe results - possible results from a probe query.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/* The probe hit terrain and returned valid values. */
|
||||
xplm_ProbeHitTerrain = 0
|
||||
/* The probe hit terrain and returned valid values. */
|
||||
xplm_ProbeHitTerrain = 0,
|
||||
|
||||
/* An error in the API call. Either the probe struct size is bad, or the *
|
||||
* probe is invalid or the type is mismatched for the specific query call.
|
||||
*/
|
||||
,
|
||||
xplm_ProbeError = 1
|
||||
/* An error in the API call. Either the probe struct size is bad, or the *
|
||||
* probe is invalid or the type is mismatched for the specific query call. */
|
||||
xplm_ProbeError = 1,
|
||||
|
||||
/* The probe call succeeded but there is no terrain under this point
|
||||
* (perhaps * it is off the side of the planet?) */
|
||||
,
|
||||
xplm_ProbeMissed = 2
|
||||
/* The probe call succeeded but there is no terrain under this point (perhaps *
|
||||
* it is off the side of the planet?) */
|
||||
xplm_ProbeMissed = 2,
|
||||
|
||||
|
||||
};
|
||||
@@ -98,88 +98,142 @@ typedef int XPLMProbeResult;
|
||||
|
||||
/*
|
||||
* XPLMProbeRef
|
||||
*
|
||||
*
|
||||
* An XPLMProbeRef is an opaque handle to a probe, used for querying the
|
||||
* terrain.
|
||||
* terrain.
|
||||
*
|
||||
*/
|
||||
typedef void *XPLMProbeRef;
|
||||
typedef void * XPLMProbeRef;
|
||||
|
||||
/*
|
||||
* XPLMProbeInfo_t
|
||||
*
|
||||
* XPLMProbeInfo_t contains the results of a probe call. Make sure to set
|
||||
* structSize to the size of the struct before using it.
|
||||
*
|
||||
* XPLMProbeInfo_t contains the results of a probe call. Make sure to set
|
||||
* structSize to the size of the struct before using it.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
/* Size of structure in bytes - always set this before calling the XPLM. */
|
||||
int structSize;
|
||||
/* Resulting X location of the terrain point we hit, in local OpenGL *
|
||||
* coordinates. */
|
||||
float locationX;
|
||||
/* Resulting Y location of the terrain point we hit, in local OpenGL *
|
||||
* coordinates. */
|
||||
float locationY;
|
||||
/* Resulting Z location of the terrain point we hit, in local OpenGL *
|
||||
* coordinates. */
|
||||
float locationZ;
|
||||
/* X component of the normal vector to the terrain we found. */
|
||||
float normalX;
|
||||
/* Y component of the normal vector to the terrain we found. */
|
||||
float normalY;
|
||||
/* Z component of the normal vector to the terrain we found. */
|
||||
float normalZ;
|
||||
/* X component of the velocity vector of the terrain we found. */
|
||||
float velocityX;
|
||||
/* Y component of the velocity vector of the terrain we found. */
|
||||
float velocityY;
|
||||
/* Z component of the velocity vector of the terrain we found. */
|
||||
float velocityZ;
|
||||
/* Tells if the surface we hit is water (otherwise it is land). */
|
||||
int is_wet;
|
||||
/* Size of structure in bytes - always set this before calling the XPLM. */
|
||||
int structSize;
|
||||
/* Resulting X location of the terrain point we hit, in local OpenGL *
|
||||
* coordinates. */
|
||||
float locationX;
|
||||
/* Resulting Y location of the terrain point we hit, in local OpenGL *
|
||||
* coordinates. */
|
||||
float locationY;
|
||||
/* Resulting Z location of the terrain point we hit, in local OpenGL *
|
||||
* coordinates. */
|
||||
float locationZ;
|
||||
/* X component of the normal vector to the terrain we found. */
|
||||
float normalX;
|
||||
/* Y component of the normal vector to the terrain we found. */
|
||||
float normalY;
|
||||
/* Z component of the normal vector to the terrain we found. */
|
||||
float normalZ;
|
||||
/* X component of the velocity vector of the terrain we found. */
|
||||
float velocityX;
|
||||
/* Y component of the velocity vector of the terrain we found. */
|
||||
float velocityY;
|
||||
/* Z component of the velocity vector of the terrain we found. */
|
||||
float velocityZ;
|
||||
/* Tells if the surface we hit is water (otherwise it is land). */
|
||||
int is_wet;
|
||||
} XPLMProbeInfo_t;
|
||||
|
||||
/*
|
||||
* XPLMCreateProbe
|
||||
*
|
||||
* Creates a new probe object of a given type and returns.
|
||||
*
|
||||
* Creates a new probe object of a given type and returns.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMProbeRef XPLMCreateProbe(XPLMProbeType inProbeType);
|
||||
XPLM_API XPLMProbeRef XPLMCreateProbe(
|
||||
XPLMProbeType inProbeType);
|
||||
|
||||
/*
|
||||
* XPLMDestroyProbe
|
||||
*
|
||||
* Deallocates an existing probe object.
|
||||
*
|
||||
* Deallocates an existing probe object.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDestroyProbe(XPLMProbeRef inProbe);
|
||||
XPLM_API void XPLMDestroyProbe(
|
||||
XPLMProbeRef inProbe);
|
||||
|
||||
/*
|
||||
* XPLMProbeTerrainXYZ
|
||||
*
|
||||
* Probes the terrain. Pass in the XYZ coordinate of the probe point, a probe
|
||||
* object, and an XPLMProbeInfo_t struct that has its structSize member set
|
||||
* properly. Other fields are filled in if we hit terrain, and a probe result
|
||||
* is returned.
|
||||
*
|
||||
* Probes the terrain. Pass in the XYZ coordinate of the probe point, a probe
|
||||
* object, and an XPLMProbeInfo_t struct that has its structSize member set
|
||||
* properly. Other fields are filled in if we hit terrain, and a probe result
|
||||
* is returned.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMProbeResult XPLMProbeTerrainXYZ(XPLMProbeRef inProbe,
|
||||
float inX,
|
||||
float inY,
|
||||
float inZ,
|
||||
XPLMProbeInfo_t *outInfo);
|
||||
XPLM_API XPLMProbeResult XPLMProbeTerrainXYZ(
|
||||
XPLMProbeRef inProbe,
|
||||
float inX,
|
||||
float inY,
|
||||
float inZ,
|
||||
XPLMProbeInfo_t * outInfo);
|
||||
|
||||
#endif /* XPLM200 */
|
||||
#if defined(XPLM300)
|
||||
/***************************************************************************
|
||||
* Magnetic Variation
|
||||
***************************************************************************/
|
||||
/*
|
||||
* Use the magnetic variation (more properly, the "magnetic declination") API
|
||||
* to find the offset of magnetic north from true north at a given latitude
|
||||
* and longitude within the simulator.
|
||||
*
|
||||
* In the real world, the Earth's magnetic field is irregular, such that true
|
||||
* north (the direction along a meridian toward the north pole) does not
|
||||
* necessarily match what a magnetic compass shows as north.
|
||||
*
|
||||
* Using this API ensures that you present the same offsets to users as
|
||||
* X-Plane's built-in instruments.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMGetMagneticVariation
|
||||
*
|
||||
* Returns X-Plane's simulated magnetic variation (declination) at the
|
||||
* indication latitude and longitude.
|
||||
*
|
||||
*/
|
||||
XPLM_API float XPLMGetMagneticVariation(
|
||||
double latitude,
|
||||
double longitude);
|
||||
|
||||
/*
|
||||
* XPLMDegTrueToDegMagnetic
|
||||
*
|
||||
* Converts a heading in degrees relative to true north into a value relative
|
||||
* to magnetic north at the user's current location.
|
||||
*
|
||||
*/
|
||||
XPLM_API float XPLMDegTrueToDegMagnetic(
|
||||
float headingDegreesTrue);
|
||||
|
||||
/*
|
||||
* XPLMDegMagneticToDegTrue
|
||||
*
|
||||
* Converts a heading in degrees relative to magnetic north at the user's
|
||||
* current location into a value relative to true north.
|
||||
*
|
||||
*/
|
||||
XPLM_API float XPLMDegMagneticToDegTrue(
|
||||
float headingDegreesMagnetic);
|
||||
|
||||
#endif /* XPLM300 */
|
||||
/***************************************************************************
|
||||
* Object Drawing
|
||||
***************************************************************************/
|
||||
/*
|
||||
* The object drawing routines let you load and draw X-Plane OBJ files.
|
||||
* Objects are loaded by file path and managed via an opaque handle. X-Plane
|
||||
* Objects are loaded by file path and managed via an opaque handle. X-Plane
|
||||
* naturally reference counts objects, so it is important that you balance
|
||||
* every successful call to XPLMLoadObject with a call to XPLMUnloadObject!
|
||||
* every successful call to XPLMLoadObject with a call to XPLMUnloadObject!
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -187,152 +241,159 @@ XPLM_API XPLMProbeResult XPLMProbeTerrainXYZ(XPLMProbeRef inProbe,
|
||||
#if defined(XPLM200)
|
||||
/*
|
||||
* XPLMObjectRef
|
||||
*
|
||||
*
|
||||
* An XPLMObjectRef is a opaque handle to an .obj file that has been loaded
|
||||
* into memory.
|
||||
* into memory.
|
||||
*
|
||||
*/
|
||||
typedef void *XPLMObjectRef;
|
||||
typedef void * XPLMObjectRef;
|
||||
#endif /* XPLM200 */
|
||||
|
||||
#if defined(XPLM200)
|
||||
/*
|
||||
* XPLMDrawInfo_t
|
||||
*
|
||||
*
|
||||
* The XPLMDrawInfo_t structure contains positioning info for one object that
|
||||
* is to be drawn. Be sure to set structSize to the size of the structure for
|
||||
* future expansion.
|
||||
* future expansion.
|
||||
*
|
||||
*/
|
||||
typedef struct {
|
||||
/* Set this to the size of this structure! */
|
||||
int structSize;
|
||||
/* X location of the object in local coordinates. */
|
||||
float x;
|
||||
/* Y location of the object in local coordinates. */
|
||||
float y;
|
||||
/* Z location of the object in local coordinates. */
|
||||
float z;
|
||||
/* Pitch in degres to rotate the object, positive is up. */
|
||||
float pitch;
|
||||
/* Heading in local coordinates to rotate the object, clockwise. */
|
||||
float heading;
|
||||
/* Roll to rotate the object. */
|
||||
float roll;
|
||||
/* Set this to the size of this structure! */
|
||||
int structSize;
|
||||
/* X location of the object in local coordinates. */
|
||||
float x;
|
||||
/* Y location of the object in local coordinates. */
|
||||
float y;
|
||||
/* Z location of the object in local coordinates. */
|
||||
float z;
|
||||
/* Pitch in degres to rotate the object, positive is up. */
|
||||
float pitch;
|
||||
/* Heading in local coordinates to rotate the object, clockwise. */
|
||||
float heading;
|
||||
/* Roll to rotate the object. */
|
||||
float roll;
|
||||
} XPLMDrawInfo_t;
|
||||
#endif /* XPLM200 */
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMObjectLoaded_f
|
||||
*
|
||||
*
|
||||
* You provide this callback when loading an object asynchronously; it will be
|
||||
* called once the object is loaded. Your refcon is passed back. The object
|
||||
* called once the object is loaded. Your refcon is passed back. The object
|
||||
* ref passed in is the newly loaded object (ready for use) or NULL if an
|
||||
* error occured.
|
||||
*
|
||||
*
|
||||
* If your plugin is disabled, this callback will be delivered as soon as the
|
||||
* plugin is re-enabled. If your plugin is unloaded before this callback is
|
||||
* ever called, the SDK will release the object handle for you.
|
||||
* plugin is re-enabled. If your plugin is unloaded before this callback is
|
||||
* ever called, the SDK will release the object handle for you.
|
||||
*
|
||||
*/
|
||||
typedef void (*XPLMObjectLoaded_f)(XPLMObjectRef inObject, void *inRefcon);
|
||||
typedef void (* XPLMObjectLoaded_f)(
|
||||
XPLMObjectRef inObject,
|
||||
void * inRefcon);
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#if defined(XPLM200)
|
||||
/*
|
||||
* XPLMLoadObject
|
||||
*
|
||||
* This routine loads an OBJ file and returns a handle to it. If X-plane has
|
||||
*
|
||||
* This routine loads an OBJ file and returns a handle to it. If X-Plane has
|
||||
* already loaded the object, the handle to the existing object is returned.
|
||||
* Do not assume you will get the same handle back twice, but do make sure to
|
||||
* call unload once for every load to avoid "leaking" objects. The object
|
||||
* will be purged from memory when no plugins and no scenery are using it.
|
||||
*
|
||||
* The path for the object must be relative to the X-System base folder. If
|
||||
* call unload once for every load to avoid "leaking" objects. The object will
|
||||
* be purged from memory when no plugins and no scenery are using it.
|
||||
*
|
||||
* The path for the object must be relative to the X-System base folder. If
|
||||
* the path is in the root of the X-System folder you may need to prepend ./
|
||||
* to it; loading objects in the root of the X-System folder is STRONGLY
|
||||
* discouraged - your plugin should not dump art resources in the root folder!
|
||||
*
|
||||
*
|
||||
*
|
||||
* XPLMLoadObject will return NULL if the object cannot be loaded (either
|
||||
* because it is not found or the file is misformatted). This routine will
|
||||
* load any object that can be used in the X-Plane scenery system.
|
||||
*
|
||||
*
|
||||
* It is important that the datarefs an object uses for animation already be
|
||||
* loaded before you load the object. For this reason it may be necessary to
|
||||
* defer object loading until the sim has fully started.
|
||||
* loaded before you load the object. For this reason it may be necessary to
|
||||
* defer object loading until the sim has fully started.
|
||||
*
|
||||
*/
|
||||
XPLM_API XPLMObjectRef XPLMLoadObject(const char *inPath);
|
||||
XPLM_API XPLMObjectRef XPLMLoadObject(
|
||||
const char * inPath);
|
||||
#endif /* XPLM200 */
|
||||
|
||||
#if defined(XPLM210)
|
||||
/*
|
||||
* XPLMLoadObjectAsync
|
||||
*
|
||||
*
|
||||
* This routine loads an object asynchronously; control is returned to you
|
||||
* immediately while X-Plane loads the object. The sim will not stop flying
|
||||
* while the object loads. For large objects, it may be several seconds
|
||||
* before the load finishes.
|
||||
*
|
||||
* immediately while X-Plane loads the object. The sim will not stop flying
|
||||
* while the object loads. For large objects, it may be several seconds before
|
||||
* the load finishes.
|
||||
*
|
||||
* You provide a callback function that is called once the load has completed.
|
||||
* Note that if the object cannot be loaded, you will not find out until the
|
||||
* callback function is called with a NULL object handle.
|
||||
*
|
||||
*
|
||||
* There is no way to cancel an asynchronous object load; you must wait for
|
||||
* the load to complete and then release the object if it is no longer
|
||||
* desired.
|
||||
* desired.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMLoadObjectAsync(const char *inPath,
|
||||
XPLMObjectLoaded_f inCallback,
|
||||
void *inRefcon);
|
||||
XPLM_API void XPLMLoadObjectAsync(
|
||||
const char * inPath,
|
||||
XPLMObjectLoaded_f inCallback,
|
||||
void * inRefcon);
|
||||
#endif /* XPLM210 */
|
||||
|
||||
#if defined(XPLM200)
|
||||
#if defined(XPLM_DEPRECATED)
|
||||
/*
|
||||
* XPLMDrawObjects
|
||||
*
|
||||
* XPLMDrawObjects draws an object from an OBJ file one or more times. You
|
||||
* pass in the object and an array of XPLMDrawInfo_t structs, one for each
|
||||
*
|
||||
* __Deprecation Warning__: use XPLMInstancing to draw 3-d objects by creating
|
||||
* instances, rather than these APIs from draw callbacks.
|
||||
*
|
||||
* XPLMDrawObjects draws an object from an OBJ file one or more times. You
|
||||
* pass in the object and an array of XPLMDrawInfo_t structs, one for each
|
||||
* place you would like the object to be drawn.
|
||||
*
|
||||
*
|
||||
* X-Plane will attempt to cull the objects based on LOD and visibility, and
|
||||
* will pick the appropriate LOD.
|
||||
*
|
||||
*
|
||||
* Lighting is a boolean; pass 1 to show the night version of object with
|
||||
* night-only lights lit up. Pass 0 to show the daytime version of the
|
||||
* object.
|
||||
*
|
||||
* earth_relative controls the coordinate system. If this is 1, the rotations
|
||||
* night-only lights lit up. Pass 0 to show the daytime version of the object.
|
||||
*
|
||||
* earth_relative controls the coordinate system. If this is 1, the rotations
|
||||
* you specify are applied to the object after its coordinate system is
|
||||
* transformed from local to earth-relative coordinates -- that is, an object
|
||||
* with no rotations will point toward true north and the Y axis will be up
|
||||
* against gravity. If this is 0, the object is drawn with your rotations
|
||||
* from local coordanates -- that is, an object with no rotations is drawn
|
||||
* pointing down the -Z axis and the Y axis of the object matches the local
|
||||
* coordinate Y axis.
|
||||
* against gravity. If this is 0, the object is drawn with your rotations from
|
||||
* local coordanates -- that is, an object with no rotations is drawn pointing
|
||||
* down the -Z axis and the Y axis of the object matches the local coordinate
|
||||
* Y axis.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMDrawObjects(XPLMObjectRef inObject,
|
||||
int inCount,
|
||||
XPLMDrawInfo_t *inLocations,
|
||||
int lighting,
|
||||
int earth_relative);
|
||||
#endif /* XPLM200 */
|
||||
XPLM_API void XPLMDrawObjects(
|
||||
XPLMObjectRef inObject,
|
||||
int inCount,
|
||||
XPLMDrawInfo_t * inLocations,
|
||||
int lighting,
|
||||
int earth_relative);
|
||||
#endif /* XPLM_DEPRECATED */
|
||||
|
||||
#if defined(XPLM200)
|
||||
/*
|
||||
* XPLMUnloadObject
|
||||
*
|
||||
*
|
||||
* This routine marks an object as no longer being used by your plugin.
|
||||
* Objects are reference counted: once no plugins are using an object, it is
|
||||
* purged from memory. Make sure to call XPLMUnloadObject once for each
|
||||
* successful call to XPLMLoadObject.
|
||||
* purged from memory. Make sure to call XPLMUnloadObject once for each
|
||||
* successful call to XPLMLoadObject.
|
||||
*
|
||||
*/
|
||||
XPLM_API void XPLMUnloadObject(XPLMObjectRef inObject);
|
||||
XPLM_API void XPLMUnloadObject(
|
||||
XPLMObjectRef inObject);
|
||||
#endif /* XPLM200 */
|
||||
|
||||
#if defined(XPLM200)
|
||||
@@ -341,42 +402,45 @@ XPLM_API void XPLMUnloadObject(XPLMObjectRef inObject);
|
||||
***************************************************************************/
|
||||
/*
|
||||
* The library access routines allow you to locate scenery objects via the
|
||||
* X-Plane library system. Right now library access is only provided for
|
||||
* X-Plane library system. Right now library access is only provided for
|
||||
* objects, allowing plugin-drawn objects to be extended using the library
|
||||
* system.
|
||||
* system.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XPLMLibraryEnumerator_f
|
||||
*
|
||||
*
|
||||
* An XPLMLibraryEnumerator_f is a callback you provide that is called once
|
||||
* for each library element that is located. The returned paths will be
|
||||
* relative to the X-System folder.
|
||||
* relative to the X-System folder.
|
||||
*
|
||||
*/
|
||||
typedef void (*XPLMLibraryEnumerator_f)(const char *inFilePath, void *inRef);
|
||||
typedef void (* XPLMLibraryEnumerator_f)(
|
||||
const char * inFilePath,
|
||||
void * inRef);
|
||||
|
||||
/*
|
||||
* XPLMLookupObjects
|
||||
*
|
||||
*
|
||||
* This routine looks up a virtual path in the library system and returns all
|
||||
* matching elements. You provide a callback - one virtual path may match
|
||||
* many objects in the library. XPLMLookupObjects returns the number of
|
||||
* objects found.
|
||||
*
|
||||
* matching elements. You provide a callback - one virtual path may match many
|
||||
* objects in the library. XPLMLookupObjects returns the number of objects
|
||||
* found.
|
||||
*
|
||||
* The latitude and longitude parameters specify the location the object will
|
||||
* be used. The library system allows for scenery packages to only provide
|
||||
* objects to certain local locations. Only objects that are allowed at the
|
||||
* latitude/longitude you provide will be returned.
|
||||
* be used. The library system allows for scenery packages to only provide
|
||||
* objects to certain local locations. Only objects that are allowed at the
|
||||
* latitude/longitude you provide will be returned.
|
||||
*
|
||||
*/
|
||||
XPLM_API int XPLMLookupObjects(const char *inPath,
|
||||
float inLatitude,
|
||||
float inLongitude,
|
||||
XPLMLibraryEnumerator_f enumerator,
|
||||
void *ref);
|
||||
XPLM_API int XPLMLookupObjects(
|
||||
const char * inPath,
|
||||
float inLatitude,
|
||||
float inLongitude,
|
||||
XPLMLibraryEnumerator_f enumerator,
|
||||
void * ref);
|
||||
|
||||
#endif /* XPLM200 */
|
||||
#ifdef __cplusplus
|
||||
|
||||
+796
-655
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user