Update XPLM for ARM64
This commit is contained in:
@@ -1,3 +1 @@
|
|||||||
- Update OSXCross Docker image to SDK 11
|
|
||||||
- Implement ARM64 arch for Plugin
|
|
||||||
- Implement Logbook PHP
|
- Implement Logbook PHP
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
#define _XPStandardWidgets_h_
|
#define _XPStandardWidgets_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* All rights reserved. See license.txt for usage.
|
|
||||||
*
|
|
||||||
* X-Plane SDK Version: 2.1.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* XPStandardWidgets
|
||||||
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* XPStandardWidgets - THEORY OF OPERATION
|
* ## THEORY OF OPERATION
|
||||||
*
|
*
|
||||||
* The standard widgets are widgets built into the widgets library. While you
|
* The standard widgets are widgets built into the widgets library. While you
|
||||||
* can gain access to the widget function that drives them, you generally use
|
* can gain access to the widget function that drives them, you generally use
|
||||||
@@ -22,9 +22,9 @@
|
|||||||
* performs an event; these messages are sent up the widget hierarchy until
|
* performs an event; these messages are sent up the widget hierarchy until
|
||||||
* they are handled. So you can add a widget proc directly to a push button
|
* they are handled. So you can add a widget proc directly to a push button
|
||||||
* (for example) to intercept the message when it is clicked, or you can put
|
* (for example) to intercept the message when it is clicked, or you can put
|
||||||
* one widget proc on a window for all of the push buttons in the window.
|
* one widget proc on a window for all of the push buttons in the window. Most
|
||||||
* Most of these messages contain the original widget ID as a parameter so you
|
* of these messages contain the original widget ID as a parameter so you can
|
||||||
* can know which widget is messaging no matter who it is sent to.
|
* know which widget is messaging no matter who it is sent to.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -39,8 +39,8 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* The main window widget class provides a "window" as the user knows it.
|
* The main window widget class provides a "window" as the user knows it.
|
||||||
* These windows are dragable and can be selected. Use them to create
|
* These windows are dragable and can be selected. Use them to create floating
|
||||||
* floating windows and non-modal dialogs.
|
* windows and non-modal dialogs.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -55,11 +55,10 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The standard main window; pin stripes on XP7, metal frame on XP 6. */
|
/* The standard main window; pin stripes on XP7, metal frame on XP 6. */
|
||||||
xpMainWindowStyle_MainWindow = 0
|
xpMainWindowStyle_MainWindow = 0,
|
||||||
|
|
||||||
/* A translucent dark gray window, like the one ATC messages appear in. */
|
/* A translucent dark gray window, like the one ATC messages appear in. */
|
||||||
,
|
xpMainWindowStyle_Translucent = 1,
|
||||||
xpMainWindowStyle_Translucent = 1
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -67,17 +66,15 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Main Window Properties
|
* Main Window Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This property specifies the type of window. Set to one of the main
|
/* This property specifies the type of window. Set to one of the main window *
|
||||||
* window * types above. */
|
* types above. */
|
||||||
xpProperty_MainWindowType = 1100
|
xpProperty_MainWindowType = 1100,
|
||||||
|
|
||||||
/* This property specifies whether the main window has close boxes in its *
|
/* This property specifies whether the main window has close boxes in its *
|
||||||
* corners. */
|
* corners. */
|
||||||
,
|
xpProperty_MainWindowHasCloseBoxes = 1200,
|
||||||
xpProperty_MainWindowHasCloseBoxes = 1200
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -85,12 +82,10 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* MainWindow Messages
|
* MainWindow Messages
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This message is sent when the close buttons are pressed for your window.
|
/* This message is sent when the close buttons are pressed for your window. */
|
||||||
*/
|
xpMessage_CloseButtonPushed = 1200,
|
||||||
xpMessage_CloseButtonPushed = 1200
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -99,7 +94,7 @@ enum {
|
|||||||
* SUB WINDOW
|
* SUB WINDOW
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* X-plane dialogs are divided into separate areas; the sub window widgets
|
* X-Plane dialogs are divided into separate areas; the sub window widgets
|
||||||
* allow you to make these areas. Create one main window and place several
|
* allow you to make these areas. Create one main window and place several
|
||||||
* subwindows inside it. Then place your controls inside the subwindows.
|
* subwindows inside it. Then place your controls inside the subwindows.
|
||||||
*
|
*
|
||||||
@@ -116,15 +111,13 @@ enum {
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* A panel that sits inside a main window. */
|
/* A panel that sits inside a main window. */
|
||||||
xpSubWindowStyle_SubWindow = 0
|
xpSubWindowStyle_SubWindow = 0,
|
||||||
|
|
||||||
/* A screen that sits inside a panel for showing text information. */
|
/* A screen that sits inside a panel for showing text information. */
|
||||||
,
|
xpSubWindowStyle_Screen = 2,
|
||||||
xpSubWindowStyle_Screen = 2
|
|
||||||
|
|
||||||
/* A list view for scrolling lists. */
|
/* A list view for scrolling lists. */
|
||||||
,
|
xpSubWindowStyle_ListView = 3,
|
||||||
xpSubWindowStyle_ListView = 3
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -132,12 +125,11 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* SubWindow Properties
|
* SubWindow Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This property specifies the type of window. Set to one of the subwindow
|
/* This property specifies the type of window. Set to one of the subwindow *
|
||||||
* * types above. */
|
* types above. */
|
||||||
xpProperty_SubWindowType = 1200
|
xpProperty_SubWindowType = 1200,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -152,16 +144,16 @@ enum {
|
|||||||
* appearance, or type.
|
* appearance, or type.
|
||||||
*
|
*
|
||||||
* The button's behavior is a separate property that dictates who it hilights
|
* The button's behavior is a separate property that dictates who it hilights
|
||||||
* and what kinds of messages it sends. Since behavior and type are
|
* and what kinds of messages it sends. Since behavior and type are different,
|
||||||
* different, you can do strange things like make check boxes that act as push
|
* you can do strange things like make check boxes that act as push buttons or
|
||||||
* buttons or push buttons with radio button behavior.
|
* push buttons with radio button behavior.
|
||||||
*
|
*
|
||||||
* In X-Plane 6 there were no check box graphics. The result is the following
|
* In X-Plane 6 there were no check box graphics. The result is the following
|
||||||
* behavior: in x-plane 6 all check box and radio buttons are round
|
* behavior: in X-Plane
|
||||||
* (radio-button style) buttons; in X-Plane 7 they are all square (check-box
|
* 6 all check box and radio buttons are round (radio-button style) buttons;
|
||||||
* style) buttons. In a future version of x-plane, the xpButtonBehavior enums
|
* in X-Plane 7 they are all square (check-box style) buttons. In a future
|
||||||
* will provide the correct graphic (check box or radio button) giving the
|
* version of X-Plane, the xpButtonBehavior enums will provide the correct
|
||||||
* expected result.
|
* graphic (check box or radio button) giving the expected result.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -176,26 +168,22 @@ enum {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This is a standard push button, like an "OK" or "Cancel" button in a
|
/* This is a standard push button, like an 'OK' or 'Cancel' button in a dialog*
|
||||||
* dialog * box. */
|
* box. */
|
||||||
xpPushButton = 0
|
xpPushButton = 0,
|
||||||
|
|
||||||
/* A check box or radio button. Use this and the button behaviors below to
|
/* A check box or radio button. Use this and the button behaviors below to *
|
||||||
* * get the desired behavior. */
|
* get the desired behavior. */
|
||||||
,
|
xpRadioButton = 1,
|
||||||
xpRadioButton = 1
|
|
||||||
|
|
||||||
/* A window close box. */
|
/* A window close box. */
|
||||||
,
|
xpWindowCloseBox = 3,
|
||||||
xpWindowCloseBox = 3
|
|
||||||
|
|
||||||
/* A small down arrow. */
|
/* A small down arrow. */
|
||||||
,
|
xpLittleDownArrow = 5,
|
||||||
xpLittleDownArrow = 5
|
|
||||||
|
|
||||||
/* A small up arrow. */
|
/* A small up arrow. */
|
||||||
,
|
xpLittleUpArrow = 6,
|
||||||
xpLittleUpArrow = 6
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -211,19 +199,16 @@ enum {
|
|||||||
* clicked over it and unhilites when the mouse is moved outside of it or *
|
* clicked over it and unhilites when the mouse is moved outside of it or *
|
||||||
* released. If the mouse is released over the button, the *
|
* released. If the mouse is released over the button, the *
|
||||||
* xpMsg_PushButtonPressed message is sent. */
|
* xpMsg_PushButtonPressed message is sent. */
|
||||||
xpButtonBehaviorPushButton = 0
|
xpButtonBehaviorPushButton = 0,
|
||||||
|
|
||||||
/* Check box behavior. The button immediately toggles its value when the *
|
/* Check box behavior. The button immediately toggles its value when the mouse*
|
||||||
* mouse is clicked and sends out a xpMsg_ButtonStateChanged message. */
|
* is clicked and sends out a xpMsg_ButtonStateChanged message. */
|
||||||
,
|
xpButtonBehaviorCheckBox = 1,
|
||||||
xpButtonBehaviorCheckBox = 1
|
|
||||||
|
|
||||||
/* Radio button behavior. The button immediately sets its state to one and
|
/* Radio button behavior. The button immediately sets its state to one and *
|
||||||
* * sends out a xpMsg_ButtonStateChanged message if it was not already set
|
* sends out a xpMsg_ButtonStateChanged message if it was not already set to *
|
||||||
* to * one. You must turn off other radio buttons in a group in your
|
* one. You must turn off other radio buttons in a group in your code. */
|
||||||
* code. */
|
xpButtonBehaviorRadioButton = 2,
|
||||||
,
|
|
||||||
xpButtonBehaviorRadioButton = 2
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -231,22 +216,19 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Button Properties
|
* Button Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This property sets the visual type of button. Use one of the button
|
/* This property sets the visual type of button. Use one of the button types *
|
||||||
* types * above. */
|
* above. */
|
||||||
xpProperty_ButtonType = 1300
|
xpProperty_ButtonType = 1300,
|
||||||
|
|
||||||
/* This property sets the button's behavior. Use one of the button
|
/* This property sets the button's behavior. Use one of the button behaviors *
|
||||||
* behaviors * above. */
|
* above. */
|
||||||
,
|
xpProperty_ButtonBehavior = 1301,
|
||||||
xpProperty_ButtonBehavior = 1301
|
|
||||||
|
|
||||||
/* This property tells whether a check box or radio button is "checked" or *
|
/* This property tells whether a check box or radio button is "checked" or *
|
||||||
* not. Not used for push buttons. */
|
* not. Not used for push buttons. */
|
||||||
,
|
xpProperty_ButtonState = 1302,
|
||||||
xpProperty_ButtonState = 1302
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -265,16 +247,14 @@ enum {
|
|||||||
* button with push button behavior. Parameter one of the message is the *
|
* button with push button behavior. Parameter one of the message is the *
|
||||||
* widget ID of the button. This message is dispatched up the widget *
|
* widget ID of the button. This message is dispatched up the widget *
|
||||||
* hierarchy. */
|
* hierarchy. */
|
||||||
xpMsg_PushButtonPressed = 1300
|
xpMsg_PushButtonPressed = 1300,
|
||||||
|
|
||||||
/* This message is sent when a button is clicked that has radio button or *
|
/* This message is sent when a button is clicked that has radio button or *
|
||||||
* check box behavior and its value changes. (Note that if the value
|
* check box behavior and its value changes. (Note that if the value changes *
|
||||||
* changes * by setting a property you do not receive this message!)
|
* by setting a property you do not receive this message!) Parameter one is *
|
||||||
* Parameter one is * the widget ID of the button, parameter 2 is the new
|
* the widget ID of the button, parameter 2 is the new state value, either *
|
||||||
* state value, either *
|
|
||||||
* zero or one. This message is dispatched up the widget hierarchy. */
|
* zero or one. This message is dispatched up the widget hierarchy. */
|
||||||
,
|
xpMsg_ButtonStateChanged = 1301,
|
||||||
xpMsg_ButtonStateChanged = 1301
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -295,8 +275,8 @@ enum {
|
|||||||
* press message. Since key presses are passed by pointer, you can modify the
|
* press message. Since key presses are passed by pointer, you can modify the
|
||||||
* keystroke and pass it through to the text field widget.
|
* keystroke and pass it through to the text field widget.
|
||||||
*
|
*
|
||||||
* WARNING: in x-plane before 7.10 (including 6.70) null characters could
|
* WARNING: in X-Plane before 7.10 (including 6.70) null characters could
|
||||||
* crash x-plane. To prevent this, wrap this object with a filter function
|
* crash X-Plane. To prevent this, wrap this object with a filter function
|
||||||
* (more instructions can be found on the SDK website).
|
* (more instructions can be found on the SDK website).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -312,17 +292,15 @@ enum {
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* A field for text entry. */
|
/* A field for text entry. */
|
||||||
xpTextEntryField = 0
|
xpTextEntryField = 0,
|
||||||
|
|
||||||
/* A transparent text field. The user can type and the text is drawn, but
|
/* A transparent text field. The user can type and the text is drawn, but no *
|
||||||
* no * background is drawn. You can draw your own background by adding a
|
* background is drawn. You can draw your own background by adding a widget *
|
||||||
* widget * handler and prehandling the draw message. */
|
* handler and prehandling the draw message. */
|
||||||
,
|
xpTextTransparent = 3,
|
||||||
xpTextTransparent = 3
|
|
||||||
|
|
||||||
/* A translucent edit field, dark gray. */
|
/* A translucent edit field, dark gray. */
|
||||||
,
|
xpTextTranslucent = 4,
|
||||||
xpTextTranslucent = 4
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -330,49 +308,40 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Text Field Properties
|
* Text Field Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This is the character position the selection starts at, zero based. If it
|
/* This is the character position the selection starts at, zero based. If it *
|
||||||
* * is the same as the end insertion point, the insertion point is not a *
|
* is the same as the end insertion point, the insertion point is not a *
|
||||||
* selection. */
|
* selection. */
|
||||||
xpProperty_EditFieldSelStart = 1400
|
xpProperty_EditFieldSelStart = 1400,
|
||||||
|
|
||||||
/* This is the character position of the end of the selection. */
|
/* This is the character position of the end of the selection. */
|
||||||
,
|
xpProperty_EditFieldSelEnd = 1401,
|
||||||
xpProperty_EditFieldSelEnd = 1401
|
|
||||||
|
|
||||||
/* This is the character position a drag was started at if the user is *
|
/* This is the character position a drag was started at if the user is *
|
||||||
* dragging to select text, or -1 if a drag is not in progress. */
|
* dragging to select text, or -1 if a drag is not in progress. */
|
||||||
,
|
xpProperty_EditFieldSelDragStart = 1402,
|
||||||
xpProperty_EditFieldSelDragStart = 1402
|
|
||||||
|
|
||||||
/* This is the type of text field to display, from the above list. */
|
/* This is the type of text field to display, from the above list. */
|
||||||
,
|
xpProperty_TextFieldType = 1403,
|
||||||
xpProperty_TextFieldType = 1403
|
|
||||||
|
|
||||||
/* Set this property to 1 to password protect the field. Characters will be
|
/* Set this property to 1 to password protect the field. Characters will be *
|
||||||
* * drawn as *s even though the descriptor will contain plain-text. */
|
* drawn as *s even though the descriptor will contain plain-text. */
|
||||||
,
|
xpProperty_PasswordMode = 1404,
|
||||||
xpProperty_PasswordMode = 1404
|
|
||||||
|
|
||||||
/* The max number of characters you can enter, if limited. Zero means *
|
/* The max number of characters you can enter, if limited. Zero means *
|
||||||
* unlimited. */
|
* unlimited. */
|
||||||
,
|
xpProperty_MaxCharacters = 1405,
|
||||||
xpProperty_MaxCharacters = 1405
|
|
||||||
|
|
||||||
/* The first visible character on the left. This effectively scrolls the
|
/* The first visible character on the left. This effectively scrolls the text*
|
||||||
* text * field. */
|
* field. */
|
||||||
,
|
xpProperty_ScrollPosition = 1406,
|
||||||
xpProperty_ScrollPosition = 1406
|
|
||||||
|
|
||||||
/* The font to draw the field's text with. (An XPLMFontID.) */
|
/* The font to draw the field's text with. (An XPLMFontID.) */
|
||||||
,
|
xpProperty_Font = 1407,
|
||||||
xpProperty_Font = 1407
|
|
||||||
|
|
||||||
/* This is the active side of the insert selection. (Internal) */
|
/* This is the active side of the insert selection. (Internal) */
|
||||||
,
|
xpProperty_ActiveEditSide = 1408,
|
||||||
xpProperty_ActiveEditSide = 1408
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -380,15 +349,11 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Text Field Messages
|
* Text Field Messages
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Text Field Messages *
|
/* The text field sends this message to itself when its text changes. It sends*
|
||||||
* *
|
* the message up the call chain; param1 is the text field's widget ID. */
|
||||||
* The text field sends this message to itself when its text changes. It *
|
xpMsg_TextFieldChanged = 1400,
|
||||||
* sends the message up the call chain; param1 is the text field's widget
|
|
||||||
* ID. */
|
|
||||||
xpMsg_TextFieldChanged = 1400
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -413,14 +378,11 @@ enum {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Scroll bar types. *
|
/* A standard X-Plane scroll bar (with arrows on the ends). */
|
||||||
* *
|
xpScrollBarTypeScrollBar = 0,
|
||||||
* A standard x-plane scroll bar (with arrows on the ends). */
|
|
||||||
xpScrollBarTypeScrollBar = 0
|
|
||||||
|
|
||||||
/* A slider, no arrows. */
|
/* A slider, no arrows. */
|
||||||
,
|
xpScrollBarTypeSlider = 1,
|
||||||
xpScrollBarTypeSlider = 1
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -428,34 +390,26 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Scroll Bar Properties
|
* Scroll Bar Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The current position of the thumb (in between the min and max, inclusive)
|
/* The current position of the thumb (in between the min and max, inclusive) */
|
||||||
*/
|
xpProperty_ScrollBarSliderPosition = 1500,
|
||||||
xpProperty_ScrollBarSliderPosition = 1500
|
|
||||||
|
|
||||||
/* The value the scroll bar has when the thumb is in the lowest position. */
|
/* The value the scroll bar has when the thumb is in the lowest position. */
|
||||||
,
|
xpProperty_ScrollBarMin = 1501,
|
||||||
xpProperty_ScrollBarMin = 1501
|
|
||||||
|
|
||||||
/* The value the scroll bar has when the thumb is in the highest position.
|
/* The value the scroll bar has when the thumb is in the highest position. */
|
||||||
*/
|
xpProperty_ScrollBarMax = 1502,
|
||||||
,
|
|
||||||
xpProperty_ScrollBarMax = 1502
|
|
||||||
|
|
||||||
/* How many units to moev the scroll bar when clicking next to the thumb.
|
/* How many units to move the scroll bar when clicking next to the thumb. The *
|
||||||
* The * scroll bar always moves one unit when the arrows are clicked. */
|
* scroll bar always moves one unit when the arrows are clicked. */
|
||||||
,
|
xpProperty_ScrollBarPageAmount = 1503,
|
||||||
xpProperty_ScrollBarPageAmount = 1503
|
|
||||||
|
|
||||||
/* The type of scrollbar from the enums above. */
|
/* The type of scrollbar from the enums above. */
|
||||||
,
|
xpProperty_ScrollBarType = 1504,
|
||||||
xpProperty_ScrollBarType = 1504
|
|
||||||
|
|
||||||
/* Used internally. */
|
/* Used internally. */
|
||||||
,
|
xpProperty_ScrollBarSlop = 1505,
|
||||||
xpProperty_ScrollBarSlop = 1505
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -463,13 +417,11 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Scroll Bar Messages
|
* Scroll Bar Messages
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The Scroll Bar sends this message when the slider position changes. It *
|
/* The scroll bar sends this message when the slider position changes. It *
|
||||||
* sends the message up the call chain; param1 is the Scroll Bar widget ID.
|
* sends the message up the call chain; param1 is the Scroll Bar widget ID. */
|
||||||
*/
|
xpMsg_ScrollBarSliderPositionChanged = 1500,
|
||||||
xpMsg_ScrollBarSliderPositionChanged = 1500
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -490,12 +442,11 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* Caption Properties
|
* Caption Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This property specifies whether the caption is lit; use lit captions *
|
/* This property specifies whether the caption is lit; use lit captions *
|
||||||
* against screens. */
|
* against screens. */
|
||||||
xpProperty_CaptionLit = 1600
|
xpProperty_CaptionLit = 1600,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -505,7 +456,7 @@ enum {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* The general graphics widget can show one of many icons available from
|
* The general graphics widget can show one of many icons available from
|
||||||
* x-plane.
|
* X-Plane.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -519,61 +470,43 @@ enum {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
xpShip = 4
|
xpShip = 4,
|
||||||
|
|
||||||
,
|
xpILSGlideScope = 5,
|
||||||
xpILSGlideScope = 5
|
|
||||||
|
|
||||||
,
|
xpMarkerLeft = 6,
|
||||||
xpMarkerLeft = 6
|
|
||||||
|
|
||||||
,
|
xp_Airport = 7,
|
||||||
xp_Airport = 7
|
|
||||||
|
|
||||||
,
|
xpNDB = 8,
|
||||||
xpNDB = 8
|
|
||||||
|
|
||||||
,
|
xpVOR = 9,
|
||||||
xpVOR = 9
|
|
||||||
|
|
||||||
,
|
xpRadioTower = 10,
|
||||||
xpRadioTower = 10
|
|
||||||
|
|
||||||
,
|
xpAircraftCarrier = 11,
|
||||||
xpAircraftCarrier = 11
|
|
||||||
|
|
||||||
,
|
xpFire = 12,
|
||||||
xpFire = 12
|
|
||||||
|
|
||||||
,
|
xpMarkerRight = 13,
|
||||||
xpMarkerRight = 13
|
|
||||||
|
|
||||||
,
|
xpCustomObject = 14,
|
||||||
xpCustomObject = 14
|
|
||||||
|
|
||||||
,
|
xpCoolingTower = 15,
|
||||||
xpCoolingTower = 15
|
|
||||||
|
|
||||||
,
|
xpSmokeStack = 16,
|
||||||
xpSmokeStack = 16
|
|
||||||
|
|
||||||
,
|
xpBuilding = 17,
|
||||||
xpBuilding = 17
|
|
||||||
|
|
||||||
,
|
xpPowerLine = 18,
|
||||||
xpPowerLine = 18
|
|
||||||
|
|
||||||
,
|
xpVORWithCompassRose = 19,
|
||||||
xpVORWithCompassRose = 19
|
|
||||||
|
|
||||||
,
|
xpOilPlatform = 21,
|
||||||
xpOilPlatform = 21
|
|
||||||
|
|
||||||
,
|
xpOilPlatformSmall = 22,
|
||||||
xpOilPlatformSmall = 22
|
|
||||||
|
|
||||||
,
|
xpWayPoint = 23,
|
||||||
xpWayPoint = 23
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -581,11 +514,10 @@ enum {
|
|||||||
/*
|
/*
|
||||||
* General Graphics Properties
|
* General Graphics Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This property controls the type of icon that is drawn. */
|
/* This property controls the type of icon that is drawn. */
|
||||||
xpProperty_GeneralGraphicsType = 1700
|
xpProperty_GeneralGraphicsType = 1700,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -594,29 +526,25 @@ enum {
|
|||||||
* PROGRESS INDICATOR
|
* PROGRESS INDICATOR
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* This widget implements a progress indicator as seen when x-plane starts up.
|
* This widget implements a progress indicator as seen when X-Plane starts up.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define xpWidgetClass_Progress 8
|
#define xpWidgetClass_Progress 8
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Progress Indicator Properties
|
* Progress Indicator Properties
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* This is the current value of the progress indicator. */
|
/* This is the current value of the progress indicator. */
|
||||||
xpProperty_ProgressPosition = 1800
|
xpProperty_ProgressPosition = 1800,
|
||||||
|
|
||||||
/* This is the minimum value, equivalent to 0% filled. */
|
/* This is the minimum value, equivalent to 0% filled. */
|
||||||
,
|
xpProperty_ProgressMin = 1801,
|
||||||
xpProperty_ProgressMin = 1801
|
|
||||||
|
|
||||||
/* This is the maximum value, equivalent to 100% filled. */
|
/* This is the maximum value, equivalent to 100% filled. */
|
||||||
,
|
xpProperty_ProgressMax = 1802,
|
||||||
xpProperty_ProgressMax = 1802
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
#define _XPUIGraphics_h_
|
#define _XPUIGraphics_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* All rights reserved. See license.txt for usage.
|
|
||||||
*
|
|
||||||
* X-Plane SDK Version: 2.1.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/***************************************************************************
|
||||||
*
|
* XPUIGraphics
|
||||||
*
|
***************************************************************************/
|
||||||
*/
|
|
||||||
|
|
||||||
#include "XPWidgetDefs.h"
|
#include "XPWidgetDefs.h"
|
||||||
|
|
||||||
@@ -24,11 +20,6 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* UI GRAPHICS
|
* UI GRAPHICS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPWindowStyle
|
* XPWindowStyle
|
||||||
@@ -43,34 +34,29 @@ extern "C" {
|
|||||||
* Sub windows must go on top of main windows, and screens and list views on
|
* Sub windows must go on top of main windows, and screens and list views on
|
||||||
* top of subwindows. Only help and main windows can be over the main screen.
|
* top of subwindows. Only help and main windows can be over the main screen.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* With X-Plane 7 any window or element may be placed over any other element.
|
* With X-Plane 7 any window or element may be placed over any other element.
|
||||||
*
|
*
|
||||||
* Some windows are scaled by stretching, some by repeating. The drawing
|
* Some windows are scaled by stretching, some by repeating. The drawing
|
||||||
* routines know which scaling method to use. The list view cannot be
|
* routines know which scaling method to use. The list view cannot be rescaled
|
||||||
* rescaled in x-plane 6 because it has both a repeating pattern and a
|
* in X-Plane 6 because it has both a repeating pattern and a gradient in one
|
||||||
* gradient in one element. All other elements can be rescaled.
|
* element. All other elements can be rescaled.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* An LCD screen that shows help. */
|
/* An LCD screen that shows help. */
|
||||||
xpWindow_Help = 0
|
xpWindow_Help = 0,
|
||||||
|
|
||||||
/* A dialog box window. */
|
/* A dialog box window. */
|
||||||
,
|
xpWindow_MainWindow = 1,
|
||||||
xpWindow_MainWindow = 1
|
|
||||||
|
|
||||||
/* A panel or frame within a dialog box window. */
|
/* A panel or frame within a dialog box window. */
|
||||||
,
|
xpWindow_SubWindow = 2,
|
||||||
xpWindow_SubWindow = 2
|
|
||||||
|
|
||||||
/* An LCD screen within a panel to hold text displays. */
|
/* An LCD screen within a panel to hold text displays. */
|
||||||
,
|
xpWindow_Screen = 4,
|
||||||
xpWindow_Screen = 4
|
|
||||||
|
|
||||||
/* A list view within a panel for scrolling file names, etc. */
|
/* A list view within a panel for scrolling file names, etc. */
|
||||||
,
|
xpWindow_ListView = 5,
|
||||||
xpWindow_ListView = 5
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -85,8 +71,12 @@ typedef int XPWindowStyle;
|
|||||||
* appropriate to the style.
|
* appropriate to the style.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void
|
WIDGET_API void XPDrawWindow(
|
||||||
XPDrawWindow(int inX1, int inY1, int inX2, int inY2, XPWindowStyle inStyle);
|
int inX1,
|
||||||
|
int inY1,
|
||||||
|
int inX2,
|
||||||
|
int inY2,
|
||||||
|
XPWindowStyle inStyle);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetWindowDefaultDimensions
|
* XPGetWindowDefaultDimensions
|
||||||
@@ -95,9 +85,10 @@ WIDGET_API void
|
|||||||
* a minimum or fixed value depending on whether the window is scalable.
|
* a minimum or fixed value depending on whether the window is scalable.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPGetWindowDefaultDimensions(XPWindowStyle inStyle,
|
WIDGET_API void XPGetWindowDefaultDimensions(
|
||||||
int *outWidth, /* Can be NULL */
|
XPWindowStyle inStyle,
|
||||||
int *outHeight); /* Can be NULL */
|
int * outWidth, /* Can be NULL */
|
||||||
|
int * outHeight); /* Can be NULL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPElementStyle
|
* XPElementStyle
|
||||||
@@ -107,155 +98,120 @@ WIDGET_API void XPGetWindowDefaultDimensions(XPWindowStyle inStyle,
|
|||||||
* stretched in one or two dimensions (depending on the element). Some
|
* stretched in one or two dimensions (depending on the element). Some
|
||||||
* elements can be lit.
|
* elements can be lit.
|
||||||
*
|
*
|
||||||
* In x-plane 6 some elements must be drawn over metal. Some are scalable and
|
* In X-Plane 6 some elements must be drawn over metal. Some are scalable and
|
||||||
* some are not. Any element can be drawn anywhere in x-plane 7.
|
* some are not. Any element can be drawn anywhere in X-Plane 7.
|
||||||
*
|
*
|
||||||
* Scalable Axis Required Background
|
* Scalable Axis Required Background
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* x metal */
|
/* x metal */
|
||||||
xpElement_TextField = 6
|
xpElement_TextField = 6,
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_CheckBox = 9,
|
||||||
xpElement_CheckBox = 9
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_CheckBoxLit = 10,
|
||||||
xpElement_CheckBoxLit = 10
|
|
||||||
|
|
||||||
/* none window header */
|
/* none window header */
|
||||||
,
|
xpElement_WindowCloseBox = 14,
|
||||||
xpElement_WindowCloseBox = 14
|
|
||||||
|
|
||||||
/* none window header */
|
/* none window header */
|
||||||
,
|
xpElement_WindowCloseBoxPressed = 15,
|
||||||
xpElement_WindowCloseBoxPressed = 15
|
|
||||||
|
|
||||||
/* x metal */
|
/* x metal */
|
||||||
,
|
xpElement_PushButton = 16,
|
||||||
xpElement_PushButton = 16
|
|
||||||
|
|
||||||
/* x metal */
|
/* x metal */
|
||||||
,
|
xpElement_PushButtonLit = 17,
|
||||||
xpElement_PushButtonLit = 17
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_OilPlatform = 24,
|
||||||
xpElement_OilPlatform = 24
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_OilPlatformSmall = 25,
|
||||||
xpElement_OilPlatformSmall = 25
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_Ship = 26,
|
||||||
xpElement_Ship = 26
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_ILSGlideScope = 27,
|
||||||
xpElement_ILSGlideScope = 27
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_MarkerLeft = 28,
|
||||||
xpElement_MarkerLeft = 28
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_Airport = 29,
|
||||||
xpElement_Airport = 29
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_Waypoint = 30,
|
||||||
xpElement_Waypoint = 30
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_NDB = 31,
|
||||||
xpElement_NDB = 31
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_VOR = 32,
|
||||||
xpElement_VOR = 32
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_RadioTower = 33,
|
||||||
xpElement_RadioTower = 33
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_AircraftCarrier = 34,
|
||||||
xpElement_AircraftCarrier = 34
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_Fire = 35,
|
||||||
xpElement_Fire = 35
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_MarkerRight = 36,
|
||||||
xpElement_MarkerRight = 36
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_CustomObject = 37,
|
||||||
xpElement_CustomObject = 37
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_CoolingTower = 38,
|
||||||
xpElement_CoolingTower = 38
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_SmokeStack = 39,
|
||||||
xpElement_SmokeStack = 39
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_Building = 40,
|
||||||
xpElement_Building = 40
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_PowerLine = 41,
|
||||||
xpElement_PowerLine = 41
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_CopyButtons = 45,
|
||||||
xpElement_CopyButtons = 45
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_CopyButtonsWithEditingGrid = 46,
|
||||||
xpElement_CopyButtonsWithEditingGrid = 46
|
|
||||||
|
|
||||||
/* x, y metal */
|
/* x, y metal */
|
||||||
,
|
xpElement_EditingGrid = 47,
|
||||||
xpElement_EditingGrid = 47
|
|
||||||
|
|
||||||
/* THIS CAN PROBABLY BE REMOVED */
|
/* THIS CAN PROBABLY BE REMOVED */
|
||||||
,
|
xpElement_ScrollBar = 48,
|
||||||
xpElement_ScrollBar = 48
|
|
||||||
|
|
||||||
/* none any */
|
/* none any */
|
||||||
,
|
xpElement_VORWithCompassRose = 49,
|
||||||
xpElement_VORWithCompassRose = 49
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_Zoomer = 51,
|
||||||
xpElement_Zoomer = 51
|
|
||||||
|
|
||||||
/* x, y metal */
|
/* x, y metal */
|
||||||
,
|
xpElement_TextFieldMiddle = 52,
|
||||||
xpElement_TextFieldMiddle = 52
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_LittleDownArrow = 53,
|
||||||
xpElement_LittleDownArrow = 53
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_LittleUpArrow = 54,
|
||||||
xpElement_LittleUpArrow = 54
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_WindowDragBar = 61,
|
||||||
xpElement_WindowDragBar = 61
|
|
||||||
|
|
||||||
/* none metal */
|
/* none metal */
|
||||||
,
|
xpElement_WindowDragBarSmooth = 62,
|
||||||
xpElement_WindowDragBarSmooth = 62
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -265,13 +221,15 @@ typedef int XPElementStyle;
|
|||||||
* XPDrawElement
|
* XPDrawElement
|
||||||
*
|
*
|
||||||
* XPDrawElement draws a given element at an offset on the virtual screen in
|
* XPDrawElement draws a given element at an offset on the virtual screen in
|
||||||
* set dimensions. EVEN if the element is not scalable, it will be scaled if
|
* set dimensions.
|
||||||
* the width and height do not match the preferred dimensions; it'll just look
|
* *Even* if the element is not scalable, it will be scaled if the width and
|
||||||
* ugly. Pass inLit to see the lit version of the element; if the element
|
* height do not match the preferred dimensions; it'll just look ugly. Pass
|
||||||
* cannot be lit this is ignored.
|
* inLit to see the lit version of the element; if the element cannot be lit
|
||||||
|
* this is ignored.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPDrawElement(int inX1,
|
WIDGET_API void XPDrawElement(
|
||||||
|
int inX1,
|
||||||
int inY1,
|
int inY1,
|
||||||
int inX2,
|
int inX2,
|
||||||
int inY2,
|
int inY2,
|
||||||
@@ -283,14 +241,14 @@ WIDGET_API void XPDrawElement(int inX1,
|
|||||||
*
|
*
|
||||||
* This routine returns the recommended or minimum dimensions of a given UI
|
* This routine returns the recommended or minimum dimensions of a given UI
|
||||||
* element. outCanBeLit tells whether the element has both a lit and unlit
|
* element. outCanBeLit tells whether the element has both a lit and unlit
|
||||||
* state. Pass NULL to not receive any of these parameters.
|
* state. Pass `NULL` to not receive any of these parameters.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void
|
WIDGET_API void XPGetElementDefaultDimensions(
|
||||||
XPGetElementDefaultDimensions(XPElementStyle inStyle,
|
XPElementStyle inStyle,
|
||||||
int *outWidth, /* Can be NULL */
|
int * outWidth, /* Can be NULL */
|
||||||
int *outHeight, /* Can be NULL */
|
int * outHeight, /* Can be NULL */
|
||||||
int *outCanBeLit); /* Can be NULL */
|
int * outCanBeLit); /* Can be NULL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPTrackStyle
|
* XPTrackStyle
|
||||||
@@ -302,23 +260,21 @@ WIDGET_API void
|
|||||||
* (e.g. they know if they are tall or wide). Sliders may be lit or unlit
|
* (e.g. they know if they are tall or wide). Sliders may be lit or unlit
|
||||||
* (showing the user manipulating them).
|
* (showing the user manipulating them).
|
||||||
*
|
*
|
||||||
* ScrollBar - this is a standard scroll bar with arrows and a thumb to drag.
|
* - ScrollBar: this is a standard scroll bar with arrows and a thumb to drag.
|
||||||
* Slider - this is a simple track with a ball in the middle that can be
|
* - Slider: this is a simple track with a ball in the middle that can be
|
||||||
* slid. Progress - this is a progress indicator showing how a long task is
|
* slid.
|
||||||
* going.
|
* - Progress: this is a progress indicator showing how a long task is going.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* not over metal can be lit can be rotated */
|
/* not over metal can be lit can be rotated */
|
||||||
xpTrack_ScrollBar = 0
|
xpTrack_ScrollBar = 0,
|
||||||
|
|
||||||
/* over metal can be lit can be rotated */
|
/* over metal can be lit can be rotated */
|
||||||
,
|
xpTrack_Slider = 1,
|
||||||
xpTrack_Slider = 1
|
|
||||||
|
|
||||||
/* over metal cannot be lit cannot be rotated */
|
/* over metal cannot be lit cannot be rotated */
|
||||||
,
|
xpTrack_Progress = 2,
|
||||||
xpTrack_Progress = 2
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -334,7 +290,8 @@ typedef int XPTrackStyle;
|
|||||||
* not.
|
* not.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPDrawTrack(int inX1,
|
WIDGET_API void XPDrawTrack(
|
||||||
|
int inX1,
|
||||||
int inY1,
|
int inY1,
|
||||||
int inX2,
|
int inX2,
|
||||||
int inY2,
|
int inY2,
|
||||||
@@ -352,9 +309,10 @@ WIDGET_API void XPDrawTrack(int inX1,
|
|||||||
* lit.
|
* lit.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPGetTrackDefaultDimensions(XPTrackStyle inStyle,
|
WIDGET_API void XPGetTrackDefaultDimensions(
|
||||||
int *outWidth,
|
XPTrackStyle inStyle,
|
||||||
int *outCanBeLit);
|
int * outWidth,
|
||||||
|
int * outCanBeLit);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetTrackMetrics
|
* XPGetTrackMetrics
|
||||||
@@ -373,7 +331,8 @@ WIDGET_API void XPGetTrackDefaultDimensions(XPTrackStyle inStyle,
|
|||||||
* button decreases; for vertical scrollers, the top button decreases.
|
* button decreases; for vertical scrollers, the top button decreases.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPGetTrackMetrics(int inX1,
|
WIDGET_API void XPGetTrackMetrics(
|
||||||
|
int inX1,
|
||||||
int inY1,
|
int inY1,
|
||||||
int inX2,
|
int inX2,
|
||||||
int inY2,
|
int inY2,
|
||||||
@@ -381,12 +340,12 @@ WIDGET_API void XPGetTrackMetrics(int inX1,
|
|||||||
int inMax,
|
int inMax,
|
||||||
int inValue,
|
int inValue,
|
||||||
XPTrackStyle inTrackStyle,
|
XPTrackStyle inTrackStyle,
|
||||||
int *outIsVertical,
|
int * outIsVertical,
|
||||||
int *outDownBtnSize,
|
int * outDownBtnSize,
|
||||||
int *outDownPageSize,
|
int * outDownPageSize,
|
||||||
int *outThumbSize,
|
int * outThumbSize,
|
||||||
int *outUpPageSize,
|
int * outUpPageSize,
|
||||||
int *outUpBtnSize);
|
int * outUpBtnSize);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
#define _XPWidgetDefs_h_
|
#define _XPWidgetDefs_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* All rights reserved. See license.txt for usage.
|
|
||||||
*
|
|
||||||
* X-Plane SDK Version: 2.1.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/***************************************************************************
|
||||||
*
|
* XPWidgetDefs
|
||||||
*
|
***************************************************************************/
|
||||||
*/
|
|
||||||
|
|
||||||
#include "XPLMDefs.h"
|
#include "XPLMDefs.h"
|
||||||
|
|
||||||
@@ -23,37 +19,37 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
#if APL
|
#if APL
|
||||||
#if XPWIDGETS
|
#if XPWIDGETS
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#define WIDGET_API __attribute__((visibility("default")))
|
#define WIDGET_API __attribute__((visibility("default")))
|
||||||
#elif __MACH__
|
#elif __MACH__
|
||||||
#define WIDGET_API
|
#define WIDGET_API
|
||||||
#else
|
#else
|
||||||
#define WIDGET_API __declspec(dllexport)
|
#define WIDGET_API __declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define WIDGET_API
|
#define WIDGET_API
|
||||||
#endif
|
#endif
|
||||||
#elif IBM
|
#elif IBM
|
||||||
#if XPWIDGETS
|
#if XPWIDGETS
|
||||||
#define WIDGET_API __declspec(dllexport)
|
#define WIDGET_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define WIDGET_API __declspec(dllimport)
|
#define WIDGET_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#elif LIN
|
#elif LIN
|
||||||
#if XPWIDGETS
|
#if XPWIDGETS
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#define WIDGET_API __attribute__((visibility("default")))
|
#define WIDGET_API __attribute__((visibility("default")))
|
||||||
#else
|
#else
|
||||||
#define WIDGET_API
|
#define WIDGET_API
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define WIDGET_API
|
#define WIDGET_API
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#pragma error "Platform not defined!"
|
#pragma error "Platform not defined!"
|
||||||
#endif
|
#endif
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* WIDGET DEFINITIONS
|
* WIDGET DEFINITIONS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
@@ -70,12 +66,12 @@ extern "C" {
|
|||||||
* XPWidgetID
|
* XPWidgetID
|
||||||
*
|
*
|
||||||
* A Widget ID is an opaque unique non-zero handle identifying your widget.
|
* A Widget ID is an opaque unique non-zero handle identifying your widget.
|
||||||
* Use 0 to specify "no widget". This type is defined as wide enough to hold
|
* Use 0 to specify "no widget". This type is defined as wide enough to hold a
|
||||||
* a pointer. You receive a widget ID when you create a new widget and then
|
* pointer. You receive a widget ID when you create a new widget and then use
|
||||||
* use that widget ID to further refer to the widget.
|
* that widget ID to further refer to the widget.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void *XPWidgetID;
|
typedef void * XPWidgetID;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPWidgetPropertyID
|
* XPWidgetPropertyID
|
||||||
@@ -92,44 +88,38 @@ typedef void *XPWidgetID;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* A window's refcon is an opaque value used by client code to find other
|
/* A window's refcon is an opaque value used by client code to find other data*
|
||||||
* data * based on it. */
|
* based on it. */
|
||||||
xpProperty_Refcon = 0
|
xpProperty_Refcon = 0,
|
||||||
|
|
||||||
/* These properties are used by the utlities to implement dragging. */
|
/* These properties are used by the utlities to implement dragging. */
|
||||||
,
|
xpProperty_Dragging = 1,
|
||||||
xpProperty_Dragging = 1
|
|
||||||
|
|
||||||
,
|
xpProperty_DragXOff = 2,
|
||||||
xpProperty_DragXOff = 2
|
|
||||||
|
|
||||||
,
|
xpProperty_DragYOff = 3,
|
||||||
xpProperty_DragYOff = 3
|
|
||||||
|
|
||||||
/* Is the widget hilited? (For widgets that support this kind of thing.) */
|
/* Is the widget hilited? (For widgets that support this kind of thing.) */
|
||||||
,
|
xpProperty_Hilited = 4,
|
||||||
xpProperty_Hilited = 4
|
|
||||||
|
|
||||||
/* Is there a C++ object attached to this widget? */
|
/* Is there a C++ object attached to this widget? */
|
||||||
,
|
xpProperty_Object = 5,
|
||||||
xpProperty_Object = 5
|
|
||||||
|
|
||||||
/* If this property is 1, the widget package will use OpenGL to restrict *
|
/* If this property is 1, the widget package will use OpenGL to restrict *
|
||||||
* drawing to the Wiget's exposed rectangle. */
|
* drawing to the Wiget's exposed rectangle. */
|
||||||
,
|
xpProperty_Clip = 6,
|
||||||
xpProperty_Clip = 6
|
|
||||||
|
|
||||||
/* Is this widget enabled (for those that have a disabled state too)? */
|
/* Is this widget enabled (for those that have a disabled state too)? */
|
||||||
,
|
xpProperty_Enabled = 7,
|
||||||
xpProperty_Enabled = 7
|
|
||||||
|
|
||||||
/* NOTE: Property IDs 1 - 999 are reserved for the widget's library. *
|
/* NOTE: Property IDs 1 - 999 are reserved for the widgets library. *
|
||||||
* *
|
* *
|
||||||
* NOTE: Property IDs 1000 - 9999 are allocated to the standard widget
|
* NOTE: Property IDs 1000 - 9999 are allocated to the standard widget classes*
|
||||||
* classes * provided with the library Properties 1000 - 1099 are for widget
|
* provided with the library. *
|
||||||
* class 0, * 1100 - 1199 for widget class 1, etc. */
|
* *
|
||||||
,
|
* Properties 1000 - 1099 are for widget class 0, 1100 - 1199 for widget class*
|
||||||
xpProperty_UserStart = 10000
|
* 1, etc. */
|
||||||
|
xpProperty_UserStart = 10000,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -148,8 +138,7 @@ typedef struct {
|
|||||||
/* Mouse Button number, left = 0 (right button not yet supported. */
|
/* Mouse Button number, left = 0 (right button not yet supported. */
|
||||||
int button;
|
int button;
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/* Scroll wheel delta (button in this case would be the wheel axis number).
|
/* Scroll wheel delta (button in this case would be the wheel axis number). */
|
||||||
*/
|
|
||||||
int delta;
|
int delta;
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
} XPMouseState_t;
|
} XPMouseState_t;
|
||||||
@@ -162,8 +151,8 @@ typedef struct {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* The ASCII key that was pressed. WARNING: this may be 0 for some
|
/* The ASCII key that was pressed. WARNING: this may be 0 for some non-ASCII *
|
||||||
* non-ASCII * key sequences. */
|
* key sequences. */
|
||||||
char key;
|
char key;
|
||||||
/* The flags. Make sure to check this if you only want key-downs! */
|
/* The flags. Make sure to check this if you only want key-downs! */
|
||||||
XPLMKeyFlags flags;
|
XPLMKeyFlags flags;
|
||||||
@@ -195,28 +184,24 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The message will only be sent to the target widget. */
|
/* The message will only be sent to the target widget. */
|
||||||
xpMode_Direct = 0
|
xpMode_Direct = 0,
|
||||||
|
|
||||||
/* The message is sent to the target widget, then up the chain of parents *
|
/* The message is sent to the target widget, then up the chain of parents *
|
||||||
* until the message is handled or a parentless widget is reached. */
|
* until the message is handled or a parentless widget is reached. */
|
||||||
,
|
xpMode_UpChain = 1,
|
||||||
xpMode_UpChain = 1
|
|
||||||
|
|
||||||
/* The message is sent to the target widget and then all of its children *
|
/* The message is sent to the target widget and then all of its children *
|
||||||
* recursively depth-first. */
|
* recursively depth-first. */
|
||||||
,
|
xpMode_Recursive = 2,
|
||||||
xpMode_Recursive = 2
|
|
||||||
|
|
||||||
/* The message is snet just to the target, but goes to every callback, even
|
/* The message is snet just to the target, but goes to every callback, even if*
|
||||||
* if * it is handled. */
|
* it is handled. */
|
||||||
,
|
xpMode_DirectAllCallbacks = 3,
|
||||||
xpMode_DirectAllCallbacks = 3
|
|
||||||
|
|
||||||
/* The message is only sent to the very first handler even if it is not *
|
/* The message is only sent to the very first handler even if it is not *
|
||||||
* accepted. (This is really only useful for some internal Widget Lib *
|
* accepted. (This is really only useful for some internal widget library *
|
||||||
* functions. */
|
* functions.) */
|
||||||
,
|
xpMode_Once = 4,
|
||||||
xpMode_Once = 4
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -239,11 +224,6 @@ typedef int XPWidgetClass;
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* WIDGET MESSAGES
|
* WIDGET MESSAGES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPWidgetMessage
|
* XPWidgetMessage
|
||||||
@@ -254,127 +234,113 @@ typedef int XPWidgetClass;
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* No message, should not be sent. */
|
/* No message, should not be sent. */
|
||||||
xpMsg_None = 0
|
xpMsg_None = 0,
|
||||||
|
|
||||||
/* The create message is sent once per widget that is created with your
|
/* The create message is sent once per widget that is created with your widget*
|
||||||
* widget * function and once for any widget that has your widget function
|
* function and once for any widget that has your widget function attached. *
|
||||||
* attached. *
|
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: 1 if you are being added as a subclass, 0 if the widget is first
|
* Param 1: 1 if you are being added as a subclass, 0 if the widget is first *
|
||||||
* * being created. */
|
* being created. */
|
||||||
,
|
xpMsg_Create = 1,
|
||||||
xpMsg_Create = 1
|
|
||||||
|
|
||||||
/* The destroy message is sent once for each message that is destroyed that
|
/* The destroy message is sent once for each message that is destroyed that *
|
||||||
* * has your widget function. *
|
* has your widget function. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct for all *
|
* Dispatching: Direct for all *
|
||||||
* *
|
* *
|
||||||
* Param 1: 1 if being deleted by a recursive delete to the parent, 0 for *
|
* Param 1: 1 if being deleted by a recursive delete to the parent, 0 for *
|
||||||
* explicit deletion. */
|
* explicit deletion. */
|
||||||
,
|
xpMsg_Destroy = 2,
|
||||||
xpMsg_Destroy = 2
|
|
||||||
|
|
||||||
/* The paint message is sent to your widget to draw itself. The paint
|
/* The paint message is sent to your widget to draw itself. The paint message *
|
||||||
* message * is the bare-bones message; in response you must draw yourself,
|
* is the bare-bones message; in response you must draw yourself, draw your *
|
||||||
* draw your * children, set up clipping and culling, check for
|
* children, set up clipping and culling, check for visibility, etc. If you *
|
||||||
* visibility, etc. If you * don't want to do all of this, ignore the
|
* don't want to do all of this, ignore the paint message and a draw message *
|
||||||
* paint message and a draw message * (see below) will be sent to you. *
|
* (see below) will be sent to you. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct */
|
* Dispatching: Direct */
|
||||||
,
|
xpMsg_Paint = 3,
|
||||||
xpMsg_Paint = 3
|
|
||||||
|
|
||||||
/* The draw message is sent to your widget when it is time to draw yourself.
|
/* The draw message is sent to your widget when it is time to draw yourself. *
|
||||||
* * OpenGL will be set up to draw in 2-d global screen coordinates, but you
|
* OpenGL will be set up to draw in 2-d global screen coordinates, but you *
|
||||||
* * should use the XPLM to set up OpenGL state. *
|
* should use the XPLM to set up OpenGL state. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct */
|
* Dispatching: Direct */
|
||||||
,
|
xpMsg_Draw = 4,
|
||||||
xpMsg_Draw = 4
|
|
||||||
|
|
||||||
/* The key press message is sent once per key that is pressed. The first *
|
/* The key press message is sent once per key that is pressed. The first *
|
||||||
* parameter is the type of key code (integer or char) and the second is the
|
* parameter is the type of key code (integer or char) and the second is the *
|
||||||
* * code itself. By handling this event, you consume the key stroke. *
|
* code itself. By handling this event, you consume the key stroke. *
|
||||||
* *
|
* *
|
||||||
* Handling this message 'consumes' the keystroke; not handling it passes it
|
* Handling this message 'consumes' the keystroke; not handling it passes it *
|
||||||
* * to your parent widget. *
|
* to your parent widget. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Up Chain *
|
* Dispatching: Up Chain *
|
||||||
* *
|
* *
|
||||||
* : Param 1: A pointer to an XPKeyState_t structure with the keystroke. */
|
* Param 1: A pointer to an XPKeyState_t structure with the keystroke. */
|
||||||
,
|
xpMsg_KeyPress = 5,
|
||||||
xpMsg_KeyPress = 5
|
|
||||||
|
|
||||||
/* Keyboard focus is being given to you. By handling this message you
|
/* Keyboard focus is being given to you. By handling this message you accept *
|
||||||
* accept * keyboard focus. The first parameter will be one if a child of
|
* keyboard focus. The first parameter will be one if a child of yours gave up*
|
||||||
* yours gave * up focus to you, 0 if someone set focus on you explicitly.
|
* focus to you, 0 if someone set focus on you explicitly. *
|
||||||
* *
|
* *
|
||||||
* *
|
* Handling this message accepts focus; not handling refuses focus. *
|
||||||
* : Handling this message accepts focus; not handling refuses focus. *
|
|
||||||
* *
|
* *
|
||||||
* Dispatching: direct *
|
* Dispatching: direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: 1 if you are gaining focus because your child is giving it up, 0
|
* Param 1: 1 if you are gaining focus because your child is giving it up, 0 *
|
||||||
* * if someone is explicitly giving you focus. */
|
* if someone is explicitly giving you focus. */
|
||||||
,
|
xpMsg_KeyTakeFocus = 6,
|
||||||
xpMsg_KeyTakeFocus = 6
|
|
||||||
|
|
||||||
/* Keyboard focus is being taken away from you. The first parameter will be
|
/* Keyboard focus is being taken away from you. The first parameter will be *
|
||||||
* * one if you are losing focus because another widget is taking it, or 0
|
* one if you are losing focus because another widget is taking it, or 0 if *
|
||||||
* if * someone called the API to make you lose focus explicitly. *
|
* someone called the API to make you lose focus explicitly. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: 1 if focus is being taken by another widget, 0 if code requested
|
* Param 1: 1 if focus is being taken by another widget, 0 if code requested *
|
||||||
* * to remove focus. */
|
* to remove focus. */
|
||||||
,
|
xpMsg_KeyLoseFocus = 7,
|
||||||
xpMsg_KeyLoseFocus = 7
|
|
||||||
|
|
||||||
/* You receive one mousedown event per click with a mouse-state structure *
|
/* You receive one mousedown event per click with a mouse-state structure *
|
||||||
* pointed to by parameter 1, by accepting this you eat the click, otherwise
|
* pointed to by parameter 1, by accepting this you eat the click, otherwise *
|
||||||
* * your parent gets it. You will not receive drag and mouse up messages
|
* your parent gets it. You will not receive drag and mouse up messages if you*
|
||||||
* if * you do not accept the down message. *
|
* do not accept the down message. *
|
||||||
* *
|
* *
|
||||||
* Handling this message consumes the mouse click, not handling it passes it
|
* Handling this message consumes the mouse click, not handling it passes it *
|
||||||
* * to the next widget. You can act 'transparent' as a window by never
|
* to the next widget. You can act 'transparent' as a window by never handling*
|
||||||
* handling * moues clicks to certain areas. *
|
* moues clicks to certain areas. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Up chain NOTE: Technically this is direct dispatched, but
|
* Dispatching: Up chain NOTE: Technically this is direct dispatched, but the *
|
||||||
* the * widgets library will shop it to each widget until one consumes the
|
* widgets library will shop it to each widget until one consumes the click, *
|
||||||
* click, * making it effectively "up chain". *
|
* making it effectively "up chain". *
|
||||||
* *
|
* *
|
||||||
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
||||||
,
|
xpMsg_MouseDown = 8,
|
||||||
xpMsg_MouseDown = 8
|
|
||||||
|
|
||||||
/* You receive a series of mouse drag messages (typically one per frame in
|
/* You receive a series of mouse drag messages (typically one per frame in the*
|
||||||
* the * sim) as the mouse is moved once you have accepted a mouse down
|
* sim) as the mouse is moved once you have accepted a mouse down message. *
|
||||||
* message. * Parameter one points to a mouse-state structure describing
|
* Parameter one points to a mouse-state structure describing the mouse *
|
||||||
* the mouse * location. You will continue to receive these until
|
* location. You will continue to receive these until the mouse button is *
|
||||||
* the mouse button is * released. You may receive multiple mouse state
|
* released. You may receive multiple mouse state messages with the same mouse*
|
||||||
* messages with the same mouse * position. You will receive mouse drag
|
* position. You will receive mouse drag events even if the mouse is dragged *
|
||||||
* events even if the mouse is dragged * out of your current or original
|
* out of your current or original bounds at the time of the mouse down. *
|
||||||
* bounds at the time of the mouse down. *
|
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
||||||
,
|
xpMsg_MouseDrag = 9,
|
||||||
xpMsg_MouseDrag = 9
|
|
||||||
|
|
||||||
/* The mouseup event is sent once when the mouse button is released after a
|
/* The mouseup event is sent once when the mouse button is released after a *
|
||||||
* * drag or click. You only receive this message if you accept the
|
* drag or click. You only receive this message if you accept the mouseDown *
|
||||||
* mouseDown * message. Parameter one points to a mouse state structure.
|
* message. Parameter one points to a mouse state structure. *
|
||||||
* *
|
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
||||||
,
|
xpMsg_MouseUp = 10,
|
||||||
xpMsg_MouseUp = 10
|
|
||||||
|
|
||||||
/* Your geometry or a child's geometry is being changed. *
|
/* Your geometry or a child's geometry is being changed. *
|
||||||
* *
|
* *
|
||||||
@@ -384,66 +350,56 @@ enum {
|
|||||||
* *
|
* *
|
||||||
* Param 2: A pointer to a XPWidgetGeometryChange_t struct describing the *
|
* Param 2: A pointer to a XPWidgetGeometryChange_t struct describing the *
|
||||||
* change. */
|
* change. */
|
||||||
,
|
xpMsg_Reshape = 11,
|
||||||
xpMsg_Reshape = 11
|
|
||||||
|
|
||||||
/* Your exposed area has changed. *
|
/* Your exposed area has changed. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct */
|
* Dispatching: Direct */
|
||||||
,
|
xpMsg_ExposedChanged = 12,
|
||||||
xpMsg_ExposedChanged = 12
|
|
||||||
|
|
||||||
/* A child has been added to you. The child's ID is passed in parameter
|
/* A child has been added to you. The child's ID is passed in parameter one. *
|
||||||
* one. *
|
|
||||||
* *
|
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: The Widget ID of the child being added. */
|
* Param 1: The Widget ID of the child being added. */
|
||||||
,
|
xpMsg_AcceptChild = 13,
|
||||||
xpMsg_AcceptChild = 13
|
|
||||||
|
|
||||||
/* A child has been removed from to you. The child's ID is passed in *
|
/* A child has been removed from to you. The child's ID is passed in parameter*
|
||||||
* parameter one. *
|
* one. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: The Widget ID of the child being removed. */
|
* Param 1: The Widget ID of the child being removed. */
|
||||||
,
|
xpMsg_LoseChild = 14,
|
||||||
xpMsg_LoseChild = 14
|
|
||||||
|
|
||||||
/* You now have a new parent, or have no parent. The parent's ID is passed
|
/* You now have a new parent, or have no parent. The parent's ID is passed in,*
|
||||||
* * in, or 0 for no parent. *
|
* or 0 for no parent. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct *
|
* Dispatching: Direct *
|
||||||
* *
|
* *
|
||||||
* Param 1: The Widget ID of your parent */
|
* Param 1: The Widget ID of your parent */
|
||||||
,
|
xpMsg_AcceptParent = 15,
|
||||||
xpMsg_AcceptParent = 15
|
|
||||||
|
|
||||||
/* You or a child has been shown. Note that this does not include you being
|
/* You or a child has been shown. Note that this does not include you being *
|
||||||
* * shown because your parent was shown, you were put in a new parent,
|
* shown because your parent was shown, you were put in a new parent, your *
|
||||||
* your * root was shown, etc. *
|
* root was shown, etc. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Up chain *
|
* Dispatching: Up chain *
|
||||||
* *
|
* *
|
||||||
* Param 1: The widget ID of the shown widget. */
|
* Param 1: The widget ID of the shown widget. */
|
||||||
,
|
xpMsg_Shown = 16,
|
||||||
xpMsg_Shown = 16
|
|
||||||
|
|
||||||
/* You have been hidden. See limitations above. *
|
/* You have been hidden. See limitations above. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Up chain *
|
* Dispatching: Up chain *
|
||||||
* *
|
* *
|
||||||
* Param 1: The widget ID of the hidden widget. */
|
* Param 1: The widget ID of the hidden widget. */
|
||||||
,
|
xpMsg_Hidden = 17,
|
||||||
xpMsg_Hidden = 17
|
|
||||||
|
|
||||||
/* Your descriptor has changed. *
|
/* Your descriptor has changed. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Direct */
|
* Dispatching: Direct */
|
||||||
,
|
xpMsg_DescriptorChanged = 18,
|
||||||
xpMsg_DescriptorChanged = 18
|
|
||||||
|
|
||||||
/* A property has changed. Param 1 contains the property ID. *
|
/* A property has changed. Param 1 contains the property ID. *
|
||||||
* *
|
* *
|
||||||
@@ -452,8 +408,7 @@ enum {
|
|||||||
* Param 1: The Property ID being changed. *
|
* Param 1: The Property ID being changed. *
|
||||||
* *
|
* *
|
||||||
* Param 2: The new property value */
|
* Param 2: The new property value */
|
||||||
,
|
xpMsg_PropertyChanged = 19,
|
||||||
xpMsg_PropertyChanged = 19
|
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/* The mouse wheel has moved. *
|
/* The mouse wheel has moved. *
|
||||||
@@ -462,32 +417,28 @@ enum {
|
|||||||
* parent. Dispatching: Up chain *
|
* parent. Dispatching: Up chain *
|
||||||
* *
|
* *
|
||||||
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
* Param 1: A pointer to an XPMouseState_t containing the mouse status. */
|
||||||
,
|
xpMsg_MouseWheel = 20,
|
||||||
xpMsg_MouseWheel = 20
|
|
||||||
|
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/* The cursor is over your widget. If you consume this message, change the
|
/* The cursor is over your widget. If you consume this message, change the *
|
||||||
* * XPLMCursorStatus value to indicate the desired result, with the same
|
* XPLMCursorStatus value to indicate the desired result, with the same rules *
|
||||||
* rules * as in XPLMDisplay.h. *
|
* as in XPLMDisplay.h. *
|
||||||
* *
|
* *
|
||||||
* Return 1 to consume this message, 0 to pass it on. *
|
* Return 1 to consume this message, 0 to pass it on. *
|
||||||
* *
|
* *
|
||||||
* Dispatching: Up chain Param 1: A pointer to an XPMouseState_t struct *
|
* Dispatching: Up chain Param 1: A pointer to an XPMouseState_t struct *
|
||||||
* containing the mouse status. *
|
* containing the mouse status. *
|
||||||
* *
|
* *
|
||||||
* Param 2: A pointer to a XPLMCursorStatus - set this to the cursor result
|
* Param 2: A pointer to a XPLMCursorStatus - set this to the cursor result *
|
||||||
* * you desire. */
|
* you desire. */
|
||||||
,
|
xpMsg_CursorAdjust = 21,
|
||||||
xpMsg_CursorAdjust = 21
|
|
||||||
|
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
/* NOTE: Message IDs 1000 - 9999 are allocated to the standard widget
|
/* NOTE: Message IDs 1000 - 9999 are allocated to the standard widget classes *
|
||||||
* classes * provided with the library with 1000 - 1099 for widget class
|
* provided with the library with 1000 - 1099 for widget class 0, 1100 - 1199 *
|
||||||
* 0, 1100 - 1199 * for widget class 1, etc. Message IDs 10,000 and
|
* for widget class 1, etc. Message IDs 10,000 and beyond are for plugin use. */
|
||||||
* beyond are for plugin use. */
|
xpMsg_UserStart = 10000,
|
||||||
,
|
|
||||||
xpMsg_UserStart = 10000
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -496,24 +447,20 @@ typedef int XPWidgetMessage;
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* WIDGET CALLBACK FUNCTION
|
* WIDGET CALLBACK FUNCTION
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPWidgetFunc_t
|
* XPWidgetFunc_t
|
||||||
*
|
*
|
||||||
* This function defines your custom widget's behavior. It will be called by
|
* This function defines your custom widget's behavior. It will be called by
|
||||||
* the widgets library to send messages to your widget. The message and
|
* the widgets library to send messages to your widget. The message and widget
|
||||||
* widget ID are passed in, as well as two ptr-width signed parameters whose
|
* ID are passed in, as well as two ptr-width signed parameters whose meaning
|
||||||
* meaning varies with the message. Return 1 to indicate that you have
|
* varies with the message. Return 1 to indicate that you have processed the
|
||||||
* processed the message, 0 to indicate that you have not. For any message
|
* message, 0 to indicate that you have not. For any message that is not
|
||||||
* that is not understood, return 0.
|
* understood, return 0.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef int (*XPWidgetFunc_t)(XPWidgetMessage inMessage,
|
typedef int (* XPWidgetFunc_t)(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
#define _XPWidgetUtils_h_
|
#define _XPWidgetUtils_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* All rights reserved. See license.txt for usage.
|
|
||||||
*
|
|
||||||
* X-Plane SDK Version: 2.1.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* XPWidgetUtils
|
||||||
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* XPWidgetUtils - USAGE NOTES
|
* ## USAGE NOTES
|
||||||
*
|
*
|
||||||
* The XPWidgetUtils library contains useful functions that make writing and
|
* The XPWidgetUtils library contains useful functions that make writing and
|
||||||
* using widgets less of a pain.
|
* using widgets less of a pain.
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
* 1. You can add a widget behavior function to a widget as a callback proc
|
* 1. You can add a widget behavior function to a widget as a callback proc
|
||||||
* using the XPAddWidgetCallback function. The widget will gain that
|
* using the XPAddWidgetCallback function. The widget will gain that
|
||||||
* behavior. Remember that the last function you add has highest priority.
|
* behavior. Remember that the last function you add has highest priority.
|
||||||
* You can use this to change or augment the behavior of an existing finished
|
* You can use this to change or augment the behavior of an existing
|
||||||
* widget.
|
* finished widget.
|
||||||
*
|
|
||||||
* 2. You can call a widget function from inside your own widget function.
|
* 2. You can call a widget function from inside your own widget function.
|
||||||
* This allows you to include useful behaviors in custom-built widgets. A
|
* This allows you to include useful behaviors in custom-built widgets. A
|
||||||
* number of the standard widgets get their behavior from this library. To do
|
* number of the standard widgets get their behavior from this library. To
|
||||||
* this, call the behavior function from your function first. If it returns
|
* do this, call the behavior function from your function first. If it
|
||||||
* 1, that means it handled the event and you don't need to; simply return 1.
|
* returns 1, that means it handled the event and you don't need to; simply
|
||||||
|
* return 1.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -43,32 +43,28 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* GENERAL UTILITIES
|
* GENERAL UTILITIES
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convenience accessors
|
* Convenience accessors
|
||||||
*
|
*
|
||||||
* It can be clumsy accessing the variables passed in by pointer to a struct
|
* It can be clumsy accessing the variables passed in by pointer to a struct
|
||||||
* for mouse and reshape messages; these accessors let you simply pass in the
|
* for mouse and reshape messages; these accessors let you simply pass in the param
|
||||||
* param right from the arguments of your widget proc and get back the value you
|
* right from the arguments of your widget proc and get back the value you want.
|
||||||
* want.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define MOUSE_X(param) (((XPMouseState_t *)(param))->x)
|
#define MOUSE_X(param) (((XPMouseState_t *) (param))->x)
|
||||||
#define MOUSE_Y(param) (((XPMouseState_t *)(param))->y)
|
#define MOUSE_Y(param) (((XPMouseState_t *) (param))->y)
|
||||||
|
|
||||||
#define DELTA_X(param) (((XPWidgetGeometryChange_t *)(param))->dx)
|
#define DELTA_X(param) (((XPWidgetGeometryChange_t *) (param))->dx)
|
||||||
#define DELTA_Y(param) (((XPWidgetGeometryChange_t *)(param))->dy)
|
#define DELTA_Y(param) (((XPWidgetGeometryChange_t *) (param))->dy)
|
||||||
#define DELTA_W(param) (((XPWidgetGeometryChange_t *)(param))->dwidth)
|
#define DELTA_W(param) (((XPWidgetGeometryChange_t *) (param))->dwidth)
|
||||||
#define DELTA_H(param) (((XPWidgetGeometryChange_t *)(param))->dheight)
|
#define DELTA_H(param) (((XPWidgetGeometryChange_t *) (param))->dheight)
|
||||||
|
|
||||||
#define KEY_CHAR(param) (((XPKeyState_t *)(param))->key)
|
#define KEY_CHAR(param) (((XPKeyState_t *) (param))->key)
|
||||||
#define KEY_FLAGS(param) (((XPKeyState_t *)(param))->flags)
|
#define KEY_FLAGS(param) (((XPKeyState_t *) (param))->flags)
|
||||||
#define KEY_VKEY(param) (((XPKeyState_t *)(param))->vkey)
|
#define KEY_VKEY(param) (((XPKeyState_t *) (param))->vkey)
|
||||||
|
|
||||||
#define IN_RECT(x, y, l, t, r, b) \
|
#define IN_RECT(x, y, l, t, r, b) \
|
||||||
(((x) >= (l)) && ((x) <= (r)) && ((y) >= (b)) && ((y) <= (t)))
|
(((x) >= (l)) && ((x) <= (r)) && ((y) >= (b)) && ((y) <= (t)))
|
||||||
@@ -79,11 +75,14 @@ extern "C" {
|
|||||||
* This structure contains all of the parameters needed to create a wiget. It
|
* This structure contains all of the parameters needed to create a wiget. It
|
||||||
* is used with XPUCreateWidgets to create widgets in bulk from an array. All
|
* is used with XPUCreateWidgets to create widgets in bulk from an array. All
|
||||||
* parameters correspond to those of XPCreateWidget except for the container
|
* parameters correspond to those of XPCreateWidget except for the container
|
||||||
* index. If the container index is equal to the index of a widget in the
|
* index.
|
||||||
* array, the widget in the array passed to XPUCreateWidgets is used as the
|
*
|
||||||
* parent of this widget. Note that if you pass an index greater than your
|
* If the container index is equal to the index of a widget in the array, the
|
||||||
* own position in the array, the parent you are requesting will not exist
|
* widget in the array passed to XPUCreateWidgets is used as the parent of
|
||||||
* yet. If the container index is NO_PARENT, the parent widget is specified as
|
* this widget. Note that if you pass an index greater than your own position
|
||||||
|
* in the array, the parent you are requesting will not exist yet.
|
||||||
|
*
|
||||||
|
* If the container index is NO_PARENT, the parent widget is specified as
|
||||||
* NULL. If the container index is PARAM_PARENT, the widget passed into
|
* NULL. If the container index is PARAM_PARENT, the widget passed into
|
||||||
* XPUCreateWidgets is used.
|
* XPUCreateWidgets is used.
|
||||||
*
|
*
|
||||||
@@ -94,8 +93,10 @@ typedef struct {
|
|||||||
int right;
|
int right;
|
||||||
int bottom;
|
int bottom;
|
||||||
int visible;
|
int visible;
|
||||||
const char *descriptor;
|
const char * descriptor;
|
||||||
|
/* Whether ethis widget is a root wiget */
|
||||||
int isRoot;
|
int isRoot;
|
||||||
|
/* The index of the widget to contain within, or a constant */
|
||||||
int containerIndex;
|
int containerIndex;
|
||||||
XPWidgetClass widgetClass;
|
XPWidgetClass widgetClass;
|
||||||
} XPWidgetCreate_t;
|
} XPWidgetCreate_t;
|
||||||
@@ -109,8 +110,8 @@ typedef struct {
|
|||||||
/*
|
/*
|
||||||
* XPUCreateWidgets
|
* XPUCreateWidgets
|
||||||
*
|
*
|
||||||
* This function creates a series of widgets from a table...see
|
* This function creates a series of widgets from a table (see
|
||||||
* XPCreateWidget_t above. Pass in an array of widget creation structures and
|
* XPCreateWidget_t above). Pass in an array of widget creation structures and
|
||||||
* an array of widget IDs that will receive each widget.
|
* an array of widget IDs that will receive each widget.
|
||||||
*
|
*
|
||||||
* Widget parents are specified by index into the created widget table,
|
* Widget parents are specified by index into the created widget table,
|
||||||
@@ -123,10 +124,11 @@ typedef struct {
|
|||||||
* XPUCreateWidgets in a widget created previously.
|
* XPUCreateWidgets in a widget created previously.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPUCreateWidgets(const XPWidgetCreate_t *inWidgetDefs,
|
WIDGET_API void XPUCreateWidgets(
|
||||||
|
const XPWidgetCreate_t * inWidgetDefs,
|
||||||
int inCount,
|
int inCount,
|
||||||
XPWidgetID inParamParent,
|
XPWidgetID inParamParent,
|
||||||
XPWidgetID *ioWidgets);
|
XPWidgetID * ioWidgets);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPUMoveWidgetBy
|
* XPUMoveWidgetBy
|
||||||
@@ -135,8 +137,10 @@ WIDGET_API void XPUCreateWidgets(const XPWidgetCreate_t *inWidgetDefs,
|
|||||||
* widget.
|
* widget.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void
|
WIDGET_API void XPUMoveWidgetBy(
|
||||||
XPUMoveWidgetBy(XPWidgetID inWidget, int inDeltaX, int inDeltaY);
|
XPWidgetID inWidget,
|
||||||
|
int inDeltaX,
|
||||||
|
int inDeltaY);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* LAYOUT MANAGERS
|
* LAYOUT MANAGERS
|
||||||
@@ -157,7 +161,8 @@ WIDGET_API void
|
|||||||
* widget for your window.
|
* widget for your window.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPUFixedLayout(XPWidgetMessage inMessage,
|
WIDGET_API int XPUFixedLayout(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
@@ -181,7 +186,8 @@ WIDGET_API int XPUFixedLayout(XPWidgetMessage inMessage,
|
|||||||
* consumed by bringin the window to the foreground.
|
* consumed by bringin the window to the foreground.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPUSelectIfNeeded(XPWidgetMessage inMessage,
|
WIDGET_API int XPUSelectIfNeeded(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2,
|
intptr_t inParam2,
|
||||||
@@ -194,7 +200,8 @@ WIDGET_API int XPUSelectIfNeeded(XPWidgetMessage inMessage,
|
|||||||
* This stops editing of any text fields, etc.
|
* This stops editing of any text fields, etc.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPUDefocusKeyboard(XPWidgetMessage inMessage,
|
WIDGET_API int XPUDefocusKeyboard(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2,
|
intptr_t inParam2,
|
||||||
@@ -208,7 +215,8 @@ WIDGET_API int XPUDefocusKeyboard(XPWidgetMessage inMessage,
|
|||||||
* be a sub-region of your widget (for example, a title bar).
|
* be a sub-region of your widget (for example, a title bar).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPUDragWidget(XPWidgetMessage inMessage,
|
WIDGET_API int XPUDragWidget(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2,
|
intptr_t inParam2,
|
||||||
|
|||||||
+151
-154
@@ -2,16 +2,16 @@
|
|||||||
#define _XPWidgets_h_
|
#define _XPWidgets_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* All rights reserved. See license.txt for usage.
|
|
||||||
*
|
|
||||||
* X-Plane SDK Version: 2.1.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* XPWidgets
|
||||||
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* WIDGETS - THEORY OF OPERATION AND NOTES
|
* ## THEORY OF OPERATION AND NOTES
|
||||||
*
|
*
|
||||||
* Widgets are persistent view 'objects' for X-Plane. A widget is an object
|
* Widgets are persistent view 'objects' for X-Plane. A widget is an object
|
||||||
* referenced by its opaque handle (widget ID) and the APIs in this file. You
|
* referenced by its opaque handle (widget ID) and the APIs in this file. You
|
||||||
@@ -20,27 +20,16 @@
|
|||||||
*
|
*
|
||||||
* - A bounding box defined in global screen coordinates with 0,0 in the
|
* - A bounding box defined in global screen coordinates with 0,0 in the
|
||||||
* bottom left and +y = up, +x = right.
|
* bottom left and +y = up, +x = right.
|
||||||
*
|
|
||||||
* - A visible box, which is the intersection of the bounding box with the
|
* - A visible box, which is the intersection of the bounding box with the
|
||||||
* widget's parents visible box.
|
* widget's parents visible box.
|
||||||
*
|
|
||||||
* - Zero or one parent widgets. (Always zero if the widget is a root widget.
|
* - Zero or one parent widgets. (Always zero if the widget is a root widget.
|
||||||
*
|
|
||||||
*
|
|
||||||
* - Zero or more child widgets.
|
* - Zero or more child widgets.
|
||||||
*
|
|
||||||
* - Whether the widget is a root. Root widgets are the top level plugin
|
* - Whether the widget is a root. Root widgets are the top level plugin
|
||||||
* windows.
|
* windows.
|
||||||
*
|
|
||||||
* - Whether the widget is visible.
|
* - Whether the widget is visible.
|
||||||
*
|
|
||||||
* - A text string descriptor, whose meaning varies from widget to widget.
|
* - A text string descriptor, whose meaning varies from widget to widget.
|
||||||
*
|
|
||||||
* - An arbitrary set of 32 bit integral properties defined by 32-bit integral
|
* - An arbitrary set of 32 bit integral properties defined by 32-bit integral
|
||||||
* keys. This is how specific widgets
|
* keys. This is how specific widgets store specific data.
|
||||||
*
|
|
||||||
* store specific data.
|
|
||||||
*
|
|
||||||
* - A list of widget callbacks proc that implements the widgets behaviors.
|
* - A list of widget callbacks proc that implements the widgets behaviors.
|
||||||
*
|
*
|
||||||
* The Widgets library sends messages to widgets to request specific behaviors
|
* The Widgets library sends messages to widgets to request specific behaviors
|
||||||
@@ -50,8 +39,8 @@
|
|||||||
* are sent to the most recently added callback function until the message is
|
* are sent to the most recently added callback function until the message is
|
||||||
* handled. Messages may also be sent to parents or children; see the
|
* handled. Messages may also be sent to parents or children; see the
|
||||||
* XPWidgetDefs.h header file for the different widget message dispatching
|
* XPWidgetDefs.h header file for the different widget message dispatching
|
||||||
* functions. By adding a callback function to a window you can 'subclass'
|
* functions. By adding a callback function to a window you can 'subclass' its
|
||||||
* its behavior.
|
* behavior.
|
||||||
*
|
*
|
||||||
* A set of standard widgets are provided that serve common UI purposes. You
|
* A set of standard widgets are provided that serve common UI purposes. You
|
||||||
* can also customize or implement entirely custom widgets.
|
* can also customize or implement entirely custom widgets.
|
||||||
@@ -61,18 +50,15 @@
|
|||||||
*
|
*
|
||||||
* - Not all behavior can be patched. State that is managed by the XPWidgets
|
* - Not all behavior can be patched. State that is managed by the XPWidgets
|
||||||
* DLL and not by individual widgets cannot be customized.
|
* DLL and not by individual widgets cannot be customized.
|
||||||
*
|
|
||||||
* - All coordinates are in global screen coordinates. Coordinates are not
|
* - All coordinates are in global screen coordinates. Coordinates are not
|
||||||
* relative to an enclosing widget, nor are they relative to a display window.
|
* relative to an enclosing widget, nor are they relative to a display
|
||||||
*
|
* window.
|
||||||
*
|
|
||||||
* - Widget messages are always dispatched synchronously, and there is no
|
* - Widget messages are always dispatched synchronously, and there is no
|
||||||
* concept of scheduling an update or a dirty region. Messages originate from
|
* concept of scheduling an update or a dirty region. Messages originate
|
||||||
* X-Plane as the sim cycle goes by. Since x-plane is constantly redrawing,
|
* from X-Plane as the sim cycle goes by. Since X-Plane is constantly
|
||||||
* so are widgets; there is no need to mark a part of a widget as 'needing
|
* redrawing, so are widgets; there is no need to mark a part of a widget as
|
||||||
* redrawing' because redrawing happens frequently whether the widget needs it
|
* 'needing redrawing' because redrawing happens frequently whether the
|
||||||
* or not.
|
* widget needs it or not.
|
||||||
*
|
|
||||||
* - Any widget may be a 'root' widget, causing it to be drawn; there is no
|
* - Any widget may be a 'root' widget, causing it to be drawn; there is no
|
||||||
* relationship between widget class and rootness. Root widgets are
|
* relationship between widget class and rootness. Root widgets are
|
||||||
* imlemented as XPLMDisply windows.
|
* imlemented as XPLMDisply windows.
|
||||||
@@ -80,6 +66,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "XPWidgetDefs.h"
|
#include "XPWidgetDefs.h"
|
||||||
|
#include "XPLMDisplay.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -88,11 +75,6 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* WIDGET CREATION AND MANAGEMENT
|
* WIDGET CREATION AND MANAGEMENT
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPCreateWidget
|
* XPCreateWidget
|
||||||
@@ -106,37 +88,33 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
* - Top, left, bottom, and right in global screen coordinates defining the
|
* - Top, left, bottom, and right in global screen coordinates defining the
|
||||||
* widget's location on the screen.
|
* widget's location on the screen.
|
||||||
*
|
|
||||||
* - inVisible is 1 if the widget should be drawn, 0 to start the widget as
|
* - inVisible is 1 if the widget should be drawn, 0 to start the widget as
|
||||||
* hidden.
|
* hidden.
|
||||||
*
|
|
||||||
* - inDescriptor is a null terminated string that will become the widget's
|
* - inDescriptor is a null terminated string that will become the widget's
|
||||||
* descriptor.
|
* descriptor.
|
||||||
*
|
|
||||||
* - inIsRoot is 1 if this is going to be a root widget, 0 if it will not be.
|
* - inIsRoot is 1 if this is going to be a root widget, 0 if it will not be.
|
||||||
*
|
* - inContainer is the ID of this widget's container. It must be 0 for a root
|
||||||
* - inContainer is the ID of this widget's container. It must be 0 for a
|
* widget. for a non-root widget, pass the widget ID of the widget to place
|
||||||
* root widget. for a non-root widget, pass the widget ID of the widget to
|
* this widget within. If this widget is not going to start inside another
|
||||||
* place this widget within. If this widget is not going to start inside
|
* widget, pass 0; this new widget will then just be floating off in space
|
||||||
* another widget, pass 0; this new widget will then just be floating off in
|
* (and will not be drawn until it is placed in a widget.
|
||||||
* space (and will not be drawn until it is placed in a widget.
|
|
||||||
*
|
|
||||||
* - inClass is the class of the widget to draw. Use one of the predefined
|
* - inClass is the class of the widget to draw. Use one of the predefined
|
||||||
* class-IDs to create a standard widget.
|
* class-IDs to create a standard widget.
|
||||||
*
|
*
|
||||||
* A note on widget embedding: a widget is only called (and will be drawn,
|
* A note on widget embedding: a widget is only called (and will be drawn,
|
||||||
* etc.) if it is placed within a widget that will be called. Root widgets
|
* etc.) if it is placed within a widget that will be called. Root widgets are
|
||||||
* are always called. So it is possible to have whole chains of widgets that
|
* always called. So it is possible to have whole chains of widgets that are
|
||||||
* are simply not called. You can preconstruct widget trees and then place
|
* simply not called. You can preconstruct widget trees and then place them
|
||||||
* them into root widgets later to activate them if you wish.
|
* into root widgets later to activate them if you wish.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPCreateWidget(int inLeft,
|
WIDGET_API XPWidgetID XPCreateWidget(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom,
|
int inBottom,
|
||||||
int inVisible,
|
int inVisible,
|
||||||
const char *inDescriptor,
|
const char * inDescriptor,
|
||||||
int inIsRoot,
|
int inIsRoot,
|
||||||
XPWidgetID inContainer,
|
XPWidgetID inContainer,
|
||||||
XPWidgetClass inClass);
|
XPWidgetClass inClass);
|
||||||
@@ -146,17 +124,18 @@ WIDGET_API XPWidgetID XPCreateWidget(int inLeft,
|
|||||||
*
|
*
|
||||||
* This function is the same as XPCreateWidget except that instead of passing
|
* This function is the same as XPCreateWidget except that instead of passing
|
||||||
* a class ID, you pass your widget callback function pointer defining the
|
* a class ID, you pass your widget callback function pointer defining the
|
||||||
* widget. Use this function to define a custom widget. All parameters are
|
* widget. Use this function to define a custom widget. All parameters are the
|
||||||
* the same as XPCreateWidget, except that the widget class has been replaced
|
* same as XPCreateWidget, except that the widget class has been replaced with
|
||||||
* with the widget function.
|
* the widget function.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPCreateCustomWidget(int inLeft,
|
WIDGET_API XPWidgetID XPCreateCustomWidget(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom,
|
int inBottom,
|
||||||
int inVisible,
|
int inVisible,
|
||||||
const char *inDescriptor,
|
const char * inDescriptor,
|
||||||
int inIsRoot,
|
int inIsRoot,
|
||||||
XPWidgetID inContainer,
|
XPWidgetID inContainer,
|
||||||
XPWidgetFunc_t inCallback);
|
XPWidgetFunc_t inCallback);
|
||||||
@@ -164,15 +143,17 @@ WIDGET_API XPWidgetID XPCreateCustomWidget(int inLeft,
|
|||||||
/*
|
/*
|
||||||
* XPDestroyWidget
|
* XPDestroyWidget
|
||||||
*
|
*
|
||||||
* This class destroys a widget. Pass in the ID of the widget to kill. If
|
* This class destroys a widget. Pass in the ID of the widget to kill. If you
|
||||||
* you pass 1 for inDestroyChilren, the widget's children will be destroyed
|
* pass 1 for inDestroyChilren, the widget's children will be destroyed first,
|
||||||
* first, then this widget will be destroyed. (Furthermore, the widget's
|
* then this widget will be destroyed. (Furthermore, the widget's children
|
||||||
* children will be destroyed with the inDestroyChildren flag set to 1, so the
|
* will be destroyed with the inDestroyChildren flag set to 1, so the
|
||||||
* destruction will recurse down the widget tree.) If you pass 0 for this
|
* destruction will recurse down the widget tree.) If you pass 0 for this
|
||||||
* flag, the child widgets will simply end up with their parent set to 0.
|
* flag, the child widgets will simply end up with their parent set to 0.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPDestroyWidget(XPWidgetID inWidget, int inDestroyChildren);
|
WIDGET_API void XPDestroyWidget(
|
||||||
|
XPWidgetID inWidget,
|
||||||
|
int inDestroyChildren);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPSendMessageToWidget
|
* XPSendMessageToWidget
|
||||||
@@ -187,11 +168,12 @@ WIDGET_API void XPDestroyWidget(XPWidgetID inWidget, int inDestroyChildren);
|
|||||||
* not.
|
* not.
|
||||||
*
|
*
|
||||||
* For each widget that receives the message (see the dispatching modes), each
|
* For each widget that receives the message (see the dispatching modes), each
|
||||||
* widget function from the most recently installed to the oldest one
|
* widget function from the most recently installed to the oldest one receives
|
||||||
* receives the message in order until it is handled.
|
* the message in order until it is handled.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPSendMessageToWidget(XPWidgetID inWidget,
|
WIDGET_API int XPSendMessageToWidget(
|
||||||
|
XPWidgetID inWidget,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPDispatchMode inMode,
|
XPDispatchMode inMode,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
@@ -200,11 +182,6 @@ WIDGET_API int XPSendMessageToWidget(XPWidgetID inWidget,
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* WIDGET POSITIONING AND VISIBILITY
|
* WIDGET POSITIONING AND VISIBILITY
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPPlaceWidgetWithin
|
* XPPlaceWidgetWithin
|
||||||
@@ -212,11 +189,11 @@ WIDGET_API int XPSendMessageToWidget(XPWidgetID inWidget,
|
|||||||
* This function changes which container a widget resides in. You may NOT use
|
* This function changes which container a widget resides in. You may NOT use
|
||||||
* this function on a root widget! inSubWidget is the widget that will be
|
* this function on a root widget! inSubWidget is the widget that will be
|
||||||
* moved. Pass a widget ID in inContainer to make inSubWidget be a child of
|
* moved. Pass a widget ID in inContainer to make inSubWidget be a child of
|
||||||
* inContainer. It will become the last/closest widget in the container.
|
* inContainer. It will become the last/closest widget in the container. Pass
|
||||||
* Pass 0 to remove the widget from any container. Any call to this other
|
* 0 to remove the widget from any container. Any call to this other than
|
||||||
* than passing the widget ID of the old parent of the affected widget will
|
* passing the widget ID of the old parent of the affected widget will cause
|
||||||
* cause the widget to be removed from its old parent. Placing a widget within
|
* the widget to be removed from its old parent. Placing a widget within its
|
||||||
* its own parent simply makes it the last widget.
|
* own parent simply makes it the last widget.
|
||||||
*
|
*
|
||||||
* NOTE: this routine does not reposition the sub widget in global
|
* NOTE: this routine does not reposition the sub widget in global
|
||||||
* coordinates. If the container has layout management code, it will
|
* coordinates. If the container has layout management code, it will
|
||||||
@@ -224,7 +201,8 @@ WIDGET_API int XPSendMessageToWidget(XPWidgetID inWidget,
|
|||||||
* SetWidgetGeometry.
|
* SetWidgetGeometry.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPPlaceWidgetWithin(XPWidgetID inSubWidget,
|
WIDGET_API void XPPlaceWidgetWithin(
|
||||||
|
XPWidgetID inSubWidget,
|
||||||
XPWidgetID inContainer);
|
XPWidgetID inContainer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -233,7 +211,8 @@ WIDGET_API void XPPlaceWidgetWithin(XPWidgetID inSubWidget,
|
|||||||
* This routine returns the number of widgets another widget contains.
|
* This routine returns the number of widgets another widget contains.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPCountChildWidgets(XPWidgetID inWidget);
|
WIDGET_API int XPCountChildWidgets(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetNthChildWidget
|
* XPGetNthChildWidget
|
||||||
@@ -243,16 +222,19 @@ WIDGET_API int XPCountChildWidgets(XPWidgetID inWidget);
|
|||||||
* inclusive. If the index is invalid, 0 is returned.
|
* inclusive. If the index is invalid, 0 is returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPGetNthChildWidget(XPWidgetID inWidget, int inIndex);
|
WIDGET_API XPWidgetID XPGetNthChildWidget(
|
||||||
|
XPWidgetID inWidget,
|
||||||
|
int inIndex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetParentWidget
|
* XPGetParentWidget
|
||||||
*
|
*
|
||||||
* This routine returns the parent of a widget, or 0 if the widget has no
|
* Returns the parent of a widget, or 0 if the widget has no parent. Root
|
||||||
* parent. Root widgets never have parents and therefore always return 0.
|
* widgets never have parents and therefore always return 0.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPGetParentWidget(XPWidgetID inWidget);
|
WIDGET_API XPWidgetID XPGetParentWidget(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPShowWidget
|
* XPShowWidget
|
||||||
@@ -262,7 +244,8 @@ WIDGET_API XPWidgetID XPGetParentWidget(XPWidgetID inWidget);
|
|||||||
* visible, it will still not be visible to the user.
|
* visible, it will still not be visible to the user.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPShowWidget(XPWidgetID inWidget);
|
WIDGET_API void XPShowWidget(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPHideWidget
|
* XPHideWidget
|
||||||
@@ -271,7 +254,8 @@ WIDGET_API void XPShowWidget(XPWidgetID inWidget);
|
|||||||
* widget might not be visible despite its own visibility state.
|
* widget might not be visible despite its own visibility state.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPHideWidget(XPWidgetID inWidget);
|
WIDGET_API void XPHideWidget(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPIsWidgetVisible
|
* XPIsWidgetVisible
|
||||||
@@ -281,17 +265,18 @@ WIDGET_API void XPHideWidget(XPWidgetID inWidget);
|
|||||||
* routine to tell if the user can see the widget.
|
* routine to tell if the user can see the widget.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPIsWidgetVisible(XPWidgetID inWidget);
|
WIDGET_API int XPIsWidgetVisible(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPFindRootWidget
|
* XPFindRootWidget
|
||||||
*
|
*
|
||||||
* XPFindRootWidget returns the Widget ID of the root widget that contains the
|
* Returns the Widget ID of the root widget that contains the passed in widget
|
||||||
* passed in widget or NULL if the passed in widget is not in a rooted
|
* or NULL if the passed in widget is not in a rooted hierarchy.
|
||||||
* hierarchy.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPFindRootWidget(XPWidgetID inWidget);
|
WIDGET_API XPWidgetID XPFindRootWidget(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPBringRootWidgetToFront
|
* XPBringRootWidgetToFront
|
||||||
@@ -303,7 +288,8 @@ WIDGET_API XPWidgetID XPFindRootWidget(XPWidgetID inWidget);
|
|||||||
* top of the tree), this routine does nothing.
|
* top of the tree), this routine does nothing.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPBringRootWidgetToFront(XPWidgetID inWidget);
|
WIDGET_API void XPBringRootWidgetToFront(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPIsWidgetInFront
|
* XPIsWidgetInFront
|
||||||
@@ -313,7 +299,8 @@ WIDGET_API void XPBringRootWidgetToFront(XPWidgetID inWidget);
|
|||||||
* if the widget is not in a rooted hierarchy.
|
* if the widget is not in a rooted hierarchy.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPIsWidgetInFront(XPWidgetID inWidget);
|
WIDGET_API int XPIsWidgetInFront(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetWidgetGeometry
|
* XPGetWidgetGeometry
|
||||||
@@ -322,11 +309,12 @@ WIDGET_API int XPIsWidgetInFront(XPWidgetID inWidget);
|
|||||||
* Pass NULL for any parameter you are not interested in.
|
* Pass NULL for any parameter you are not interested in.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPGetWidgetGeometry(XPWidgetID inWidget,
|
WIDGET_API void XPGetWidgetGeometry(
|
||||||
int *outLeft, /* Can be NULL */
|
XPWidgetID inWidget,
|
||||||
int *outTop, /* Can be NULL */
|
int * outLeft, /* Can be NULL */
|
||||||
int *outRight, /* Can be NULL */
|
int * outTop, /* Can be NULL */
|
||||||
int *outBottom); /* Can be NULL */
|
int * outRight, /* Can be NULL */
|
||||||
|
int * outBottom); /* Can be NULL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPSetWidgetGeometry
|
* XPSetWidgetGeometry
|
||||||
@@ -334,7 +322,8 @@ WIDGET_API void XPGetWidgetGeometry(XPWidgetID inWidget,
|
|||||||
* This function changes the bounding box of a widget.
|
* This function changes the bounding box of a widget.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPSetWidgetGeometry(XPWidgetID inWidget,
|
WIDGET_API void XPSetWidgetGeometry(
|
||||||
|
XPWidgetID inWidget,
|
||||||
int inLeft,
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
@@ -349,8 +338,8 @@ WIDGET_API void XPSetWidgetGeometry(XPWidgetID inWidget,
|
|||||||
* deepest widget at that location. If inVisibleOnly is true, then only
|
* deepest widget at that location. If inVisibleOnly is true, then only
|
||||||
* visible widgets are considered, otherwise all widgets are considered. The
|
* visible widgets are considered, otherwise all widgets are considered. The
|
||||||
* widget ID passed for inContainer will be returned if the location is in
|
* widget ID passed for inContainer will be returned if the location is in
|
||||||
* that widget but not in a child widget. 0 is returned if the location is
|
* that widget but not in a child widget. 0 is returned if the location is not
|
||||||
* not in the container.
|
* in the container.
|
||||||
*
|
*
|
||||||
* NOTE: if a widget's geometry extends outside its parents geometry, it will
|
* NOTE: if a widget's geometry extends outside its parents geometry, it will
|
||||||
* not be returned by this call for mouse locations outside the parent
|
* not be returned by this call for mouse locations outside the parent
|
||||||
@@ -358,7 +347,8 @@ WIDGET_API void XPSetWidgetGeometry(XPWidgetID inWidget,
|
|||||||
* location.
|
* location.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPGetWidgetForLocation(XPWidgetID inContainer,
|
WIDGET_API XPWidgetID XPGetWidgetForLocation(
|
||||||
|
XPWidgetID inContainer,
|
||||||
int inXOffset,
|
int inXOffset,
|
||||||
int inYOffset,
|
int inYOffset,
|
||||||
int inRecursive,
|
int inRecursive,
|
||||||
@@ -368,43 +358,40 @@ WIDGET_API XPWidgetID XPGetWidgetForLocation(XPWidgetID inContainer,
|
|||||||
* XPGetWidgetExposedGeometry
|
* XPGetWidgetExposedGeometry
|
||||||
*
|
*
|
||||||
* This routine returns the bounds of the area of a widget that is completely
|
* This routine returns the bounds of the area of a widget that is completely
|
||||||
* within its parent widgets. Since a widget's bounding box can be outside
|
* within its parent widgets. Since a widget's bounding box can be outside its
|
||||||
* its parent, part of its area will not be elligible for mouse clicks and
|
* parent, part of its area will not be elligible for mouse clicks and should
|
||||||
* should not draw. Use XPGetWidgetGeometry to find out what area defines
|
* not draw. Use XPGetWidgetGeometry to find out what area defines your
|
||||||
* your widget's shape, but use this routine to find out what area to actually
|
* widget's shape, but use this routine to find out what area to actually draw
|
||||||
* draw into. Note that the widget library does not use OpenGL clipping to
|
* into. Note that the widget library does not use OpenGL clipping to keep
|
||||||
* keep frame rates up, although you could use it internally.
|
* frame rates up, although you could use it internally.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPGetWidgetExposedGeometry(XPWidgetID inWidgetID,
|
WIDGET_API void XPGetWidgetExposedGeometry(
|
||||||
int *outLeft, /* Can be NULL */
|
XPWidgetID inWidgetID,
|
||||||
int *outTop, /* Can be NULL */
|
int * outLeft, /* Can be NULL */
|
||||||
int *outRight, /* Can be NULL */
|
int * outTop, /* Can be NULL */
|
||||||
int *outBottom); /* Can be NULL */
|
int * outRight, /* Can be NULL */
|
||||||
|
int * outBottom); /* Can be NULL */
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* ACCESSING WIDGET DATA
|
* ACCESSING WIDGET DATA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPSetWidgetDescriptor
|
* XPSetWidgetDescriptor
|
||||||
*
|
*
|
||||||
* Every widget has a descriptor, which is a text string. What the text
|
* Every widget has a descriptor, which is a text string. What the text string
|
||||||
* string is used for varies from widget to widget; for example, a push
|
* is used for varies from widget to widget; for example, a push button's text
|
||||||
* button's text is its descriptor, a caption shows its descriptor, and a text
|
* is its descriptor, a caption shows its descriptor, and a text field's
|
||||||
* field's descriptor is the text being edited. In other words, the usage for
|
* descriptor is the text being edited. In other words, the usage for the text
|
||||||
* the text varies from widget to widget, but this API provides a universal
|
* varies from widget to widget, but this API provides a universal and
|
||||||
* and convenient way to get at it. While not all UI widgets need their
|
* convenient way to get at it. While not all UI widgets need their
|
||||||
* descriptor, many do.
|
* descriptor, many do.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPSetWidgetDescriptor(XPWidgetID inWidget,
|
WIDGET_API void XPSetWidgetDescriptor(
|
||||||
const char *inDescriptor);
|
XPWidgetID inWidget,
|
||||||
|
const char * inDescriptor);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetWidgetDescriptor
|
* XPGetWidgetDescriptor
|
||||||
@@ -418,10 +405,25 @@ WIDGET_API void XPSetWidgetDescriptor(XPWidgetID inWidget,
|
|||||||
* terminated (this routine has 'strncpy' semantics).
|
* terminated (this routine has 'strncpy' semantics).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API int XPGetWidgetDescriptor(XPWidgetID inWidget,
|
WIDGET_API int XPGetWidgetDescriptor(
|
||||||
char *outDescriptor,
|
XPWidgetID inWidget,
|
||||||
|
char * outDescriptor,
|
||||||
int inMaxDescLength);
|
int inMaxDescLength);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPGetWidgetUnderlyingWindow
|
||||||
|
*
|
||||||
|
* Returns the window (from the XPLMDisplay API) that backs your widget
|
||||||
|
* window. If you have opted in to modern windows, via a call to
|
||||||
|
* XPLMEnableFeature("XPLM_USE_NATIVE_WIDGET_WINDOWS", 1), you can use the
|
||||||
|
* returned window ID for display APIs like XPLMSetWindowPositioningMode(),
|
||||||
|
* allowing you to pop the widget window out into a real OS window, or move it
|
||||||
|
* into VR.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
WIDGET_API XPLMWindowID XPGetWidgetUnderlyingWindow(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPSetWidgetProperty
|
* XPSetWidgetProperty
|
||||||
*
|
*
|
||||||
@@ -429,7 +431,8 @@ WIDGET_API int XPGetWidgetDescriptor(XPWidgetID inWidget,
|
|||||||
* associated by a widget by ID.
|
* associated by a widget by ID.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPSetWidgetProperty(XPWidgetID inWidget,
|
WIDGET_API void XPSetWidgetProperty(
|
||||||
|
XPWidgetID inWidget,
|
||||||
XPWidgetPropertyID inProperty,
|
XPWidgetPropertyID inProperty,
|
||||||
intptr_t inValue);
|
intptr_t inValue);
|
||||||
|
|
||||||
@@ -437,44 +440,40 @@ WIDGET_API void XPSetWidgetProperty(XPWidgetID inWidget,
|
|||||||
* XPGetWidgetProperty
|
* XPGetWidgetProperty
|
||||||
*
|
*
|
||||||
* This routine returns the value of a widget's property, or 0 if the property
|
* This routine returns the value of a widget's property, or 0 if the property
|
||||||
* is not defined. If you need to know whether the property is defined, pass
|
* is not defined. If you need to know whether the property is defined, pass a
|
||||||
* a pointer to an int for inExists; the existence of that property will be
|
* pointer to an int for inExists; the existence of that property will be
|
||||||
* returned in the int. Pass NULL for inExists if you do not need this
|
* returned in the int. Pass NULL for inExists if you do not need this
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API intptr_t XPGetWidgetProperty(XPWidgetID inWidget,
|
WIDGET_API intptr_t XPGetWidgetProperty(
|
||||||
|
XPWidgetID inWidget,
|
||||||
XPWidgetPropertyID inProperty,
|
XPWidgetPropertyID inProperty,
|
||||||
int *inExists); /* Can be NULL */
|
int * inExists); /* Can be NULL */
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* KEYBOARD MANAGEMENT
|
* KEYBOARD MANAGEMENT
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPSetKeyboardFocus
|
* XPSetKeyboardFocus
|
||||||
*
|
*
|
||||||
* XPSetKeyboardFocus controls which widget will receive keystrokes. Pass the
|
* Controls which widget will receive keystrokes. Pass the widget ID of the
|
||||||
* Widget ID of the widget to get the keys. Note that if the widget does not
|
* widget to get the keys. Note that if the widget does not care about
|
||||||
* care about keystrokes, they will go to the parent widget, and if no widget
|
* keystrokes, they will go to the parent widget, and if no widget cares about
|
||||||
* cares about them, they go to X-Plane.
|
* them, they go to X-Plane.
|
||||||
*
|
*
|
||||||
* If you set the keyboard focus to Widget ID 0, X-Plane gets keyboard focus.
|
* If you set the keyboard focus to widget ID 0, X-Plane gets keyboard focus.
|
||||||
*
|
*
|
||||||
* This routine returns the widget ID that ended up with keyboard focus, or 0
|
* This routine returns the widget ID that ended up with keyboard focus, or 0
|
||||||
* for x-plane.
|
* for X-Plane.
|
||||||
*
|
*
|
||||||
* Keyboard focus is not changed if the new widget will not accept it. For
|
* Keyboard focus is not changed if the new widget will not accept it. For
|
||||||
* setting to x-plane, keyboard focus is always accepted.
|
* setting to X-Plane, keyboard focus is always accepted.
|
||||||
*
|
*
|
||||||
* *
|
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetID XPSetKeyboardFocus(XPWidgetID inWidget);
|
WIDGET_API XPWidgetID XPSetKeyboardFocus(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLoseKeyboardFocus
|
* XPLoseKeyboardFocus
|
||||||
@@ -484,7 +483,8 @@ WIDGET_API XPWidgetID XPSetKeyboardFocus(XPWidgetID inWidget);
|
|||||||
* if this widget does not have focus.
|
* if this widget does not have focus.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPLoseKeyboardFocus(XPWidgetID inWidget);
|
WIDGET_API void XPLoseKeyboardFocus(
|
||||||
|
XPWidgetID inWidget);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPGetWidgetWithFocus
|
* XPGetWidgetWithFocus
|
||||||
@@ -499,11 +499,6 @@ WIDGET_API XPWidgetID XPGetWidgetWithFocus(void);
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* CREATING CUSTOM WIDGETS
|
* CREATING CUSTOM WIDGETS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPAddWidgetCallback
|
* XPAddWidgetCallback
|
||||||
@@ -517,12 +512,13 @@ WIDGET_API XPWidgetID XPGetWidgetWithFocus(void);
|
|||||||
* widget ID, and the destruction message will be sent before the other widget
|
* widget ID, and the destruction message will be sent before the other widget
|
||||||
* function receives a destruction message.
|
* function receives a destruction message.
|
||||||
*
|
*
|
||||||
* This provides a way to 'subclass' an existing widget. By providing a
|
* This provides a way to 'subclass' an existing widget. By providing a second
|
||||||
* second hook that only handles certain widget messages, you can customize or
|
* hook that only handles certain widget messages, you can customize or extend
|
||||||
* extend widget behavior.
|
* widget behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API void XPAddWidgetCallback(XPWidgetID inWidget,
|
WIDGET_API void XPAddWidgetCallback(
|
||||||
|
XPWidgetID inWidget,
|
||||||
XPWidgetFunc_t inNewCallback);
|
XPWidgetFunc_t inNewCallback);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -532,7 +528,8 @@ WIDGET_API void XPAddWidgetCallback(XPWidgetID inWidget,
|
|||||||
* widget class.
|
* widget class.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
WIDGET_API XPWidgetFunc_t XPGetWidgetClassFunc(XPWidgetClass inWidgetClass);
|
WIDGET_API XPWidgetFunc_t XPGetWidgetClassFunc(
|
||||||
|
XPWidgetClass inWidgetClass);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,38 @@
|
|||||||
#include "XPCBroadcaster.h"
|
#include "XPCBroadcaster.h"
|
||||||
#include "XPCListener.h"
|
#include "XPCListener.h"
|
||||||
|
|
||||||
XPCBroadcaster::XPCBroadcaster() : mIterator(NULL) {}
|
XPCBroadcaster::XPCBroadcaster() :
|
||||||
|
mIterator(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
XPCBroadcaster::~XPCBroadcaster()
|
XPCBroadcaster::~XPCBroadcaster()
|
||||||
{
|
{
|
||||||
ListenerVector::iterator iter;
|
ListenerVector::iterator iter;
|
||||||
mIterator = &iter;
|
mIterator = &iter;
|
||||||
for (iter = mListeners.begin(); iter != mListeners.end(); ++iter) {
|
for (iter = mListeners.begin(); iter != mListeners.end(); ++iter)
|
||||||
|
{
|
||||||
(*iter)->BroadcasterRemoved(this);
|
(*iter)->BroadcasterRemoved(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCBroadcaster::AddListener(XPCListener *inListener)
|
void XPCBroadcaster::AddListener(
|
||||||
|
XPCListener * inListener)
|
||||||
{
|
{
|
||||||
mListeners.push_back(inListener);
|
mListeners.push_back(inListener);
|
||||||
inListener->BroadcasterAdded(this);
|
inListener->BroadcasterAdded(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCBroadcaster::RemoveListener(XPCListener *inListener)
|
void XPCBroadcaster::RemoveListener(
|
||||||
|
XPCListener * inListener)
|
||||||
{
|
{
|
||||||
ListenerVector::iterator iter =
|
ListenerVector::iterator iter = std::find
|
||||||
std::find(mListeners.begin(), mListeners.end(), inListener);
|
(mListeners.begin(), mListeners.end(), inListener);
|
||||||
if (iter == mListeners.end())
|
if (iter == mListeners.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mIterator != NULL) {
|
if (mIterator != NULL)
|
||||||
|
{
|
||||||
if (*mIterator >= iter)
|
if (*mIterator >= iter)
|
||||||
(*mIterator)--;
|
(*mIterator)--;
|
||||||
}
|
}
|
||||||
@@ -34,12 +41,16 @@ void XPCBroadcaster::RemoveListener(XPCListener *inListener)
|
|||||||
inListener->BroadcasterRemoved(this);
|
inListener->BroadcasterRemoved(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCBroadcaster::BroadcastMessage(int inMessage, void *inParam)
|
void XPCBroadcaster::BroadcastMessage(
|
||||||
|
int inMessage,
|
||||||
|
void * inParam)
|
||||||
{
|
{
|
||||||
ListenerVector::iterator iter;
|
ListenerVector::iterator iter;
|
||||||
mIterator = &iter;
|
mIterator = &iter;
|
||||||
for (iter = mListeners.begin(); iter != mListeners.end(); ++iter) {
|
for (iter = mListeners.begin(); iter != mListeners.end(); ++iter)
|
||||||
|
{
|
||||||
(*iter)->ListenToMessage(inMessage, inParam);
|
(*iter)->ListenToMessage(inMessage, inParam);
|
||||||
}
|
}
|
||||||
mIterator = NULL;
|
mIterator = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,38 @@
|
|||||||
#ifndef _XPCBroadcaster_h_
|
#ifndef _XPCBroadcaster_h_
|
||||||
#define _XPCBroadcaster_h_
|
#define _XPCBroadcaster_h_
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
class XPCListener;
|
class XPCListener;
|
||||||
|
|
||||||
class XPCBroadcaster
|
class XPCBroadcaster {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XPCBroadcaster();
|
XPCBroadcaster();
|
||||||
virtual ~XPCBroadcaster();
|
virtual ~XPCBroadcaster();
|
||||||
|
|
||||||
void AddListener(XPCListener *inListener);
|
void AddListener(
|
||||||
void RemoveListener(XPCListener *inListener);
|
XPCListener * inListener);
|
||||||
|
void RemoveListener(
|
||||||
|
XPCListener * inListener);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void BroadcastMessage(int inMessage, void *inParam = 0);
|
|
||||||
|
void BroadcastMessage(
|
||||||
|
int inMessage,
|
||||||
|
void * inParam=0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::vector<XPCListener *> ListenerVector;
|
typedef std::vector<XPCListener *> ListenerVector;
|
||||||
|
|
||||||
ListenerVector mListeners;
|
ListenerVector mListeners;
|
||||||
|
|
||||||
// Reentrancy support
|
// Reentrancy support
|
||||||
|
|
||||||
ListenerVector::iterator *mIterator;
|
ListenerVector::iterator * mIterator;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,58 +1,54 @@
|
|||||||
#include "XPCDisplay.h"
|
#include "XPCDisplay.h"
|
||||||
|
|
||||||
XPCKeySniffer::XPCKeySniffer(int inBeforeWindows)
|
XPCKeySniffer::XPCKeySniffer(int inBeforeWindows) : mBeforeWindows(inBeforeWindows)
|
||||||
: mBeforeWindows(inBeforeWindows)
|
|
||||||
{
|
{
|
||||||
XPLMRegisterKeySniffer(KeySnifferCB,
|
XPLMRegisterKeySniffer(KeySnifferCB, mBeforeWindows, reinterpret_cast<void *>(this));
|
||||||
mBeforeWindows,
|
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCKeySniffer::~XPCKeySniffer()
|
XPCKeySniffer::~XPCKeySniffer()
|
||||||
{
|
{
|
||||||
XPLMUnregisterKeySniffer(KeySnifferCB,
|
XPLMUnregisterKeySniffer(KeySnifferCB, mBeforeWindows, reinterpret_cast<void *>(this));
|
||||||
mBeforeWindows,
|
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int XPCKeySniffer::KeySnifferCB(char inCharKey,
|
int XPCKeySniffer::KeySnifferCB(
|
||||||
|
char inCharKey,
|
||||||
XPLMKeyFlags inFlags,
|
XPLMKeyFlags inFlags,
|
||||||
char inVirtualKey,
|
char inVirtualKey,
|
||||||
void *inRefCon)
|
void * inRefCon)
|
||||||
{
|
{
|
||||||
XPCKeySniffer *me = reinterpret_cast<XPCKeySniffer *>(inRefCon);
|
XPCKeySniffer * me = reinterpret_cast<XPCKeySniffer *>(inRefCon);
|
||||||
return me->HandleKeyStroke(inCharKey, inFlags, inVirtualKey);
|
return me->HandleKeyStroke(inCharKey, inFlags, inVirtualKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCWindow::XPCWindow(int inLeft,
|
XPCWindow::XPCWindow(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom,
|
int inBottom,
|
||||||
int inIsVisible)
|
int inIsVisible)
|
||||||
{
|
{
|
||||||
mWindow = XPLMCreateWindow(inLeft,
|
mWindow = XPLMCreateWindow(inLeft, inTop, inRight, inBottom, inIsVisible,
|
||||||
inTop,
|
DrawCB, HandleKeyCB, MouseClickCB,
|
||||||
inRight,
|
|
||||||
inBottom,
|
|
||||||
inIsVisible,
|
|
||||||
DrawCB,
|
|
||||||
HandleKeyCB,
|
|
||||||
MouseClickCB,
|
|
||||||
reinterpret_cast<void *>(this));
|
reinterpret_cast<void *>(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCWindow::~XPCWindow() { XPLMDestroyWindow(mWindow); }
|
XPCWindow::~XPCWindow()
|
||||||
|
{
|
||||||
|
XPLMDestroyWindow(mWindow);
|
||||||
|
}
|
||||||
|
|
||||||
void XPCWindow::GetWindowGeometry(int *outLeft,
|
void XPCWindow::GetWindowGeometry(
|
||||||
int *outTop,
|
int * outLeft,
|
||||||
int *outRight,
|
int * outTop,
|
||||||
int *outBottom)
|
int * outRight,
|
||||||
|
int * outBottom)
|
||||||
{
|
{
|
||||||
XPLMGetWindowGeometry(mWindow, outLeft, outTop, outRight, outBottom);
|
XPLMGetWindowGeometry(mWindow, outLeft, outTop, outRight, outBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCWindow::SetWindowGeometry(int inLeft,
|
void XPCWindow::SetWindowGeometry(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom)
|
int inBottom)
|
||||||
@@ -65,43 +61,44 @@ int XPCWindow::GetWindowIsVisible(void)
|
|||||||
return XPLMGetWindowIsVisible(mWindow);
|
return XPLMGetWindowIsVisible(mWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCWindow::SetWindowIsVisible(int inIsVisible)
|
void XPCWindow::SetWindowIsVisible(
|
||||||
|
int inIsVisible)
|
||||||
{
|
{
|
||||||
XPLMSetWindowIsVisible(mWindow, inIsVisible);
|
XPLMSetWindowIsVisible(mWindow, inIsVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCWindow::TakeKeyboardFocus(void) { XPLMTakeKeyboardFocus(mWindow); }
|
void XPCWindow::TakeKeyboardFocus(void)
|
||||||
|
|
||||||
void XPCWindow::BringWindowToFront(void) { XPLMBringWindowToFront(mWindow); }
|
|
||||||
|
|
||||||
int XPCWindow::IsWindowInFront(void) { return XPLMIsWindowInFront(mWindow); }
|
|
||||||
|
|
||||||
void XPCWindow::DrawCB(XPLMWindowID inWindowID, void *inRefcon)
|
|
||||||
{
|
{
|
||||||
XPCWindow *me = reinterpret_cast<XPCWindow *>(inRefcon);
|
XPLMTakeKeyboardFocus(mWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPCWindow::BringWindowToFront(void)
|
||||||
|
{
|
||||||
|
XPLMBringWindowToFront(mWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
int XPCWindow::IsWindowInFront(void)
|
||||||
|
{
|
||||||
|
return XPLMIsWindowInFront(mWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XPCWindow::DrawCB(XPLMWindowID inWindowID, void * inRefcon)
|
||||||
|
{
|
||||||
|
XPCWindow * me = reinterpret_cast<XPCWindow *>(inRefcon);
|
||||||
me->DoDraw();
|
me->DoDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCWindow::HandleKeyCB(XPLMWindowID inWindowID,
|
void XPCWindow::HandleKeyCB(XPLMWindowID inWindowID, char inKey, XPLMKeyFlags inFlags, char inVirtualKey, void * inRefcon, int losingFocus)
|
||||||
char inKey,
|
|
||||||
XPLMKeyFlags inFlags,
|
|
||||||
char inVirtualKey,
|
|
||||||
void *inRefcon,
|
|
||||||
int losingFocus)
|
|
||||||
{
|
{
|
||||||
XPCWindow *me = reinterpret_cast<XPCWindow *>(inRefcon);
|
XPCWindow * me = reinterpret_cast<XPCWindow *>(inRefcon);
|
||||||
if (losingFocus)
|
if (losingFocus)
|
||||||
me->LoseFocus();
|
me->LoseFocus();
|
||||||
else
|
else
|
||||||
me->HandleKey(inKey, inFlags, inVirtualKey);
|
me->HandleKey(inKey, inFlags, inVirtualKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
int XPCWindow::MouseClickCB(XPLMWindowID inWindowID,
|
int XPCWindow::MouseClickCB(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse, void * inRefcon)
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
XPLMMouseStatus inMouse,
|
|
||||||
void *inRefcon)
|
|
||||||
{
|
{
|
||||||
XPCWindow *me = reinterpret_cast<XPCWindow *>(inRefcon);
|
XPCWindow * me = reinterpret_cast<XPCWindow *>(inRefcon);
|
||||||
return me->HandleClick(x, y, inMouse);
|
return me->HandleClick(x, y, inMouse);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,68 +3,71 @@
|
|||||||
|
|
||||||
#include "XPLMDisplay.h"
|
#include "XPLMDisplay.h"
|
||||||
|
|
||||||
class XPCKeySniffer
|
class XPCKeySniffer {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XPCKeySniffer(int inBeforeWindows);
|
XPCKeySniffer(int inBeforeWindows);
|
||||||
virtual ~XPCKeySniffer();
|
virtual ~XPCKeySniffer();
|
||||||
|
|
||||||
virtual int HandleKeyStroke(char inCharKey,
|
virtual int HandleKeyStroke(
|
||||||
|
char inCharKey,
|
||||||
XPLMKeyFlags inFlags,
|
XPLMKeyFlags inFlags,
|
||||||
char inVirtualKey) = 0;
|
char inVirtualKey)=0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int mBeforeWindows;
|
int mBeforeWindows;
|
||||||
|
|
||||||
static int KeySnifferCB(char inCharKey,
|
static int KeySnifferCB(
|
||||||
|
char inCharKey,
|
||||||
XPLMKeyFlags inFlags,
|
XPLMKeyFlags inFlags,
|
||||||
char inVirtualKey,
|
char inVirtualKey,
|
||||||
void *inRefCon);
|
void * inRefCon);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class XPCWindow
|
|
||||||
{
|
class XPCWindow {
|
||||||
public:
|
public:
|
||||||
XPCWindow(int inLeft,
|
|
||||||
|
XPCWindow(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom,
|
int inBottom,
|
||||||
int inIsVisible);
|
int inIsVisible);
|
||||||
virtual ~XPCWindow();
|
virtual ~XPCWindow();
|
||||||
|
|
||||||
virtual void DoDraw(void) = 0;
|
virtual void DoDraw(void)=0;
|
||||||
virtual void
|
virtual void HandleKey(char inKey, XPLMKeyFlags inFlags, char inVirtualKey)=0;
|
||||||
HandleKey(char inKey, XPLMKeyFlags inFlags, char inVirtualKey) = 0;
|
virtual void LoseFocus(void)=0;
|
||||||
virtual void LoseFocus(void) = 0;
|
virtual int HandleClick(int x, int y, XPLMMouseStatus inMouse)=0;
|
||||||
virtual int HandleClick(int x, int y, XPLMMouseStatus inMouse) = 0;
|
|
||||||
|
|
||||||
void GetWindowGeometry(int *outLeft,
|
void GetWindowGeometry(
|
||||||
int *outTop,
|
int * outLeft,
|
||||||
int *outRight,
|
int * outTop,
|
||||||
int *outBottom);
|
int * outRight,
|
||||||
void SetWindowGeometry(int inLeft, int inTop, int inRight, int inBottom);
|
int * outBottom);
|
||||||
|
void SetWindowGeometry(
|
||||||
|
int inLeft,
|
||||||
|
int inTop,
|
||||||
|
int inRight,
|
||||||
|
int inBottom);
|
||||||
int GetWindowIsVisible(void);
|
int GetWindowIsVisible(void);
|
||||||
void SetWindowIsVisible(int inIsVisible);
|
void SetWindowIsVisible(
|
||||||
|
int inIsVisible);
|
||||||
void TakeKeyboardFocus(void);
|
void TakeKeyboardFocus(void);
|
||||||
void BringWindowToFront(void);
|
void BringWindowToFront(void);
|
||||||
int IsWindowInFront(void);
|
int IsWindowInFront(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
XPLMWindowID mWindow;
|
XPLMWindowID mWindow;
|
||||||
|
|
||||||
static void DrawCB(XPLMWindowID inWindowID, void *inRefcon);
|
static void DrawCB(XPLMWindowID inWindowID, void * inRefcon);
|
||||||
static void HandleKeyCB(XPLMWindowID inWindowID,
|
static void HandleKeyCB(XPLMWindowID inWindowID, char inKey, XPLMKeyFlags inFlags, char inVirtualKey, void * inRefcon, int losingFocus);
|
||||||
char inKey,
|
static int MouseClickCB(XPLMWindowID inWindowID, int x, int y, XPLMMouseStatus inMouse, void * inRefcon);
|
||||||
XPLMKeyFlags inFlags,
|
|
||||||
char inVirtualKey,
|
|
||||||
void *inRefcon,
|
|
||||||
int losingFocus);
|
|
||||||
static int MouseClickCB(XPLMWindowID inWindowID,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
XPLMMouseStatus inMouse,
|
|
||||||
void *inRefcon);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
#include "XPCListener.h"
|
#include "XPCListener.h"
|
||||||
#include "XPCBroadcaster.h"
|
#include "XPCBroadcaster.h"
|
||||||
|
|
||||||
XPCListener::XPCListener() {}
|
XPCListener::XPCListener()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
XPCListener::~XPCListener()
|
XPCListener::~XPCListener()
|
||||||
{
|
{
|
||||||
@@ -9,15 +11,17 @@ XPCListener::~XPCListener()
|
|||||||
mBroadcasters.front()->RemoveListener(this);
|
mBroadcasters.front()->RemoveListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCListener::BroadcasterAdded(XPCBroadcaster *inBroadcaster)
|
void XPCListener::BroadcasterAdded(
|
||||||
|
XPCBroadcaster * inBroadcaster)
|
||||||
{
|
{
|
||||||
mBroadcasters.push_back(inBroadcaster);
|
mBroadcasters.push_back(inBroadcaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCListener::BroadcasterRemoved(XPCBroadcaster *inBroadcaster)
|
void XPCListener::BroadcasterRemoved(
|
||||||
|
XPCBroadcaster * inBroadcaster)
|
||||||
{
|
{
|
||||||
BroadcastVector::iterator iter =
|
BroadcastVector::iterator iter = std::find(mBroadcasters.begin(),
|
||||||
std::find(mBroadcasters.begin(), mBroadcasters.end(), inBroadcaster);
|
mBroadcasters.end(), inBroadcaster);
|
||||||
if (iter != mBroadcasters.end())
|
if (iter != mBroadcasters.end())
|
||||||
mBroadcasters.erase(iter);
|
mBroadcasters.erase(iter);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,36 @@
|
|||||||
#ifndef _XPCListener_h_
|
#ifndef _XPCListener_h_
|
||||||
#define _XPCListener_h_
|
#define _XPCListener_h_
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
class XPCBroadcaster;
|
class XPCBroadcaster;
|
||||||
|
|
||||||
|
|
||||||
class XPCListener
|
class XPCListener {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XPCListener();
|
XPCListener();
|
||||||
virtual ~XPCListener();
|
virtual ~XPCListener();
|
||||||
|
|
||||||
virtual void ListenToMessage(int inMessage, void *inParam) = 0;
|
virtual void ListenToMessage(
|
||||||
|
int inMessage,
|
||||||
|
void * inParam)=0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::vector<XPCBroadcaster *> BroadcastVector;
|
typedef std::vector<XPCBroadcaster *> BroadcastVector;
|
||||||
|
|
||||||
BroadcastVector mBroadcasters;
|
BroadcastVector mBroadcasters;
|
||||||
|
|
||||||
friend class XPCBroadcaster;
|
friend class XPCBroadcaster;
|
||||||
|
|
||||||
void BroadcasterAdded(XPCBroadcaster *inBroadcaster);
|
void BroadcasterAdded(
|
||||||
|
XPCBroadcaster * inBroadcaster);
|
||||||
|
|
||||||
|
void BroadcasterRemoved(
|
||||||
|
XPCBroadcaster * inBroadcaster);
|
||||||
|
|
||||||
void BroadcasterRemoved(XPCBroadcaster *inBroadcaster);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,60 +1,52 @@
|
|||||||
#include "XPCProcessing.h"
|
#include "XPCProcessing.h"
|
||||||
#include "XPLMUtilities.h"
|
#include "XPLMUtilities.h"
|
||||||
|
|
||||||
XPCProcess::XPCProcess() : mInCallback(false), mCallbackTime(0)
|
XPCProcess::XPCProcess() :
|
||||||
|
mInCallback(false),
|
||||||
|
mCallbackTime(0)
|
||||||
{
|
{
|
||||||
XPLMRegisterFlightLoopCallback(FlightLoopCB,
|
XPLMRegisterFlightLoopCallback(FlightLoopCB, 0, reinterpret_cast<void *>(this));
|
||||||
0,
|
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCProcess::~XPCProcess()
|
XPCProcess::~XPCProcess()
|
||||||
{
|
{
|
||||||
XPLMUnregisterFlightLoopCallback(FlightLoopCB,
|
XPLMUnregisterFlightLoopCallback(FlightLoopCB, reinterpret_cast<void *>(this));
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCProcess::StartProcessTime(float inSeconds)
|
void XPCProcess::StartProcessTime(float inSeconds)
|
||||||
{
|
{
|
||||||
mCallbackTime = inSeconds;
|
mCallbackTime = inSeconds;
|
||||||
if (!mInCallback)
|
if (!mInCallback)
|
||||||
XPLMSetFlightLoopCallbackInterval(FlightLoopCB,
|
XPLMSetFlightLoopCallbackInterval(
|
||||||
mCallbackTime,
|
FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast<void *>(this));
|
||||||
1 /*relative to now*/,
|
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCProcess::StartProcessCycles(int inCycles)
|
void XPCProcess::StartProcessCycles(int inCycles)
|
||||||
{
|
{
|
||||||
mCallbackTime = -inCycles;
|
mCallbackTime = -inCycles;
|
||||||
if (!mInCallback)
|
if (!mInCallback)
|
||||||
XPLMSetFlightLoopCallbackInterval(FlightLoopCB,
|
XPLMSetFlightLoopCallbackInterval(
|
||||||
mCallbackTime,
|
FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast<void *>(this));
|
||||||
1 /*relative to now*/,
|
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCProcess::StopProcess(void)
|
void XPCProcess::StopProcess(void)
|
||||||
{
|
{
|
||||||
mCallbackTime = 0;
|
mCallbackTime = 0;
|
||||||
if (!mInCallback)
|
if (!mInCallback)
|
||||||
XPLMSetFlightLoopCallbackInterval(FlightLoopCB,
|
XPLMSetFlightLoopCallbackInterval(
|
||||||
mCallbackTime,
|
FlightLoopCB, mCallbackTime, 1/*relative to now*/, reinterpret_cast<void *>(this));
|
||||||
1 /*relative to now*/,
|
|
||||||
reinterpret_cast<void *>(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float XPCProcess::FlightLoopCB(float inElapsedSinceLastCall,
|
float XPCProcess::FlightLoopCB(
|
||||||
|
float inElapsedSinceLastCall,
|
||||||
float inElapsedTimeSinceLastFlightLoop,
|
float inElapsedTimeSinceLastFlightLoop,
|
||||||
int inCounter,
|
int inCounter,
|
||||||
void *inRefcon)
|
void * inRefcon)
|
||||||
{
|
{
|
||||||
XPCProcess *me = reinterpret_cast<XPCProcess *>(inRefcon);
|
XPCProcess * me = reinterpret_cast<XPCProcess *>(inRefcon);
|
||||||
me->mInCallback = true;
|
me->mInCallback = true;
|
||||||
me->DoProcessing(inElapsedSinceLastCall,
|
me->DoProcessing(inElapsedSinceLastCall, inElapsedTimeSinceLastFlightLoop, inCounter);
|
||||||
inElapsedTimeSinceLastFlightLoop,
|
|
||||||
inCounter);
|
|
||||||
me->mInCallback = false;
|
me->mInCallback = false;
|
||||||
return me->mCallbackTime;
|
return me->mCallbackTime;
|
||||||
}
|
}
|
||||||
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "XPLMProcessing.h"
|
#include "XPLMProcessing.h"
|
||||||
|
|
||||||
class XPCProcess
|
class XPCProcess {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XPCProcess();
|
XPCProcess();
|
||||||
virtual ~XPCProcess();
|
virtual ~XPCProcess();
|
||||||
|
|
||||||
@@ -13,21 +13,25 @@ public:
|
|||||||
void StartProcessCycles(int inCycles);
|
void StartProcessCycles(int inCycles);
|
||||||
void StopProcess(void);
|
void StopProcess(void);
|
||||||
|
|
||||||
virtual void DoProcessing(float inElapsedSinceLastCall,
|
virtual void DoProcessing(
|
||||||
|
float inElapsedSinceLastCall,
|
||||||
float inElapsedTimeSinceLastFlightLoop,
|
float inElapsedTimeSinceLastFlightLoop,
|
||||||
int inCounter) = 0;
|
int inCounter)=0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static float FlightLoopCB(float inElapsedSinceLastCall,
|
|
||||||
|
static float FlightLoopCB(
|
||||||
|
float inElapsedSinceLastCall,
|
||||||
float inElapsedTimeSinceLastFlightLoop,
|
float inElapsedTimeSinceLastFlightLoop,
|
||||||
int inCounter,
|
int inCounter,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
bool mInCallback;
|
bool mInCallback;
|
||||||
float mCallbackTime;
|
float mCallbackTime;
|
||||||
|
|
||||||
XPCProcess(const XPCProcess &);
|
XPCProcess(const XPCProcess&);
|
||||||
XPCProcess &operator=(const XPCProcess &);
|
XPCProcess& operator=(const XPCProcess&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,38 +1,39 @@
|
|||||||
#include "XPCWidget.h"
|
#include "XPCWidget.h"
|
||||||
|
|
||||||
XPCWidget::XPCWidget(int inLeft,
|
XPCWidget::XPCWidget(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom,
|
int inBottom,
|
||||||
bool inVisible,
|
bool inVisible,
|
||||||
const char *inDescriptor,
|
const char * inDescriptor,
|
||||||
bool inIsRoot,
|
bool inIsRoot,
|
||||||
XPWidgetID inParent,
|
XPWidgetID inParent,
|
||||||
XPWidgetClass inClass)
|
XPWidgetClass inClass) :
|
||||||
: mWidget(NULL), mOwnsChildren(false), mOwnsWidget(true)
|
mWidget(NULL),
|
||||||
|
mOwnsChildren(false),
|
||||||
|
mOwnsWidget(true)
|
||||||
{
|
{
|
||||||
mWidget = XPCreateWidget(inLeft,
|
mWidget = XPCreateWidget(
|
||||||
inTop,
|
inLeft, inTop, inRight, inBottom,
|
||||||
inRight,
|
|
||||||
inBottom,
|
|
||||||
inVisible ? 1 : 0,
|
inVisible ? 1 : 0,
|
||||||
inDescriptor,
|
inDescriptor,
|
||||||
inIsRoot ? 1 : 0,
|
inIsRoot ? 1 : 0,
|
||||||
inIsRoot ? NULL : inParent,
|
inIsRoot ? NULL : inParent,
|
||||||
inClass);
|
inClass);
|
||||||
|
|
||||||
XPSetWidgetProperty(mWidget,
|
XPSetWidgetProperty(mWidget, xpProperty_Object, reinterpret_cast<intptr_t>(this));
|
||||||
xpProperty_Object,
|
|
||||||
reinterpret_cast<intptr_t>(this));
|
|
||||||
XPAddWidgetCallback(mWidget, WidgetCallback);
|
XPAddWidgetCallback(mWidget, WidgetCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCWidget::XPCWidget(XPWidgetID inWidget, bool inOwnsWidget)
|
XPCWidget::XPCWidget(
|
||||||
: mWidget(inWidget), mOwnsChildren(false), mOwnsWidget(inOwnsWidget)
|
XPWidgetID inWidget,
|
||||||
|
bool inOwnsWidget) :
|
||||||
|
mWidget(inWidget),
|
||||||
|
mOwnsChildren(false),
|
||||||
|
mOwnsWidget(inOwnsWidget)
|
||||||
{
|
{
|
||||||
XPSetWidgetProperty(mWidget,
|
XPSetWidgetProperty(mWidget, xpProperty_Object, reinterpret_cast<intptr_t>(this));
|
||||||
xpProperty_Object,
|
|
||||||
reinterpret_cast<intptr_t>(this));
|
|
||||||
XPAddWidgetCallback(mWidget, WidgetCallback);
|
XPAddWidgetCallback(mWidget, WidgetCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,42 +43,57 @@ XPCWidget::~XPCWidget()
|
|||||||
XPDestroyWidget(mWidget, mOwnsChildren ? 1 : 0);
|
XPDestroyWidget(mWidget, mOwnsChildren ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCWidget::SetOwnsWidget(bool inOwnsWidget) { mOwnsWidget = inOwnsWidget; }
|
void XPCWidget::SetOwnsWidget(
|
||||||
|
bool inOwnsWidget)
|
||||||
|
{
|
||||||
|
mOwnsWidget = inOwnsWidget;
|
||||||
|
}
|
||||||
|
|
||||||
void XPCWidget::SetOwnsChildren(bool inOwnsChildren)
|
void XPCWidget::SetOwnsChildren(
|
||||||
|
bool inOwnsChildren)
|
||||||
{
|
{
|
||||||
mOwnsChildren = inOwnsChildren;
|
mOwnsChildren = inOwnsChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCWidget::operator XPWidgetID() const { return mWidget; }
|
XPCWidget::operator XPWidgetID () const
|
||||||
|
{
|
||||||
|
return mWidget;
|
||||||
|
}
|
||||||
|
|
||||||
XPWidgetID XPCWidget::Get(void) const { return mWidget; }
|
XPWidgetID XPCWidget::Get(void) const
|
||||||
|
{
|
||||||
|
return mWidget;
|
||||||
|
}
|
||||||
|
|
||||||
void XPCWidget::AddAttachment(XPCWidgetAttachment *inAttachment,
|
void XPCWidget::AddAttachment(
|
||||||
|
XPCWidgetAttachment * inAttachment,
|
||||||
bool inOwnsAttachment,
|
bool inOwnsAttachment,
|
||||||
bool inPrefilter)
|
bool inPrefilter)
|
||||||
{
|
{
|
||||||
if (inPrefilter) {
|
if (inPrefilter)
|
||||||
mAttachments.insert(mAttachments.begin(),
|
{
|
||||||
AttachmentInfo(inAttachment, inOwnsAttachment));
|
mAttachments.insert(mAttachments.begin(), AttachmentInfo(inAttachment, inOwnsAttachment));
|
||||||
} else {
|
} else {
|
||||||
mAttachments.push_back(AttachmentInfo(inAttachment, inOwnsAttachment));
|
mAttachments.push_back(AttachmentInfo(inAttachment, inOwnsAttachment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XPCWidget::RemoveAttachment(XPCWidgetAttachment *inAttachment)
|
void XPCWidget::RemoveAttachment(
|
||||||
|
XPCWidgetAttachment * inAttachment)
|
||||||
{
|
{
|
||||||
for (AttachmentVector::iterator iter = mAttachments.begin();
|
for (AttachmentVector::iterator iter = mAttachments.begin();
|
||||||
iter != mAttachments.end();
|
iter != mAttachments.end(); ++iter)
|
||||||
++iter) {
|
{
|
||||||
if (iter->first == inAttachment) {
|
if (iter->first == inAttachment)
|
||||||
|
{
|
||||||
mAttachments.erase(iter);
|
mAttachments.erase(iter);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int XPCWidget::HandleWidgetMessage(XPWidgetMessage inMessage,
|
int XPCWidget::HandleWidgetMessage(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
@@ -85,24 +101,20 @@ int XPCWidget::HandleWidgetMessage(XPWidgetMessage inMessage,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int XPCWidget::WidgetCallback(XPWidgetMessage inMessage,
|
int XPCWidget::WidgetCallback(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
XPCWidget *me = reinterpret_cast<XPCWidget *>(
|
XPCWidget * me = reinterpret_cast<XPCWidget *>(XPGetWidgetProperty(inWidget, xpProperty_Object, NULL));
|
||||||
XPGetWidgetProperty(inWidget, xpProperty_Object, NULL));
|
|
||||||
if (me == NULL)
|
if (me == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (AttachmentVector::iterator iter = me->mAttachments.begin();
|
for (AttachmentVector::iterator iter = me->mAttachments.begin(); iter !=
|
||||||
iter != me->mAttachments.end();
|
me->mAttachments.end(); ++iter)
|
||||||
++iter) {
|
{
|
||||||
int result = iter->first->HandleWidgetMessage(me,
|
int result = iter->first->HandleWidgetMessage(me, inMessage, inWidget, inParam1, inParam2);
|
||||||
inMessage,
|
|
||||||
inWidget,
|
|
||||||
inParam1,
|
|
||||||
inParam2);
|
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,68 @@
|
|||||||
#ifndef _XPCWidget_h_
|
#ifndef _XPCWidget_h_
|
||||||
#define _XPCWidget_h_
|
#define _XPCWidget_h_
|
||||||
|
|
||||||
#include "XPWidgets.h"
|
|
||||||
#include <algorithm>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
#include "XPWidgets.h"
|
||||||
|
|
||||||
class XPCWidget;
|
class XPCWidget;
|
||||||
|
|
||||||
class XPCWidgetAttachment
|
class XPCWidgetAttachment {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
|
||||||
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2) = 0;
|
intptr_t inParam2)=0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class XPCWidget
|
class XPCWidget {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XPCWidget(int inLeft,
|
|
||||||
|
XPCWidget(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom,
|
int inBottom,
|
||||||
bool inVisible,
|
bool inVisible,
|
||||||
const char *inDescriptor,
|
const char * inDescriptor,
|
||||||
bool inIsRoot,
|
bool inIsRoot,
|
||||||
XPWidgetID inParent,
|
XPWidgetID inParent,
|
||||||
XPWidgetClass inClass);
|
XPWidgetClass inClass);
|
||||||
XPCWidget(XPWidgetID inWidget, bool inOwnsWidget);
|
XPCWidget(
|
||||||
|
XPWidgetID inWidget,
|
||||||
|
bool inOwnsWidget);
|
||||||
virtual ~XPCWidget();
|
virtual ~XPCWidget();
|
||||||
|
|
||||||
void SetOwnsWidget(bool inOwnsWidget);
|
void SetOwnsWidget(
|
||||||
void SetOwnsChildren(bool inOwnsChildren);
|
bool inOwnsWidget);
|
||||||
|
void SetOwnsChildren(
|
||||||
|
bool inOwnsChildren);
|
||||||
|
|
||||||
operator XPWidgetID() const;
|
operator XPWidgetID () const;
|
||||||
|
|
||||||
XPWidgetID Get(void) const;
|
XPWidgetID Get(void) const;
|
||||||
|
|
||||||
void AddAttachment(XPCWidgetAttachment *inAttachment,
|
void AddAttachment(
|
||||||
|
XPCWidgetAttachment * inAttachment,
|
||||||
bool inOwnsAttachment,
|
bool inOwnsAttachment,
|
||||||
bool inPrefilter);
|
bool inPrefilter);
|
||||||
void RemoveAttachment(XPCWidgetAttachment *inAttachment);
|
void RemoveAttachment(
|
||||||
|
XPCWidgetAttachment * inAttachment);
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPWidgetMessage inMessage,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int WidgetCallback(XPWidgetMessage inMessage,
|
|
||||||
|
static int WidgetCallback(
|
||||||
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
@@ -64,8 +76,9 @@ private:
|
|||||||
bool mOwnsWidget;
|
bool mOwnsWidget;
|
||||||
|
|
||||||
XPCWidget();
|
XPCWidget();
|
||||||
XPCWidget(const XPCWidget &);
|
XPCWidget(const XPCWidget&);
|
||||||
XPCWidget &operator=(const XPCWidget &);
|
XPCWidget& operator=(const XPCWidget&);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,25 +2,32 @@
|
|||||||
#include "XPStandardWidgets.h"
|
#include "XPStandardWidgets.h"
|
||||||
#include "XPWidgetUtils.h"
|
#include "XPWidgetUtils.h"
|
||||||
|
|
||||||
static void XPCGetOrderedSubWidgets(XPWidgetID inWidget,
|
static void XPCGetOrderedSubWidgets(
|
||||||
std::vector<XPWidgetID> &outChildren);
|
XPWidgetID inWidget,
|
||||||
|
std::vector<XPWidgetID>& outChildren);
|
||||||
|
|
||||||
XPCKeyFilterAttachment::XPCKeyFilterAttachment(const char *inValidKeys,
|
XPCKeyFilterAttachment::XPCKeyFilterAttachment(
|
||||||
const char *outValidKeys)
|
const char * inValidKeys,
|
||||||
: mInput(inValidKeys), mOutput(outValidKeys)
|
const char * outValidKeys) :
|
||||||
|
mInput(inValidKeys),
|
||||||
|
mOutput(outValidKeys)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCKeyFilterAttachment::~XPCKeyFilterAttachment() {}
|
XPCKeyFilterAttachment::~XPCKeyFilterAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int XPCKeyFilterAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
int XPCKeyFilterAttachment::HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
if (inMessage == xpMsg_KeyPress) {
|
if (inMessage == xpMsg_KeyPress)
|
||||||
char &theKey = KEY_CHAR(inParam1);
|
{
|
||||||
|
char& theKey = KEY_CHAR(inParam1);
|
||||||
std::string::size_type pos = mInput.find(theKey);
|
std::string::size_type pos = mInput.find(theKey);
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
return 1; // Not found; eat the key!
|
return 1; // Not found; eat the key!
|
||||||
@@ -33,28 +40,33 @@ int XPCKeyFilterAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
XPCKeyMessageAttachment::XPCKeyMessageAttachment(char inKey,
|
XPCKeyMessageAttachment::XPCKeyMessageAttachment(
|
||||||
|
char inKey,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
bool inConsume,
|
bool inConsume,
|
||||||
bool inVkey,
|
bool inVkey,
|
||||||
XPCListener *inListener)
|
XPCListener * inListener) :
|
||||||
: mKey(inKey), mMsg(inMessage), mParam(inParam), mConsume(inConsume),
|
mKey(inKey), mMsg(inMessage), mParam(inParam), mConsume(inConsume),
|
||||||
mVkey(inVkey)
|
mVkey(inVkey)
|
||||||
{
|
{
|
||||||
if (inListener != NULL)
|
if (inListener != NULL)
|
||||||
this->AddListener(inListener);
|
this->AddListener(inListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCKeyMessageAttachment::~XPCKeyMessageAttachment() {}
|
XPCKeyMessageAttachment::~XPCKeyMessageAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int XPCKeyMessageAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
int XPCKeyMessageAttachment::HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
if (inMessage == xpMsg_KeyPress) {
|
if (inMessage == xpMsg_KeyPress)
|
||||||
|
{
|
||||||
char theKey = mVkey ? KEY_VKEY(inParam1) : KEY_CHAR(inParam1);
|
char theKey = mVkey ? KEY_VKEY(inParam1) : KEY_CHAR(inParam1);
|
||||||
if (theKey != mKey)
|
if (theKey != mKey)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -70,57 +82,63 @@ int XPCKeyMessageAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
|||||||
XPCPushButtonMessageAttachment::XPCPushButtonMessageAttachment(
|
XPCPushButtonMessageAttachment::XPCPushButtonMessageAttachment(
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
XPCListener *inListener)
|
XPCListener * inListener) :
|
||||||
: mMsg(inMessage), mParam(inParam), mWidget(inWidget)
|
mMsg(inMessage), mParam(inParam), mWidget(inWidget)
|
||||||
{
|
{
|
||||||
if (inListener != NULL)
|
if (inListener != NULL)
|
||||||
this->AddListener(inListener);
|
this->AddListener(inListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCPushButtonMessageAttachment::~XPCPushButtonMessageAttachment() {}
|
XPCPushButtonMessageAttachment::~XPCPushButtonMessageAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int XPCPushButtonMessageAttachment::HandleWidgetMessage(
|
int XPCPushButtonMessageAttachment::HandleWidgetMessage(
|
||||||
XPCWidget *inObject,
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
if ((inMessage == xpMsg_PushButtonPressed) &&
|
if ((inMessage == xpMsg_PushButtonPressed) && ((XPWidgetID) inParam1 == mWidget))
|
||||||
((XPWidgetID)inParam1 == mWidget)) {
|
{
|
||||||
BroadcastMessage(mMsg, mParam);
|
BroadcastMessage(mMsg, mParam);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((inMessage == xpMsg_ButtonStateChanged) &&
|
if ((inMessage == xpMsg_ButtonStateChanged) && ((XPWidgetID) inParam1 == mWidget))
|
||||||
((XPWidgetID)inParam1 == mWidget)) {
|
{
|
||||||
BroadcastMessage(mMsg, mParam);
|
BroadcastMessage(mMsg, mParam);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCSliderMessageAttachment::XPCSliderMessageAttachment(XPWidgetID inWidget,
|
XPCSliderMessageAttachment::XPCSliderMessageAttachment(
|
||||||
|
XPWidgetID inWidget,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
XPCListener *inListener)
|
XPCListener * inListener) :
|
||||||
: mMsg(inMessage), mParam(inParam), mWidget(inWidget)
|
mMsg(inMessage), mParam(inParam), mWidget(inWidget)
|
||||||
{
|
{
|
||||||
if (inListener != NULL)
|
if (inListener != NULL)
|
||||||
this->AddListener(inListener);
|
this->AddListener(inListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCSliderMessageAttachment::~XPCSliderMessageAttachment() {}
|
XPCSliderMessageAttachment::~XPCSliderMessageAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int XPCSliderMessageAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
int XPCSliderMessageAttachment::HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
if ((inMessage == xpMsg_ScrollBarSliderPositionChanged) &&
|
if ((inMessage == xpMsg_ScrollBarSliderPositionChanged) && ((XPWidgetID) inParam1 == mWidget))
|
||||||
((XPWidgetID)inParam1 == mWidget)) {
|
{
|
||||||
BroadcastMessage(mMsg, mParam);
|
BroadcastMessage(mMsg, mParam);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -132,25 +150,27 @@ int XPCSliderMessageAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
|||||||
XPCCloseButtonMessageAttachment::XPCCloseButtonMessageAttachment(
|
XPCCloseButtonMessageAttachment::XPCCloseButtonMessageAttachment(
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
XPCListener *inListener)
|
XPCListener * inListener) :
|
||||||
: mMsg(inMessage), mParam(inParam), mWidget(inWidget)
|
mMsg(inMessage), mParam(inParam), mWidget(inWidget)
|
||||||
{
|
{
|
||||||
if (inListener != NULL)
|
if (inListener != NULL)
|
||||||
this->AddListener(inListener);
|
this->AddListener(inListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCCloseButtonMessageAttachment::~XPCCloseButtonMessageAttachment() {}
|
XPCCloseButtonMessageAttachment::~XPCCloseButtonMessageAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int XPCCloseButtonMessageAttachment::HandleWidgetMessage(
|
int XPCCloseButtonMessageAttachment::HandleWidgetMessage(
|
||||||
XPCWidget *inObject,
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
if ((inMessage == xpMessage_CloseButtonPushed) &&
|
if ((inMessage == xpMessage_CloseButtonPushed) && ((XPWidgetID) inParam1 == mWidget))
|
||||||
((XPWidgetID)inParam1 == mWidget)) {
|
{
|
||||||
BroadcastMessage(mMsg, mParam);
|
BroadcastMessage(mMsg, mParam);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -158,26 +178,32 @@ int XPCCloseButtonMessageAttachment::HandleWidgetMessage(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
XPCTabGroupAttachment::XPCTabGroupAttachment() {}
|
XPCTabGroupAttachment::XPCTabGroupAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
XPCTabGroupAttachment::~XPCTabGroupAttachment() {}
|
XPCTabGroupAttachment::~XPCTabGroupAttachment()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
int XPCTabGroupAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
int XPCTabGroupAttachment::HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2)
|
intptr_t inParam2)
|
||||||
{
|
{
|
||||||
if ((inMessage == xpMsg_KeyPress) && (KEY_CHAR(inParam1) == XPLM_KEY_TAB) &&
|
if ((inMessage == xpMsg_KeyPress) && (KEY_CHAR(inParam1) == XPLM_KEY_TAB) &&
|
||||||
((KEY_FLAGS(inParam1) & xplm_UpFlag) == 0)) {
|
((KEY_FLAGS(inParam1) & xplm_UpFlag) == 0))
|
||||||
|
{
|
||||||
bool backwards = (KEY_FLAGS(inParam1) & xplm_ShiftFlag) != 0;
|
bool backwards = (KEY_FLAGS(inParam1) & xplm_ShiftFlag) != 0;
|
||||||
std::vector<XPWidgetID> widgets;
|
std::vector<XPWidgetID> widgets;
|
||||||
XPCGetOrderedSubWidgets(inWidget, widgets);
|
XPCGetOrderedSubWidgets(inWidget, widgets);
|
||||||
int n, index = 0;
|
int n, index = 0;
|
||||||
XPWidgetID focusWidget = XPGetWidgetWithFocus();
|
XPWidgetID focusWidget = XPGetWidgetWithFocus();
|
||||||
std::vector<XPWidgetID>::iterator iter =
|
std::vector<XPWidgetID>::iterator iter = std::find(widgets.begin(), widgets.end(), focusWidget);
|
||||||
std::find(widgets.begin(), widgets.end(), focusWidget);
|
if (iter != widgets.end())
|
||||||
if (iter != widgets.end()) {
|
{
|
||||||
index = std::distance(widgets.begin(), iter);
|
index = std::distance(widgets.begin(), iter);
|
||||||
if (backwards)
|
if (backwards)
|
||||||
index--;
|
index--;
|
||||||
@@ -189,24 +215,29 @@ int XPCTabGroupAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
|||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (backwards) {
|
if (backwards)
|
||||||
for (n = index; n >= 0; --n) {
|
{
|
||||||
|
for (n = index; n >= 0; --n)
|
||||||
|
{
|
||||||
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
||||||
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (n = widgets.size() - 1; n > index; --n) {
|
for (n = widgets.size() - 1; n > index; --n)
|
||||||
|
{
|
||||||
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
||||||
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (n = index; n < widgets.size(); ++n) {
|
for (n = index; n < widgets.size(); ++n)
|
||||||
|
{
|
||||||
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
||||||
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (n = 0; n < index; ++n) {
|
for (n = 0; n < index; ++n)
|
||||||
|
{
|
||||||
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
if (XPGetWidgetProperty(widgets[n], xpProperty_Enabled, NULL))
|
||||||
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
if (XPSetKeyboardFocus(widgets[n]) != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -217,19 +248,20 @@ int XPCTabGroupAttachment::HandleWidgetMessage(XPCWidget *inObject,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void XPCGetOrderedSubWidgets(XPWidgetID inWidget,
|
|
||||||
std::vector<XPWidgetID> &outChildren)
|
static void XPCGetOrderedSubWidgets(
|
||||||
|
XPWidgetID inWidget,
|
||||||
|
std::vector<XPWidgetID>& outChildren)
|
||||||
{
|
{
|
||||||
outChildren.clear();
|
outChildren.clear();
|
||||||
int count = XPCountChildWidgets(inWidget);
|
int count = XPCountChildWidgets(inWidget);
|
||||||
for (int n = 0; n < count; ++n) {
|
for (int n = 0; n < count; ++n)
|
||||||
|
{
|
||||||
XPWidgetID child = XPGetNthChildWidget(inWidget, n);
|
XPWidgetID child = XPGetNthChildWidget(inWidget, n);
|
||||||
outChildren.push_back(child);
|
outChildren.push_back(child);
|
||||||
std::vector<XPWidgetID> grandChildren;
|
std::vector<XPWidgetID> grandChildren;
|
||||||
XPCGetOrderedSubWidgets(child, grandChildren);
|
XPCGetOrderedSubWidgets(child, grandChildren);
|
||||||
|
|
||||||
outChildren.insert(outChildren.end(),
|
outChildren.insert(outChildren.end(), grandChildren.begin(), grandChildren.end());
|
||||||
grandChildren.begin(),
|
|
||||||
grandChildren.end());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,64 +3,73 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "XPCBroadcaster.h"
|
|
||||||
#include "XPCWidget.h"
|
#include "XPCWidget.h"
|
||||||
|
#include "XPCBroadcaster.h"
|
||||||
|
|
||||||
class XPCKeyFilterAttachment : public XPCWidgetAttachment
|
class XPCKeyFilterAttachment : public XPCWidgetAttachment {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XPCKeyFilterAttachment(const char *inValidKeys, const char *outValidKeys);
|
|
||||||
|
XPCKeyFilterAttachment(
|
||||||
|
const char * inValidKeys,
|
||||||
|
const char * outValidKeys);
|
||||||
virtual ~XPCKeyFilterAttachment();
|
virtual ~XPCKeyFilterAttachment();
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string mInput;
|
std::string mInput;
|
||||||
std::string mOutput;
|
std::string mOutput;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class XPCKeyMessageAttachment : public XPCWidgetAttachment,
|
class XPCKeyMessageAttachment : public XPCWidgetAttachment, public XPCBroadcaster {
|
||||||
public XPCBroadcaster
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XPCKeyMessageAttachment(char inKey,
|
|
||||||
|
XPCKeyMessageAttachment(
|
||||||
|
char inKey,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
bool inConsume,
|
bool inConsume,
|
||||||
bool inVkey,
|
bool inVkey,
|
||||||
XPCListener *inListener);
|
XPCListener * inListener);
|
||||||
virtual ~XPCKeyMessageAttachment();
|
virtual ~XPCKeyMessageAttachment();
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
char mKey;
|
char mKey;
|
||||||
bool mVkey;
|
bool mVkey;
|
||||||
int mMsg;
|
int mMsg;
|
||||||
void *mParam;
|
void * mParam;
|
||||||
bool mConsume;
|
bool mConsume;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class XPCPushButtonMessageAttachment : public XPCWidgetAttachment,
|
class XPCPushButtonMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster {
|
||||||
XPCBroadcaster
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XPCPushButtonMessageAttachment(XPWidgetID inWidget,
|
|
||||||
|
XPCPushButtonMessageAttachment(
|
||||||
|
XPWidgetID inWidget,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
XPCListener *inListener);
|
XPCListener * inListener);
|
||||||
virtual ~XPCPushButtonMessageAttachment();
|
virtual ~XPCPushButtonMessageAttachment();
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
@@ -69,19 +78,21 @@ public:
|
|||||||
private:
|
private:
|
||||||
XPWidgetID mWidget;
|
XPWidgetID mWidget;
|
||||||
int mMsg;
|
int mMsg;
|
||||||
void *mParam;
|
void * mParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
class XPCSliderMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster
|
class XPCSliderMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XPCSliderMessageAttachment(XPWidgetID inWidget,
|
|
||||||
|
XPCSliderMessageAttachment(
|
||||||
|
XPWidgetID inWidget,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
XPCListener *inListener);
|
XPCListener * inListener);
|
||||||
virtual ~XPCSliderMessageAttachment();
|
virtual ~XPCSliderMessageAttachment();
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
@@ -90,21 +101,22 @@ public:
|
|||||||
private:
|
private:
|
||||||
XPWidgetID mWidget;
|
XPWidgetID mWidget;
|
||||||
int mMsg;
|
int mMsg;
|
||||||
void *mParam;
|
void * mParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class XPCCloseButtonMessageAttachment : public XPCWidgetAttachment,
|
class XPCCloseButtonMessageAttachment : public XPCWidgetAttachment, XPCBroadcaster {
|
||||||
XPCBroadcaster
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
XPCCloseButtonMessageAttachment(XPWidgetID inWidget,
|
|
||||||
|
XPCCloseButtonMessageAttachment(
|
||||||
|
XPWidgetID inWidget,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam,
|
void * inParam,
|
||||||
XPCListener *inListener);
|
XPCListener * inListener);
|
||||||
virtual ~XPCCloseButtonMessageAttachment();
|
virtual ~XPCCloseButtonMessageAttachment();
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
@@ -113,20 +125,22 @@ public:
|
|||||||
private:
|
private:
|
||||||
XPWidgetID mWidget;
|
XPWidgetID mWidget;
|
||||||
int mMsg;
|
int mMsg;
|
||||||
void *mParam;
|
void * mParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
class XPCTabGroupAttachment : public XPCWidgetAttachment
|
class XPCTabGroupAttachment : public XPCWidgetAttachment {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
XPCTabGroupAttachment();
|
XPCTabGroupAttachment();
|
||||||
virtual ~XPCTabGroupAttachment();
|
virtual ~XPCTabGroupAttachment();
|
||||||
|
|
||||||
virtual int HandleWidgetMessage(XPCWidget *inObject,
|
virtual int HandleWidgetMessage(
|
||||||
|
XPCWidget * inObject,
|
||||||
XPWidgetMessage inMessage,
|
XPWidgetMessage inMessage,
|
||||||
XPWidgetID inWidget,
|
XPWidgetID inWidget,
|
||||||
intptr_t inParam1,
|
intptr_t inParam1,
|
||||||
intptr_t inParam2);
|
intptr_t inParam2);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,22 +2,20 @@
|
|||||||
#define _XPLMCamera_h_
|
#define _XPLMCamera_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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
|
* The XPLMCamera APIs allow plug-ins to control the camera angle in X-Plane.
|
||||||
* control the camera angle in X-Plane. This has a number of applications,
|
* This has a number of applications, including but not limited to:
|
||||||
* including but not limited to:
|
|
||||||
*
|
*
|
||||||
* - Creating new views (including dynamic/user-controllable views) for the
|
* - Creating new views (including dynamic/user-controllable views) for the
|
||||||
* user.
|
* user.
|
||||||
*
|
|
||||||
* - Creating applications that use X-Plane as a renderer of scenery,
|
* - Creating applications that use X-Plane as a renderer of scenery,
|
||||||
* aircrafts, or both.
|
* aircrafts, or both.
|
||||||
*
|
*
|
||||||
@@ -26,10 +24,10 @@
|
|||||||
* OpenGL coordinate info is described in detail in the XPLMGraphics
|
* OpenGL coordinate info is described in detail in the XPLMGraphics
|
||||||
* documentation; generally you should use the XPLMGraphics routines to
|
* documentation; generally you should use the XPLMGraphics routines to
|
||||||
* convert from world to local coordinates. The camera's orientation starts
|
* convert from world to local coordinates. The camera's orientation starts
|
||||||
* facing level with the ground directly up the negative-Z axis
|
* facing level with the ground directly up the negative-Z axis (approximately
|
||||||
* (approximately north) with the horizon horizontal. It is then rotated
|
* north) with the horizon horizontal. It is then rotated clockwise for yaw,
|
||||||
* clockwise for yaw, pitched up for positive pitch, and rolled clockwise
|
* pitched up for positive pitch, and rolled clockwise around the vector it is
|
||||||
* around the vector it is looking along for roll.
|
* looking along for roll.
|
||||||
*
|
*
|
||||||
* You control the camera either either until the user selects a new view or
|
* 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
|
||||||
@@ -39,6 +37,12 @@
|
|||||||
* Use the XPLMDataAccess APIs to get information like the position of the
|
* Use the XPLMDataAccess APIs to get information like the position of the
|
||||||
* aircraft, etc. for complex camera positioning.
|
* 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.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "XPLMDefs.h"
|
#include "XPLMDefs.h"
|
||||||
@@ -50,11 +54,6 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* CAMERA CONTROL
|
* CAMERA CONTROL
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMCameraControlDuration
|
* XPLMCameraControlDuration
|
||||||
@@ -65,12 +64,11 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Control the camera until the user picks a new view. */
|
/* Control the camera until the user picks a new view. */
|
||||||
xplm_ControlCameraUntilViewChanges = 1
|
xplm_ControlCameraUntilViewChanges = 1,
|
||||||
|
|
||||||
/* Control the camera until your plugin is disabled or another plugin
|
/* Control the camera until your plugin is disabled or another plugin forcably*
|
||||||
* forcably * takes control. */
|
* takes control. */
|
||||||
,
|
xplm_ControlCameraForever = 2,
|
||||||
xplm_ControlCameraForever = 2
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -79,8 +77,8 @@ typedef int XPLMCameraControlDuration;
|
|||||||
/*
|
/*
|
||||||
* XPLMCameraPosition_t
|
* XPLMCameraPosition_t
|
||||||
*
|
*
|
||||||
* This structure contains a full specification of the camera. X, Y, and Z
|
* This structure contains a full specification of the camera. X, Y, and Z are
|
||||||
* are the camera's position in OpenGL coordiantes; pitch, roll, and yaw 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
|
* 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,
|
* 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
|
* all in degrees. Zoom is a zoom factor, with 1.0 meaning normal zoom and 2.0
|
||||||
@@ -111,22 +109,23 @@ typedef struct {
|
|||||||
* called with inIsLosingControl set to 1 and ioCameraPosition NULL.
|
* called with inIsLosingControl set to 1 and ioCameraPosition NULL.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef int (*XPLMCameraControl_f)(
|
typedef int (* XPLMCameraControl_f)(
|
||||||
XPLMCameraPosition_t *outCameraPosition, /* Can be NULL */
|
XPLMCameraPosition_t * outCameraPosition, /* Can be NULL */
|
||||||
int inIsLosingControl,
|
int inIsLosingControl,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMControlCamera
|
* XPLMControlCamera
|
||||||
*
|
*
|
||||||
* This function repositions the camera on the next drawing cycle. You must
|
* 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
|
* pass a non-null control function. Specify in inHowLong how long you'd like
|
||||||
* control (indefinitely or until a key is pressed).
|
* control (indefinitely or until a new view mode is set by the user).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMControlCamera(XPLMCameraControlDuration inHowLong,
|
XPLM_API void XPLMControlCamera(
|
||||||
|
XPLMCameraControlDuration inHowLong,
|
||||||
XPLMCameraControl_f inControlFunc,
|
XPLMCameraControl_f inControlFunc,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMDontControlCamera
|
* XPLMDontControlCamera
|
||||||
@@ -150,7 +149,7 @@ XPLM_API void XPLMDontControlCamera(void);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMIsCameraBeingControlled(
|
XPLM_API int XPLMIsCameraBeingControlled(
|
||||||
XPLMCameraControlDuration *outCameraControlDuration); /* Can be NULL */
|
XPLMCameraControlDuration * outCameraControlDuration); /* Can be NULL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMReadCameraPosition
|
* XPLMReadCameraPosition
|
||||||
@@ -158,7 +157,8 @@ XPLM_API int XPLMIsCameraBeingControlled(
|
|||||||
* 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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,15 @@
|
|||||||
#define _XPLMDataAccess_h_
|
#define _XPLMDataAccess_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* All rights reserved. See license.txt for usage.
|
|
||||||
*
|
|
||||||
* X-Plane SDK Version: 2.1.1
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* XPLMDataAccess
|
||||||
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* XPLM Data Access API - Theory of Operation
|
|
||||||
*
|
|
||||||
* The data access API gives you a generic, flexible, high performance way to
|
* The data access API gives you a generic, flexible, high performance way to
|
||||||
* read and write data to and from X-Plane and other plug-ins. For example,
|
* read and write data to and from X-Plane and other plug-ins. For example,
|
||||||
* this API allows you to read and set the nav radios, get the plane location,
|
* this API allows you to read and set the nav radios, get the plane location,
|
||||||
@@ -21,31 +19,52 @@
|
|||||||
* The data access APIs are the way that you read and write data from the sim
|
* The data access APIs are the way that you read and write data from the sim
|
||||||
* as well as other plugins.
|
* as well as other plugins.
|
||||||
*
|
*
|
||||||
* The API works using opaque data references. A data reference is a source
|
* The API works using opaque data references. A data reference is a source of
|
||||||
* of data; you do not know where it comes from, but once you have it you can
|
* data; you do not know where it comes from, but once you have it you can
|
||||||
* read the data quickly and possibly write it. To get a data reference, you
|
* read the data quickly and possibly write it.
|
||||||
* look it up.
|
|
||||||
*
|
*
|
||||||
* Data references are identified by verbose string names
|
* Dataref Lookup
|
||||||
* (sim/cockpit/radios/nav1_freq_hz). The actual numeric value of the data
|
* --------------
|
||||||
* reference is implementation defined and is likely to change each time the
|
*
|
||||||
* simulator is run (or the plugin that provides the datareference is
|
* Data references are identified by verbose, permanent string names; by
|
||||||
* reloaded).
|
* convention these names use path separates to form a hierarchy of datarefs,
|
||||||
|
* e.g. (sim/cockpit/radios/nav1_freq_hz). The actual opaque numeric value of
|
||||||
|
* the data reference, as returned by the XPLM API, is implementation defined
|
||||||
|
* and changes each time X-Plane is launched; therefore you need to look up
|
||||||
|
* the dataref by path every time your plugin runs.
|
||||||
*
|
*
|
||||||
* The task of looking up a data reference is relatively expensive; look up
|
* The task of looking up a data reference is relatively expensive; look up
|
||||||
* your data references once based on verbose strings, and save the opaque
|
* your data references once based on the verbose path strings, and save the
|
||||||
* data reference value for the duration of your plugin's operation. Reading
|
* opaque data reference value for the duration of your plugin's operation.
|
||||||
* and writing data references is relatively fast (the cost is equivalent to
|
* Reading and writing data references is relatively fast (the cost is
|
||||||
* two function calls through function pointers).
|
* equivalent to two function calls through function pointers).
|
||||||
*
|
*
|
||||||
* This allows data access to be high performance, while leaving in
|
* X-Plane publishes over 4000 datarefs; a complete list may be found in the
|
||||||
* abstraction; since data references are opaque and are searched for, the
|
* reference section of the SDK online documentation (from the SDK home page,
|
||||||
* underlying data access system can be rebuilt.
|
* choose Documentation).
|
||||||
|
*
|
||||||
|
* Dataref Types
|
||||||
|
* -------------
|
||||||
*
|
*
|
||||||
* A note on typing: you must know the correct data type to read and write.
|
* A note on typing: you must know the correct data type to read and write.
|
||||||
* APIs are provided for reading and writing data in a number of ways. You
|
* APIs are provided for reading and writing data in a number of ways. You can
|
||||||
* can also double check the data type for a data ref. Note that automatic
|
* also double check the data type for a data ref. Automatic type conversion
|
||||||
* conversion is not done for you.
|
* is not done for you.
|
||||||
|
*
|
||||||
|
* Dataref types are a set, e.g. a dataref can be more than one type. When
|
||||||
|
* this happens, you can choose which API you want to use to read. For
|
||||||
|
* example, it is not uncommon for a dataref to be of type float and double.
|
||||||
|
* This means you can use either XPLMGetDatad or XPLMGetDataf to read it.
|
||||||
|
*
|
||||||
|
* Creating New Datarefs
|
||||||
|
* ---------------------
|
||||||
|
*
|
||||||
|
* X-Plane provides datarefs that come with the sim, but plugins can also
|
||||||
|
* create their own datarefs. A plugin creates a dataref by registering
|
||||||
|
* function callbacks to read and write the dataref. The XPLM will call your
|
||||||
|
* plugin each time some other plugin (or X-Plane) tries to read or write the
|
||||||
|
* dataref. You must provide a read (and optional write) callback for each
|
||||||
|
* data type you support.
|
||||||
*
|
*
|
||||||
* A note for plugins sharing data with other plugins: the load order of
|
* A note for plugins sharing data with other plugins: the load order of
|
||||||
* plugins is not guaranteed. To make sure that every plugin publishing data
|
* plugins is not guaranteed. To make sure that every plugin publishing data
|
||||||
@@ -54,9 +73,11 @@
|
|||||||
* first time your 'enable' routine is called, or the first time they are
|
* first time your 'enable' routine is called, or the first time they are
|
||||||
* needed in code.
|
* needed in code.
|
||||||
*
|
*
|
||||||
* X-Plane publishes well over 1000 datarefs; a complete list may be found in
|
* When a plugin that created a dataref is unloaded, it becomes "orphaned".
|
||||||
* the reference section of the SDK online documentation (from the SDK home
|
* The dataref handle continues to be usable, but the dataref is not writable,
|
||||||
* page, choose Documentation).
|
* and reading it will always return 0 (or 0 items for arrays). If the plugin
|
||||||
|
* is reloaded and re-registers the dataref, the handle becomes un-orphaned
|
||||||
|
* and works again.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -70,8 +91,8 @@ extern "C" {
|
|||||||
* READING AND WRITING DATA
|
* READING AND WRITING DATA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* These routines allow you to access a wide variety of data from within
|
* These routines allow you to access data from within X-Plane and sometimes
|
||||||
* x-plane and modify some of it.
|
* modify it.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -85,7 +106,7 @@ extern "C" {
|
|||||||
* get them from XPLMFindDataRef.
|
* get them from XPLMFindDataRef.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void *XPLMDataRef;
|
typedef void * XPLMDataRef;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMDataTypeID
|
* XPLMDataTypeID
|
||||||
@@ -95,36 +116,32 @@ typedef void *XPLMDataRef;
|
|||||||
* you expect. But for the most part, you will know the type of data you are
|
* you expect. But for the most part, you will know the type of data you are
|
||||||
* expecting from the online documentation.
|
* expecting from the online documentation.
|
||||||
*
|
*
|
||||||
* Data types each take a bit field, so sets of data types may be formed.
|
* Data types each take a bit field; it is legal to have a single dataref be
|
||||||
|
* more than one type of data. Whe this happens, you can pick any matching
|
||||||
|
* get/set API.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Data of a type the current XPLM doesn't do. */
|
/* Data of a type the current XPLM doesn't do. */
|
||||||
xplmType_Unknown = 0
|
xplmType_Unknown = 0,
|
||||||
|
|
||||||
/* A single 4-byte integer, native endian. */
|
/* A single 4-byte integer, native endian. */
|
||||||
,
|
xplmType_Int = 1,
|
||||||
xplmType_Int = 1
|
|
||||||
|
|
||||||
/* A single 4-byte float, native endian. */
|
/* A single 4-byte float, native endian. */
|
||||||
,
|
xplmType_Float = 2,
|
||||||
xplmType_Float = 2
|
|
||||||
|
|
||||||
/* A single 8-byte double, native endian. */
|
/* A single 8-byte double, native endian. */
|
||||||
,
|
xplmType_Double = 4,
|
||||||
xplmType_Double = 4
|
|
||||||
|
|
||||||
/* An array of 4-byte floats, native endian. */
|
/* An array of 4-byte floats, native endian. */
|
||||||
,
|
xplmType_FloatArray = 8,
|
||||||
xplmType_FloatArray = 8
|
|
||||||
|
|
||||||
/* An array of 4-byte integers, native endian. */
|
/* An array of 4-byte integers, native endian. */
|
||||||
,
|
xplmType_IntArray = 16,
|
||||||
xplmType_IntArray = 16
|
|
||||||
|
|
||||||
/* A variable block of data. */
|
/* A variable block of data. */
|
||||||
,
|
xplmType_Data = 32,
|
||||||
xplmType_Data = 32
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -135,7 +152,7 @@ typedef int XPLMDataTypeID;
|
|||||||
*
|
*
|
||||||
* Given a c-style string that names the data ref, this routine looks up the
|
* Given a c-style string that names the data ref, this routine looks up the
|
||||||
* actual opaque XPLMDataRef that you use to read and write the data. The
|
* actual opaque XPLMDataRef that you use to read and write the data. The
|
||||||
* string names for datarefs are published on the x-plane SDK web site.
|
* string names for datarefs are published on the X-Plane SDK web site.
|
||||||
*
|
*
|
||||||
* This function returns NULL if the data ref cannot be found.
|
* This function returns NULL if the data ref cannot be found.
|
||||||
*
|
*
|
||||||
@@ -144,42 +161,52 @@ typedef int XPLMDataTypeID;
|
|||||||
* every time you need to read or write it.
|
* every time you need to read or write it.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMDataRef XPLMFindDataRef(const char *inDataRefName);
|
XPLM_API XPLMDataRef XPLMFindDataRef(
|
||||||
|
const char * inDataRefName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMCanWriteDataRef
|
* XPLMCanWriteDataRef
|
||||||
*
|
*
|
||||||
* Given a data ref, this routine returns true if you can successfully set
|
* Given a data ref, this routine returns true if you can successfully set the
|
||||||
* the data, false otherwise. Some datarefs are read-only.
|
* data, false otherwise. Some datarefs are read-only.
|
||||||
|
*
|
||||||
|
* NOTE: even if a dataref is marked writable, it may not act writable. This
|
||||||
|
* can happen for datarefs that X-Plane writes to on every frame of
|
||||||
|
* simulation. In some cases, the dataref is writable but you have to set a
|
||||||
|
* separate "override" dataref to 1 to stop X-Plane from writing it.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMCanWriteDataRef(XPLMDataRef inDataRef);
|
XPLM_API int XPLMCanWriteDataRef(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMIsDataRefGood
|
* XPLMIsDataRefGood
|
||||||
*
|
*
|
||||||
* WARNING: This function is deprecated and should not be used. Datarefs are
|
* This function returns true if the passed in handle is a valid dataref that
|
||||||
* valid until plugins are reloaded or the sim quits. Plugins sharing
|
* is not orphaned.
|
||||||
* datarefs should support these semantics by not unregistering datarefs
|
|
||||||
* during operation. (You should however unregister datarefs when your plugin
|
|
||||||
* is unloaded, as part of general resource cleanup.)
|
|
||||||
*
|
*
|
||||||
* This function returns whether a data ref is still valid. If it returns
|
* Note: there is normally no need to call this function; datarefs returned by
|
||||||
* false, you should refind the data ref from its original string. Calling an
|
* XPLMFindDataRef remain valid (but possibly orphaned) unless there is a
|
||||||
* accessor function on a bad data ref will return a default value, typically
|
* complete plugin reload (in which case your plugin is reloaded anyway).
|
||||||
* 0 or 0-length data.
|
* Orphaned datarefs can be safely read and return 0. Therefore you never need
|
||||||
|
* to call XPLMIsDataRefGood to 'check' the safety of a dataref.
|
||||||
|
* (XPLMIsDatarefGood performs some slow checking of the handle validity, so
|
||||||
|
* it has a perormance cost.)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMIsDataRefGood(XPLMDataRef inDataRef);
|
XPLM_API int XPLMIsDataRefGood(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDataRefTypes
|
* XPLMGetDataRefTypes
|
||||||
*
|
*
|
||||||
* This routine returns the types of the data ref for accessor use. If a data
|
* This routine returns the types of the data ref for accessor use. If a data
|
||||||
* ref is available in multiple data types, they will all be returned.
|
* ref is available in multiple data types, the bit-wise OR of these types
|
||||||
|
* will be returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMDataTypeID XPLMGetDataRefTypes(XPLMDataRef inDataRef);
|
XPLM_API XPLMDataTypeID XPLMGetDataRefTypes(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* DATA ACCESSORS
|
* DATA ACCESSORS
|
||||||
@@ -188,13 +215,15 @@ XPLM_API XPLMDataTypeID XPLMGetDataRefTypes(XPLMDataRef inDataRef);
|
|||||||
* These routines read and write the data references. For each supported data
|
* These routines read and write the data references. For each supported data
|
||||||
* type there is a reader and a writer.
|
* type there is a reader and a writer.
|
||||||
*
|
*
|
||||||
* If the data ref is invalid or the plugin that provides it is disabled or
|
* If the data ref is orphaned or the plugin that provides it is disabled or
|
||||||
* there is a type mismatch, the functions that read data will return 0 as a
|
* there is a type mismatch, the functions that read data will return 0 as a
|
||||||
* default value or not modify the passed in memory. The plugins that write
|
* default value or not modify the passed in memory. The plugins that write
|
||||||
* data will not write under these circumstances or if the data ref is
|
* data will not write under these circumstances or if the data ref is
|
||||||
* read-only. NOTE: to keep the overhead of reading datarefs low, these
|
* read-only.
|
||||||
* routines do not do full validation of a dataref; passing a junk value for
|
*
|
||||||
* a dataref can result in crashing the sim.
|
* NOTE: to keep the overhead of reading datarefs low, these routines do not
|
||||||
|
* do full validation of a dataref; passing a junk value for a dataref can
|
||||||
|
* result in crashing the sim. The get/set APIs do check for NULL.
|
||||||
*
|
*
|
||||||
* For array-style datarefs, you specify the number of items to read/write and
|
* For array-style datarefs, you specify the number of items to read/write and
|
||||||
* the offset into the array; the actual number of items read or written is
|
* the offset into the array; the actual number of items read or written is
|
||||||
@@ -207,69 +236,76 @@ XPLM_API XPLMDataTypeID XPLMGetDataRefTypes(XPLMDataRef inDataRef);
|
|||||||
* XPLMGetDatai
|
* XPLMGetDatai
|
||||||
*
|
*
|
||||||
* Read an integer data ref and return its value. The return value is the
|
* Read an integer data ref and return its value. The return value is the
|
||||||
* dataref value or 0 if the dataref is invalid/NULL or the plugin is
|
* dataref value or 0 if the dataref is NULL or the plugin is disabled.
|
||||||
* disabled.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMGetDatai(XPLMDataRef inDataRef);
|
XPLM_API int XPLMGetDatai(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatai
|
* XPLMSetDatai
|
||||||
*
|
*
|
||||||
* Write a new value to an integer data ref. This routine is a no-op if the
|
* Write a new value to an integer data ref. This routine is a no-op if the
|
||||||
* plugin publishing the dataref is disabled, the dataref is invalid, or the
|
* plugin publishing the dataref is disabled, the dataref is NULL, or the
|
||||||
* dataref is not writable.
|
* dataref is not writable.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetDatai(XPLMDataRef inDataRef, int inValue);
|
XPLM_API void XPLMSetDatai(
|
||||||
|
XPLMDataRef inDataRef,
|
||||||
|
int inValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDataf
|
* XPLMGetDataf
|
||||||
*
|
*
|
||||||
* Read a single precision floating point dataref and return its value. The
|
* Read a single precision floating point dataref and return its value. The
|
||||||
* return value is the dataref value or 0.0 if the dataref is invalid/NULL or
|
* return value is the dataref value or 0.0 if the dataref is NULL or the
|
||||||
* the plugin is disabled.
|
* plugin is disabled.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API float XPLMGetDataf(XPLMDataRef inDataRef);
|
XPLM_API float XPLMGetDataf(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDataf
|
* XPLMSetDataf
|
||||||
*
|
*
|
||||||
* Write a new value to a single precision floating point data ref. This
|
* Write a new value to a single precision floating point data ref. This
|
||||||
* routine is a no-op if the plugin publishing the dataref is disabled, the
|
* routine is a no-op if the plugin publishing the dataref is disabled, the
|
||||||
* dataref is invalid, or the dataref is not writable.
|
* dataref is NULL, or the dataref is not writable.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetDataf(XPLMDataRef inDataRef, float inValue);
|
XPLM_API void XPLMSetDataf(
|
||||||
|
XPLMDataRef inDataRef,
|
||||||
|
float inValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatad
|
* XPLMGetDatad
|
||||||
*
|
*
|
||||||
* Read a double precision floating point dataref and return its value. The
|
* Read a double precision floating point dataref and return its value. The
|
||||||
* return value is the dataref value or 0.0 if the dataref is invalid/NULL or
|
* return value is the dataref value or 0.0 if the dataref is NULL or the
|
||||||
* the plugin is disabled.
|
* plugin is disabled.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API double XPLMGetDatad(XPLMDataRef inDataRef);
|
XPLM_API double XPLMGetDatad(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatad
|
* XPLMSetDatad
|
||||||
*
|
*
|
||||||
* Write a new value to a double precision floating point data ref. This
|
* Write a new value to a double precision floating point data ref. This
|
||||||
* routine is a no-op if the plugin publishing the dataref is disabled, the
|
* routine is a no-op if the plugin publishing the dataref is disabled, the
|
||||||
* dataref is invalid, or the dataref is not writable.
|
* dataref is NULL, or the dataref is not writable.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetDatad(XPLMDataRef inDataRef, double inValue);
|
XPLM_API void XPLMSetDatad(
|
||||||
|
XPLMDataRef inDataRef,
|
||||||
|
double inValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatavi
|
* XPLMGetDatavi
|
||||||
*
|
*
|
||||||
* Read a part of an integer array dataref. If you pass NULL for outVaules,
|
* Read a part of an integer array dataref. If you pass NULL for outValues,
|
||||||
* the routine will return the size of the array, ignoring inOffset and inMax.
|
* the routine will return the size of the array, ignoring inOffset and inMax.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* If outValues is not NULL, then up to inMax values are copied from the
|
* If outValues is not NULL, then up to inMax values are copied from the
|
||||||
* dataref into outValues, starting at inOffset in the dataref. If inMax +
|
* dataref into outValues, starting at inOffset in the dataref. If inMax +
|
||||||
* inOffset is larger than the size of the dataref, less than inMax values
|
* inOffset is larger than the size of the dataref, less than inMax values
|
||||||
@@ -281,8 +317,9 @@ XPLM_API void XPLMSetDatad(XPLMDataRef inDataRef, double inValue);
|
|||||||
* plugin may have different behavior.
|
* plugin may have different behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMGetDatavi(XPLMDataRef inDataRef,
|
XPLM_API int XPLMGetDatavi(
|
||||||
int *outValues, /* Can be NULL */
|
XPLMDataRef inDataRef,
|
||||||
|
int * outValues, /* Can be NULL */
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inMax);
|
int inMax);
|
||||||
|
|
||||||
@@ -300,17 +337,18 @@ XPLM_API int XPLMGetDatavi(XPLMDataRef inDataRef,
|
|||||||
* plugin may have different behavior.
|
* plugin may have different behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetDatavi(XPLMDataRef inDataRef,
|
XPLM_API void XPLMSetDatavi(
|
||||||
int *inValues,
|
XPLMDataRef inDataRef,
|
||||||
|
int * inValues,
|
||||||
int inoffset,
|
int inoffset,
|
||||||
int inCount);
|
int inCount);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatavf
|
* XPLMGetDatavf
|
||||||
*
|
*
|
||||||
* Read a part of a single precision floating point array dataref. If you
|
* Read a part of a single precision floating point array dataref. If you pass
|
||||||
* pass NULL for outVaules, the routine will return the size of the array,
|
* NULL for outVaules, the routine will return the size of the array, ignoring
|
||||||
* ignoring inOffset and inMax.
|
* inOffset and inMax.
|
||||||
*
|
*
|
||||||
* If outValues is not NULL, then up to inMax values are copied from the
|
* If outValues is not NULL, then up to inMax values are copied from the
|
||||||
* dataref into outValues, starting at inOffset in the dataref. If inMax +
|
* dataref into outValues, starting at inOffset in the dataref. If inMax +
|
||||||
@@ -323,8 +361,9 @@ XPLM_API void XPLMSetDatavi(XPLMDataRef inDataRef,
|
|||||||
* plugin may have different behavior.
|
* plugin may have different behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMGetDatavf(XPLMDataRef inDataRef,
|
XPLM_API int XPLMGetDatavf(
|
||||||
float *outValues, /* Can be NULL */
|
XPLMDataRef inDataRef,
|
||||||
|
float * outValues, /* Can be NULL */
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inMax);
|
int inMax);
|
||||||
|
|
||||||
@@ -342,8 +381,9 @@ XPLM_API int XPLMGetDatavf(XPLMDataRef inDataRef,
|
|||||||
* plugin may have different behavior.
|
* plugin may have different behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetDatavf(XPLMDataRef inDataRef,
|
XPLM_API void XPLMSetDatavf(
|
||||||
float *inValues,
|
XPLMDataRef inDataRef,
|
||||||
|
float * inValues,
|
||||||
int inoffset,
|
int inoffset,
|
||||||
int inCount);
|
int inCount);
|
||||||
|
|
||||||
@@ -364,8 +404,9 @@ XPLM_API void XPLMSetDatavf(XPLMDataRef inDataRef,
|
|||||||
* plugin may have different behavior.
|
* plugin may have different behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMGetDatab(XPLMDataRef inDataRef,
|
XPLM_API int XPLMGetDatab(
|
||||||
void *outValue, /* Can be NULL */
|
XPLMDataRef inDataRef,
|
||||||
|
void * outValue, /* Can be NULL */
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inMaxBytes);
|
int inMaxBytes);
|
||||||
|
|
||||||
@@ -373,8 +414,8 @@ XPLM_API int XPLMGetDatab(XPLMDataRef inDataRef,
|
|||||||
* XPLMSetDatab
|
* XPLMSetDatab
|
||||||
*
|
*
|
||||||
* Write part or all of a byte array dataref. The values passed by inValues
|
* Write part or all of a byte array dataref. The values passed by inValues
|
||||||
* are written into the dataref starting at inOffset. Up to inCount values
|
* are written into the dataref starting at inOffset. Up to inCount values are
|
||||||
* are written; however if the values would write "off the end" of the dataref
|
* written; however if the values would write "off the end" of the dataref
|
||||||
* array, then fewer values are written.
|
* array, then fewer values are written.
|
||||||
*
|
*
|
||||||
* Note: the semantics of array datarefs are entirely implemented by the
|
* Note: the semantics of array datarefs are entirely implemented by the
|
||||||
@@ -383,20 +424,21 @@ XPLM_API int XPLMGetDatab(XPLMDataRef inDataRef,
|
|||||||
* plugin may have different behavior.
|
* plugin may have different behavior.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetDatab(XPLMDataRef inDataRef,
|
XPLM_API void XPLMSetDatab(
|
||||||
void *inValue,
|
XPLMDataRef inDataRef,
|
||||||
|
void * inValue,
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inLength);
|
int inLength);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* PUBLISHING YOUR PLUGINS DATA
|
* PUBLISHING YOUR PLUGIN'S DATA
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* These functions allow you to create data references that other plug-ins can
|
* These functions allow you to create data references that other plug-ins and
|
||||||
* access via the above data access APIs. Data references published by other
|
* X-Plane can access via the above data access APIs. Data references
|
||||||
* plugins operate the same as ones published by x-plane in all manners except
|
* published by other plugins operate the same as ones published by X-Plane in
|
||||||
* that your data reference will not be available to other plugins if/when
|
* all manners except that your data reference will not be available to other
|
||||||
* your plugin is disabled.
|
* plugins if/when your plugin is disabled.
|
||||||
*
|
*
|
||||||
* You share data by registering data provider callback functions. When a
|
* You share data by registering data provider callback functions. When a
|
||||||
* plug-in requests your data, these callbacks are then called. You provide
|
* plug-in requests your data, these callbacks are then called. You provide
|
||||||
@@ -418,7 +460,7 @@ XPLM_API void XPLMSetDatab(XPLMDataRef inDataRef,
|
|||||||
*
|
*
|
||||||
* These define the function pointers you provide to get or set data. Note
|
* These define the function pointers you provide to get or set data. Note
|
||||||
* that you are passed a generic pointer for each one. This is the same
|
* that you are passed a generic pointer for each one. This is the same
|
||||||
* pointer you pass in your register routine; you can use it to find global
|
* pointer you pass in your register routine; you can use it to locate plugin
|
||||||
* variables, etc.
|
* variables, etc.
|
||||||
*
|
*
|
||||||
* The semantics of your callbacks are the same as the dataref accessor above
|
* The semantics of your callbacks are the same as the dataref accessor above
|
||||||
@@ -428,100 +470,104 @@ XPLM_API void XPLMSetDatab(XPLMDataRef inDataRef,
|
|||||||
* offset read/writes, and handling a read with a NULL buffer.
|
* offset read/writes, and handling a read with a NULL buffer.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef int (*XPLMGetDatai_f)(void *inRefcon);
|
typedef int (* XPLMGetDatai_f)(
|
||||||
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatai_f
|
* XPLMSetDatai_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMSetDatai_f)(void *inRefcon, int inValue);
|
typedef void (* XPLMSetDatai_f)(
|
||||||
|
void * inRefcon,
|
||||||
|
int inValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDataf_f
|
* XPLMGetDataf_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef float (*XPLMGetDataf_f)(void *inRefcon);
|
typedef float (* XPLMGetDataf_f)(
|
||||||
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDataf_f
|
* XPLMSetDataf_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMSetDataf_f)(void *inRefcon, float inValue);
|
typedef void (* XPLMSetDataf_f)(
|
||||||
|
void * inRefcon,
|
||||||
|
float inValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatad_f
|
* XPLMGetDatad_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef double (*XPLMGetDatad_f)(void *inRefcon);
|
typedef double (* XPLMGetDatad_f)(
|
||||||
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatad_f
|
* XPLMSetDatad_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMSetDatad_f)(void *inRefcon, double inValue);
|
typedef void (* XPLMSetDatad_f)(
|
||||||
|
void * inRefcon,
|
||||||
|
double inValue);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatavi_f
|
* XPLMGetDatavi_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef int (*XPLMGetDatavi_f)(void *inRefcon,
|
typedef int (* XPLMGetDatavi_f)(
|
||||||
int *outValues, /* Can be NULL */
|
void * inRefcon,
|
||||||
|
int * outValues, /* Can be NULL */
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inMax);
|
int inMax);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatavi_f
|
* XPLMSetDatavi_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMSetDatavi_f)(void *inRefcon,
|
typedef void (* XPLMSetDatavi_f)(
|
||||||
int *inValues,
|
void * inRefcon,
|
||||||
|
int * inValues,
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inCount);
|
int inCount);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatavf_f
|
* XPLMGetDatavf_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef int (*XPLMGetDatavf_f)(void *inRefcon,
|
typedef int (* XPLMGetDatavf_f)(
|
||||||
float *outValues, /* Can be NULL */
|
void * inRefcon,
|
||||||
|
float * outValues, /* Can be NULL */
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inMax);
|
int inMax);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatavf_f
|
* XPLMSetDatavf_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMSetDatavf_f)(void *inRefcon,
|
typedef void (* XPLMSetDatavf_f)(
|
||||||
float *inValues,
|
void * inRefcon,
|
||||||
|
float * inValues,
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inCount);
|
int inCount);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetDatab_f
|
* XPLMGetDatab_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef int (*XPLMGetDatab_f)(void *inRefcon,
|
typedef int (* XPLMGetDatab_f)(
|
||||||
void *outValue, /* Can be NULL */
|
void * inRefcon,
|
||||||
|
void * outValue, /* Can be NULL */
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inMaxLength);
|
int inMaxLength);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetDatab_f
|
* XPLMSetDatab_f
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMSetDatab_f)(void *inRefcon,
|
typedef void (* XPLMSetDatab_f)(
|
||||||
void *inValue,
|
void * inRefcon,
|
||||||
|
void * inValue,
|
||||||
int inOffset,
|
int inOffset,
|
||||||
int inLength);
|
int inLength);
|
||||||
|
|
||||||
@@ -539,7 +585,8 @@ typedef void (*XPLMSetDatab_f)(void *inRefcon,
|
|||||||
* this data ref to unregister your data later or read or write from it.
|
* this data ref to unregister your data later or read or write from it.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMDataRef XPLMRegisterDataAccessor(const char *inDataName,
|
XPLM_API XPLMDataRef XPLMRegisterDataAccessor(
|
||||||
|
const char * inDataName,
|
||||||
XPLMDataTypeID inDataType,
|
XPLMDataTypeID inDataType,
|
||||||
int inIsWritable,
|
int inIsWritable,
|
||||||
XPLMGetDatai_f inReadInt,
|
XPLMGetDatai_f inReadInt,
|
||||||
@@ -554,8 +601,8 @@ XPLM_API XPLMDataRef XPLMRegisterDataAccessor(const char *inDataName,
|
|||||||
XPLMSetDatavf_f inWriteFloatArray,
|
XPLMSetDatavf_f inWriteFloatArray,
|
||||||
XPLMGetDatab_f inReadData,
|
XPLMGetDatab_f inReadData,
|
||||||
XPLMSetDatab_f inWriteData,
|
XPLMSetDatab_f inWriteData,
|
||||||
void *inReadRefcon,
|
void * inReadRefcon,
|
||||||
void *inWriteRefcon);
|
void * inWriteRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMUnregisterDataAccessor
|
* XPLMUnregisterDataAccessor
|
||||||
@@ -565,13 +612,9 @@ XPLM_API XPLMDataRef XPLMRegisterDataAccessor(const char *inDataName,
|
|||||||
* registration. Once you unregister a data ref, your function pointer will
|
* registration. Once you unregister a data ref, your function pointer will
|
||||||
* not be called anymore.
|
* not be called anymore.
|
||||||
*
|
*
|
||||||
* For maximum compatibility, do not unregister your data accessors until
|
|
||||||
* final shutdown (when your XPluginStop routine is called). This allows
|
|
||||||
* other plugins to find your data reference once and use it for their entire
|
|
||||||
* time of operation.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMUnregisterDataAccessor(XPLMDataRef inDataRef);
|
XPLM_API void XPLMUnregisterDataAccessor(
|
||||||
|
XPLMDataRef inDataRef);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* SHARING DATA BETWEEN MULTIPLE PLUGINS
|
* SHARING DATA BETWEEN MULTIPLE PLUGINS
|
||||||
@@ -591,16 +634,16 @@ XPLM_API void XPLMUnregisterDataAccessor(XPLMDataRef inDataRef);
|
|||||||
* Shared data references differ from the 'owned' data references from the
|
* Shared data references differ from the 'owned' data references from the
|
||||||
* previous section in a few ways:
|
* previous section in a few ways:
|
||||||
*
|
*
|
||||||
* - With shared data references, any plugin can create the data reference;
|
* * With shared data references, any plugin can create the data reference;
|
||||||
* with owned plugins one plugin must create the data reference and others
|
* with owned plugins one plugin must create the data reference and others
|
||||||
* subscribe. (This can be a problem if you don't know which set of plugins
|
* subscribe. (This can be a problem if you don't know which set of plugins
|
||||||
* will be present).
|
* will be present).
|
||||||
*
|
*
|
||||||
* - With shared data references, every plugin that is sharing the data is
|
* * With shared data references, every plugin that is sharing the data is
|
||||||
* notified when the data is changed. With owned data references, only the
|
* notified when the data is changed. With owned data references, only the
|
||||||
* one owner is notified when the data is changed.
|
* one owner is notified when the data is changed.
|
||||||
*
|
*
|
||||||
* - With shared data references, you cannot access the physical memory of the
|
* * With shared data references, you cannot access the physical memory of the
|
||||||
* data reference; you must use the XPLMGet... and XPLMSet... APIs. With an
|
* data reference; you must use the XPLMGet... and XPLMSet... APIs. With an
|
||||||
* owned data reference, the one owning data reference can manipulate the
|
* owned data reference, the one owning data reference can manipulate the
|
||||||
* data reference's memory in any way it sees fit.
|
* data reference's memory in any way it sees fit.
|
||||||
@@ -622,7 +665,8 @@ XPLM_API void XPLMUnregisterDataAccessor(XPLMDataRef inDataRef);
|
|||||||
* of the XPLMGetDataxxx routines to find the new value of the data.
|
* of the XPLMGetDataxxx routines to find the new value of the data.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMDataChanged_f)(void *inRefcon);
|
typedef void (* XPLMDataChanged_f)(
|
||||||
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMShareData
|
* XPLMShareData
|
||||||
@@ -644,10 +688,11 @@ typedef void (*XPLMDataChanged_f)(void *inRefcon);
|
|||||||
* zero if the data already exists but is of the wrong type.
|
* zero if the data already exists but is of the wrong type.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMShareData(const char *inDataName,
|
XPLM_API int XPLMShareData(
|
||||||
|
const char * inDataName,
|
||||||
XPLMDataTypeID inDataType,
|
XPLMDataTypeID inDataType,
|
||||||
XPLMDataChanged_f inNotificationFunc,
|
XPLMDataChanged_f inNotificationFunc,
|
||||||
void *inNotificationRefcon);
|
void * inNotificationRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMUnshareData
|
* XPLMUnshareData
|
||||||
@@ -658,10 +703,11 @@ XPLM_API int XPLMShareData(const char *inDataName,
|
|||||||
* since other plug-ins could be using it.
|
* since other plug-ins could be using it.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMUnshareData(const char *inDataName,
|
XPLM_API int XPLMUnshareData(
|
||||||
|
const char * inDataName,
|
||||||
XPLMDataTypeID inDataType,
|
XPLMDataTypeID inDataType,
|
||||||
XPLMDataChanged_f inNotificationFunc,
|
XPLMDataChanged_f inNotificationFunc,
|
||||||
void *inNotificationRefcon);
|
void * inNotificationRefcon);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
#define _XPLMDefs_h_
|
#define _XPLMDefs_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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
|
* This file is contains the cross-platform and basic definitions for the
|
||||||
* X-Plane SDK.
|
* X-Plane SDK.
|
||||||
@@ -48,77 +48,77 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if APL
|
#if APL
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
||||||
#elif __MACH__
|
#elif __MACH__
|
||||||
#define PLUGIN_API extern "C"
|
#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
|
#else
|
||||||
#define PLUGIN_API extern "C" __declspec(dllexport)
|
#if APL
|
||||||
#endif
|
#if __GNUC__ >= 4
|
||||||
#elif IBM
|
#define PLUGIN_API __attribute__((visibility("default")))
|
||||||
#define PLUGIN_API extern "C" __declspec(dllexport)
|
#elif __MACH__
|
||||||
#elif LIN
|
#define PLUGIN_API
|
||||||
#if __GNUC__ >= 4
|
#else
|
||||||
#define PLUGIN_API extern "C" __attribute__((visibility("default")))
|
#define PLUGIN_API __declspec(dllexport)
|
||||||
#else
|
#endif
|
||||||
#define PLUGIN_API extern "C"
|
#elif IBM
|
||||||
#endif
|
#define PLUGIN_API __declspec(dllexport)
|
||||||
#else
|
#elif LIN
|
||||||
#error "Platform not defined!"
|
#if __GNUC__ >= 4
|
||||||
#endif
|
#define PLUGIN_API __attribute__((visibility("default")))
|
||||||
#else
|
#else
|
||||||
#if APL
|
#define PLUGIN_API
|
||||||
#if __GNUC__ >= 4
|
#endif
|
||||||
#define PLUGIN_API __attribute__((visibility("default")))
|
#else
|
||||||
#elif __MACH__
|
#error "Platform not defined!"
|
||||||
#define PLUGIN_API
|
#endif
|
||||||
#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
|
#endif
|
||||||
|
|
||||||
#if APL
|
#if APL
|
||||||
#if XPLM
|
#if XPLM
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#define XPLM_API __attribute__((visibility("default")))
|
#define XPLM_API __attribute__((visibility("default")))
|
||||||
#elif __MACH__
|
#elif __MACH__
|
||||||
#define XPLM_API
|
#define XPLM_API
|
||||||
#else
|
#else
|
||||||
#define XPLM_API __declspec(dllexport)
|
#define XPLM_API __declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define XPLM_API
|
#define XPLM_API
|
||||||
#endif
|
#endif
|
||||||
#elif IBM
|
#elif IBM
|
||||||
#if XPLM
|
#if XPLM
|
||||||
#define XPLM_API __declspec(dllexport)
|
#define XPLM_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define XPLM_API __declspec(dllimport)
|
#define XPLM_API __declspec(dllimport)
|
||||||
#endif
|
#endif
|
||||||
#elif LIN
|
#elif LIN
|
||||||
#if XPLM
|
#if XPLM
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#define XPLM_API __attribute__((visibility("default")))
|
#define XPLM_API __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
|
#define XPLM_API
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define XPLM_API
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define XPLM_API
|
#error "Platform not defined!"
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define XPLM_API
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#error "Platform not defined!"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -137,7 +137,8 @@ extern "C" {
|
|||||||
* disable or enable a plug-in, or discover what plug-in is 'running' at the
|
* 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
|
* 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
|
* 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
|
* For persistent identification of plug-ins, use XPLMFindPluginBySignature in
|
||||||
* XPLMUtiltiies.h
|
* XPLMUtiltiies.h
|
||||||
@@ -153,8 +154,8 @@ typedef int XPLMPluginID;
|
|||||||
/* X-Plane itself */
|
/* X-Plane itself */
|
||||||
#define XPLM_PLUGIN_XPLANE (0)
|
#define XPLM_PLUGIN_XPLANE (0)
|
||||||
|
|
||||||
/* The current XPLM revision is 2.10 (210). */
|
/* The current XPLM revision is 4.00 (400). */
|
||||||
#define kXPLM_Version (210)
|
#define kXPLM_Version (400)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMKeyFlags
|
* XPLMKeyFlags
|
||||||
@@ -175,23 +176,19 @@ typedef int XPLMPluginID;
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The shift key is down */
|
/* The shift key is down */
|
||||||
xplm_ShiftFlag = 1
|
xplm_ShiftFlag = 1,
|
||||||
|
|
||||||
/* The option or alt key is down */
|
/* The option or alt key is down */
|
||||||
,
|
xplm_OptionAltFlag = 2,
|
||||||
xplm_OptionAltFlag = 2
|
|
||||||
|
|
||||||
/* The control key is down* */
|
/* The control key is down* */
|
||||||
,
|
xplm_ControlFlag = 4,
|
||||||
xplm_ControlFlag = 4
|
|
||||||
|
|
||||||
/* The key is being pressed down */
|
/* The key is being pressed down */
|
||||||
,
|
xplm_DownFlag = 8,
|
||||||
xplm_DownFlag = 8
|
|
||||||
|
|
||||||
/* The key is being released */
|
/* The key is being released */
|
||||||
,
|
xplm_UpFlag = 16,
|
||||||
xplm_UpFlag = 16
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -205,11 +202,12 @@ typedef int XPLMKeyFlags;
|
|||||||
* codes. Not all key presses generate an ASCII value, so plugin code should
|
* 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
|
* 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
|
* 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
|
* press. Use virtual key codes to find these key strokes.
|
||||||
* take into account modifier keys; shift keys will affect capitals and
|
*
|
||||||
* punctuation; control key combinations may have no vaild ASCII and produce
|
* ASCII key codes take into account modifier keys; shift keys will affect
|
||||||
* NULL. To detect control-key combinations, use virtual key codes, not ASCII
|
* capitals and punctuation; control key combinations may have no vaild ASCII
|
||||||
* keys.
|
* and produce NULL. To detect control-key combinations, use virtual key
|
||||||
|
* codes, not ASCII keys.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -258,10 +256,10 @@ typedef int XPLMKeyFlags;
|
|||||||
/*
|
/*
|
||||||
* These are cross-platform defines for every distinct keyboard press on the
|
* 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
|
* 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
|
* the "two" key on the top row of the main keyboard has a different code from
|
||||||
* from the "two" key on the numeric key pad. But the 'w' and 'W' character
|
* the "two" key on the numeric key pad. But the 'w' and 'W' character are
|
||||||
* are indistinguishable by virtual key code because they are the same
|
* indistinguishable by virtual key code because they are the same physical
|
||||||
* physical key (one with and one without the shift key).
|
* key (one with and one without the shift key).
|
||||||
*
|
*
|
||||||
* Use virtual key codes to detect keystrokes that do not have ASCII
|
* Use virtual key codes to detect keystrokes that do not have ASCII
|
||||||
* equivalents, allow the user to map the numeric keypad separately from the
|
* equivalents, allow the user to map the numeric keypad separately from the
|
||||||
@@ -275,10 +273,8 @@ typedef int XPLMKeyFlags;
|
|||||||
* 1. Modifier keys are not available as virtual key codes. You cannot get
|
* 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
|
* distinct modifier press and release messages. Please do not try to use
|
||||||
* modifier keys as regular keys; doing so will almost certainly interfere
|
* modifier keys as regular keys; doing so will almost certainly interfere
|
||||||
* with users' abilities to use the native x-plane key bindings.
|
* 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.
|
* 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
|
* 3. Do not assume that the values of these keystrokes are interchangeable
|
||||||
* with MS v-keys.
|
* with MS v-keys.
|
||||||
*
|
*
|
||||||
|
|||||||
+1249
-334
File diff suppressed because it is too large
Load Diff
+154
-130
@@ -2,17 +2,15 @@
|
|||||||
#define _XPLMGraphics_h_
|
#define _XPLMGraphics_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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:
|
* A few notes on coordinate systems:
|
||||||
*
|
*
|
||||||
* X-Plane uses three kinds of coordinates. Global coordinates are specified
|
* X-Plane uses three kinds of coordinates. Global coordinates are specified
|
||||||
@@ -26,14 +24,15 @@
|
|||||||
* not truly straight up and down at other points). The Z axis is aligned
|
* 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
|
* 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).
|
* 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
|
* One unit is one meter and the point 0,0,0 is on the surface of the earth at
|
||||||
* at sea level for some latitude and longitude picked by the sim such that
|
* sea level for some latitude and longitude picked by the sim such that the
|
||||||
* the user's aircraft is reasonably nearby.
|
* user's aircraft is reasonably nearby.
|
||||||
*
|
*
|
||||||
* Cockpit coordinates are 2d, with the X axis horizontal and the Y axis
|
* 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
|
* vertical. The point 0,0 is the bottom left and 1024,768 is the upper
|
||||||
* of the screen. This is true no matter what resolution the user's monitor is
|
* right of the screen. This is true no matter what resolution the user's
|
||||||
* in; when running in higher resolution, graphics will be scaled.
|
* 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
|
* Use X-Plane's routines to convert between global and local coordinates. Do
|
||||||
* not attempt to do this conversion yourself; the precise 'roundness' of
|
* not attempt to do this conversion yourself; the precise 'roundness' of
|
||||||
@@ -64,19 +63,25 @@ extern "C" {
|
|||||||
* XPLM Texture IDs name well-known textures in the sim for you to use. This
|
* 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.
|
* 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 {
|
enum {
|
||||||
/* The bitmap that contains window outlines, button outlines, fonts, etc. */
|
/* The bitmap that contains window outlines, button outlines, fonts, etc. */
|
||||||
xplm_Tex_GeneralInterface = 0
|
xplm_Tex_GeneralInterface = 0,
|
||||||
|
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* The exterior paint for the user's aircraft (daytime). */
|
/* The exterior paint for the user's aircraft (daytime). */
|
||||||
,
|
xplm_Tex_AircraftPaint = 1,
|
||||||
xplm_Tex_AircraftPaint = 1
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* The exterior light map for the user's aircraft. */
|
/* The exterior light map for the user's aircraft. */
|
||||||
,
|
xplm_Tex_AircraftLiteMap = 2,
|
||||||
xplm_Tex_AircraftLiteMap = 2
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef int XPLMTextureID;
|
typedef int XPLMTextureID;
|
||||||
@@ -84,30 +89,27 @@ typedef int XPLMTextureID;
|
|||||||
/*
|
/*
|
||||||
* XPLMSetGraphicsState
|
* XPLMSetGraphicsState
|
||||||
*
|
*
|
||||||
* XPLMSetGraphicsState changes OpenGL's graphics state in a number of ways:
|
* 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);
|
* - inEnableFog - enables or disables fog, equivalent to: glEnable(GL_FOG);
|
||||||
*
|
* - inNumberTexUnits - enables or disables a number of multitexturing units.
|
||||||
* inNumberTexUnits - enables or disables a number of multitexturing units. If
|
* If the number is 0, 2d texturing is disabled entirely, as in
|
||||||
* the number is 0, 2d texturing is disabled entirely, as in
|
|
||||||
* glDisable(GL_TEXTURE_2D); Otherwise, 2d texturing is enabled, and a
|
* glDisable(GL_TEXTURE_2D); Otherwise, 2d texturing is enabled, and a
|
||||||
* number of multitexturing units are enabled sequentially, starting with
|
* number of multitexturing units are enabled sequentially, starting with
|
||||||
* unit 0, e.g. glActiveTextureARB(GL_TEXTURE0_ARB); glEnable
|
* unit 0, e.g. glActiveTextureARB(GL_TEXTURE0_ARB); glEnable
|
||||||
* (GL_TEXTURE_2D);
|
* (GL_TEXTURE_2D);
|
||||||
*
|
* - inEnableLighting - enables or disables OpenGL lighting, e.g.
|
||||||
* inEnableLighting - enables or disables OpenGL lighting, e.g.
|
|
||||||
* glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);
|
* glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);
|
||||||
*
|
* - inEnableAlphaTesting - enables or disables the alpha test per pixel, e.g.
|
||||||
* inEnableAlphaTesting - enables or disables the alpha test per pixel, e.g.
|
|
||||||
* glEnable(GL_ALPHA_TEST);
|
* glEnable(GL_ALPHA_TEST);
|
||||||
*
|
* - inEnableAlphaBlending - enables or disables alpha blending per pixel,
|
||||||
* inEnableAlphaBlending - enables or disables alpha blending per pixel, e.g.
|
* e.g. glEnable(GL_BLEND);
|
||||||
* glEnable(GL_BLEND);
|
* - inEnableDepthTesting - enables per pixel depth testing, as in
|
||||||
*
|
|
||||||
* inEnableDepthTesting - enables per pixel depth testing, as in
|
|
||||||
* glEnable(GL_DEPTH_TEST);
|
* glEnable(GL_DEPTH_TEST);
|
||||||
*
|
* - inEnableDepthWriting - enables writing back of depth information to the
|
||||||
* inEnableDepthWriting - enables writing back of depth information to the
|
|
||||||
* depth bufffer, as in glDepthMask(GL_TRUE);
|
* depth bufffer, as in glDepthMask(GL_TRUE);
|
||||||
*
|
*
|
||||||
* The purpose of this function is to change OpenGL state while keeping
|
* The purpose of this function is to change OpenGL state while keeping
|
||||||
@@ -116,16 +118,24 @@ typedef int XPLMTextureID;
|
|||||||
* having to set all state before all draws; XPLMSetGraphicsState internally
|
* having to set all state before all draws; XPLMSetGraphicsState internally
|
||||||
* skips calls to change state that is already properly enabled.
|
* 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
|
* X-Plane does not have a 'default' OGL state for plug-ins with respect to
|
||||||
* totally set OGL state before drawing. Use XPLMSetGraphicsState instead of
|
* the above state vector; plug-ins should totally set OGL state using this
|
||||||
* any of the above OpenGL calls.
|
* API before drawing. Use XPLMSetGraphicsState instead of any of the above
|
||||||
|
* OpenGL calls.
|
||||||
*
|
*
|
||||||
* WARNING: Any routine that performs drawing (e.g. XPLMDrawString or widget
|
* WARNING: Any routine that performs drawing (e.g. XPLMDrawString or widget
|
||||||
* code) may change X-Plane's state. Always set state before drawing after
|
* code) may change X-Plane's state. Always set state before drawing after
|
||||||
* unknown code has executed.
|
* 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,
|
XPLM_API void XPLMSetGraphicsState(
|
||||||
|
int inEnableFog,
|
||||||
int inNumberTexUnits,
|
int inNumberTexUnits,
|
||||||
int inEnableLighting,
|
int inEnableLighting,
|
||||||
int inEnableAlphaTesting,
|
int inEnableAlphaTesting,
|
||||||
@@ -136,53 +146,49 @@ XPLM_API void XPLMSetGraphicsState(int inEnableFog,
|
|||||||
/*
|
/*
|
||||||
* XPLMBindTexture2d
|
* XPLMBindTexture2d
|
||||||
*
|
*
|
||||||
* XPLMBindTexture2d changes what texture is bound to the 2d texturing target.
|
* XPLMBindTexture2d changes what texture is bound to the 2d texturing
|
||||||
* This routine caches the current 2d texture across all texturing units in
|
* target. This routine caches the current 2d texture across all texturing
|
||||||
* the sim and plug-ins, preventing extraneous binding. For example, consider
|
* units in the sim and plug-ins, preventing extraneous binding. For
|
||||||
* several plug-ins running in series; if they all use the 'general interface'
|
* example, consider several plug-ins running in series; if they all use the
|
||||||
* bitmap to do UI, calling this function will skip the rebinding of the
|
* 'general interface' bitmap to do UI, calling this function will skip the
|
||||||
* general interface texture on all but the first plug-in, which can provide
|
* rebinding of the general interface texture on all but the first plug-in,
|
||||||
* better frame rate son some graphics cards.
|
* which can provide better frame rate son some graphics cards.
|
||||||
*
|
*
|
||||||
* inTextureID is the ID of the texture object to bind; inTextureUnit is a
|
* 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
|
* 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.)
|
* units. (This number may increase in future versions of X-Plane.)
|
||||||
*
|
*
|
||||||
* Use this routine instead of glBindTexture(GL_TEXTURE_2D, ....);
|
* 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
|
* XPLMGenerateTextureNumbers
|
||||||
*
|
*
|
||||||
* This routine generates unused texture numbers that a plug-in can use to
|
* Use this routine instead of glGenTextures to generate new texture object
|
||||||
* safely bind textures. Use this routine instead of glGenTextures;
|
* IDs. This routine historically ensured that plugins don't use texure IDs
|
||||||
* glGenTextures will allocate texture numbers in ranges that X-Plane reserves
|
* that X-Plane is reserving for its own use.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMGenerateTextureNumbers(int *outTextureIDs, int inCount);
|
XPLM_API void XPLMGenerateTextureNumbers(
|
||||||
|
int * outTextureIDs,
|
||||||
|
int inCount);
|
||||||
|
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/*
|
/*
|
||||||
* XPLMGetTexture
|
* XPLMGetTexture
|
||||||
*
|
*
|
||||||
* XPLMGetTexture returns the OpenGL texture enumeration of an X-Plane texture
|
* XPLMGetTexture returns the OpenGL texture ID of an X-Plane texture based on
|
||||||
* based on a generic identifying code. For example, you can get the texture
|
* a generic identifying code. For example, you can get the texture for
|
||||||
* for X-Plane's UI bitmaps. This allows you to build new gauges that take
|
* X-Plane's UI bitmaps.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMGetTexture(XPLMTextureID inTexture);
|
XPLM_API int XPLMGetTexture(
|
||||||
|
XPLMTextureID inTexture);
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMWorldToLocal
|
* XPLMWorldToLocal
|
||||||
@@ -193,12 +199,13 @@ XPLM_API int XPLMGetTexture(XPLMTextureID inTexture);
|
|||||||
* meters in the local OpenGL coordinate system.
|
* meters in the local OpenGL coordinate system.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMWorldToLocal(double inLatitude,
|
XPLM_API void XPLMWorldToLocal(
|
||||||
|
double inLatitude,
|
||||||
double inLongitude,
|
double inLongitude,
|
||||||
double inAltitude,
|
double inAltitude,
|
||||||
double *outX,
|
double * outX,
|
||||||
double *outY,
|
double * outY,
|
||||||
double *outZ);
|
double * outZ);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMLocalToWorld
|
* XPLMLocalToWorld
|
||||||
@@ -212,12 +219,13 @@ XPLM_API void XPLMWorldToLocal(double inLatitude,
|
|||||||
* 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,
|
XPLM_API void XPLMLocalToWorld(
|
||||||
|
double inX,
|
||||||
double inY,
|
double inY,
|
||||||
double inZ,
|
double inZ,
|
||||||
double *outLatitude,
|
double * outLatitude,
|
||||||
double *outLongitude,
|
double * outLongitude,
|
||||||
double *outAltitude);
|
double * outAltitude);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMDrawTranslucentDarkBox
|
* XPLMDrawTranslucentDarkBox
|
||||||
@@ -227,7 +235,8 @@ XPLM_API void XPLMLocalToWorld(double inX,
|
|||||||
* 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,
|
XPLM_API void XPLMDrawTranslucentDarkBox(
|
||||||
|
int inLeft,
|
||||||
int inTop,
|
int inTop,
|
||||||
int inRight,
|
int inRight,
|
||||||
int inBottom);
|
int inBottom);
|
||||||
@@ -235,11 +244,6 @@ XPLM_API void XPLMDrawTranslucentDarkBox(int inLeft,
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* X-PLANE TEXT
|
* X-PLANE TEXT
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMFontID
|
* XPLMFontID
|
||||||
@@ -257,82 +261,97 @@ XPLM_API void XPLMDrawTranslucentDarkBox(int inLeft,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Mono-spaced font for user interface. Available in all versions of the
|
/* Mono-spaced font for user interface. Available in all versions of the SDK.*/
|
||||||
SDK. */
|
xplmFont_Basic = 0,
|
||||||
xplmFont_Basic = 0
|
|
||||||
|
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_Menus = 1,
|
||||||
xplmFont_Menus = 1
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_Metal = 2,
|
||||||
xplmFont_Metal = 2
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_Led = 3,
|
||||||
xplmFont_Led = 3
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_LedWide = 4,
|
||||||
xplmFont_LedWide = 4
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_PanelHUD = 5,
|
||||||
xplmFont_PanelHUD = 5
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_PanelEFIS = 6,
|
||||||
xplmFont_PanelEFIS = 6
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_PanelGPS = 7,
|
||||||
xplmFont_PanelGPS = 7
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_RadiosGA = 8,
|
||||||
xplmFont_RadiosGA = 8
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_RadiosBC = 9,
|
||||||
xplmFont_RadiosBC = 9
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_RadiosHM = 10,
|
||||||
xplmFont_RadiosHM = 10
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_RadiosGANarrow = 11,
|
||||||
xplmFont_RadiosGANarrow = 11
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_RadiosBCNarrow = 12,
|
||||||
xplmFont_RadiosBCNarrow = 12
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_RadiosHMNarrow = 13,
|
||||||
xplmFont_RadiosHMNarrow = 13
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_Timer = 14,
|
||||||
xplmFont_Timer = 14
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_FullRound = 15,
|
||||||
xplmFont_FullRound = 15
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_SmallRound = 16,
|
||||||
xplmFont_SmallRound = 16
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/* Deprecated, do not use. */
|
/* Deprecated, do not use. */
|
||||||
,
|
xplmFont_Menus_Localized = 17,
|
||||||
xplmFont_Menus_Localized = 17
|
|
||||||
|
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/* Proportional UI font. */
|
/* Proportional UI font. */
|
||||||
,
|
xplmFont_Proportional = 18,
|
||||||
xplmFont_Proportional = 18
|
|
||||||
|
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
|
|
||||||
@@ -350,11 +369,12 @@ typedef int XPLMFontID;
|
|||||||
* to 1.0.
|
* to 1.0.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMDrawString(float *inColorRGB,
|
XPLM_API void XPLMDrawString(
|
||||||
|
float * inColorRGB,
|
||||||
int inXOffset,
|
int inXOffset,
|
||||||
int inYOffset,
|
int inYOffset,
|
||||||
char *inChar,
|
char * inChar,
|
||||||
int *inWordWrapWidth, /* Can be NULL */
|
int * inWordWrapWidth, /* Can be NULL */
|
||||||
XPLMFontID inFontID);
|
XPLMFontID inFontID);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -368,7 +388,8 @@ XPLM_API void XPLMDrawString(float *inColorRGB,
|
|||||||
* string drawn.
|
* string drawn.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMDrawNumber(float *inColorRGB,
|
XPLM_API void XPLMDrawNumber(
|
||||||
|
float * inColorRGB,
|
||||||
int inXOffset,
|
int inXOffset,
|
||||||
int inYOffset,
|
int inYOffset,
|
||||||
double inValue,
|
double inValue,
|
||||||
@@ -386,10 +407,11 @@ XPLM_API void XPLMDrawNumber(float *inColorRGB,
|
|||||||
* will be an arbitrary, hopefully average width.
|
* will be an arbitrary, hopefully average width.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMGetFontDimensions(XPLMFontID inFontID,
|
XPLM_API void XPLMGetFontDimensions(
|
||||||
int *outCharWidth, /* Can be NULL */
|
XPLMFontID inFontID,
|
||||||
int *outCharHeight, /* Can be NULL */
|
int * outCharWidth, /* Can be NULL */
|
||||||
int *outDigitsOnly); /* Can be NULL */
|
int * outCharHeight, /* Can be NULL */
|
||||||
|
int * outDigitsOnly); /* Can be NULL */
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/*
|
/*
|
||||||
@@ -402,8 +424,10 @@ XPLM_API void XPLMGetFontDimensions(XPLMFontID inFontID,
|
|||||||
* for fractional pixels.
|
* for fractional pixels.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API float
|
XPLM_API float XPLMMeasureString(
|
||||||
XPLMMeasureString(XPLMFontID inFontID, const char *inChar, int inNumChars);
|
XPLMFontID inFontID,
|
||||||
|
const char * inChar,
|
||||||
|
int inNumChars);
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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
|
||||||
+128
-48
@@ -2,27 +2,46 @@
|
|||||||
#define _XPLMMenus_h_
|
#define _XPLMMenus_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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
|
* 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
|
* opaque ID. Items are referred to by (zero-based) index number.
|
||||||
* 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
|
* Menus are "sandboxed" between plugins---no plugin can access the menus of
|
||||||
* are zero based.
|
* 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 "XPLMDefs.h"
|
||||||
|
#include "XPLMUtilities.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -31,31 +50,24 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* XPLM MENUS
|
* XPLM MENUS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMMenuCheck
|
* XPLMMenuCheck
|
||||||
*
|
*
|
||||||
* These enumerations define the various 'check' states for an X-Plane menu.
|
* 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
|
* 'checking' in X-Plane actually appears as a light which may or may not be
|
||||||
* lit. So there are three possible states.
|
* lit. So there are three possible states.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* there is no symbol to the left of the menu item. */
|
/* there is no symbol to the left of the menu item. */
|
||||||
xplm_Menu_NoCheck = 0
|
xplm_Menu_NoCheck = 0,
|
||||||
|
|
||||||
/* the menu has a mark next to it that is unmarked (not lit). */
|
/* the menu has a mark next to it that is unmarked (not lit). */
|
||||||
,
|
xplm_Menu_Unchecked = 1,
|
||||||
xplm_Menu_Unchecked = 1
|
|
||||||
|
|
||||||
/* the menu has a mark next to it that is checked (lit). */
|
/* the menu has a mark next to it that is checked (lit). */
|
||||||
,
|
xplm_Menu_Checked = 2,
|
||||||
xplm_Menu_Checked = 2
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -67,7 +79,7 @@ typedef int XPLMMenuCheck;
|
|||||||
* 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
|
* XPLMMenuHandler_f
|
||||||
@@ -77,7 +89,9 @@ typedef void *XPLMMenuID;
|
|||||||
* 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
|
* XPLMFindPluginsMenu
|
||||||
@@ -88,6 +102,25 @@ typedef void (*XPLMMenuHandler_f)(void *inMenuRef, void *inItemRef);
|
|||||||
*/
|
*/
|
||||||
XPLM_API XPLMMenuID XPLMFindPluginsMenu(void);
|
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
|
* XPLMCreateMenu
|
||||||
*
|
*
|
||||||
@@ -103,11 +136,12 @@ XPLM_API XPLMMenuID XPLMFindPluginsMenu(void);
|
|||||||
* a submenu where the title is not visible.
|
* a submenu where the title is not visible.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMMenuID XPLMCreateMenu(const char *inName,
|
XPLM_API XPLMMenuID XPLMCreateMenu(
|
||||||
|
const char * inName,
|
||||||
XPLMMenuID inParentMenu,
|
XPLMMenuID inParentMenu,
|
||||||
int inParentItem,
|
int inParentItem,
|
||||||
XPLMMenuHandler_f inHandler,
|
XPLMMenuHandler_f inHandler,
|
||||||
void *inMenuRef);
|
void * inMenuRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMDestroyMenu
|
* XPLMDestroyMenu
|
||||||
@@ -116,7 +150,8 @@ XPLM_API XPLMMenuID XPLMCreateMenu(const char *inName,
|
|||||||
* 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
|
* XPLMClearAllMenuItems
|
||||||
@@ -125,32 +160,68 @@ XPLM_API void XPLMDestroyMenu(XPLMMenuID inMenuID);
|
|||||||
* it. Use this function if you need to change the number of items on a menu.
|
* 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
|
* XPLMAppendMenuItem
|
||||||
*
|
*
|
||||||
* This routine appends a new menu item to the bottom of a menu and returns
|
* 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
|
* 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
|
* * ref for this item.
|
||||||
* 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
|
* Returns a negative index if the append failed (due to an invalid parent
|
||||||
* of why you'd want to do this is for a proper name.) See XPLMUtilities for
|
* menu argument).
|
||||||
* determining the current langauge.
|
*
|
||||||
|
* 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,
|
XPLM_API int XPLMAppendMenuItem(
|
||||||
const char *inItemName,
|
XPLMMenuID inMenu,
|
||||||
void *inItemRef,
|
const char * inItemName,
|
||||||
int inForceEnglish);
|
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
|
* 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
|
* XPLMSetMenuItemName
|
||||||
@@ -159,10 +230,11 @@ XPLM_API void XPLMAppendMenuSeparator(XPLMMenuID inMenu);
|
|||||||
* ID and the index of the menu item.
|
* ID and the index of the menu item.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetMenuItemName(XPLMMenuID inMenu,
|
XPLM_API void XPLMSetMenuItemName(
|
||||||
|
XPLMMenuID inMenu,
|
||||||
int inIndex,
|
int inIndex,
|
||||||
const char *inItemName,
|
const char * inItemName,
|
||||||
int inForceEnglish);
|
int inDeprecatedAndIgnored);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMCheckMenuItem
|
* XPLMCheckMenuItem
|
||||||
@@ -170,8 +242,10 @@ XPLM_API void XPLMSetMenuItemName(XPLMMenuID inMenu,
|
|||||||
* 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
|
XPLM_API void XPLMCheckMenuItem(
|
||||||
XPLMCheckMenuItem(XPLMMenuID inMenu, int index, XPLMMenuCheck inCheck);
|
XPLMMenuID inMenu,
|
||||||
|
int index,
|
||||||
|
XPLMMenuCheck inCheck);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMCheckMenuItemState
|
* XPLMCheckMenuItemState
|
||||||
@@ -180,9 +254,10 @@ XPLM_API void
|
|||||||
* 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,
|
XPLM_API void XPLMCheckMenuItemState(
|
||||||
|
XPLMMenuID inMenu,
|
||||||
int index,
|
int index,
|
||||||
XPLMMenuCheck *outCheck);
|
XPLMMenuCheck * outCheck);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMEnableMenuItem
|
* XPLMEnableMenuItem
|
||||||
@@ -190,7 +265,10 @@ XPLM_API void XPLMCheckMenuItemState(XPLMMenuID inMenu,
|
|||||||
* 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)
|
#if defined(XPLM210)
|
||||||
/*
|
/*
|
||||||
@@ -200,7 +278,9 @@ XPLM_API void XPLMEnableMenuItem(XPLMMenuID inMenu, int index, int enabled);
|
|||||||
* 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 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -2,17 +2,15 @@
|
|||||||
#define _XPLMNavigation_h_
|
#define _XPLMNavigation_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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
|
* 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
|
* 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
|
* using these APIs you can gain access to most information without having to
|
||||||
@@ -20,7 +18,7 @@
|
|||||||
*
|
*
|
||||||
* You can also use this API to program the FMS. You must use the navigation
|
* 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
|
* 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,11 +31,6 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* NAVIGATION DATABASE ACCESS
|
* NAVIGATION DATABASE ACCESS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMNavType
|
* XPLMNavType
|
||||||
@@ -53,43 +46,31 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
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
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -126,17 +107,14 @@ XPLM_API XPLMNavRef XPLMGetFirstNavAid(void);
|
|||||||
/*
|
/*
|
||||||
* XPLMGetNextNavAid
|
* XPLMGetNextNavAid
|
||||||
*
|
*
|
||||||
* Given a nav aid ref, this routine returns the next navaid. It returns
|
* Given a valid nav aid ref, this routine returns the next navaid. It
|
||||||
* XPLM_NAV_NOT_FOUND if the nav aid passed in was invalid or if the navaid
|
* returns XPLM_NAV_NOT_FOUND if the nav aid passed in was invalid or if the
|
||||||
* passed in was the last one in the database. Use this routine to iterate
|
* navaid passed in was the last one in the database. Use this routine to
|
||||||
* across all like-typed navaids or the entire database.
|
* 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.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMNavRef XPLMGetNextNavAid(XPLMNavRef inNavAidRef);
|
XPLM_API XPLMNavRef XPLMGetNextNavAid(
|
||||||
|
XPLMNavRef inNavAidRef);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMFindFirstNavAidOfType
|
* XPLMFindFirstNavAidOfType
|
||||||
@@ -145,12 +123,9 @@ XPLM_API XPLMNavRef XPLMGetNextNavAid(XPLMNavRef inNavAidRef);
|
|||||||
* database or XPLM_NAV_NOT_FOUND if there are no navaids of that 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.
|
* 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.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMNavRef XPLMFindFirstNavAidOfType(XPLMNavType inType);
|
XPLM_API XPLMNavRef XPLMFindFirstNavAidOfType(
|
||||||
|
XPLMNavType inType);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMFindLastNavAidOfType
|
* XPLMFindLastNavAidOfType
|
||||||
@@ -159,12 +134,9 @@ XPLM_API XPLMNavRef XPLMFindFirstNavAidOfType(XPLMNavType inType);
|
|||||||
* database or XPLM_NAV_NOT_FOUND if there are no navaids of that 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.
|
* 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.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMNavRef XPLMFindLastNavAidOfType(XPLMNavType inType);
|
XPLM_API XPLMNavRef XPLMFindLastNavAidOfType(
|
||||||
|
XPLMNavType inType);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMFindNavAid
|
* XPLMFindNavAid
|
||||||
@@ -174,31 +146,32 @@ XPLM_API XPLMNavRef XPLMFindLastNavAidOfType(XPLMNavType inType);
|
|||||||
* within inType (multiple types may be added together) and return any
|
* within inType (multiple types may be added together) and return any
|
||||||
* nav-aids found based on the following rules:
|
* nav-aids found based on the following rules:
|
||||||
*
|
*
|
||||||
* If inLat and inLon are not NULL, the navaid nearest to that lat/lon will be
|
* * If inLat and inLon are not NULL, the navaid nearest to that lat/lon will
|
||||||
* returned, otherwise the last navaid found will be returned.
|
* be returned, otherwise the last navaid found will be returned.
|
||||||
*
|
*
|
||||||
* If inFrequency is not NULL, then any navaids considered must match this
|
* * 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. Note that this will screen out radio beacons that do not have
|
||||||
* frequency data published (like inner markers) but not fixes and airports.
|
* frequency data published (like inner markers) but not fixes and airports.
|
||||||
*
|
*
|
||||||
* If inNameFragment is not NULL, only navaids that contain the fragment in
|
* * If inNameFragment is not NULL, only navaids that contain the fragment in
|
||||||
* their name will be returned.
|
* their name will be returned.
|
||||||
*
|
*
|
||||||
* If inIDFragment is not NULL, only navaids that contain the fragment in
|
* * If inIDFragment is not NULL, only navaids that contain the fragment in
|
||||||
* their IDs will be returned.
|
* their IDs will be returned.
|
||||||
*
|
*
|
||||||
* This routine provides a simple way to do a number of useful searches:
|
* This routine provides a simple way to do a number of useful searches:
|
||||||
*
|
* * Find the nearest navaid on this frequency.
|
||||||
* Find the nearest navaid on this frequency. Find the nearest airport. Find
|
* * Find the nearest airport.
|
||||||
* the VOR whose ID is "KBOS". Find the nearest airport whose name contains
|
* * Find the VOR whose ID is "KBOS".
|
||||||
* "Chicago".
|
* * Find the nearest airport whose name contains "Chicago".
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMNavRef XPLMFindNavAid(const char *inNameFragment, /* Can be NULL */
|
XPLM_API XPLMNavRef XPLMFindNavAid(
|
||||||
const char *inIDFragment, /* Can be NULL */
|
const char * inNameFragment, /* Can be NULL */
|
||||||
float *inLat, /* Can be NULL */
|
const char * inIDFragment, /* Can be NULL */
|
||||||
float *inLon, /* Can be NULL */
|
float * inLat, /* Can be NULL */
|
||||||
int *inFrequency, /* Can be NULL */
|
float * inLon, /* Can be NULL */
|
||||||
|
int * inFrequency, /* Can be NULL */
|
||||||
XPLMNavType inType);
|
XPLMNavType inType);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -221,16 +194,17 @@ XPLM_API XPLMNavRef XPLMFindNavAid(const char *inNameFragment, /* Can be NULL */
|
|||||||
* string.
|
* string.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMGetNavAidInfo(XPLMNavRef inRef,
|
XPLM_API void XPLMGetNavAidInfo(
|
||||||
XPLMNavType *outType, /* Can be NULL */
|
XPLMNavRef inRef,
|
||||||
float *outLatitude, /* Can be NULL */
|
XPLMNavType * outType, /* Can be NULL */
|
||||||
float *outLongitude, /* Can be NULL */
|
float * outLatitude, /* Can be NULL */
|
||||||
float *outHeight, /* Can be NULL */
|
float * outLongitude, /* Can be NULL */
|
||||||
int *outFrequency, /* Can be NULL */
|
float * outHeight, /* Can be NULL */
|
||||||
float *outHeading, /* Can be NULL */
|
int * outFrequency, /* Can be NULL */
|
||||||
char *outID, /* Can be NULL */
|
float * outHeading, /* Can be NULL */
|
||||||
char *outName, /* Can be NULL */
|
char * outID, /* Can be NULL */
|
||||||
char *outReg); /* Can be NULL */
|
char * outName, /* Can be NULL */
|
||||||
|
char * outReg); /* Can be NULL */
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* FLIGHT MANAGEMENT COMPUTER
|
* FLIGHT MANAGEMENT COMPUTER
|
||||||
@@ -275,9 +249,10 @@ XPLM_API int XPLMGetDestinationFMSEntry(void);
|
|||||||
* XPLMSetDisplayedFMSEntry
|
* XPLMSetDisplayedFMSEntry
|
||||||
*
|
*
|
||||||
* This routine changes which entry the FMS is showing to the index specified.
|
* 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
|
* XPLMSetDestinationFMSEntry
|
||||||
@@ -285,27 +260,38 @@ XPLM_API void XPLMSetDisplayedFMSEntry(int inIndex);
|
|||||||
* 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
|
* XPLMGetFMSEntryInfo
|
||||||
*
|
*
|
||||||
* This routine returns information about a given FMS entry. A reference to a
|
* This routine returns information about a given FMS entry. If the entry is
|
||||||
* navaid can be returned allowing you to find additional information (such as
|
* an airport or navaid, a reference to a nav entry can be returned allowing
|
||||||
* a frequency, ILS heading, name, etc.). Some information is available
|
* you to find additional information (such as a frequency, ILS heading, name,
|
||||||
* immediately. For a lat/lon entry, the lat/lon is returned by this routine
|
* etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the
|
||||||
* but the navaid cannot be looked up (and the reference will be
|
* information has been looked up asynchronously, so after flightplan changes,
|
||||||
* XPLM_NAV_NOT_FOUND. FMS name entry buffers should be at least 256 chars in
|
* it might take up to a second for this field to become populated. The other
|
||||||
* length.
|
* 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,
|
XPLM_API void XPLMGetFMSEntryInfo(
|
||||||
XPLMNavType *outType, /* Can be NULL */
|
int inIndex,
|
||||||
char *outID, /* Can be NULL */
|
XPLMNavType * outType, /* Can be NULL */
|
||||||
XPLMNavRef *outRef, /* Can be NULL */
|
char * outID, /* Can be NULL */
|
||||||
int *outAltitude, /* Can be NULL */
|
XPLMNavRef * outRef, /* Can be NULL */
|
||||||
float *outLat, /* Can be NULL */
|
int * outAltitude, /* Can be NULL */
|
||||||
float *outLon); /* Can be NULL */
|
float * outLat, /* Can be NULL */
|
||||||
|
float * outLon); /* Can be NULL */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetFMSEntryInfo
|
* XPLMSetFMSEntryInfo
|
||||||
@@ -316,8 +302,10 @@ XPLM_API void XPLMGetFMSEntryInfo(int inIndex,
|
|||||||
* support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
|
* support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void
|
XPLM_API void XPLMSetFMSEntryInfo(
|
||||||
XPLMSetFMSEntryInfo(int inIndex, XPLMNavRef inRef, int inAltitude);
|
int inIndex,
|
||||||
|
XPLMNavRef inRef,
|
||||||
|
int inAltitude);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetFMSEntryLatLon
|
* XPLMSetFMSEntryLatLon
|
||||||
@@ -326,7 +314,8 @@ XPLM_API void
|
|||||||
* coordinates.
|
* coordinates.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetFMSEntryLatLon(int inIndex,
|
XPLM_API void XPLMSetFMSEntryLatLon(
|
||||||
|
int inIndex,
|
||||||
float inLat,
|
float inLat,
|
||||||
float inLon,
|
float inLon,
|
||||||
int inAltitude);
|
int inAltitude);
|
||||||
@@ -338,7 +327,8 @@ XPLM_API void XPLMSetFMSEntryLatLon(int inIndex,
|
|||||||
* plan.
|
* plan.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMClearFMSEntry(int inIndex);
|
XPLM_API void XPLMClearFMSEntry(
|
||||||
|
int inIndex);
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* GPS RECEIVER
|
* GPS RECEIVER
|
||||||
@@ -348,7 +338,6 @@ XPLM_API void XPLMClearFMSEntry(int inIndex);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMGetGPSDestinationType
|
* XPLMGetGPSDestinationType
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -2,18 +2,22 @@
|
|||||||
#define _XPLMPlanes_h_
|
#define _XPLMPlanes_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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.
|
* 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.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "XPLMDefs.h"
|
#include "XPLMDefs.h"
|
||||||
@@ -25,11 +29,6 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* USER AIRCRAFT ACCESS
|
* USER AIRCRAFT ACCESS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetUsersAircraft
|
* XPLMSetUsersAircraft
|
||||||
@@ -39,26 +38,44 @@ extern "C" {
|
|||||||
* (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
|
* XPLMPlaceUserAtAirport
|
||||||
*
|
*
|
||||||
* This routine places the user at a given airport. Specify the airport by
|
* 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
|
* GLOBAL AIRCRAFT ACCESS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* The user's aircraft is always index 0. */
|
/* The user's aircraft is always index 0. */
|
||||||
#define XPLM_USER_AIRCRAFT 0
|
#define XPLM_USER_AIRCRAFT 0
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/*
|
/*
|
||||||
* XPLMPlaneDrawState_t
|
* XPLMPlaneDrawState_t
|
||||||
*
|
*
|
||||||
@@ -100,6 +117,7 @@ typedef struct {
|
|||||||
/* Total Roll input for this plane. */
|
/* Total Roll input for this plane. */
|
||||||
float yokeRoll;
|
float yokeRoll;
|
||||||
} XPLMPlaneDrawState_t;
|
} XPLMPlaneDrawState_t;
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
/*
|
/*
|
||||||
* XPLMCountAircraft
|
* XPLMCountAircraft
|
||||||
*
|
*
|
||||||
@@ -110,9 +128,10 @@ typedef struct {
|
|||||||
* 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,
|
XPLM_API void XPLMCountAircraft(
|
||||||
int *outActiveAircraft,
|
int * outTotalAircraft,
|
||||||
XPLMPluginID *outController);
|
int * outActiveAircraft,
|
||||||
|
XPLMPluginID * outController);
|
||||||
/*
|
/*
|
||||||
* XPLMGetNthAircraftModel
|
* XPLMGetNthAircraftModel
|
||||||
*
|
*
|
||||||
@@ -122,8 +141,10 @@ XPLM_API void XPLMCountAircraft(int *outTotalAircraft,
|
|||||||
* length.
|
* length.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void
|
XPLM_API void XPLMGetNthAircraftModel(
|
||||||
XPLMGetNthAircraftModel(int inIndex, char *outFileName, char *outPath);
|
int inIndex,
|
||||||
|
char * outFileName,
|
||||||
|
char * outPath);
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* EXCLUSIVE AIRCRAFT ACCESS
|
* EXCLUSIVE AIRCRAFT ACCESS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@@ -142,25 +163,30 @@ XPLM_API void
|
|||||||
* multiplayer.
|
* multiplayer.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void (*XPLMPlanesAvailable_f)(void *inRefcon);
|
typedef void (* XPLMPlanesAvailable_f)(
|
||||||
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMAcquirePlanes
|
* XPLMAcquirePlanes
|
||||||
*
|
*
|
||||||
* XPLMAcquirePlanes grants your plugin exclusive access to the aircraft. It
|
* 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
|
* returns 1 if you gain access, 0 if you do not.
|
||||||
* 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
|
* inAircraft - pass in an array of pointers to strings specifying the planes
|
||||||
* strings should be full paths with the .acf extension. NULL terminates this
|
* you want loaded. For any plane index you do not want loaded, pass a
|
||||||
* array, or pass NULL if there are no planes you want loaded. If you pass in
|
* 0-length string. Other strings should be full paths with the .acf
|
||||||
* a callback and do not receive access to the planes your callback will be
|
* extension. NULL terminates this array, or pass NULL if there are no planes
|
||||||
* called when the airplanes are available. If you do receive airplane access,
|
* you want loaded.
|
||||||
* your callback will not be called.
|
*
|
||||||
|
* 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 */
|
XPLM_API int XPLMAcquirePlanes(
|
||||||
|
char ** inAircraft, /* Can be NULL */
|
||||||
XPLMPlanesAvailable_f inCallback,
|
XPLMPlanesAvailable_f inCallback,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMReleasePlanes
|
* XPLMReleasePlanes
|
||||||
@@ -179,7 +205,8 @@ XPLM_API void XPLMReleasePlanes(void);
|
|||||||
* planes available is actually used.
|
* planes available is actually used.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSetActiveAircraftCount(int inCount);
|
XPLM_API void XPLMSetActiveAircraftCount(
|
||||||
|
int inCount);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetAircraftModel
|
* XPLMSetAircraftModel
|
||||||
@@ -190,7 +217,9 @@ XPLM_API void XPLMSetActiveAircraftCount(int inCount);
|
|||||||
* (use XPLMSetUsersAircraft to load the user's aircracft).
|
* (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
|
* XPLMDisableAIForPlane
|
||||||
@@ -199,11 +228,17 @@ XPLM_API void XPLMSetAircraftModel(int inIndex, const char *inAircraftPath);
|
|||||||
* 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
|
* 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
|
* 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
|
* 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
|
* and the orientation of the plane. A 1 for full drawing indicates that the
|
||||||
@@ -211,7 +246,8 @@ XPLM_API void XPLMDisableAIForPlane(int inPlaneIndex);
|
|||||||
* 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,
|
XPLM_API void XPLMDrawAircraft(
|
||||||
|
int inPlaneIndex,
|
||||||
float inX,
|
float inX,
|
||||||
float inY,
|
float inY,
|
||||||
float inZ,
|
float inZ,
|
||||||
@@ -219,15 +255,20 @@ XPLM_API void XPLMDrawAircraft(int inPlaneIndex,
|
|||||||
float inRoll,
|
float inRoll,
|
||||||
float inYaw,
|
float inYaw,
|
||||||
int inFullDraw,
|
int inFullDraw,
|
||||||
XPLMPlaneDrawState_t *inDrawStateInfo);
|
XPLMPlaneDrawState_t * inDrawStateInfo);
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
|
||||||
|
#if defined(XPLM_DEPRECATED)
|
||||||
/*
|
/*
|
||||||
* XPLMReinitUsersPlane
|
* XPLMReinitUsersPlane
|
||||||
*
|
*
|
||||||
|
* WARNING: DO NOT USE. Use XPLMPlaceUserAtAirport or
|
||||||
|
* XPLMPlaceUserAtLocation.
|
||||||
|
*
|
||||||
* This function recomputes the derived flight model data from the aircraft
|
* 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
|
* structure in memory. If you have used the data access layer to modify the
|
||||||
* aircraft structure, use this routine to resynchronize x-plane; since
|
* aircraft structure, use this routine to resynchronize X-Plane; since
|
||||||
* X-plane works at least partly from derived values, the sim will not behave
|
* X-Plane works at least partly from derived values, the sim will not behave
|
||||||
* properly until this is called.
|
* properly until this is called.
|
||||||
*
|
*
|
||||||
* WARNING: this routine does not necessarily place the airplane at the
|
* WARNING: this routine does not necessarily place the airplane at the
|
||||||
@@ -237,6 +278,7 @@ XPLM_API void XPLMDrawAircraft(int inPlaneIndex,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMReinitUsersPlane(void);
|
XPLM_API void XPLMReinitUsersPlane(void);
|
||||||
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
#define _XPLMPlugin_h_
|
#define _XPLMPlugin_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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
|
* These APIs provide facilities to find and work with other plugins and
|
||||||
* manage other plugins.
|
* manage other plugins.
|
||||||
@@ -60,7 +60,8 @@ XPLM_API int XPLMCountPlugins(void);
|
|||||||
* order.
|
* order.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMPluginID XPLMGetNthPlugin(int inIndex);
|
XPLM_API XPLMPluginID XPLMGetNthPlugin(
|
||||||
|
int inIndex);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMFindPluginByPath
|
* XPLMFindPluginByPath
|
||||||
@@ -70,7 +71,8 @@ XPLM_API XPLMPluginID XPLMGetNthPlugin(int inIndex);
|
|||||||
* 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
|
* XPLMFindPluginBySignature
|
||||||
@@ -83,14 +85,15 @@ XPLM_API XPLMPluginID XPLMFindPluginByPath(const char *inPath);
|
|||||||
* 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
|
* XPLMGetPluginInfo
|
||||||
*
|
*
|
||||||
* This routine returns information about a plug-in. Each parameter should be
|
* 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
|
* a pointer to a buffer of at least
|
||||||
* the information.
|
* 256 characters, or NULL to not receive the information.
|
||||||
*
|
*
|
||||||
* outName - the human-readable name of the plug-in. outFilePath - the
|
* outName - the human-readable name of the plug-in. outFilePath - the
|
||||||
* absolute file path to the file that contains this plug-in. outSignature - a
|
* absolute file path to the file that contains this plug-in. outSignature - a
|
||||||
@@ -98,11 +101,12 @@ XPLM_API XPLMPluginID XPLMFindPluginBySignature(const char *inSignature);
|
|||||||
* human-readable description of this plug-in.
|
* human-readable description of this plug-in.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMGetPluginInfo(XPLMPluginID inPlugin,
|
XPLM_API void XPLMGetPluginInfo(
|
||||||
char *outName, /* Can be NULL */
|
XPLMPluginID inPlugin,
|
||||||
char *outFilePath, /* Can be NULL */
|
char * outName, /* Can be NULL */
|
||||||
char *outSignature, /* Can be NULL */
|
char * outFilePath, /* Can be NULL */
|
||||||
char *outDescription); /* Can be NULL */
|
char * outSignature, /* Can be NULL */
|
||||||
|
char * outDescription); /* Can be NULL */
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* ENABLING/DISABLING PLUG-INS
|
* ENABLING/DISABLING PLUG-INS
|
||||||
@@ -120,7 +124,8 @@ XPLM_API void XPLMGetPluginInfo(XPLMPluginID inPlugin,
|
|||||||
* 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
|
* XPLMEnablePlugin
|
||||||
@@ -131,7 +136,8 @@ XPLM_API int XPLMIsPluginEnabled(XPLMPluginID inPluginID);
|
|||||||
* 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
|
* XPLMDisablePlugin
|
||||||
@@ -139,7 +145,8 @@ XPLM_API int XPLMEnablePlugin(XPLMPluginID inPluginID);
|
|||||||
* 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
|
* XPLMReloadPlugins
|
||||||
@@ -160,6 +167,21 @@ XPLM_API void XPLMReloadPlugins(void);
|
|||||||
* Plugin messages are defined as 32-bit integers. Messages below 0x00FFFFFF
|
* Plugin messages are defined as 32-bit integers. Messages below 0x00FFFFFF
|
||||||
* are reserved for X-Plane and the plugin SDK.
|
* 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
|
* Messages have two conceptual uses: notifications and commands. Commands
|
||||||
* are sent from one plugin to another to induce behavior; notifications are
|
* are sent from one plugin to another to induce behavior; notifications are
|
||||||
* sent from one plugin to all others for informational purposes. It is
|
* sent from one plugin to all others for informational purposes. It is
|
||||||
@@ -171,38 +193,41 @@ XPLM_API void XPLMReloadPlugins(void);
|
|||||||
* (e.g. be greater or equal to unsigned 0x8000000) while commands should have
|
* (e.g. be greater or equal to unsigned 0x8000000) while commands should have
|
||||||
* this bit be cleared.
|
* 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
|
#define XPLM_MSG_PLANE_CRASHED 101
|
||||||
|
|
||||||
/* This message is sent to your plugin whenever a new plane is loaded. The *
|
/* 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 *
|
* parameter contains the index number of the plane being loaded; 0 indicates *
|
||||||
* plane. */
|
* the user's plane. */
|
||||||
#define XPLM_MSG_PLANE_LOADED 102
|
#define XPLM_MSG_PLANE_LOADED 102
|
||||||
|
|
||||||
/* This messages is called whenever the user's plane is positioned at a new *
|
/* This messages is sent whenever the user's plane is positioned at a new *
|
||||||
* airport. */
|
* airport. The parameter is ignored. */
|
||||||
#define XPLM_MSG_AIRPORT_LOADED 103
|
#define XPLM_MSG_AIRPORT_LOADED 103
|
||||||
|
|
||||||
/* This message is sent whenever new scenery is loaded. Use datarefs to *
|
/* This message is sent whenever new scenery is loaded. Use datarefs to *
|
||||||
* determine the new scenery files that were loaded. */
|
* determine the new scenery files that were loaded. The parameter is ignored.*/
|
||||||
#define XPLM_MSG_SCENERY_LOADED 104
|
#define XPLM_MSG_SCENERY_LOADED 104
|
||||||
|
|
||||||
/* This message is sent whenever the user adjusts the number of X-Plane *
|
/* 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 *
|
* 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 *
|
* are now available. This message will only be sent in XP7 and higher *
|
||||||
* because in XP6 the number of aircraft is not user-adjustable. */
|
* because in XP6 the number of aircraft is not user-adjustable. The parameter*
|
||||||
|
* is ignored. */
|
||||||
#define XPLM_MSG_AIRPLANE_COUNT_CHANGED 105
|
#define XPLM_MSG_AIRPLANE_COUNT_CHANGED 105
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/* This message is sent to your plugin whenever a plane is unloaded. The *
|
/* 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 *
|
* parameter contains the index number of the plane being unloaded; 0 *
|
||||||
* plane. The parameter is of type int, passed as the value of the pointer. *
|
* indicates the user's plane. The parameter is of type int, passed as the *
|
||||||
* (That is: the parameter is an int, not a pointer to an int.) */
|
* value of the pointer. (That is: the parameter is an int, not a pointer to *
|
||||||
|
* an int.) */
|
||||||
#define XPLM_MSG_PLANE_UNLOADED 106
|
#define XPLM_MSG_PLANE_UNLOADED 106
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
|
|
||||||
@@ -210,20 +235,49 @@ XPLM_API void XPLMReloadPlugins(void);
|
|||||||
/* This message is sent to your plugin right before X-Plane writes its *
|
/* 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 file. You can use this for two purposes: to write your own *
|
||||||
* preferences, and to modify any datarefs to influence preferences output. *
|
* preferences, and to modify any datarefs to influence preferences output. *
|
||||||
* For example, if your plugin temporarily modifies saved preferences, you can *
|
* 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 *
|
* 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. */
|
* 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
|
#define XPLM_MSG_WILL_WRITE_PREFS 107
|
||||||
#endif /* XPLM210 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
/* This message is sent to your plugin right after a livery is loaded for an *
|
/* 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 *
|
* 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 *
|
* react accordingly. The parameter contains the index number of the aircraft*
|
||||||
* pointer and represents the aicraft plane number - 0 is the user's plane. */
|
* whose livery is changing. */
|
||||||
#define XPLM_MSG_LIVERY_LOADED 108
|
#define XPLM_MSG_LIVERY_LOADED 108
|
||||||
#endif /* XPLM210 */
|
#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
|
* XPLMSendMessageToPlugin
|
||||||
*
|
*
|
||||||
@@ -232,9 +286,10 @@ XPLM_API void XPLMReloadPlugins(void);
|
|||||||
* a message receive function receive the message.
|
* a message receive function receive the message.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMSendMessageToPlugin(XPLMPluginID inPlugin,
|
XPLM_API void XPLMSendMessageToPlugin(
|
||||||
|
XPLMPluginID inPlugin,
|
||||||
int inMessage,
|
int inMessage,
|
||||||
void *inParam);
|
void * inParam);
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@@ -250,6 +305,55 @@ XPLM_API void XPLMSendMessageToPlugin(XPLMPluginID inPlugin,
|
|||||||
* 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.
|
* 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.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -261,7 +365,9 @@ XPLM_API void XPLMSendMessageToPlugin(XPLMPluginID inPlugin,
|
|||||||
* 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
|
* XPLMHasFeature
|
||||||
@@ -270,7 +376,8 @@ typedef void (*XPLMFeatureEnumerator_f)(const char *inFeature, void *inRef);
|
|||||||
* 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
|
* XPLMIsFeatureEnabled
|
||||||
@@ -280,7 +387,8 @@ XPLM_API int XPLMHasFeature(const char *inFeature);
|
|||||||
* feature.
|
* feature.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMIsFeatureEnabled(const char *inFeature);
|
XPLM_API int XPLMIsFeatureEnabled(
|
||||||
|
const char * inFeature);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMEnableFeature
|
* XPLMEnableFeature
|
||||||
@@ -290,7 +398,9 @@ XPLM_API int XPLMIsFeatureEnabled(const char *inFeature);
|
|||||||
* 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
|
* XPLMEnumerateFeatures
|
||||||
@@ -300,8 +410,9 @@ XPLM_API void XPLMEnableFeature(const char *inFeature, int inEnable);
|
|||||||
* the features that X-Plane can support.
|
* the features that X-Plane can support.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMEnumerateFeatures(XPLMFeatureEnumerator_f inEnumerator,
|
XPLM_API void XPLMEnumerateFeatures(
|
||||||
void *inRef);
|
XPLMFeatureEnumerator_f inEnumerator,
|
||||||
|
void * inRef);
|
||||||
|
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -2,23 +2,38 @@
|
|||||||
#define _XPLMProcessing_h_
|
#define _XPLMProcessing_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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
|
* 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
|
* 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.
|
* and performing I/O.
|
||||||
*
|
*
|
||||||
|
* 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
|
* WARNING: Do NOT use these callbacks to draw! You cannot draw during flight
|
||||||
* loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
* loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
||||||
* for graphics.
|
* for graphics. (One exception: you can use a post-flight loop callback to
|
||||||
|
* update your own off-screen FBOs.)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -31,11 +46,6 @@ extern "C" {
|
|||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* FLIGHT LOOP CALLBACKS
|
* FLIGHT LOOP CALLBACKS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
/*
|
/*
|
||||||
@@ -47,11 +57,10 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* Your callback runs before X-Plane integrates the flight model. */
|
/* Your callback runs before X-Plane integrates the flight model. */
|
||||||
xplm_FlightLoop_Phase_BeforeFlightModel = 0
|
xplm_FlightLoop_Phase_BeforeFlightModel = 0,
|
||||||
|
|
||||||
/* Your callback runs after X-Plane integrates the flight model. */
|
/* Your callback runs after X-Plane integrates the flight model. */
|
||||||
,
|
xplm_FlightLoop_Phase_AfterFlightModel = 1,
|
||||||
xplm_FlightLoop_Phase_AfterFlightModel = 1
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -67,36 +76,47 @@ typedef int XPLMFlightLoopPhaseType;
|
|||||||
* flight loop APIs.
|
* flight loop APIs.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void *XPLMFlightLoopID;
|
typedef void * XPLMFlightLoopID;
|
||||||
#endif /* XPLM210 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMFlightLoop_f
|
* XPLMFlightLoop_f
|
||||||
*
|
*
|
||||||
* This is your flight loop callback. Each time the flight loop is iterated
|
* 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
|
* through, you receive this call at the end.
|
||||||
* 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
|
* Flight loop callbacks receive a number of input timing parameters. These
|
||||||
* receiving callbacks. Pass a positive number to specify how many seconds
|
* input timing parameters are not particularly useful; you may need to track
|
||||||
* until the next callback. (You will be called at or after this time, not
|
* your own timing data (e.g. by reading datarefs). The input parameters are:
|
||||||
* 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
|
* - inElapsedSinceLastCall: the wall time since your last callback.
|
||||||
* to run your flight loop as infrequently as is practical, and suspend it
|
* - 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
|
* (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
|
* Your callback will NOT be unregistered if you return 0; it will merely be
|
||||||
* inactive.
|
* inactive.
|
||||||
*
|
*
|
||||||
* The reference constant you passed to your loop is passed back to you.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
typedef float (*XPLMFlightLoop_f)(float inElapsedSinceLastCall,
|
typedef float (* XPLMFlightLoop_f)(
|
||||||
|
float inElapsedSinceLastCall,
|
||||||
float inElapsedTimeSinceLastFlightLoop,
|
float inElapsedTimeSinceLastFlightLoop,
|
||||||
int inCounter,
|
int inCounter,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
/*
|
/*
|
||||||
@@ -111,7 +131,7 @@ typedef struct {
|
|||||||
int structSize;
|
int structSize;
|
||||||
XPLMFlightLoopPhaseType phase;
|
XPLMFlightLoopPhaseType phase;
|
||||||
XPLMFlightLoop_f callbackFunc;
|
XPLMFlightLoop_f callbackFunc;
|
||||||
void *refcon;
|
void * refcon;
|
||||||
} XPLMCreateFlightLoop_t;
|
} XPLMCreateFlightLoop_t;
|
||||||
#endif /* XPLM210 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
@@ -119,7 +139,12 @@ typedef struct {
|
|||||||
* XPLMGetElapsedTime
|
* XPLMGetElapsedTime
|
||||||
*
|
*
|
||||||
* This routine returns the elapsed time since the sim started up in decimal
|
* 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);
|
||||||
@@ -138,26 +163,34 @@ XPLM_API int XPLMGetCycleNumber(void);
|
|||||||
*
|
*
|
||||||
* This routine registers your flight loop callback. Pass in a pointer to a
|
* 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
|
* flight loop function and a refcon. inInterval defines when you will be
|
||||||
* called. Pass in a positive number to specify seconds from registration
|
* called. Pass in a positive number to specify seconds from registration time
|
||||||
* time to the next callback. Pass in a negative number to indicate when you
|
* to the next callback. Pass in a negative number to indicate when you will
|
||||||
* will be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to
|
* be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to not be
|
||||||
* not be called; your callback will be inactive.
|
* 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,
|
XPLM_API void XPLMRegisterFlightLoopCallback(
|
||||||
|
XPLMFlightLoop_f inFlightLoop,
|
||||||
float inInterval,
|
float inInterval,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMUnregisterFlightLoopCallback
|
* XPLMUnregisterFlightLoopCallback
|
||||||
*
|
*
|
||||||
* This routine unregisters your flight loop callback. Do NOT call it from
|
* This routine unregisters your flight loop callback. Do NOT call it from
|
||||||
* your flight loop callback. Once your flight loop callback is
|
* your flight loop callback. Once your flight loop callback is unregistered,
|
||||||
* unregistered, it will not be called again.
|
* it will not be called again.
|
||||||
|
*
|
||||||
|
* Only use this on flight loops registered via
|
||||||
|
* XPLMRegisterFlightLoopCallback.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMUnregisterFlightLoopCallback(XPLMFlightLoop_f inFlightLoop,
|
XPLM_API void XPLMUnregisterFlightLoopCallback(
|
||||||
void *inRefcon);
|
XPLMFlightLoop_f inFlightLoop,
|
||||||
|
void * inRefcon);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMSetFlightLoopCallbackInterval
|
* XPLMSetFlightLoopCallbackInterval
|
||||||
@@ -173,10 +206,11 @@ XPLM_API void XPLMUnregisterFlightLoopCallback(XPLMFlightLoop_f inFlightLoop,
|
|||||||
* 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,
|
XPLM_API void XPLMSetFlightLoopCallbackInterval(
|
||||||
|
XPLMFlightLoop_f inFlightLoop,
|
||||||
float inInterval,
|
float inInterval,
|
||||||
int inRelativeToNow,
|
int inRelativeToNow,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
/*
|
/*
|
||||||
@@ -187,18 +221,20 @@ XPLM_API void XPLMSetFlightLoopCallbackInterval(XPLMFlightLoop_f inFlightLoop,
|
|||||||
* unscheduled.
|
* unscheduled.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMFlightLoopID
|
XPLM_API XPLMFlightLoopID XPLMCreateFlightLoop(
|
||||||
XPLMCreateFlightLoop(XPLMCreateFlightLoop_t *inParams);
|
XPLMCreateFlightLoop_t * inParams);
|
||||||
#endif /* XPLM210 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
/*
|
/*
|
||||||
* XPLMDestroyFlightLoop
|
* 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 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
@@ -214,29 +250,9 @@ XPLM_API void XPLMDestroyFlightLoop(XPLMFlightLoopID inFlightLoopID);
|
|||||||
* routine is called; otherwise they are relative to the last call time or the
|
* routine is called; otherwise they are relative to the last call time or the
|
||||||
* time the flight loop was registered (if never called).
|
* 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.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMScheduleFlightLoop(XPLMFlightLoopID inFlightLoopID,
|
XPLM_API void XPLMScheduleFlightLoop(
|
||||||
|
XPLMFlightLoopID inFlightLoopID,
|
||||||
float inInterval,
|
float inInterval,
|
||||||
int inRelativeToNow);
|
int inRelativeToNow);
|
||||||
#endif /* XPLM210 */
|
#endif /* XPLM210 */
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
#define _XPLMScenery_h_
|
#define _XPLMScenery_h_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
* Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
*
|
* license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
@@ -27,24 +27,27 @@ extern "C" {
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* The Y-testing API allows you to locate the physical scenery mesh. This
|
* 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
|
* would be used to place dynamic graphics on top of the ground in a plausible
|
||||||
* plausible way or do physics interactions.
|
* way or do physics interactions.
|
||||||
*
|
*
|
||||||
* The Y-test API works via probe objects, which are allocated by your plugin
|
* 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
|
* and used to query terrain. Probe objects exist both to capture which
|
||||||
* algorithm you have requested (see probe types) and also to cache query
|
* algorithm you have requested (see probe types) and also to cache query
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
* Performance guidelines: It is generally faster to use the same probe for
|
* Performance Guidelines
|
||||||
* 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
|
* It is generally faster to use the same probe for nearby points and
|
||||||
* via caching when possible.
|
* 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
|
* 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
|
* 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
|
* that point. The velocity vector tells you if that terrain is moving (and is
|
||||||
* is in meters/second). For example, if your Y test hits the aircraft carrier
|
* 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.
|
* 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,
|
* Note: the Y-testing API is limited to probing the loaded scenery area,
|
||||||
@@ -63,9 +66,9 @@ extern "C" {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The Y probe gives you the location of the tallest physical scenery along
|
/* The Y probe gives you the location of the tallest physical scenery along *
|
||||||
* * the Y axis going through the queried point. */
|
* the Y axis going through the queried point. */
|
||||||
xplm_ProbeY = 0
|
xplm_ProbeY = 0,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -79,18 +82,15 @@ typedef int XPLMProbeType;
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* The probe hit terrain and returned valid values. */
|
/* The probe hit terrain and returned valid values. */
|
||||||
xplm_ProbeHitTerrain = 0
|
xplm_ProbeHitTerrain = 0,
|
||||||
|
|
||||||
/* An error in the API call. Either the probe struct size is bad, or the *
|
/* 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.
|
* probe is invalid or the type is mismatched for the specific query call. */
|
||||||
*/
|
xplm_ProbeError = 1,
|
||||||
,
|
|
||||||
xplm_ProbeError = 1
|
|
||||||
|
|
||||||
/* The probe call succeeded but there is no terrain under this point
|
/* The probe call succeeded but there is no terrain under this point (perhaps *
|
||||||
* (perhaps * it is off the side of the planet?) */
|
* it is off the side of the planet?) */
|
||||||
,
|
xplm_ProbeMissed = 2,
|
||||||
xplm_ProbeMissed = 2
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -103,7 +103,7 @@ typedef int XPLMProbeResult;
|
|||||||
* terrain.
|
* terrain.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void *XPLMProbeRef;
|
typedef void * XPLMProbeRef;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMProbeInfo_t
|
* XPLMProbeInfo_t
|
||||||
@@ -146,7 +146,8 @@ typedef struct {
|
|||||||
* 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
|
* XPLMDestroyProbe
|
||||||
@@ -154,7 +155,8 @@ XPLM_API XPLMProbeRef XPLMCreateProbe(XPLMProbeType inProbeType);
|
|||||||
* Deallocates an existing probe object.
|
* Deallocates an existing probe object.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMDestroyProbe(XPLMProbeRef inProbe);
|
XPLM_API void XPLMDestroyProbe(
|
||||||
|
XPLMProbeRef inProbe);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPLMProbeTerrainXYZ
|
* XPLMProbeTerrainXYZ
|
||||||
@@ -165,13 +167,65 @@ XPLM_API void XPLMDestroyProbe(XPLMProbeRef inProbe);
|
|||||||
* is returned.
|
* is returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API XPLMProbeResult XPLMProbeTerrainXYZ(XPLMProbeRef inProbe,
|
XPLM_API XPLMProbeResult XPLMProbeTerrainXYZ(
|
||||||
|
XPLMProbeRef inProbe,
|
||||||
float inX,
|
float inX,
|
||||||
float inY,
|
float inY,
|
||||||
float inZ,
|
float inZ,
|
||||||
XPLMProbeInfo_t *outInfo);
|
XPLMProbeInfo_t * outInfo);
|
||||||
|
|
||||||
#endif /* XPLM200 */
|
#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
|
* Object Drawing
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@@ -192,7 +246,7 @@ XPLM_API XPLMProbeResult XPLMProbeTerrainXYZ(XPLMProbeRef inProbe,
|
|||||||
* into memory.
|
* into memory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void *XPLMObjectRef;
|
typedef void * XPLMObjectRef;
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
@@ -236,25 +290,26 @@ typedef struct {
|
|||||||
* ever called, the SDK will release the object handle for you.
|
* 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 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/*
|
/*
|
||||||
* XPLMLoadObject
|
* 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.
|
* 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
|
* 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
|
* call unload once for every load to avoid "leaking" objects. The object will
|
||||||
* will be purged from memory when no plugins and no scenery are using it.
|
* 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 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 ./
|
* 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
|
* 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!
|
* discouraged - your plugin should not dump art resources in the root folder!
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* XPLMLoadObject will return NULL if the object cannot be loaded (either
|
* XPLMLoadObject will return NULL if the object cannot be loaded (either
|
||||||
* because it is not found or the file is misformatted). This routine will
|
* 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.
|
* load any object that can be used in the X-Plane scenery system.
|
||||||
@@ -264,7 +319,8 @@ typedef void (*XPLMObjectLoaded_f)(XPLMObjectRef inObject, void *inRefcon);
|
|||||||
* defer object loading until the sim has fully started.
|
* 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 */
|
#endif /* XPLM200 */
|
||||||
|
|
||||||
#if defined(XPLM210)
|
#if defined(XPLM210)
|
||||||
@@ -273,8 +329,8 @@ XPLM_API XPLMObjectRef XPLMLoadObject(const char *inPath);
|
|||||||
*
|
*
|
||||||
* This routine loads an object asynchronously; control is returned to you
|
* This routine loads an object asynchronously; control is returned to you
|
||||||
* immediately while X-Plane loads the object. The sim will not stop flying
|
* 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
|
* while the object loads. For large objects, it may be several seconds before
|
||||||
* before the load finishes.
|
* the load finishes.
|
||||||
*
|
*
|
||||||
* You provide a callback function that is called once the load has completed.
|
* 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
|
* Note that if the object cannot be loaded, you will not find out until the
|
||||||
@@ -285,15 +341,19 @@ XPLM_API XPLMObjectRef XPLMLoadObject(const char *inPath);
|
|||||||
* desired.
|
* desired.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMLoadObjectAsync(const char *inPath,
|
XPLM_API void XPLMLoadObjectAsync(
|
||||||
|
const char * inPath,
|
||||||
XPLMObjectLoaded_f inCallback,
|
XPLMObjectLoaded_f inCallback,
|
||||||
void *inRefcon);
|
void * inRefcon);
|
||||||
#endif /* XPLM210 */
|
#endif /* XPLM210 */
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM_DEPRECATED)
|
||||||
/*
|
/*
|
||||||
* XPLMDrawObjects
|
* XPLMDrawObjects
|
||||||
*
|
*
|
||||||
|
* __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
|
* 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
|
* pass in the object and an array of XPLMDrawInfo_t structs, one for each
|
||||||
* place you would like the object to be drawn.
|
* place you would like the object to be drawn.
|
||||||
@@ -302,25 +362,25 @@ XPLM_API void XPLMLoadObjectAsync(const char *inPath,
|
|||||||
* will pick the appropriate LOD.
|
* will pick the appropriate LOD.
|
||||||
*
|
*
|
||||||
* Lighting is a boolean; pass 1 to show the night version of object with
|
* 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
|
* night-only lights lit up. Pass 0 to show the daytime version of the object.
|
||||||
* object.
|
|
||||||
*
|
*
|
||||||
* earth_relative controls the coordinate system. If this is 1, the rotations
|
* earth_relative controls the coordinate system. If this is 1, the rotations
|
||||||
* you specify are applied to the object after its coordinate system is
|
* you specify are applied to the object after its coordinate system is
|
||||||
* transformed from local to earth-relative coordinates -- that is, an object
|
* 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
|
* 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
|
* against gravity. If this is 0, the object is drawn with your rotations from
|
||||||
* from local coordanates -- that is, an object with no rotations is drawn
|
* local coordanates -- that is, an object with no rotations is drawn pointing
|
||||||
* pointing down the -Z axis and the Y axis of the object matches the local
|
* down the -Z axis and the Y axis of the object matches the local coordinate
|
||||||
* coordinate Y axis.
|
* Y axis.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMDrawObjects(XPLMObjectRef inObject,
|
XPLM_API void XPLMDrawObjects(
|
||||||
|
XPLMObjectRef inObject,
|
||||||
int inCount,
|
int inCount,
|
||||||
XPLMDrawInfo_t *inLocations,
|
XPLMDrawInfo_t * inLocations,
|
||||||
int lighting,
|
int lighting,
|
||||||
int earth_relative);
|
int earth_relative);
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM_DEPRECATED */
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
/*
|
/*
|
||||||
@@ -332,7 +392,8 @@ XPLM_API void XPLMDrawObjects(XPLMObjectRef inObject,
|
|||||||
* successful call to XPLMLoadObject.
|
* successful call to XPLMLoadObject.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API void XPLMUnloadObject(XPLMObjectRef inObject);
|
XPLM_API void XPLMUnloadObject(
|
||||||
|
XPLMObjectRef inObject);
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
|
|
||||||
#if defined(XPLM200)
|
#if defined(XPLM200)
|
||||||
@@ -356,15 +417,17 @@ XPLM_API void XPLMUnloadObject(XPLMObjectRef inObject);
|
|||||||
* 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
|
* XPLMLookupObjects
|
||||||
*
|
*
|
||||||
* This routine looks up a virtual path in the library system and returns all
|
* 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
|
* matching elements. You provide a callback - one virtual path may match many
|
||||||
* many objects in the library. XPLMLookupObjects returns the number of
|
* objects in the library. XPLMLookupObjects returns the number of objects
|
||||||
* objects found.
|
* found.
|
||||||
*
|
*
|
||||||
* The latitude and longitude parameters specify the location the object will
|
* The latitude and longitude parameters specify the location the object will
|
||||||
* be used. The library system allows for scenery packages to only provide
|
* be used. The library system allows for scenery packages to only provide
|
||||||
@@ -372,11 +435,12 @@ typedef void (*XPLMLibraryEnumerator_f)(const char *inFilePath, void *inRef);
|
|||||||
* latitude/longitude you provide will be returned.
|
* latitude/longitude you provide will be returned.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
XPLM_API int XPLMLookupObjects(const char *inPath,
|
XPLM_API int XPLMLookupObjects(
|
||||||
|
const char * inPath,
|
||||||
float inLatitude,
|
float inLatitude,
|
||||||
float inLongitude,
|
float inLongitude,
|
||||||
XPLMLibraryEnumerator_f enumerator,
|
XPLMLibraryEnumerator_f enumerator,
|
||||||
void *ref);
|
void * ref);
|
||||||
|
|
||||||
#endif /* XPLM200 */
|
#endif /* XPLM200 */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
+698
-557
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPStandardWidgets;
|
UNIT XPStandardWidgets;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
XPStandardWidgets - THEORY OF OPERATION
|
## THEORY OF OPERATION
|
||||||
|
|
||||||
The standard widgets are widgets built into the widgets library. While you
|
The standard widgets are widgets built into the widgets library. While you
|
||||||
can gain access to the widget function that drives them, you generally use
|
can gain access to the widget function that drives them, you generally use
|
||||||
@@ -20,27 +17,24 @@ INTERFACE
|
|||||||
performs an event; these messages are sent up the widget hierarchy until
|
performs an event; these messages are sent up the widget hierarchy until
|
||||||
they are handled. So you can add a widget proc directly to a push button
|
they are handled. So you can add a widget proc directly to a push button
|
||||||
(for example) to intercept the message when it is clicked, or you can put
|
(for example) to intercept the message when it is clicked, or you can put
|
||||||
one widget proc on a window for all of the push buttons in the window.
|
one widget proc on a window for all of the push buttons in the window. Most
|
||||||
Most of these messages contain the original widget ID as a parameter so you
|
of these messages contain the original widget ID as a parameter so you can
|
||||||
can know which widget is messaging no matter who it is sent to.
|
know which widget is messaging no matter who it is sent to.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPWidgetDefs;
|
USES
|
||||||
|
XPWidgetDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* MAIN WINDOW
|
* MAIN WINDOW
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
The main window widget class provides a "window" as the user knows it.
|
The main window widget class provides a "window" as the user knows it.
|
||||||
These windows are dragable and can be selected. Use them to create
|
These windows are dragable and can be selected. Use them to create floating
|
||||||
floating windows and non-modal dialogs.
|
windows and non-modal dialogs.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_MainWindow = 1;
|
xpWidgetClass_MainWindow = 1;
|
||||||
|
|
||||||
@@ -58,7 +52,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
Main Window Properties
|
Main Window Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This property specifies the type of window. Set to one of the main window }
|
{ This property specifies the type of window. Set to one of the main window }
|
||||||
{ types above. }
|
{ types above. }
|
||||||
@@ -71,7 +64,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
MainWindow Messages
|
MainWindow Messages
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This message is sent when the close buttons are pressed for your window. }
|
{ This message is sent when the close buttons are pressed for your window. }
|
||||||
xpMessage_CloseButtonPushed = 1200
|
xpMessage_CloseButtonPushed = 1200
|
||||||
@@ -81,13 +73,12 @@ CONST
|
|||||||
* SUB WINDOW
|
* SUB WINDOW
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
X-plane dialogs are divided into separate areas; the sub window widgets
|
X-Plane dialogs are divided into separate areas; the sub window widgets
|
||||||
allow you to make these areas. Create one main window and place several
|
allow you to make these areas. Create one main window and place several
|
||||||
subwindows inside it. Then place your controls inside the subwindows.
|
subwindows inside it. Then place your controls inside the subwindows.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_SubWindow = 2;
|
xpWidgetClass_SubWindow = 2;
|
||||||
|
|
||||||
@@ -108,7 +99,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
SubWindow Properties
|
SubWindow Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This property specifies the type of window. Set to one of the subwindow }
|
{ This property specifies the type of window. Set to one of the subwindow }
|
||||||
{ types above. }
|
{ types above. }
|
||||||
@@ -125,20 +115,19 @@ CONST
|
|||||||
appearance, or type.
|
appearance, or type.
|
||||||
|
|
||||||
The button's behavior is a separate property that dictates who it hilights
|
The button's behavior is a separate property that dictates who it hilights
|
||||||
and what kinds of messages it sends. Since behavior and type are
|
and what kinds of messages it sends. Since behavior and type are different,
|
||||||
different, you can do strange things like make check boxes that act as push
|
you can do strange things like make check boxes that act as push buttons or
|
||||||
buttons or push buttons with radio button behavior.
|
push buttons with radio button behavior.
|
||||||
|
|
||||||
In X-Plane 6 there were no check box graphics. The result is the following
|
In X-Plane 6 there were no check box graphics. The result is the following
|
||||||
behavior: in x-plane 6 all check box and radio buttons are round
|
behavior: in X-Plane
|
||||||
(radio-button style) buttons; in X-Plane 7 they are all square (check-box
|
6 all check box and radio buttons are round (radio-button style) buttons;
|
||||||
style) buttons. In a future version of x-plane, the xpButtonBehavior enums
|
in X-Plane 7 they are all square (check-box style) buttons. In a future
|
||||||
will provide the correct graphic (check box or radio button) giving the
|
version of X-Plane, the xpButtonBehavior enums will provide the correct
|
||||||
expected result.
|
graphic (check box or radio button) giving the expected result.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_Button = 3;
|
xpWidgetClass_Button = 3;
|
||||||
|
|
||||||
@@ -148,7 +137,7 @@ CONST
|
|||||||
These define the visual appearance of buttons but not how they respond to
|
These define the visual appearance of buttons but not how they respond to
|
||||||
the mouse.
|
the mouse.
|
||||||
}
|
}
|
||||||
{ This is a standard push button, like an "OK" or "Cancel" button in a dialog }
|
{ This is a standard push button, like an 'OK' or 'Cancel' button in a dialog}
|
||||||
{ box. }
|
{ box. }
|
||||||
xpPushButton = 0
|
xpPushButton = 0
|
||||||
;
|
;
|
||||||
@@ -177,8 +166,8 @@ CONST
|
|||||||
{ xpMsg_PushButtonPressed message is sent. }
|
{ xpMsg_PushButtonPressed message is sent. }
|
||||||
xpButtonBehaviorPushButton = 0
|
xpButtonBehaviorPushButton = 0
|
||||||
;
|
;
|
||||||
{ Check box behavior. The button immediately toggles its value when the }
|
{ Check box behavior. The button immediately toggles its value when the mouse}
|
||||||
{ mouse is clicked and sends out a xpMsg_ButtonStateChanged message. }
|
{ is clicked and sends out a xpMsg_ButtonStateChanged message. }
|
||||||
xpButtonBehaviorCheckBox = 1
|
xpButtonBehaviorCheckBox = 1
|
||||||
;
|
;
|
||||||
{ Radio button behavior. The button immediately sets its state to one and }
|
{ Radio button behavior. The button immediately sets its state to one and }
|
||||||
@@ -189,7 +178,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
Button Properties
|
Button Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This property sets the visual type of button. Use one of the button types }
|
{ This property sets the visual type of button. Use one of the button types }
|
||||||
{ above. }
|
{ above. }
|
||||||
@@ -242,13 +230,12 @@ CONST
|
|||||||
press message. Since key presses are passed by pointer, you can modify the
|
press message. Since key presses are passed by pointer, you can modify the
|
||||||
keystroke and pass it through to the text field widget.
|
keystroke and pass it through to the text field widget.
|
||||||
|
|
||||||
WARNING: in x-plane before 7.10 (including 6.70) null characters could
|
WARNING: in X-Plane before 7.10 (including 6.70) null characters could
|
||||||
crash x-plane. To prevent this, wrap this object with a filter function
|
crash X-Plane. To prevent this, wrap this object with a filter function
|
||||||
(more instructions can be found on the SDK website).
|
(more instructions can be found on the SDK website).
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_TextField = 4;
|
xpWidgetClass_TextField = 4;
|
||||||
|
|
||||||
@@ -271,7 +258,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
Text Field Properties
|
Text Field Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This is the character position the selection starts at, zero based. If it }
|
{ This is the character position the selection starts at, zero based. If it }
|
||||||
{ is the same as the end insertion point, the insertion point is not a }
|
{ is the same as the end insertion point, the insertion point is not a }
|
||||||
@@ -296,7 +282,7 @@ CONST
|
|||||||
{ unlimited. }
|
{ unlimited. }
|
||||||
xpProperty_MaxCharacters = 1405
|
xpProperty_MaxCharacters = 1405
|
||||||
;
|
;
|
||||||
{ The first visible character on the left. This effectively scrolls the text }
|
{ The first visible character on the left. This effectively scrolls the text}
|
||||||
{ field. }
|
{ field. }
|
||||||
xpProperty_ScrollPosition = 1406
|
xpProperty_ScrollPosition = 1406
|
||||||
;
|
;
|
||||||
@@ -309,12 +295,9 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
Text Field Messages
|
Text Field Messages
|
||||||
|
|
||||||
}
|
}
|
||||||
{ Text Field Messages }
|
{ The text field sends this message to itself when its text changes. It sends}
|
||||||
{ }
|
{ the message up the call chain; param1 is the text field's widget ID. }
|
||||||
{ The text field sends this message to itself when its text changes. It }
|
|
||||||
{ sends the message up the call chain; param1 is the text field's widget ID. }
|
|
||||||
xpMsg_TextFieldChanged = 1400
|
xpMsg_TextFieldChanged = 1400
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -328,7 +311,6 @@ CONST
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_ScrollBar = 5;
|
xpWidgetClass_ScrollBar = 5;
|
||||||
|
|
||||||
@@ -337,9 +319,7 @@ CONST
|
|||||||
|
|
||||||
This defines how the scroll bar looks.
|
This defines how the scroll bar looks.
|
||||||
}
|
}
|
||||||
{ Scroll bar types. }
|
{ A standard X-Plane scroll bar (with arrows on the ends). }
|
||||||
{ }
|
|
||||||
{ A standard x-plane scroll bar (with arrows on the ends). }
|
|
||||||
xpScrollBarTypeScrollBar = 0
|
xpScrollBarTypeScrollBar = 0
|
||||||
;
|
;
|
||||||
{ A slider, no arrows. }
|
{ A slider, no arrows. }
|
||||||
@@ -348,7 +328,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
Scroll Bar Properties
|
Scroll Bar Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ The current position of the thumb (in between the min and max, inclusive) }
|
{ The current position of the thumb (in between the min and max, inclusive) }
|
||||||
xpProperty_ScrollBarSliderPosition = 1500
|
xpProperty_ScrollBarSliderPosition = 1500
|
||||||
@@ -359,7 +338,7 @@ CONST
|
|||||||
{ The value the scroll bar has when the thumb is in the highest position. }
|
{ The value the scroll bar has when the thumb is in the highest position. }
|
||||||
xpProperty_ScrollBarMax = 1502
|
xpProperty_ScrollBarMax = 1502
|
||||||
;
|
;
|
||||||
{ How many units to moev the scroll bar when clicking next to the thumb. The }
|
{ How many units to move the scroll bar when clicking next to the thumb. The }
|
||||||
{ scroll bar always moves one unit when the arrows are clicked. }
|
{ scroll bar always moves one unit when the arrows are clicked. }
|
||||||
xpProperty_ScrollBarPageAmount = 1503
|
xpProperty_ScrollBarPageAmount = 1503
|
||||||
;
|
;
|
||||||
@@ -372,9 +351,8 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
Scroll Bar Messages
|
Scroll Bar Messages
|
||||||
|
|
||||||
}
|
}
|
||||||
{ The Scroll Bar sends this message when the slider position changes. It }
|
{ The scroll bar sends this message when the slider position changes. It }
|
||||||
{ sends the message up the call chain; param1 is the Scroll Bar widget ID. }
|
{ sends the message up the call chain; param1 is the Scroll Bar widget ID. }
|
||||||
xpMsg_ScrollBarSliderPositionChanged = 1500
|
xpMsg_ScrollBarSliderPositionChanged = 1500
|
||||||
;
|
;
|
||||||
@@ -389,13 +367,11 @@ CONST
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_Caption = 6;
|
xpWidgetClass_Caption = 6;
|
||||||
|
|
||||||
{
|
{
|
||||||
Caption Properties
|
Caption Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This property specifies whether the caption is lit; use lit captions }
|
{ This property specifies whether the caption is lit; use lit captions }
|
||||||
{ against screens. }
|
{ against screens. }
|
||||||
@@ -407,11 +383,10 @@ CONST
|
|||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
The general graphics widget can show one of many icons available from
|
The general graphics widget can show one of many icons available from
|
||||||
x-plane.
|
X-Plane.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_GeneralGraphics = 7;
|
xpWidgetClass_GeneralGraphics = 7;
|
||||||
|
|
||||||
@@ -461,7 +436,6 @@ CONST
|
|||||||
|
|
||||||
{
|
{
|
||||||
General Graphics Properties
|
General Graphics Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This property controls the type of icon that is drawn. }
|
{ This property controls the type of icon that is drawn. }
|
||||||
xpProperty_GeneralGraphicsType = 1700
|
xpProperty_GeneralGraphicsType = 1700
|
||||||
@@ -471,17 +445,14 @@ CONST
|
|||||||
* PROGRESS INDICATOR
|
* PROGRESS INDICATOR
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
This widget implements a progress indicator as seen when x-plane starts up.
|
This widget implements a progress indicator as seen when X-Plane starts up.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
xpWidgetClass_Progress = 8;
|
xpWidgetClass_Progress = 8;
|
||||||
|
|
||||||
{
|
{
|
||||||
Progress Indicator Properties
|
Progress Indicator Properties
|
||||||
|
|
||||||
}
|
}
|
||||||
{ This is the current value of the progress indicator. }
|
{ This is the current value of the progress indicator. }
|
||||||
xpProperty_ProgressPosition = 1800
|
xpProperty_ProgressPosition = 1800
|
||||||
@@ -493,5 +464,7 @@ CONST
|
|||||||
xpProperty_ProgressMax = 1802
|
xpProperty_ProgressMax = 1802
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPUIGraphics;
|
UNIT XPUIGraphics;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
|
||||||
|
|
||||||
}
|
USES
|
||||||
|
XPWidgetDefs;
|
||||||
USES XPWidgetDefs;
|
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* UI GRAPHICS
|
* UI GRAPHICS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPWindowStyle
|
XPWindowStyle
|
||||||
@@ -38,13 +26,12 @@ USES XPWidgetDefs;
|
|||||||
Sub windows must go on top of main windows, and screens and list views on
|
Sub windows must go on top of main windows, and screens and list views on
|
||||||
top of subwindows. Only help and main windows can be over the main screen.
|
top of subwindows. Only help and main windows can be over the main screen.
|
||||||
|
|
||||||
|
|
||||||
With X-Plane 7 any window or element may be placed over any other element.
|
With X-Plane 7 any window or element may be placed over any other element.
|
||||||
|
|
||||||
Some windows are scaled by stretching, some by repeating. The drawing
|
Some windows are scaled by stretching, some by repeating. The drawing
|
||||||
routines know which scaling method to use. The list view cannot be
|
routines know which scaling method to use. The list view cannot be rescaled
|
||||||
rescaled in x-plane 6 because it has both a repeating pattern and a
|
in X-Plane 6 because it has both a repeating pattern and a gradient in one
|
||||||
gradient in one element. All other elements can be rescaled.
|
element. All other elements can be rescaled.
|
||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPWindowStyle = (
|
XPWindowStyle = (
|
||||||
@@ -75,16 +62,12 @@ TYPE
|
|||||||
appropriate to the style.
|
appropriate to the style.
|
||||||
}
|
}
|
||||||
PROCEDURE XPDrawWindow(
|
PROCEDURE XPDrawWindow(
|
||||||
inX1 : integer;
|
inX1 : Integer;
|
||||||
inY1 : integer;
|
inY1 : Integer;
|
||||||
inX2 : integer;
|
inX2 : Integer;
|
||||||
inY2 : integer;
|
inY2 : Integer;
|
||||||
inStyle : XPWindowStyle);
|
inStyle : XPWindowStyle);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWindowDefaultDimensions
|
XPGetWindowDefaultDimensions
|
||||||
@@ -94,13 +77,9 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPGetWindowDefaultDimensions(
|
PROCEDURE XPGetWindowDefaultDimensions(
|
||||||
inStyle : XPWindowStyle;
|
inStyle : XPWindowStyle;
|
||||||
outWidth : Pinteger; { Can be nil }
|
outWidth : PInteger; { Can be nil }
|
||||||
outHeight : Pinteger); { Can be nil }
|
outHeight : PInteger); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPElementStyle
|
XPElementStyle
|
||||||
@@ -110,8 +89,8 @@ TYPE
|
|||||||
stretched in one or two dimensions (depending on the element). Some
|
stretched in one or two dimensions (depending on the element). Some
|
||||||
elements can be lit.
|
elements can be lit.
|
||||||
|
|
||||||
In x-plane 6 some elements must be drawn over metal. Some are scalable and
|
In X-Plane 6 some elements must be drawn over metal. Some are scalable and
|
||||||
some are not. Any element can be drawn anywhere in x-plane 7.
|
some are not. Any element can be drawn anywhere in X-Plane 7.
|
||||||
|
|
||||||
Scalable Axis Required Background
|
Scalable Axis Required Background
|
||||||
}
|
}
|
||||||
@@ -232,41 +211,34 @@ TYPE
|
|||||||
XPDrawElement
|
XPDrawElement
|
||||||
|
|
||||||
XPDrawElement draws a given element at an offset on the virtual screen in
|
XPDrawElement draws a given element at an offset on the virtual screen in
|
||||||
set dimensions. EVEN if the element is not scalable, it will be scaled if
|
set dimensions.
|
||||||
the width and height do not match the preferred dimensions; it'll just look
|
*Even* if the element is not scalable, it will be scaled if the width and
|
||||||
ugly. Pass inLit to see the lit version of the element; if the element
|
height do not match the preferred dimensions; it'll just look ugly. Pass
|
||||||
cannot be lit this is ignored.
|
inLit to see the lit version of the element; if the element cannot be lit
|
||||||
|
this is ignored.
|
||||||
}
|
}
|
||||||
PROCEDURE XPDrawElement(
|
PROCEDURE XPDrawElement(
|
||||||
inX1 : integer;
|
inX1 : Integer;
|
||||||
inY1 : integer;
|
inY1 : Integer;
|
||||||
inX2 : integer;
|
inX2 : Integer;
|
||||||
inY2 : integer;
|
inY2 : Integer;
|
||||||
inStyle : XPElementStyle;
|
inStyle : XPElementStyle;
|
||||||
inLit : integer);
|
inLit : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetElementDefaultDimensions
|
XPGetElementDefaultDimensions
|
||||||
|
|
||||||
This routine returns the recommended or minimum dimensions of a given UI
|
This routine returns the recommended or minimum dimensions of a given UI
|
||||||
element. outCanBeLit tells whether the element has both a lit and unlit
|
element. outCanBeLit tells whether the element has both a lit and unlit
|
||||||
state. Pass NULL to not receive any of these parameters.
|
state. Pass `NULL` to not receive any of these parameters.
|
||||||
}
|
}
|
||||||
PROCEDURE XPGetElementDefaultDimensions(
|
PROCEDURE XPGetElementDefaultDimensions(
|
||||||
inStyle : XPElementStyle;
|
inStyle : XPElementStyle;
|
||||||
outWidth : Pinteger; { Can be nil }
|
outWidth : PInteger; { Can be nil }
|
||||||
outHeight : Pinteger; { Can be nil }
|
outHeight : PInteger; { Can be nil }
|
||||||
outCanBeLit : Pinteger); { Can be nil }
|
outCanBeLit : PInteger); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPTrackStyle
|
XPTrackStyle
|
||||||
@@ -278,10 +250,10 @@ TYPE
|
|||||||
(e.g. they know if they are tall or wide). Sliders may be lit or unlit
|
(e.g. they know if they are tall or wide). Sliders may be lit or unlit
|
||||||
(showing the user manipulating them).
|
(showing the user manipulating them).
|
||||||
|
|
||||||
ScrollBar - this is a standard scroll bar with arrows and a thumb to drag.
|
- ScrollBar: this is a standard scroll bar with arrows and a thumb to drag.
|
||||||
Slider - this is a simple track with a ball in the middle that can be
|
- Slider: this is a simple track with a ball in the middle that can be
|
||||||
slid. Progress - this is a progress indicator showing how a long task is
|
slid.
|
||||||
going.
|
- Progress: this is a progress indicator showing how a long task is going.
|
||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPTrackStyle = (
|
XPTrackStyle = (
|
||||||
@@ -307,20 +279,16 @@ TYPE
|
|||||||
not.
|
not.
|
||||||
}
|
}
|
||||||
PROCEDURE XPDrawTrack(
|
PROCEDURE XPDrawTrack(
|
||||||
inX1 : integer;
|
inX1 : Integer;
|
||||||
inY1 : integer;
|
inY1 : Integer;
|
||||||
inX2 : integer;
|
inX2 : Integer;
|
||||||
inY2 : integer;
|
inY2 : Integer;
|
||||||
inMin : integer;
|
inMin : Integer;
|
||||||
inMax : integer;
|
inMax : Integer;
|
||||||
inValue : integer;
|
inValue : Integer;
|
||||||
inTrackStyle : XPTrackStyle;
|
inTrackStyle : XPTrackStyle;
|
||||||
inLit : integer);
|
inLit : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetTrackDefaultDimensions
|
XPGetTrackDefaultDimensions
|
||||||
@@ -331,13 +299,9 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPGetTrackDefaultDimensions(
|
PROCEDURE XPGetTrackDefaultDimensions(
|
||||||
inStyle : XPTrackStyle;
|
inStyle : XPTrackStyle;
|
||||||
outWidth : Pinteger;
|
outWidth : PInteger;
|
||||||
outCanBeLit : Pinteger);
|
outCanBeLit : PInteger);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetTrackMetrics
|
XPGetTrackMetrics
|
||||||
@@ -356,25 +320,23 @@ TYPE
|
|||||||
button decreases; for vertical scrollers, the top button decreases.
|
button decreases; for vertical scrollers, the top button decreases.
|
||||||
}
|
}
|
||||||
PROCEDURE XPGetTrackMetrics(
|
PROCEDURE XPGetTrackMetrics(
|
||||||
inX1 : integer;
|
inX1 : Integer;
|
||||||
inY1 : integer;
|
inY1 : Integer;
|
||||||
inX2 : integer;
|
inX2 : Integer;
|
||||||
inY2 : integer;
|
inY2 : Integer;
|
||||||
inMin : integer;
|
inMin : Integer;
|
||||||
inMax : integer;
|
inMax : Integer;
|
||||||
inValue : integer;
|
inValue : Integer;
|
||||||
inTrackStyle : XPTrackStyle;
|
inTrackStyle : XPTrackStyle;
|
||||||
outIsVertical : Pinteger;
|
outIsVertical : PInteger;
|
||||||
outDownBtnSize : Pinteger;
|
outDownBtnSize : PInteger;
|
||||||
outDownPageSize : Pinteger;
|
outDownPageSize : PInteger;
|
||||||
outThumbSize : Pinteger;
|
outThumbSize : PInteger;
|
||||||
outUpPageSize : Pinteger;
|
outUpPageSize : PInteger;
|
||||||
outUpBtnSize : Pinteger);
|
outUpBtnSize : PInteger);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPWidgetDefs;
|
UNIT XPWidgetDefs;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
|
||||||
|
|
||||||
}
|
USES
|
||||||
|
XPLMDefs;
|
||||||
USES XPLMDefs;
|
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* WIDGET DEFINITIONS
|
* WIDGET DEFINITIONS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
@@ -29,15 +21,14 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
{
|
{
|
||||||
XPWidgetID
|
XPWidgetID
|
||||||
|
|
||||||
A Widget ID is an opaque unique non-zero handle identifying your widget.
|
A Widget ID is an opaque unique non-zero handle identifying your widget.
|
||||||
Use 0 to specify "no widget". This type is defined as wide enough to hold
|
Use 0 to specify "no widget". This type is defined as wide enough to hold a
|
||||||
a pointer. You receive a widget ID when you create a new widget and then
|
pointer. You receive a widget ID when you create a new widget and then use
|
||||||
use that widget ID to further refer to the widget.
|
that widget ID to further refer to the widget.
|
||||||
}
|
}
|
||||||
XPWidgetID = pointer;
|
XPWidgetID = pointer;
|
||||||
PXPWidgetID = ^XPWidgetID;
|
PXPWidgetID = ^XPWidgetID;
|
||||||
@@ -56,7 +47,7 @@ TYPE
|
|||||||
your own property IDs as well.
|
your own property IDs as well.
|
||||||
}
|
}
|
||||||
XPWidgetPropertyID = (
|
XPWidgetPropertyID = (
|
||||||
{ A window's refcon is an opaque value used by client code to find other data }
|
{ A window's refcon is an opaque value used by client code to find other data}
|
||||||
{ based on it. }
|
{ based on it. }
|
||||||
xpProperty_Refcon = 0
|
xpProperty_Refcon = 0
|
||||||
|
|
||||||
@@ -80,11 +71,13 @@ TYPE
|
|||||||
{ Is this widget enabled (for those that have a disabled state too)? }
|
{ Is this widget enabled (for those that have a disabled state too)? }
|
||||||
,xpProperty_Enabled = 7
|
,xpProperty_Enabled = 7
|
||||||
|
|
||||||
{ NOTE: Property IDs 1 - 999 are reserved for the widget's library. }
|
{ NOTE: Property IDs 1 - 999 are reserved for the widgets library. }
|
||||||
{ }
|
{ }
|
||||||
{ NOTE: Property IDs 1000 - 9999 are allocated to the standard widget classes }
|
{ NOTE: Property IDs 1000 - 9999 are allocated to the standard widget classes}
|
||||||
{ provided with the library Properties 1000 - 1099 are for widget class 0, }
|
{ provided with the library. }
|
||||||
{ 1100 - 1199 for widget class 1, etc. }
|
{ }
|
||||||
|
{ Properties 1000 - 1099 are for widget class 0, 1100 - 1199 for widget class}
|
||||||
|
{ 1, etc. }
|
||||||
,xpProperty_UserStart = 10000
|
,xpProperty_UserStart = 10000
|
||||||
|
|
||||||
);
|
);
|
||||||
@@ -97,14 +90,14 @@ TYPE
|
|||||||
to your widget function.
|
to your widget function.
|
||||||
}
|
}
|
||||||
XPMouseState_t = RECORD
|
XPMouseState_t = RECORD
|
||||||
x : integer;
|
x : Integer;
|
||||||
y : integer;
|
y : Integer;
|
||||||
{ Mouse Button number, left = 0 (right button not yet supported. }
|
{ Mouse Button number, left = 0 (right button not yet supported. }
|
||||||
button : integer;
|
button : Integer;
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{ Scroll wheel delta (button in this case would be the wheel axis number). }
|
{ Scroll wheel delta (button in this case would be the wheel axis number). }
|
||||||
delta : integer;
|
delta : Integer;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
END;
|
END;
|
||||||
PXPMouseState_t = ^XPMouseState_t;
|
PXPMouseState_t = ^XPMouseState_t;
|
||||||
|
|
||||||
@@ -117,11 +110,11 @@ TYPE
|
|||||||
XPKeyState_t = RECORD
|
XPKeyState_t = RECORD
|
||||||
{ The ASCII key that was pressed. WARNING: this may be 0 for some non-ASCII }
|
{ The ASCII key that was pressed. WARNING: this may be 0 for some non-ASCII }
|
||||||
{ key sequences. }
|
{ key sequences. }
|
||||||
key : char;
|
key : XPLMChar;
|
||||||
{ The flags. Make sure to check this if you only want key-downs! }
|
{ The flags. Make sure to check this if you only want key-downs! }
|
||||||
flags : XPLMKeyFlags;
|
flags : XPLMKeyFlags;
|
||||||
{ The virtual key code for the key }
|
{ The virtual key code for the key }
|
||||||
vkey : char;
|
vkey : XPLMChar;
|
||||||
END;
|
END;
|
||||||
PXPKeyState_t = ^XPKeyState_t;
|
PXPKeyState_t = ^XPKeyState_t;
|
||||||
|
|
||||||
@@ -132,11 +125,11 @@ TYPE
|
|||||||
changes.
|
changes.
|
||||||
}
|
}
|
||||||
XPWidgetGeometryChange_t = RECORD
|
XPWidgetGeometryChange_t = RECORD
|
||||||
dx : integer;
|
dx : Integer;
|
||||||
{ +Y = the widget moved up }
|
{ +Y = the widget moved up }
|
||||||
dy : integer;
|
dy : Integer;
|
||||||
dwidth : integer;
|
dwidth : Integer;
|
||||||
dheight : integer;
|
dheight : Integer;
|
||||||
END;
|
END;
|
||||||
PXPWidgetGeometryChange_t = ^XPWidgetGeometryChange_t;
|
PXPWidgetGeometryChange_t = ^XPWidgetGeometryChange_t;
|
||||||
|
|
||||||
@@ -158,13 +151,13 @@ TYPE
|
|||||||
{ recursively depth-first. }
|
{ recursively depth-first. }
|
||||||
,xpMode_Recursive = 2
|
,xpMode_Recursive = 2
|
||||||
|
|
||||||
{ The message is snet just to the target, but goes to every callback, even if }
|
{ The message is snet just to the target, but goes to every callback, even if}
|
||||||
{ it is handled. }
|
{ it is handled. }
|
||||||
,xpMode_DirectAllCallbacks = 3
|
,xpMode_DirectAllCallbacks = 3
|
||||||
|
|
||||||
{ The message is only sent to the very first handler even if it is not }
|
{ The message is only sent to the very first handler even if it is not }
|
||||||
{ accepted. (This is really only useful for some internal Widget Lib }
|
{ accepted. (This is really only useful for some internal widget library }
|
||||||
{ functions. }
|
{ functions.) }
|
||||||
,xpMode_Once = 4
|
,xpMode_Once = 4
|
||||||
|
|
||||||
);
|
);
|
||||||
@@ -177,7 +170,7 @@ TYPE
|
|||||||
specifies from a library the widget function to be used for the widget.
|
specifies from a library the widget function to be used for the widget.
|
||||||
Most widgets can be made right from classes.
|
Most widgets can be made right from classes.
|
||||||
}
|
}
|
||||||
XPWidgetClass = integer;
|
XPWidgetClass = Integer;
|
||||||
PXPWidgetClass = ^XPWidgetClass;
|
PXPWidgetClass = ^XPWidgetClass;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
@@ -188,10 +181,6 @@ CONST
|
|||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* WIDGET MESSAGES
|
* WIDGET MESSAGES
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPWidgetMessage
|
XPWidgetMessage
|
||||||
@@ -204,7 +193,7 @@ TYPE
|
|||||||
{ No message, should not be sent. }
|
{ No message, should not be sent. }
|
||||||
xpMsg_None = 0
|
xpMsg_None = 0
|
||||||
|
|
||||||
{ The create message is sent once per widget that is created with your widget }
|
{ The create message is sent once per widget that is created with your widget}
|
||||||
{ function and once for any widget that has your widget function attached. }
|
{ function and once for any widget that has your widget function attached. }
|
||||||
{ }
|
{ }
|
||||||
{ Dispatching: Direct }
|
{ Dispatching: Direct }
|
||||||
@@ -247,14 +236,14 @@ TYPE
|
|||||||
{ }
|
{ }
|
||||||
{ Dispatching: Up Chain }
|
{ Dispatching: Up Chain }
|
||||||
{ }
|
{ }
|
||||||
{ : Param 1: A pointer to an XPKeyState_t structure with the keystroke. }
|
{ Param 1: A pointer to an XPKeyState_t structure with the keystroke. }
|
||||||
,xpMsg_KeyPress = 5
|
,xpMsg_KeyPress = 5
|
||||||
|
|
||||||
{ Keyboard focus is being given to you. By handling this message you accept }
|
{ Keyboard focus is being given to you. By handling this message you accept }
|
||||||
{ keyboard focus. The first parameter will be one if a child of yours gave }
|
{ keyboard focus. The first parameter will be one if a child of yours gave up}
|
||||||
{ up focus to you, 0 if someone set focus on you explicitly. }
|
{ focus to you, 0 if someone set focus on you explicitly. }
|
||||||
{ }
|
{ }
|
||||||
{ : Handling this message accepts focus; not handling refuses focus. }
|
{ Handling this message accepts focus; not handling refuses focus. }
|
||||||
{ }
|
{ }
|
||||||
{ Dispatching: direct }
|
{ Dispatching: direct }
|
||||||
{ }
|
{ }
|
||||||
@@ -274,11 +263,11 @@ TYPE
|
|||||||
|
|
||||||
{ You receive one mousedown event per click with a mouse-state structure }
|
{ You receive one mousedown event per click with a mouse-state structure }
|
||||||
{ pointed to by parameter 1, by accepting this you eat the click, otherwise }
|
{ pointed to by parameter 1, by accepting this you eat the click, otherwise }
|
||||||
{ your parent gets it. You will not receive drag and mouse up messages if }
|
{ your parent gets it. You will not receive drag and mouse up messages if you}
|
||||||
{ you do not accept the down message. }
|
{ do not accept the down message. }
|
||||||
{ }
|
{ }
|
||||||
{ Handling this message consumes the mouse click, not handling it passes it }
|
{ Handling this message consumes the mouse click, not handling it passes it }
|
||||||
{ to the next widget. You can act 'transparent' as a window by never handling }
|
{ to the next widget. You can act 'transparent' as a window by never handling}
|
||||||
{ moues clicks to certain areas. }
|
{ moues clicks to certain areas. }
|
||||||
{ }
|
{ }
|
||||||
{ Dispatching: Up chain NOTE: Technically this is direct dispatched, but the }
|
{ Dispatching: Up chain NOTE: Technically this is direct dispatched, but the }
|
||||||
@@ -288,11 +277,11 @@ TYPE
|
|||||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||||
,xpMsg_MouseDown = 8
|
,xpMsg_MouseDown = 8
|
||||||
|
|
||||||
{ You receive a series of mouse drag messages (typically one per frame in the }
|
{ You receive a series of mouse drag messages (typically one per frame in the}
|
||||||
{ sim) as the mouse is moved once you have accepted a mouse down message. }
|
{ sim) as the mouse is moved once you have accepted a mouse down message. }
|
||||||
{ Parameter one points to a mouse-state structure describing the mouse }
|
{ Parameter one points to a mouse-state structure describing the mouse }
|
||||||
{ location. You will continue to receive these until the mouse button is }
|
{ location. You will continue to receive these until the mouse button is }
|
||||||
{ released. You may receive multiple mouse state messages with the same mouse }
|
{ released. You may receive multiple mouse state messages with the same mouse}
|
||||||
{ position. You will receive mouse drag events even if the mouse is dragged }
|
{ position. You will receive mouse drag events even if the mouse is dragged }
|
||||||
{ out of your current or original bounds at the time of the mouse down. }
|
{ out of your current or original bounds at the time of the mouse down. }
|
||||||
{ }
|
{ }
|
||||||
@@ -327,22 +316,21 @@ TYPE
|
|||||||
|
|
||||||
{ A child has been added to you. The child's ID is passed in parameter one. }
|
{ A child has been added to you. The child's ID is passed in parameter one. }
|
||||||
{ }
|
{ }
|
||||||
{ }
|
|
||||||
{ Dispatching: Direct }
|
{ Dispatching: Direct }
|
||||||
{ }
|
{ }
|
||||||
{ Param 1: The Widget ID of the child being added. }
|
{ Param 1: The Widget ID of the child being added. }
|
||||||
,xpMsg_AcceptChild = 13
|
,xpMsg_AcceptChild = 13
|
||||||
|
|
||||||
{ A child has been removed from to you. The child's ID is passed in }
|
{ A child has been removed from to you. The child's ID is passed in parameter}
|
||||||
{ parameter one. }
|
{ one. }
|
||||||
{ }
|
{ }
|
||||||
{ Dispatching: Direct }
|
{ Dispatching: Direct }
|
||||||
{ }
|
{ }
|
||||||
{ Param 1: The Widget ID of the child being removed. }
|
{ Param 1: The Widget ID of the child being removed. }
|
||||||
,xpMsg_LoseChild = 14
|
,xpMsg_LoseChild = 14
|
||||||
|
|
||||||
{ You now have a new parent, or have no parent. The parent's ID is passed }
|
{ You now have a new parent, or have no parent. The parent's ID is passed in,}
|
||||||
{ in, or 0 for no parent. }
|
{ or 0 for no parent. }
|
||||||
{ }
|
{ }
|
||||||
{ Dispatching: Direct }
|
{ Dispatching: Direct }
|
||||||
{ }
|
{ }
|
||||||
@@ -387,7 +375,7 @@ TYPE
|
|||||||
{ }
|
{ }
|
||||||
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
{ Param 1: A pointer to an XPMouseState_t containing the mouse status. }
|
||||||
,xpMsg_MouseWheel = 20
|
,xpMsg_MouseWheel = 20
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{ The cursor is over your widget. If you consume this message, change the }
|
{ The cursor is over your widget. If you consume this message, change the }
|
||||||
@@ -402,7 +390,7 @@ TYPE
|
|||||||
{ Param 2: A pointer to a XPLMCursorStatus - set this to the cursor result }
|
{ Param 2: A pointer to a XPLMCursorStatus - set this to the cursor result }
|
||||||
{ you desire. }
|
{ you desire. }
|
||||||
,xpMsg_CursorAdjust = 21
|
,xpMsg_CursorAdjust = 21
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
|
||||||
{ NOTE: Message IDs 1000 - 9999 are allocated to the standard widget classes }
|
{ NOTE: Message IDs 1000 - 9999 are allocated to the standard widget classes }
|
||||||
{ provided with the library with 1000 - 1099 for widget class 0, 1100 - 1199 }
|
{ provided with the library with 1000 - 1099 for widget class 0, 1100 - 1199 }
|
||||||
@@ -415,27 +403,25 @@ TYPE
|
|||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* WIDGET CALLBACK FUNCTION
|
* WIDGET CALLBACK FUNCTION
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPWidgetFunc_t
|
XPWidgetFunc_t
|
||||||
|
|
||||||
This function defines your custom widget's behavior. It will be called by
|
This function defines your custom widget's behavior. It will be called by
|
||||||
the widgets library to send messages to your widget. The message and
|
the widgets library to send messages to your widget. The message and widget
|
||||||
widget ID are passed in, as well as two ptr-width signed parameters whose
|
ID are passed in, as well as two ptr-width signed parameters whose meaning
|
||||||
meaning varies with the message. Return 1 to indicate that you have
|
varies with the message. Return 1 to indicate that you have processed the
|
||||||
processed the message, 0 to indicate that you have not. For any message
|
message, 0 to indicate that you have not. For any message that is not
|
||||||
that is not understood, return 0.
|
understood, return 0.
|
||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPWidgetFunc_t = FUNCTION(
|
XPWidgetFunc_t = FUNCTION(
|
||||||
inMessage : XPWidgetMessage;
|
inMessage : XPWidgetMessage;
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inParam1 : intptr_t;
|
inParam1 : intptr_t;
|
||||||
inParam2 : intptr_t) : integer; cdecl;
|
inParam2 : intptr_t) : Integer; cdecl;
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPWidgetUtils;
|
UNIT XPWidgetUtils;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
XPWidgetUtils - USAGE NOTES
|
## USAGE NOTES
|
||||||
|
|
||||||
The XPWidgetUtils library contains useful functions that make writing and
|
The XPWidgetUtils library contains useful functions that make writing and
|
||||||
using widgets less of a pain.
|
using widgets less of a pain.
|
||||||
@@ -21,28 +18,22 @@ INTERFACE
|
|||||||
1. You can add a widget behavior function to a widget as a callback proc
|
1. You can add a widget behavior function to a widget as a callback proc
|
||||||
using the XPAddWidgetCallback function. The widget will gain that
|
using the XPAddWidgetCallback function. The widget will gain that
|
||||||
behavior. Remember that the last function you add has highest priority.
|
behavior. Remember that the last function you add has highest priority.
|
||||||
You can use this to change or augment the behavior of an existing finished
|
You can use this to change or augment the behavior of an existing
|
||||||
widget.
|
finished widget.
|
||||||
|
|
||||||
2. You can call a widget function from inside your own widget function.
|
2. You can call a widget function from inside your own widget function.
|
||||||
This allows you to include useful behaviors in custom-built widgets. A
|
This allows you to include useful behaviors in custom-built widgets. A
|
||||||
number of the standard widgets get their behavior from this library. To do
|
number of the standard widgets get their behavior from this library. To
|
||||||
this, call the behavior function from your function first. If it returns
|
do this, call the behavior function from your function first. If it
|
||||||
1, that means it handled the event and you don't need to; simply return 1.
|
returns 1, that means it handled the event and you don't need to; simply
|
||||||
|
return 1.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPWidgetDefs;
|
USES
|
||||||
|
XPWidgetDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* GENERAL UTILITIES
|
* GENERAL UTILITIES
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -51,24 +42,29 @@ USES XPWidgetDefs;
|
|||||||
This structure contains all of the parameters needed to create a wiget. It
|
This structure contains all of the parameters needed to create a wiget. It
|
||||||
is used with XPUCreateWidgets to create widgets in bulk from an array. All
|
is used with XPUCreateWidgets to create widgets in bulk from an array. All
|
||||||
parameters correspond to those of XPCreateWidget except for the container
|
parameters correspond to those of XPCreateWidget except for the container
|
||||||
index. If the container index is equal to the index of a widget in the
|
index.
|
||||||
array, the widget in the array passed to XPUCreateWidgets is used as the
|
|
||||||
parent of this widget. Note that if you pass an index greater than your
|
If the container index is equal to the index of a widget in the array, the
|
||||||
own position in the array, the parent you are requesting will not exist
|
widget in the array passed to XPUCreateWidgets is used as the parent of
|
||||||
yet. If the container index is NO_PARENT, the parent widget is specified as
|
this widget. Note that if you pass an index greater than your own position
|
||||||
|
in the array, the parent you are requesting will not exist yet.
|
||||||
|
|
||||||
|
If the container index is NO_PARENT, the parent widget is specified as
|
||||||
NULL. If the container index is PARAM_PARENT, the widget passed into
|
NULL. If the container index is PARAM_PARENT, the widget passed into
|
||||||
XPUCreateWidgets is used.
|
XPUCreateWidgets is used.
|
||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPWidgetCreate_t = RECORD
|
XPWidgetCreate_t = RECORD
|
||||||
left : integer;
|
left : Integer;
|
||||||
top : integer;
|
top : Integer;
|
||||||
right : integer;
|
right : Integer;
|
||||||
bottom : integer;
|
bottom : Integer;
|
||||||
visible : integer;
|
visible : Integer;
|
||||||
descriptor : Pchar;
|
descriptor : XPLMString;
|
||||||
isRoot : integer;
|
{ Whether ethis widget is a root wiget }
|
||||||
containerIndex : integer;
|
isRoot : Integer;
|
||||||
|
{ The index of the widget to contain within, or a constant }
|
||||||
|
containerIndex : Integer;
|
||||||
widgetClass : XPWidgetClass;
|
widgetClass : XPWidgetClass;
|
||||||
END;
|
END;
|
||||||
PXPWidgetCreate_t = ^XPWidgetCreate_t;
|
PXPWidgetCreate_t = ^XPWidgetCreate_t;
|
||||||
@@ -82,8 +78,8 @@ CONST
|
|||||||
{
|
{
|
||||||
XPUCreateWidgets
|
XPUCreateWidgets
|
||||||
|
|
||||||
This function creates a series of widgets from a table...see
|
This function creates a series of widgets from a table (see
|
||||||
XPCreateWidget_t above. Pass in an array of widget creation structures and
|
XPCreateWidget_t above). Pass in an array of widget creation structures and
|
||||||
an array of widget IDs that will receive each widget.
|
an array of widget IDs that will receive each widget.
|
||||||
|
|
||||||
Widget parents are specified by index into the created widget table,
|
Widget parents are specified by index into the created widget table,
|
||||||
@@ -97,14 +93,10 @@ CONST
|
|||||||
}
|
}
|
||||||
PROCEDURE XPUCreateWidgets(
|
PROCEDURE XPUCreateWidgets(
|
||||||
inWidgetDefs : PXPWidgetCreate_t;
|
inWidgetDefs : PXPWidgetCreate_t;
|
||||||
inCount : integer;
|
inCount : Integer;
|
||||||
inParamParent : XPWidgetID;
|
inParamParent : XPWidgetID;
|
||||||
ioWidgets : PXPWidgetID);
|
ioWidgets : PXPWidgetID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPUMoveWidgetBy
|
XPUMoveWidgetBy
|
||||||
@@ -114,13 +106,9 @@ CONST
|
|||||||
}
|
}
|
||||||
PROCEDURE XPUMoveWidgetBy(
|
PROCEDURE XPUMoveWidgetBy(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inDeltaX : integer;
|
inDeltaX : Integer;
|
||||||
inDeltaY : integer);
|
inDeltaY : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* LAYOUT MANAGERS
|
* LAYOUT MANAGERS
|
||||||
@@ -132,7 +120,6 @@ CONST
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPUFixedLayout
|
XPUFixedLayout
|
||||||
|
|
||||||
@@ -144,12 +131,8 @@ CONST
|
|||||||
inMessage : XPWidgetMessage;
|
inMessage : XPWidgetMessage;
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inParam1 : intptr_t;
|
inParam1 : intptr_t;
|
||||||
inParam2 : intptr_t) : integer;
|
inParam2 : intptr_t) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* WIDGET PROC BEHAVIORS
|
* WIDGET PROC BEHAVIORS
|
||||||
@@ -161,7 +144,6 @@ CONST
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPUSelectIfNeeded
|
XPUSelectIfNeeded
|
||||||
|
|
||||||
@@ -174,12 +156,8 @@ CONST
|
|||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inParam1 : intptr_t;
|
inParam1 : intptr_t;
|
||||||
inParam2 : intptr_t;
|
inParam2 : intptr_t;
|
||||||
inEatClick : integer) : integer;
|
inEatClick : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPUDefocusKeyboard
|
XPUDefocusKeyboard
|
||||||
@@ -192,12 +170,8 @@ CONST
|
|||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inParam1 : intptr_t;
|
inParam1 : intptr_t;
|
||||||
inParam2 : intptr_t;
|
inParam2 : intptr_t;
|
||||||
inEatClick : integer) : integer;
|
inEatClick : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPUDragWidget
|
XPUDragWidget
|
||||||
@@ -211,15 +185,13 @@ CONST
|
|||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inParam1 : intptr_t;
|
inParam1 : intptr_t;
|
||||||
inParam2 : intptr_t;
|
inParam2 : intptr_t;
|
||||||
inLeft : integer;
|
inLeft : Integer;
|
||||||
inTop : integer;
|
inTop : Integer;
|
||||||
inRight : integer;
|
inRight : Integer;
|
||||||
inBottom : integer) : integer;
|
inBottom : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
+151
-289
@@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPWidgets;
|
UNIT XPWidgets;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
WIDGETS - THEORY OF OPERATION AND NOTES
|
## THEORY OF OPERATION AND NOTES
|
||||||
|
|
||||||
Widgets are persistent view 'objects' for X-Plane. A widget is an object
|
Widgets are persistent view 'objects' for X-Plane. A widget is an object
|
||||||
referenced by its opaque handle (widget ID) and the APIs in this file. You
|
referenced by its opaque handle (widget ID) and the APIs in this file. You
|
||||||
@@ -18,27 +15,16 @@ INTERFACE
|
|||||||
|
|
||||||
- A bounding box defined in global screen coordinates with 0,0 in the
|
- A bounding box defined in global screen coordinates with 0,0 in the
|
||||||
bottom left and +y = up, +x = right.
|
bottom left and +y = up, +x = right.
|
||||||
|
|
||||||
- A visible box, which is the intersection of the bounding box with the
|
- A visible box, which is the intersection of the bounding box with the
|
||||||
widget's parents visible box.
|
widget's parents visible box.
|
||||||
|
|
||||||
- Zero or one parent widgets. (Always zero if the widget is a root widget.
|
- Zero or one parent widgets. (Always zero if the widget is a root widget.
|
||||||
|
|
||||||
|
|
||||||
- Zero or more child widgets.
|
- Zero or more child widgets.
|
||||||
|
|
||||||
- Whether the widget is a root. Root widgets are the top level plugin
|
- Whether the widget is a root. Root widgets are the top level plugin
|
||||||
windows.
|
windows.
|
||||||
|
|
||||||
- Whether the widget is visible.
|
- Whether the widget is visible.
|
||||||
|
|
||||||
- A text string descriptor, whose meaning varies from widget to widget.
|
- A text string descriptor, whose meaning varies from widget to widget.
|
||||||
|
|
||||||
- An arbitrary set of 32 bit integral properties defined by 32-bit integral
|
- An arbitrary set of 32 bit integral properties defined by 32-bit integral
|
||||||
keys. This is how specific widgets
|
keys. This is how specific widgets store specific data.
|
||||||
|
|
||||||
store specific data.
|
|
||||||
|
|
||||||
- A list of widget callbacks proc that implements the widgets behaviors.
|
- A list of widget callbacks proc that implements the widgets behaviors.
|
||||||
|
|
||||||
The Widgets library sends messages to widgets to request specific behaviors
|
The Widgets library sends messages to widgets to request specific behaviors
|
||||||
@@ -48,8 +34,8 @@ INTERFACE
|
|||||||
are sent to the most recently added callback function until the message is
|
are sent to the most recently added callback function until the message is
|
||||||
handled. Messages may also be sent to parents or children; see the
|
handled. Messages may also be sent to parents or children; see the
|
||||||
XPWidgetDefs.h header file for the different widget message dispatching
|
XPWidgetDefs.h header file for the different widget message dispatching
|
||||||
functions. By adding a callback function to a window you can 'subclass'
|
functions. By adding a callback function to a window you can 'subclass' its
|
||||||
its behavior.
|
behavior.
|
||||||
|
|
||||||
A set of standard widgets are provided that serve common UI purposes. You
|
A set of standard widgets are provided that serve common UI purposes. You
|
||||||
can also customize or implement entirely custom widgets.
|
can also customize or implement entirely custom widgets.
|
||||||
@@ -59,35 +45,26 @@ INTERFACE
|
|||||||
|
|
||||||
- Not all behavior can be patched. State that is managed by the XPWidgets
|
- Not all behavior can be patched. State that is managed by the XPWidgets
|
||||||
DLL and not by individual widgets cannot be customized.
|
DLL and not by individual widgets cannot be customized.
|
||||||
|
|
||||||
- All coordinates are in global screen coordinates. Coordinates are not
|
- All coordinates are in global screen coordinates. Coordinates are not
|
||||||
relative to an enclosing widget, nor are they relative to a display window.
|
relative to an enclosing widget, nor are they relative to a display
|
||||||
|
window.
|
||||||
|
|
||||||
- Widget messages are always dispatched synchronously, and there is no
|
- Widget messages are always dispatched synchronously, and there is no
|
||||||
concept of scheduling an update or a dirty region. Messages originate from
|
concept of scheduling an update or a dirty region. Messages originate
|
||||||
X-Plane as the sim cycle goes by. Since x-plane is constantly redrawing,
|
from X-Plane as the sim cycle goes by. Since X-Plane is constantly
|
||||||
so are widgets; there is no need to mark a part of a widget as 'needing
|
redrawing, so are widgets; there is no need to mark a part of a widget as
|
||||||
redrawing' because redrawing happens frequently whether the widget needs it
|
'needing redrawing' because redrawing happens frequently whether the
|
||||||
or not.
|
widget needs it or not.
|
||||||
|
|
||||||
- Any widget may be a 'root' widget, causing it to be drawn; there is no
|
- Any widget may be a 'root' widget, causing it to be drawn; there is no
|
||||||
relationship between widget class and rootness. Root widgets are
|
relationship between widget class and rootness. Root widgets are
|
||||||
imlemented as XPLMDisply windows.
|
imlemented as XPLMDisply windows.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPWidgetDefs;
|
USES
|
||||||
|
XPWidgetDefs, XPLMDisplay;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* WIDGET CREATION AND MANAGEMENT
|
* WIDGET CREATION AND MANAGEMENT
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPCreateWidget
|
XPCreateWidget
|
||||||
@@ -101,89 +78,72 @@ USES XPWidgetDefs;
|
|||||||
|
|
||||||
- Top, left, bottom, and right in global screen coordinates defining the
|
- Top, left, bottom, and right in global screen coordinates defining the
|
||||||
widget's location on the screen.
|
widget's location on the screen.
|
||||||
|
|
||||||
- inVisible is 1 if the widget should be drawn, 0 to start the widget as
|
- inVisible is 1 if the widget should be drawn, 0 to start the widget as
|
||||||
hidden.
|
hidden.
|
||||||
|
|
||||||
- inDescriptor is a null terminated string that will become the widget's
|
- inDescriptor is a null terminated string that will become the widget's
|
||||||
descriptor.
|
descriptor.
|
||||||
|
|
||||||
- inIsRoot is 1 if this is going to be a root widget, 0 if it will not be.
|
- inIsRoot is 1 if this is going to be a root widget, 0 if it will not be.
|
||||||
|
- inContainer is the ID of this widget's container. It must be 0 for a root
|
||||||
- inContainer is the ID of this widget's container. It must be 0 for a
|
widget. for a non-root widget, pass the widget ID of the widget to place
|
||||||
root widget. for a non-root widget, pass the widget ID of the widget to
|
this widget within. If this widget is not going to start inside another
|
||||||
place this widget within. If this widget is not going to start inside
|
widget, pass 0; this new widget will then just be floating off in space
|
||||||
another widget, pass 0; this new widget will then just be floating off in
|
(and will not be drawn until it is placed in a widget.
|
||||||
space (and will not be drawn until it is placed in a widget.
|
|
||||||
|
|
||||||
- inClass is the class of the widget to draw. Use one of the predefined
|
- inClass is the class of the widget to draw. Use one of the predefined
|
||||||
class-IDs to create a standard widget.
|
class-IDs to create a standard widget.
|
||||||
|
|
||||||
A note on widget embedding: a widget is only called (and will be drawn,
|
A note on widget embedding: a widget is only called (and will be drawn,
|
||||||
etc.) if it is placed within a widget that will be called. Root widgets
|
etc.) if it is placed within a widget that will be called. Root widgets are
|
||||||
are always called. So it is possible to have whole chains of widgets that
|
always called. So it is possible to have whole chains of widgets that are
|
||||||
are simply not called. You can preconstruct widget trees and then place
|
simply not called. You can preconstruct widget trees and then place them
|
||||||
them into root widgets later to activate them if you wish.
|
into root widgets later to activate them if you wish.
|
||||||
}
|
}
|
||||||
FUNCTION XPCreateWidget(
|
FUNCTION XPCreateWidget(
|
||||||
inLeft : integer;
|
inLeft : Integer;
|
||||||
inTop : integer;
|
inTop : Integer;
|
||||||
inRight : integer;
|
inRight : Integer;
|
||||||
inBottom : integer;
|
inBottom : Integer;
|
||||||
inVisible : integer;
|
inVisible : Integer;
|
||||||
inDescriptor : Pchar;
|
inDescriptor : XPLMString;
|
||||||
inIsRoot : integer;
|
inIsRoot : Integer;
|
||||||
inContainer : XPWidgetID;
|
inContainer : XPWidgetID;
|
||||||
inClass : XPWidgetClass) : XPWidgetID;
|
inClass : XPWidgetClass) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPCreateCustomWidget
|
XPCreateCustomWidget
|
||||||
|
|
||||||
This function is the same as XPCreateWidget except that instead of passing
|
This function is the same as XPCreateWidget except that instead of passing
|
||||||
a class ID, you pass your widget callback function pointer defining the
|
a class ID, you pass your widget callback function pointer defining the
|
||||||
widget. Use this function to define a custom widget. All parameters are
|
widget. Use this function to define a custom widget. All parameters are the
|
||||||
the same as XPCreateWidget, except that the widget class has been replaced
|
same as XPCreateWidget, except that the widget class has been replaced with
|
||||||
with the widget function.
|
the widget function.
|
||||||
}
|
}
|
||||||
FUNCTION XPCreateCustomWidget(
|
FUNCTION XPCreateCustomWidget(
|
||||||
inLeft : integer;
|
inLeft : Integer;
|
||||||
inTop : integer;
|
inTop : Integer;
|
||||||
inRight : integer;
|
inRight : Integer;
|
||||||
inBottom : integer;
|
inBottom : Integer;
|
||||||
inVisible : integer;
|
inVisible : Integer;
|
||||||
inDescriptor : Pchar;
|
inDescriptor : XPLMString;
|
||||||
inIsRoot : integer;
|
inIsRoot : Integer;
|
||||||
inContainer : XPWidgetID;
|
inContainer : XPWidgetID;
|
||||||
inCallback : XPWidgetFunc_t) : XPWidgetID;
|
inCallback : XPWidgetFunc_t) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPDestroyWidget
|
XPDestroyWidget
|
||||||
|
|
||||||
This class destroys a widget. Pass in the ID of the widget to kill. If
|
This class destroys a widget. Pass in the ID of the widget to kill. If you
|
||||||
you pass 1 for inDestroyChilren, the widget's children will be destroyed
|
pass 1 for inDestroyChilren, the widget's children will be destroyed first,
|
||||||
first, then this widget will be destroyed. (Furthermore, the widget's
|
then this widget will be destroyed. (Furthermore, the widget's children
|
||||||
children will be destroyed with the inDestroyChildren flag set to 1, so the
|
will be destroyed with the inDestroyChildren flag set to 1, so the
|
||||||
destruction will recurse down the widget tree.) If you pass 0 for this
|
destruction will recurse down the widget tree.) If you pass 0 for this
|
||||||
flag, the child widgets will simply end up with their parent set to 0.
|
flag, the child widgets will simply end up with their parent set to 0.
|
||||||
}
|
}
|
||||||
PROCEDURE XPDestroyWidget(
|
PROCEDURE XPDestroyWidget(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inDestroyChildren : integer);
|
inDestroyChildren : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPSendMessageToWidget
|
XPSendMessageToWidget
|
||||||
@@ -198,28 +158,20 @@ USES XPWidgetDefs;
|
|||||||
not.
|
not.
|
||||||
|
|
||||||
For each widget that receives the message (see the dispatching modes), each
|
For each widget that receives the message (see the dispatching modes), each
|
||||||
widget function from the most recently installed to the oldest one
|
widget function from the most recently installed to the oldest one receives
|
||||||
receives the message in order until it is handled.
|
the message in order until it is handled.
|
||||||
}
|
}
|
||||||
FUNCTION XPSendMessageToWidget(
|
FUNCTION XPSendMessageToWidget(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inMessage : XPWidgetMessage;
|
inMessage : XPWidgetMessage;
|
||||||
inMode : XPDispatchMode;
|
inMode : XPDispatchMode;
|
||||||
inParam1 : intptr_t;
|
inParam1 : intptr_t;
|
||||||
inParam2 : intptr_t) : integer;
|
inParam2 : intptr_t) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* WIDGET POSITIONING AND VISIBILITY
|
* WIDGET POSITIONING AND VISIBILITY
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPPlaceWidgetWithin
|
XPPlaceWidgetWithin
|
||||||
@@ -227,11 +179,11 @@ USES XPWidgetDefs;
|
|||||||
This function changes which container a widget resides in. You may NOT use
|
This function changes which container a widget resides in. You may NOT use
|
||||||
this function on a root widget! inSubWidget is the widget that will be
|
this function on a root widget! inSubWidget is the widget that will be
|
||||||
moved. Pass a widget ID in inContainer to make inSubWidget be a child of
|
moved. Pass a widget ID in inContainer to make inSubWidget be a child of
|
||||||
inContainer. It will become the last/closest widget in the container.
|
inContainer. It will become the last/closest widget in the container. Pass
|
||||||
Pass 0 to remove the widget from any container. Any call to this other
|
0 to remove the widget from any container. Any call to this other than
|
||||||
than passing the widget ID of the old parent of the affected widget will
|
passing the widget ID of the old parent of the affected widget will cause
|
||||||
cause the widget to be removed from its old parent. Placing a widget within
|
the widget to be removed from its old parent. Placing a widget within its
|
||||||
its own parent simply makes it the last widget.
|
own parent simply makes it the last widget.
|
||||||
|
|
||||||
NOTE: this routine does not reposition the sub widget in global
|
NOTE: this routine does not reposition the sub widget in global
|
||||||
coordinates. If the container has layout management code, it will
|
coordinates. If the container has layout management code, it will
|
||||||
@@ -241,11 +193,7 @@ USES XPWidgetDefs;
|
|||||||
PROCEDURE XPPlaceWidgetWithin(
|
PROCEDURE XPPlaceWidgetWithin(
|
||||||
inSubWidget : XPWidgetID;
|
inSubWidget : XPWidgetID;
|
||||||
inContainer : XPWidgetID);
|
inContainer : XPWidgetID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPCountChildWidgets
|
XPCountChildWidgets
|
||||||
@@ -253,12 +201,8 @@ USES XPWidgetDefs;
|
|||||||
This routine returns the number of widgets another widget contains.
|
This routine returns the number of widgets another widget contains.
|
||||||
}
|
}
|
||||||
FUNCTION XPCountChildWidgets(
|
FUNCTION XPCountChildWidgets(
|
||||||
inWidget : XPWidgetID) : integer;
|
inWidget : XPWidgetID) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetNthChildWidget
|
XPGetNthChildWidget
|
||||||
@@ -269,26 +213,18 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
FUNCTION XPGetNthChildWidget(
|
FUNCTION XPGetNthChildWidget(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inIndex : integer) : XPWidgetID;
|
inIndex : Integer) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetParentWidget
|
XPGetParentWidget
|
||||||
|
|
||||||
This routine returns the parent of a widget, or 0 if the widget has no
|
Returns the parent of a widget, or 0 if the widget has no parent. Root
|
||||||
parent. Root widgets never have parents and therefore always return 0.
|
widgets never have parents and therefore always return 0.
|
||||||
}
|
}
|
||||||
FUNCTION XPGetParentWidget(
|
FUNCTION XPGetParentWidget(
|
||||||
inWidget : XPWidgetID) : XPWidgetID;
|
inWidget : XPWidgetID) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPShowWidget
|
XPShowWidget
|
||||||
@@ -299,11 +235,7 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPShowWidget(
|
PROCEDURE XPShowWidget(
|
||||||
inWidget : XPWidgetID);
|
inWidget : XPWidgetID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPHideWidget
|
XPHideWidget
|
||||||
@@ -313,11 +245,7 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPHideWidget(
|
PROCEDURE XPHideWidget(
|
||||||
inWidget : XPWidgetID);
|
inWidget : XPWidgetID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPIsWidgetVisible
|
XPIsWidgetVisible
|
||||||
@@ -327,27 +255,18 @@ USES XPWidgetDefs;
|
|||||||
routine to tell if the user can see the widget.
|
routine to tell if the user can see the widget.
|
||||||
}
|
}
|
||||||
FUNCTION XPIsWidgetVisible(
|
FUNCTION XPIsWidgetVisible(
|
||||||
inWidget : XPWidgetID) : integer;
|
inWidget : XPWidgetID) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPFindRootWidget
|
XPFindRootWidget
|
||||||
|
|
||||||
XPFindRootWidget returns the Widget ID of the root widget that contains the
|
Returns the Widget ID of the root widget that contains the passed in widget
|
||||||
passed in widget or NULL if the passed in widget is not in a rooted
|
or NULL if the passed in widget is not in a rooted hierarchy.
|
||||||
hierarchy.
|
|
||||||
}
|
}
|
||||||
FUNCTION XPFindRootWidget(
|
FUNCTION XPFindRootWidget(
|
||||||
inWidget : XPWidgetID) : XPWidgetID;
|
inWidget : XPWidgetID) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPBringRootWidgetToFront
|
XPBringRootWidgetToFront
|
||||||
@@ -360,11 +279,7 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPBringRootWidgetToFront(
|
PROCEDURE XPBringRootWidgetToFront(
|
||||||
inWidget : XPWidgetID);
|
inWidget : XPWidgetID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPIsWidgetInFront
|
XPIsWidgetInFront
|
||||||
@@ -374,12 +289,8 @@ USES XPWidgetDefs;
|
|||||||
if the widget is not in a rooted hierarchy.
|
if the widget is not in a rooted hierarchy.
|
||||||
}
|
}
|
||||||
FUNCTION XPIsWidgetInFront(
|
FUNCTION XPIsWidgetInFront(
|
||||||
inWidget : XPWidgetID) : integer;
|
inWidget : XPWidgetID) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetGeometry
|
XPGetWidgetGeometry
|
||||||
@@ -389,15 +300,11 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPGetWidgetGeometry(
|
PROCEDURE XPGetWidgetGeometry(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
outLeft : Pinteger; { Can be nil }
|
outLeft : PInteger; { Can be nil }
|
||||||
outTop : Pinteger; { Can be nil }
|
outTop : PInteger; { Can be nil }
|
||||||
outRight : Pinteger; { Can be nil }
|
outRight : PInteger; { Can be nil }
|
||||||
outBottom : Pinteger); { Can be nil }
|
outBottom : PInteger); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPSetWidgetGeometry
|
XPSetWidgetGeometry
|
||||||
@@ -406,15 +313,11 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPSetWidgetGeometry(
|
PROCEDURE XPSetWidgetGeometry(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inLeft : integer;
|
inLeft : Integer;
|
||||||
inTop : integer;
|
inTop : Integer;
|
||||||
inRight : integer;
|
inRight : Integer;
|
||||||
inBottom : integer);
|
inBottom : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetForLocation
|
XPGetWidgetForLocation
|
||||||
@@ -425,8 +328,8 @@ USES XPWidgetDefs;
|
|||||||
deepest widget at that location. If inVisibleOnly is true, then only
|
deepest widget at that location. If inVisibleOnly is true, then only
|
||||||
visible widgets are considered, otherwise all widgets are considered. The
|
visible widgets are considered, otherwise all widgets are considered. The
|
||||||
widget ID passed for inContainer will be returned if the location is in
|
widget ID passed for inContainer will be returned if the location is in
|
||||||
that widget but not in a child widget. 0 is returned if the location is
|
that widget but not in a child widget. 0 is returned if the location is not
|
||||||
not in the container.
|
in the container.
|
||||||
|
|
||||||
NOTE: if a widget's geometry extends outside its parents geometry, it will
|
NOTE: if a widget's geometry extends outside its parents geometry, it will
|
||||||
not be returned by this call for mouse locations outside the parent
|
not be returned by this call for mouse locations outside the parent
|
||||||
@@ -435,66 +338,50 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
FUNCTION XPGetWidgetForLocation(
|
FUNCTION XPGetWidgetForLocation(
|
||||||
inContainer : XPWidgetID;
|
inContainer : XPWidgetID;
|
||||||
inXOffset : integer;
|
inXOffset : Integer;
|
||||||
inYOffset : integer;
|
inYOffset : Integer;
|
||||||
inRecursive : integer;
|
inRecursive : Integer;
|
||||||
inVisibleOnly : integer) : XPWidgetID;
|
inVisibleOnly : Integer) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetExposedGeometry
|
XPGetWidgetExposedGeometry
|
||||||
|
|
||||||
This routine returns the bounds of the area of a widget that is completely
|
This routine returns the bounds of the area of a widget that is completely
|
||||||
within its parent widgets. Since a widget's bounding box can be outside
|
within its parent widgets. Since a widget's bounding box can be outside its
|
||||||
its parent, part of its area will not be elligible for mouse clicks and
|
parent, part of its area will not be elligible for mouse clicks and should
|
||||||
should not draw. Use XPGetWidgetGeometry to find out what area defines
|
not draw. Use XPGetWidgetGeometry to find out what area defines your
|
||||||
your widget's shape, but use this routine to find out what area to actually
|
widget's shape, but use this routine to find out what area to actually draw
|
||||||
draw into. Note that the widget library does not use OpenGL clipping to
|
into. Note that the widget library does not use OpenGL clipping to keep
|
||||||
keep frame rates up, although you could use it internally.
|
frame rates up, although you could use it internally.
|
||||||
}
|
}
|
||||||
PROCEDURE XPGetWidgetExposedGeometry(
|
PROCEDURE XPGetWidgetExposedGeometry(
|
||||||
inWidgetID : XPWidgetID;
|
inWidgetID : XPWidgetID;
|
||||||
outLeft : Pinteger; { Can be nil }
|
outLeft : PInteger; { Can be nil }
|
||||||
outTop : Pinteger; { Can be nil }
|
outTop : PInteger; { Can be nil }
|
||||||
outRight : Pinteger; { Can be nil }
|
outRight : PInteger; { Can be nil }
|
||||||
outBottom : Pinteger); { Can be nil }
|
outBottom : PInteger); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* ACCESSING WIDGET DATA
|
* ACCESSING WIDGET DATA
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPSetWidgetDescriptor
|
XPSetWidgetDescriptor
|
||||||
|
|
||||||
Every widget has a descriptor, which is a text string. What the text
|
Every widget has a descriptor, which is a text string. What the text string
|
||||||
string is used for varies from widget to widget; for example, a push
|
is used for varies from widget to widget; for example, a push button's text
|
||||||
button's text is its descriptor, a caption shows its descriptor, and a text
|
is its descriptor, a caption shows its descriptor, and a text field's
|
||||||
field's descriptor is the text being edited. In other words, the usage for
|
descriptor is the text being edited. In other words, the usage for the text
|
||||||
the text varies from widget to widget, but this API provides a universal
|
varies from widget to widget, but this API provides a universal and
|
||||||
and convenient way to get at it. While not all UI widgets need their
|
convenient way to get at it. While not all UI widgets need their
|
||||||
descriptor, many do.
|
descriptor, many do.
|
||||||
}
|
}
|
||||||
PROCEDURE XPSetWidgetDescriptor(
|
PROCEDURE XPSetWidgetDescriptor(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inDescriptor : Pchar);
|
inDescriptor : XPLMString);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetDescriptor
|
XPGetWidgetDescriptor
|
||||||
@@ -509,13 +396,23 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
FUNCTION XPGetWidgetDescriptor(
|
FUNCTION XPGetWidgetDescriptor(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
outDescriptor : Pchar;
|
outDescriptor : XPLMString;
|
||||||
inMaxDescLength : integer) : integer;
|
inMaxDescLength : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
{
|
||||||
cdecl; external '';
|
XPGetWidgetUnderlyingWindow
|
||||||
{$ENDIF}
|
|
||||||
|
Returns the window (from the XPLMDisplay API) that backs your widget
|
||||||
|
window. If you have opted in to modern windows, via a call to
|
||||||
|
XPLMEnableFeature("XPLM_USE_NATIVE_WIDGET_WINDOWS", 1), you can use the
|
||||||
|
returned window ID for display APIs like XPLMSetWindowPositioningMode(),
|
||||||
|
allowing you to pop the widget window out into a real OS window, or move it
|
||||||
|
into VR.
|
||||||
|
}
|
||||||
|
FUNCTION XPGetWidgetUnderlyingWindow(
|
||||||
|
inWidget : XPWidgetID) : XPLMWindowID;
|
||||||
|
cdecl; external XPWIDGETS.DLL;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPSetWidgetProperty
|
XPSetWidgetProperty
|
||||||
@@ -527,63 +424,46 @@ USES XPWidgetDefs;
|
|||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inProperty : XPWidgetPropertyID;
|
inProperty : XPWidgetPropertyID;
|
||||||
inValue : intptr_t);
|
inValue : intptr_t);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetProperty
|
XPGetWidgetProperty
|
||||||
|
|
||||||
This routine returns the value of a widget's property, or 0 if the property
|
This routine returns the value of a widget's property, or 0 if the property
|
||||||
is not defined. If you need to know whether the property is defined, pass
|
is not defined. If you need to know whether the property is defined, pass a
|
||||||
a pointer to an int for inExists; the existence of that property will be
|
pointer to an int for inExists; the existence of that property will be
|
||||||
returned in the int. Pass NULL for inExists if you do not need this
|
returned in the int. Pass NULL for inExists if you do not need this
|
||||||
information.
|
information.
|
||||||
}
|
}
|
||||||
FUNCTION XPGetWidgetProperty(
|
FUNCTION XPGetWidgetProperty(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inProperty : XPWidgetPropertyID;
|
inProperty : XPWidgetPropertyID;
|
||||||
inExists : Pinteger) : intptr_t; { Can be nil }
|
inExists : PInteger) : intptr_t; { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* KEYBOARD MANAGEMENT
|
* KEYBOARD MANAGEMENT
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPSetKeyboardFocus
|
XPSetKeyboardFocus
|
||||||
|
|
||||||
XPSetKeyboardFocus controls which widget will receive keystrokes. Pass the
|
Controls which widget will receive keystrokes. Pass the widget ID of the
|
||||||
Widget ID of the widget to get the keys. Note that if the widget does not
|
widget to get the keys. Note that if the widget does not care about
|
||||||
care about keystrokes, they will go to the parent widget, and if no widget
|
keystrokes, they will go to the parent widget, and if no widget cares about
|
||||||
cares about them, they go to X-Plane.
|
them, they go to X-Plane.
|
||||||
|
|
||||||
If you set the keyboard focus to Widget ID 0, X-Plane gets keyboard focus.
|
If you set the keyboard focus to widget ID 0, X-Plane gets keyboard focus.
|
||||||
|
|
||||||
This routine returns the widget ID that ended up with keyboard focus, or 0
|
This routine returns the widget ID that ended up with keyboard focus, or 0
|
||||||
for x-plane.
|
for X-Plane.
|
||||||
|
|
||||||
Keyboard focus is not changed if the new widget will not accept it. For
|
Keyboard focus is not changed if the new widget will not accept it. For
|
||||||
setting to x-plane, keyboard focus is always accepted.
|
setting to X-Plane, keyboard focus is always accepted.
|
||||||
|
|
||||||
}
|
}
|
||||||
FUNCTION XPSetKeyboardFocus(
|
FUNCTION XPSetKeyboardFocus(
|
||||||
inWidget : XPWidgetID) : XPWidgetID;
|
inWidget : XPWidgetID) : XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLoseKeyboardFocus
|
XPLoseKeyboardFocus
|
||||||
@@ -594,11 +474,7 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLoseKeyboardFocus(
|
PROCEDURE XPLoseKeyboardFocus(
|
||||||
inWidget : XPWidgetID);
|
inWidget : XPWidgetID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetWithFocus
|
XPGetWidgetWithFocus
|
||||||
@@ -608,19 +484,11 @@ USES XPWidgetDefs;
|
|||||||
has focus.
|
has focus.
|
||||||
}
|
}
|
||||||
FUNCTION XPGetWidgetWithFocus: XPWidgetID;
|
FUNCTION XPGetWidgetWithFocus: XPWidgetID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* CREATING CUSTOM WIDGETS
|
* CREATING CUSTOM WIDGETS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPAddWidgetCallback
|
XPAddWidgetCallback
|
||||||
@@ -634,18 +502,14 @@ USES XPWidgetDefs;
|
|||||||
widget ID, and the destruction message will be sent before the other widget
|
widget ID, and the destruction message will be sent before the other widget
|
||||||
function receives a destruction message.
|
function receives a destruction message.
|
||||||
|
|
||||||
This provides a way to 'subclass' an existing widget. By providing a
|
This provides a way to 'subclass' an existing widget. By providing a second
|
||||||
second hook that only handles certain widget messages, you can customize or
|
hook that only handles certain widget messages, you can customize or extend
|
||||||
extend widget behavior.
|
widget behavior.
|
||||||
}
|
}
|
||||||
PROCEDURE XPAddWidgetCallback(
|
PROCEDURE XPAddWidgetCallback(
|
||||||
inWidget : XPWidgetID;
|
inWidget : XPWidgetID;
|
||||||
inNewCallback : XPWidgetFunc_t);
|
inNewCallback : XPWidgetFunc_t);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPGetWidgetClassFunc
|
XPGetWidgetClassFunc
|
||||||
@@ -655,11 +519,9 @@ USES XPWidgetDefs;
|
|||||||
}
|
}
|
||||||
FUNCTION XPGetWidgetClassFunc(
|
FUNCTION XPGetWidgetClassFunc(
|
||||||
inWidgetClass : XPWidgetClass) : XPWidgetFunc_t;
|
inWidgetClass : XPWidgetClass) : XPWidgetFunc_t;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPWIDGETS.DLL;
|
||||||
cdecl; external 'XPWIDGETS.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMCamera;
|
UNIT XPLMCamera;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
XPLMCamera - THEORY OF OPERATION The XPLMCamera APIs allow plug-ins to
|
The XPLMCamera APIs allow plug-ins to control the camera angle in X-Plane.
|
||||||
control the camera angle in X-Plane. This has a number of applications,
|
This has a number of applications, including but not limited to:
|
||||||
including but not limited to:
|
|
||||||
|
|
||||||
- Creating new views (including dynamic/user-controllable views) for the
|
- Creating new views (including dynamic/user-controllable views) for the
|
||||||
user.
|
user.
|
||||||
|
|
||||||
- Creating applications that use X-Plane as a renderer of scenery,
|
- Creating applications that use X-Plane as a renderer of scenery,
|
||||||
aircrafts, or both.
|
aircrafts, or both.
|
||||||
|
|
||||||
@@ -24,10 +19,10 @@ INTERFACE
|
|||||||
OpenGL coordinate info is described in detail in the XPLMGraphics
|
OpenGL coordinate info is described in detail in the XPLMGraphics
|
||||||
documentation; generally you should use the XPLMGraphics routines to
|
documentation; generally you should use the XPLMGraphics routines to
|
||||||
convert from world to local coordinates. The camera's orientation starts
|
convert from world to local coordinates. The camera's orientation starts
|
||||||
facing level with the ground directly up the negative-Z axis
|
facing level with the ground directly up the negative-Z axis (approximately
|
||||||
(approximately north) with the horizon horizontal. It is then rotated
|
north) with the horizon horizontal. It is then rotated clockwise for yaw,
|
||||||
clockwise for yaw, pitched up for positive pitch, and rolled clockwise
|
pitched up for positive pitch, and rolled clockwise around the vector it is
|
||||||
around the vector it is looking along for roll.
|
looking along for roll.
|
||||||
|
|
||||||
You control the camera either either until the user selects a new view or
|
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
|
||||||
@@ -36,20 +31,20 @@ INTERFACE
|
|||||||
|
|
||||||
Use the XPLMDataAccess APIs to get information like the position of the
|
Use the XPLMDataAccess APIs to get information like the position of the
|
||||||
aircraft, etc. for complex camera positioning.
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* CAMERA CONTROL
|
* CAMERA CONTROL
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCameraControlDuration
|
XPLMCameraControlDuration
|
||||||
@@ -62,7 +57,7 @@ TYPE
|
|||||||
{ Control the camera until the user picks a new view. }
|
{ Control the camera until the user picks a new view. }
|
||||||
xplm_ControlCameraUntilViewChanges = 1
|
xplm_ControlCameraUntilViewChanges = 1
|
||||||
|
|
||||||
{ Control the camera until your plugin is disabled or another plugin forcably }
|
{ Control the camera until your plugin is disabled or another plugin forcably}
|
||||||
{ takes control. }
|
{ takes control. }
|
||||||
,xplm_ControlCameraForever = 2
|
,xplm_ControlCameraForever = 2
|
||||||
|
|
||||||
@@ -72,21 +67,21 @@ TYPE
|
|||||||
{
|
{
|
||||||
XPLMCameraPosition_t
|
XPLMCameraPosition_t
|
||||||
|
|
||||||
This structure contains a full specification of the camera. X, Y, and Z
|
This structure contains a full specification of the camera. X, Y, and Z are
|
||||||
are the camera's position in OpenGL coordiantes; pitch, roll, and yaw 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
|
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,
|
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
|
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).
|
||||||
}
|
}
|
||||||
XPLMCameraPosition_t = RECORD
|
XPLMCameraPosition_t = RECORD
|
||||||
x : single;
|
x : Single;
|
||||||
y : single;
|
y : Single;
|
||||||
z : single;
|
z : Single;
|
||||||
pitch : single;
|
pitch : Single;
|
||||||
heading : single;
|
heading : Single;
|
||||||
roll : single;
|
roll : Single;
|
||||||
zoom : single;
|
zoom : Single;
|
||||||
END;
|
END;
|
||||||
PXPLMCameraPosition_t = ^XPLMCameraPosition_t;
|
PXPLMCameraPosition_t = ^XPLMCameraPosition_t;
|
||||||
|
|
||||||
@@ -105,25 +100,21 @@ TYPE
|
|||||||
}
|
}
|
||||||
XPLMCameraControl_f = FUNCTION(
|
XPLMCameraControl_f = FUNCTION(
|
||||||
outCameraPosition : PXPLMCameraPosition_t; { Can be nil }
|
outCameraPosition : PXPLMCameraPosition_t; { Can be nil }
|
||||||
inIsLosingControl : integer;
|
inIsLosingControl : Integer;
|
||||||
inRefcon : pointer) : integer; cdecl;
|
inRefcon : pointer) : Integer; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMControlCamera
|
XPLMControlCamera
|
||||||
|
|
||||||
This function repositions the camera on the next drawing cycle. You must
|
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
|
pass a non-null control function. Specify in inHowLong how long you'd like
|
||||||
control (indefinitely or until a key is pressed).
|
control (indefinitely or until a new view mode is set by the user).
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMControlCamera(
|
PROCEDURE XPLMControlCamera(
|
||||||
inHowLong : XPLMCameraControlDuration;
|
inHowLong : XPLMCameraControlDuration;
|
||||||
inControlFunc : XPLMCameraControl_f;
|
inControlFunc : XPLMCameraControl_f;
|
||||||
inRefcon : pointer);
|
inRefcon : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDontControlCamera
|
XPLMDontControlCamera
|
||||||
@@ -136,11 +127,7 @@ TYPE
|
|||||||
posession of the camera.
|
posession of the camera.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDontControlCamera;
|
PROCEDURE XPLMDontControlCamera;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMIsCameraBeingControlled
|
XPLMIsCameraBeingControlled
|
||||||
@@ -150,12 +137,8 @@ TYPE
|
|||||||
current control duration will be returned.
|
current control duration will be returned.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMIsCameraBeingControlled(
|
FUNCTION XPLMIsCameraBeingControlled(
|
||||||
outCameraControlDuration: PXPLMCameraControlDuration) : integer; { Can be nil }
|
outCameraControlDuration: PXPLMCameraControlDuration) : Integer; { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMReadCameraPosition
|
XPLMReadCameraPosition
|
||||||
@@ -164,11 +147,9 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMReadCameraPosition(
|
PROCEDURE XPLMReadCameraPosition(
|
||||||
outCameraPosition : PXPLMCameraPosition_t);
|
outCameraPosition : PXPLMCameraPosition_t);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMDataAccess;
|
UNIT XPLMDataAccess;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
XPLM Data Access API - Theory of Operation
|
|
||||||
|
|
||||||
The data access API gives you a generic, flexible, high performance way to
|
The data access API gives you a generic, flexible, high performance way to
|
||||||
read and write data to and from X-Plane and other plug-ins. For example,
|
read and write data to and from X-Plane and other plug-ins. For example,
|
||||||
this API allows you to read and set the nav radios, get the plane location,
|
this API allows you to read and set the nav radios, get the plane location,
|
||||||
@@ -19,31 +14,52 @@ INTERFACE
|
|||||||
The data access APIs are the way that you read and write data from the sim
|
The data access APIs are the way that you read and write data from the sim
|
||||||
as well as other plugins.
|
as well as other plugins.
|
||||||
|
|
||||||
The API works using opaque data references. A data reference is a source
|
The API works using opaque data references. A data reference is a source of
|
||||||
of data; you do not know where it comes from, but once you have it you can
|
data; you do not know where it comes from, but once you have it you can
|
||||||
read the data quickly and possibly write it. To get a data reference, you
|
read the data quickly and possibly write it.
|
||||||
look it up.
|
|
||||||
|
|
||||||
Data references are identified by verbose string names
|
Dataref Lookup
|
||||||
(sim/cockpit/radios/nav1_freq_hz). The actual numeric value of the data
|
--------------
|
||||||
reference is implementation defined and is likely to change each time the
|
|
||||||
simulator is run (or the plugin that provides the datareference is
|
Data references are identified by verbose, permanent string names; by
|
||||||
reloaded).
|
convention these names use path separates to form a hierarchy of datarefs,
|
||||||
|
e.g. (sim/cockpit/radios/nav1_freq_hz). The actual opaque numeric value of
|
||||||
|
the data reference, as returned by the XPLM API, is implementation defined
|
||||||
|
and changes each time X-Plane is launched; therefore you need to look up
|
||||||
|
the dataref by path every time your plugin runs.
|
||||||
|
|
||||||
The task of looking up a data reference is relatively expensive; look up
|
The task of looking up a data reference is relatively expensive; look up
|
||||||
your data references once based on verbose strings, and save the opaque
|
your data references once based on the verbose path strings, and save the
|
||||||
data reference value for the duration of your plugin's operation. Reading
|
opaque data reference value for the duration of your plugin's operation.
|
||||||
and writing data references is relatively fast (the cost is equivalent to
|
Reading and writing data references is relatively fast (the cost is
|
||||||
two function calls through function pointers).
|
equivalent to two function calls through function pointers).
|
||||||
|
|
||||||
This allows data access to be high performance, while leaving in
|
X-Plane publishes over 4000 datarefs; a complete list may be found in the
|
||||||
abstraction; since data references are opaque and are searched for, the
|
reference section of the SDK online documentation (from the SDK home page,
|
||||||
underlying data access system can be rebuilt.
|
choose Documentation).
|
||||||
|
|
||||||
|
Dataref Types
|
||||||
|
-------------
|
||||||
|
|
||||||
A note on typing: you must know the correct data type to read and write.
|
A note on typing: you must know the correct data type to read and write.
|
||||||
APIs are provided for reading and writing data in a number of ways. You
|
APIs are provided for reading and writing data in a number of ways. You can
|
||||||
can also double check the data type for a data ref. Note that automatic
|
also double check the data type for a data ref. Automatic type conversion
|
||||||
conversion is not done for you.
|
is not done for you.
|
||||||
|
|
||||||
|
Dataref types are a set, e.g. a dataref can be more than one type. When
|
||||||
|
this happens, you can choose which API you want to use to read. For
|
||||||
|
example, it is not uncommon for a dataref to be of type float and double.
|
||||||
|
This means you can use either XPLMGetDatad or XPLMGetDataf to read it.
|
||||||
|
|
||||||
|
Creating New Datarefs
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
X-Plane provides datarefs that come with the sim, but plugins can also
|
||||||
|
create their own datarefs. A plugin creates a dataref by registering
|
||||||
|
function callbacks to read and write the dataref. The XPLM will call your
|
||||||
|
plugin each time some other plugin (or X-Plane) tries to read or write the
|
||||||
|
dataref. You must provide a read (and optional write) callback for each
|
||||||
|
data type you support.
|
||||||
|
|
||||||
A note for plugins sharing data with other plugins: the load order of
|
A note for plugins sharing data with other plugins: the load order of
|
||||||
plugins is not guaranteed. To make sure that every plugin publishing data
|
plugins is not guaranteed. To make sure that every plugin publishing data
|
||||||
@@ -52,26 +68,25 @@ INTERFACE
|
|||||||
first time your 'enable' routine is called, or the first time they are
|
first time your 'enable' routine is called, or the first time they are
|
||||||
needed in code.
|
needed in code.
|
||||||
|
|
||||||
X-Plane publishes well over 1000 datarefs; a complete list may be found in
|
When a plugin that created a dataref is unloaded, it becomes "orphaned".
|
||||||
the reference section of the SDK online documentation (from the SDK home
|
The dataref handle continues to be usable, but the dataref is not writable,
|
||||||
page, choose Documentation).
|
and reading it will always return 0 (or 0 items for arrays). If the plugin
|
||||||
|
is reloaded and re-registers the dataref, the handle becomes un-orphaned
|
||||||
|
and works again.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* READING AND WRITING DATA
|
* READING AND WRITING DATA
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
These routines allow you to access a wide variety of data from within
|
These routines allow you to access data from within X-Plane and sometimes
|
||||||
x-plane and modify some of it.
|
modify it.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
{
|
{
|
||||||
XPLMDataRef
|
XPLMDataRef
|
||||||
@@ -92,7 +107,9 @@ TYPE
|
|||||||
you expect. But for the most part, you will know the type of data you are
|
you expect. But for the most part, you will know the type of data you are
|
||||||
expecting from the online documentation.
|
expecting from the online documentation.
|
||||||
|
|
||||||
Data types each take a bit field, so sets of data types may be formed.
|
Data types each take a bit field; it is legal to have a single dataref be
|
||||||
|
more than one type of data. Whe this happens, you can pick any matching
|
||||||
|
get/set API.
|
||||||
}
|
}
|
||||||
XPLMDataTypeID = (
|
XPLMDataTypeID = (
|
||||||
{ Data of a type the current XPLM doesn't do. }
|
{ Data of a type the current XPLM doesn't do. }
|
||||||
@@ -124,7 +141,7 @@ TYPE
|
|||||||
|
|
||||||
Given a c-style string that names the data ref, this routine looks up the
|
Given a c-style string that names the data ref, this routine looks up the
|
||||||
actual opaque XPLMDataRef that you use to read and write the data. The
|
actual opaque XPLMDataRef that you use to read and write the data. The
|
||||||
string names for datarefs are published on the x-plane SDK web site.
|
string names for datarefs are published on the X-Plane SDK web site.
|
||||||
|
|
||||||
This function returns NULL if the data ref cannot be found.
|
This function returns NULL if the data ref cannot be found.
|
||||||
|
|
||||||
@@ -133,62 +150,52 @@ TYPE
|
|||||||
every time you need to read or write it.
|
every time you need to read or write it.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindDataRef(
|
FUNCTION XPLMFindDataRef(
|
||||||
inDataRefName : Pchar) : XPLMDataRef;
|
inDataRefName : XPLMString) : XPLMDataRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCanWriteDataRef
|
XPLMCanWriteDataRef
|
||||||
|
|
||||||
Given a data ref, this routine returns true if you can successfully set
|
Given a data ref, this routine returns true if you can successfully set the
|
||||||
the data, false otherwise. Some datarefs are read-only.
|
data, false otherwise. Some datarefs are read-only.
|
||||||
|
|
||||||
|
NOTE: even if a dataref is marked writable, it may not act writable. This
|
||||||
|
can happen for datarefs that X-Plane writes to on every frame of
|
||||||
|
simulation. In some cases, the dataref is writable but you have to set a
|
||||||
|
separate "override" dataref to 1 to stop X-Plane from writing it.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMCanWriteDataRef(
|
FUNCTION XPLMCanWriteDataRef(
|
||||||
inDataRef : XPLMDataRef) : integer;
|
inDataRef : XPLMDataRef) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMIsDataRefGood
|
XPLMIsDataRefGood
|
||||||
|
|
||||||
WARNING: This function is deprecated and should not be used. Datarefs are
|
This function returns true if the passed in handle is a valid dataref that
|
||||||
valid until plugins are reloaded or the sim quits. Plugins sharing
|
is not orphaned.
|
||||||
datarefs should support these semantics by not unregistering datarefs
|
|
||||||
during operation. (You should however unregister datarefs when your plugin
|
|
||||||
is unloaded, as part of general resource cleanup.)
|
|
||||||
|
|
||||||
This function returns whether a data ref is still valid. If it returns
|
Note: there is normally no need to call this function; datarefs returned by
|
||||||
false, you should refind the data ref from its original string. Calling an
|
XPLMFindDataRef remain valid (but possibly orphaned) unless there is a
|
||||||
accessor function on a bad data ref will return a default value, typically
|
complete plugin reload (in which case your plugin is reloaded anyway).
|
||||||
0 or 0-length data.
|
Orphaned datarefs can be safely read and return 0. Therefore you never need
|
||||||
|
to call XPLMIsDataRefGood to 'check' the safety of a dataref.
|
||||||
|
(XPLMIsDatarefGood performs some slow checking of the handle validity, so
|
||||||
|
it has a perormance cost.)
|
||||||
}
|
}
|
||||||
FUNCTION XPLMIsDataRefGood(
|
FUNCTION XPLMIsDataRefGood(
|
||||||
inDataRef : XPLMDataRef) : integer;
|
inDataRef : XPLMDataRef) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDataRefTypes
|
XPLMGetDataRefTypes
|
||||||
|
|
||||||
This routine returns the types of the data ref for accessor use. If a data
|
This routine returns the types of the data ref for accessor use. If a data
|
||||||
ref is available in multiple data types, they will all be returned.
|
ref is available in multiple data types, the bit-wise OR of these types
|
||||||
|
will be returned.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetDataRefTypes(
|
FUNCTION XPLMGetDataRefTypes(
|
||||||
inDataRef : XPLMDataRef) : XPLMDataTypeID;
|
inDataRef : XPLMDataRef) : XPLMDataTypeID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* DATA ACCESSORS
|
* DATA ACCESSORS
|
||||||
@@ -197,13 +204,15 @@ TYPE
|
|||||||
These routines read and write the data references. For each supported data
|
These routines read and write the data references. For each supported data
|
||||||
type there is a reader and a writer.
|
type there is a reader and a writer.
|
||||||
|
|
||||||
If the data ref is invalid or the plugin that provides it is disabled or
|
If the data ref is orphaned or the plugin that provides it is disabled or
|
||||||
there is a type mismatch, the functions that read data will return 0 as a
|
there is a type mismatch, the functions that read data will return 0 as a
|
||||||
default value or not modify the passed in memory. The plugins that write
|
default value or not modify the passed in memory. The plugins that write
|
||||||
data will not write under these circumstances or if the data ref is
|
data will not write under these circumstances or if the data ref is
|
||||||
read-only. NOTE: to keep the overhead of reading datarefs low, these
|
read-only.
|
||||||
routines do not do full validation of a dataref; passing a junk value for
|
|
||||||
a dataref can result in crashing the sim.
|
NOTE: to keep the overhead of reading datarefs low, these routines do not
|
||||||
|
do full validation of a dataref; passing a junk value for a dataref can
|
||||||
|
result in crashing the sim. The get/set APIs do check for NULL.
|
||||||
|
|
||||||
For array-style datarefs, you specify the number of items to read/write and
|
For array-style datarefs, you specify the number of items to read/write and
|
||||||
the offset into the array; the actual number of items read or written is
|
the offset into the array; the actual number of items read or written is
|
||||||
@@ -211,107 +220,80 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatai
|
XPLMGetDatai
|
||||||
|
|
||||||
Read an integer data ref and return its value. The return value is the
|
Read an integer data ref and return its value. The return value is the
|
||||||
dataref value or 0 if the dataref is invalid/NULL or the plugin is
|
dataref value or 0 if the dataref is NULL or the plugin is disabled.
|
||||||
disabled.
|
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetDatai(
|
FUNCTION XPLMGetDatai(
|
||||||
inDataRef : XPLMDataRef) : integer;
|
inDataRef : XPLMDataRef) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatai
|
XPLMSetDatai
|
||||||
|
|
||||||
Write a new value to an integer data ref. This routine is a no-op if the
|
Write a new value to an integer data ref. This routine is a no-op if the
|
||||||
plugin publishing the dataref is disabled, the dataref is invalid, or the
|
plugin publishing the dataref is disabled, the dataref is NULL, or the
|
||||||
dataref is not writable.
|
dataref is not writable.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDatai(
|
PROCEDURE XPLMSetDatai(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
inValue : integer);
|
inValue : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDataf
|
XPLMGetDataf
|
||||||
|
|
||||||
Read a single precision floating point dataref and return its value. The
|
Read a single precision floating point dataref and return its value. The
|
||||||
return value is the dataref value or 0.0 if the dataref is invalid/NULL or
|
return value is the dataref value or 0.0 if the dataref is NULL or the
|
||||||
the plugin is disabled.
|
plugin is disabled.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetDataf(
|
FUNCTION XPLMGetDataf(
|
||||||
inDataRef : XPLMDataRef) : single;
|
inDataRef : XPLMDataRef) : Single;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDataf
|
XPLMSetDataf
|
||||||
|
|
||||||
Write a new value to a single precision floating point data ref. This
|
Write a new value to a single precision floating point data ref. This
|
||||||
routine is a no-op if the plugin publishing the dataref is disabled, the
|
routine is a no-op if the plugin publishing the dataref is disabled, the
|
||||||
dataref is invalid, or the dataref is not writable.
|
dataref is NULL, or the dataref is not writable.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDataf(
|
PROCEDURE XPLMSetDataf(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
inValue : single);
|
inValue : Single);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatad
|
XPLMGetDatad
|
||||||
|
|
||||||
Read a double precision floating point dataref and return its value. The
|
Read a double precision floating point dataref and return its value. The
|
||||||
return value is the dataref value or 0.0 if the dataref is invalid/NULL or
|
return value is the dataref value or 0.0 if the dataref is NULL or the
|
||||||
the plugin is disabled.
|
plugin is disabled.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetDatad(
|
FUNCTION XPLMGetDatad(
|
||||||
inDataRef : XPLMDataRef) : real;
|
inDataRef : XPLMDataRef) : Real;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatad
|
XPLMSetDatad
|
||||||
|
|
||||||
Write a new value to a double precision floating point data ref. This
|
Write a new value to a double precision floating point data ref. This
|
||||||
routine is a no-op if the plugin publishing the dataref is disabled, the
|
routine is a no-op if the plugin publishing the dataref is disabled, the
|
||||||
dataref is invalid, or the dataref is not writable.
|
dataref is NULL, or the dataref is not writable.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDatad(
|
PROCEDURE XPLMSetDatad(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
inValue : real);
|
inValue : Real);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatavi
|
XPLMGetDatavi
|
||||||
|
|
||||||
Read a part of an integer array dataref. If you pass NULL for outVaules,
|
Read a part of an integer array dataref. If you pass NULL for outValues,
|
||||||
the routine will return the size of the array, ignoring inOffset and inMax.
|
the routine will return the size of the array, ignoring inOffset and inMax.
|
||||||
|
|
||||||
|
|
||||||
If outValues is not NULL, then up to inMax values are copied from the
|
If outValues is not NULL, then up to inMax values are copied from the
|
||||||
dataref into outValues, starting at inOffset in the dataref. If inMax +
|
dataref into outValues, starting at inOffset in the dataref. If inMax +
|
||||||
inOffset is larger than the size of the dataref, less than inMax values
|
inOffset is larger than the size of the dataref, less than inMax values
|
||||||
@@ -324,14 +306,10 @@ TYPE
|
|||||||
}
|
}
|
||||||
FUNCTION XPLMGetDatavi(
|
FUNCTION XPLMGetDatavi(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
outValues : Pinteger; { Can be nil }
|
outValues : PInteger; { Can be nil }
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inMax : integer) : integer;
|
inMax : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatavi
|
XPLMSetDatavi
|
||||||
@@ -348,21 +326,17 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDatavi(
|
PROCEDURE XPLMSetDatavi(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
inValues : Pinteger;
|
inValues : PInteger;
|
||||||
inoffset : integer;
|
inoffset : Integer;
|
||||||
inCount : integer);
|
inCount : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatavf
|
XPLMGetDatavf
|
||||||
|
|
||||||
Read a part of a single precision floating point array dataref. If you
|
Read a part of a single precision floating point array dataref. If you pass
|
||||||
pass NULL for outVaules, the routine will return the size of the array,
|
NULL for outVaules, the routine will return the size of the array, ignoring
|
||||||
ignoring inOffset and inMax.
|
inOffset and inMax.
|
||||||
|
|
||||||
If outValues is not NULL, then up to inMax values are copied from the
|
If outValues is not NULL, then up to inMax values are copied from the
|
||||||
dataref into outValues, starting at inOffset in the dataref. If inMax +
|
dataref into outValues, starting at inOffset in the dataref. If inMax +
|
||||||
@@ -376,14 +350,10 @@ TYPE
|
|||||||
}
|
}
|
||||||
FUNCTION XPLMGetDatavf(
|
FUNCTION XPLMGetDatavf(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
outValues : Psingle; { Can be nil }
|
outValues : PSingle; { Can be nil }
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inMax : integer) : integer;
|
inMax : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatavf
|
XPLMSetDatavf
|
||||||
@@ -400,14 +370,10 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDatavf(
|
PROCEDURE XPLMSetDatavf(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
inValues : Psingle;
|
inValues : PSingle;
|
||||||
inoffset : integer;
|
inoffset : Integer;
|
||||||
inCount : integer);
|
inCount : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatab
|
XPLMGetDatab
|
||||||
@@ -428,20 +394,16 @@ TYPE
|
|||||||
FUNCTION XPLMGetDatab(
|
FUNCTION XPLMGetDatab(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
outValue : pointer; { Can be nil }
|
outValue : pointer; { Can be nil }
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inMaxBytes : integer) : integer;
|
inMaxBytes : Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatab
|
XPLMSetDatab
|
||||||
|
|
||||||
Write part or all of a byte array dataref. The values passed by inValues
|
Write part or all of a byte array dataref. The values passed by inValues
|
||||||
are written into the dataref starting at inOffset. Up to inCount values
|
are written into the dataref starting at inOffset. Up to inCount values are
|
||||||
are written; however if the values would write "off the end" of the dataref
|
written; however if the values would write "off the end" of the dataref
|
||||||
array, then fewer values are written.
|
array, then fewer values are written.
|
||||||
|
|
||||||
Note: the semantics of array datarefs are entirely implemented by the
|
Note: the semantics of array datarefs are entirely implemented by the
|
||||||
@@ -452,23 +414,19 @@ TYPE
|
|||||||
PROCEDURE XPLMSetDatab(
|
PROCEDURE XPLMSetDatab(
|
||||||
inDataRef : XPLMDataRef;
|
inDataRef : XPLMDataRef;
|
||||||
inValue : pointer;
|
inValue : pointer;
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inLength : integer);
|
inLength : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* PUBLISHING YOUR PLUGINS DATA
|
* PUBLISHING YOUR PLUGIN'S DATA
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
These functions allow you to create data references that other plug-ins can
|
These functions allow you to create data references that other plug-ins and
|
||||||
access via the above data access APIs. Data references published by other
|
X-Plane can access via the above data access APIs. Data references
|
||||||
plugins operate the same as ones published by x-plane in all manners except
|
published by other plugins operate the same as ones published by X-Plane in
|
||||||
that your data reference will not be available to other plugins if/when
|
all manners except that your data reference will not be available to other
|
||||||
your plugin is disabled.
|
plugins if/when your plugin is disabled.
|
||||||
|
|
||||||
You share data by registering data provider callback functions. When a
|
You share data by registering data provider callback functions. When a
|
||||||
plug-in requests your data, these callbacks are then called. You provide
|
plug-in requests your data, these callbacks are then called. You provide
|
||||||
@@ -482,7 +440,6 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatai_f
|
XPLMGetDatai_f
|
||||||
|
|
||||||
@@ -490,7 +447,7 @@ TYPE
|
|||||||
|
|
||||||
These define the function pointers you provide to get or set data. Note
|
These define the function pointers you provide to get or set data. Note
|
||||||
that you are passed a generic pointer for each one. This is the same
|
that you are passed a generic pointer for each one. This is the same
|
||||||
pointer you pass in your register routine; you can use it to find global
|
pointer you pass in your register routine; you can use it to locate plugin
|
||||||
variables, etc.
|
variables, etc.
|
||||||
|
|
||||||
The semantics of your callbacks are the same as the dataref accessor above
|
The semantics of your callbacks are the same as the dataref accessor above
|
||||||
@@ -501,105 +458,94 @@ TYPE
|
|||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPLMGetDatai_f = FUNCTION(
|
XPLMGetDatai_f = FUNCTION(
|
||||||
inRefcon : pointer) : integer; cdecl;
|
inRefcon : pointer) : Integer; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatai_f
|
XPLMSetDatai_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMSetDatai_f = PROCEDURE(
|
XPLMSetDatai_f = PROCEDURE(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
inValue : integer); cdecl;
|
inValue : Integer); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDataf_f
|
XPLMGetDataf_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMGetDataf_f = FUNCTION(
|
XPLMGetDataf_f = FUNCTION(
|
||||||
inRefcon : pointer) : single; cdecl;
|
inRefcon : pointer) : Single; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDataf_f
|
XPLMSetDataf_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMSetDataf_f = PROCEDURE(
|
XPLMSetDataf_f = PROCEDURE(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
inValue : single); cdecl;
|
inValue : Single); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatad_f
|
XPLMGetDatad_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMGetDatad_f = FUNCTION(
|
XPLMGetDatad_f = FUNCTION(
|
||||||
inRefcon : pointer) : real; cdecl;
|
inRefcon : pointer) : Real; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatad_f
|
XPLMSetDatad_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMSetDatad_f = PROCEDURE(
|
XPLMSetDatad_f = PROCEDURE(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
inValue : real); cdecl;
|
inValue : Real); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatavi_f
|
XPLMGetDatavi_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMGetDatavi_f = FUNCTION(
|
XPLMGetDatavi_f = FUNCTION(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
outValues : Pinteger; { Can be nil }
|
outValues : PInteger; { Can be nil }
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inMax : integer) : integer; cdecl;
|
inMax : Integer) : Integer; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatavi_f
|
XPLMSetDatavi_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMSetDatavi_f = PROCEDURE(
|
XPLMSetDatavi_f = PROCEDURE(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
inValues : Pinteger;
|
inValues : PInteger;
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inCount : integer); cdecl;
|
inCount : Integer); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatavf_f
|
XPLMGetDatavf_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMGetDatavf_f = FUNCTION(
|
XPLMGetDatavf_f = FUNCTION(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
outValues : Psingle; { Can be nil }
|
outValues : PSingle; { Can be nil }
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inMax : integer) : integer; cdecl;
|
inMax : Integer) : Integer; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatavf_f
|
XPLMSetDatavf_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMSetDatavf_f = PROCEDURE(
|
XPLMSetDatavf_f = PROCEDURE(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
inValues : Psingle;
|
inValues : PSingle;
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inCount : integer); cdecl;
|
inCount : Integer); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDatab_f
|
XPLMGetDatab_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMGetDatab_f = FUNCTION(
|
XPLMGetDatab_f = FUNCTION(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
outValue : pointer; { Can be nil }
|
outValue : pointer; { Can be nil }
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inMaxLength : integer) : integer; cdecl;
|
inMaxLength : Integer) : Integer; cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDatab_f
|
XPLMSetDatab_f
|
||||||
|
|
||||||
}
|
}
|
||||||
XPLMSetDatab_f = PROCEDURE(
|
XPLMSetDatab_f = PROCEDURE(
|
||||||
inRefcon : pointer;
|
inRefcon : pointer;
|
||||||
inValue : pointer;
|
inValue : pointer;
|
||||||
inOffset : integer;
|
inOffset : Integer;
|
||||||
inLength : integer); cdecl;
|
inLength : Integer); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMRegisterDataAccessor
|
XPLMRegisterDataAccessor
|
||||||
@@ -615,9 +561,9 @@ TYPE
|
|||||||
this data ref to unregister your data later or read or write from it.
|
this data ref to unregister your data later or read or write from it.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMRegisterDataAccessor(
|
FUNCTION XPLMRegisterDataAccessor(
|
||||||
inDataName : Pchar;
|
inDataName : XPLMString;
|
||||||
inDataType : XPLMDataTypeID;
|
inDataType : XPLMDataTypeID;
|
||||||
inIsWritable : integer;
|
inIsWritable : Integer;
|
||||||
inReadInt : XPLMGetDatai_f;
|
inReadInt : XPLMGetDatai_f;
|
||||||
inWriteInt : XPLMSetDatai_f;
|
inWriteInt : XPLMSetDatai_f;
|
||||||
inReadFloat : XPLMGetDataf_f;
|
inReadFloat : XPLMGetDataf_f;
|
||||||
@@ -632,11 +578,7 @@ TYPE
|
|||||||
inWriteData : XPLMSetDatab_f;
|
inWriteData : XPLMSetDatab_f;
|
||||||
inReadRefcon : pointer;
|
inReadRefcon : pointer;
|
||||||
inWriteRefcon : pointer) : XPLMDataRef;
|
inWriteRefcon : pointer) : XPLMDataRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMUnregisterDataAccessor
|
XPLMUnregisterDataAccessor
|
||||||
@@ -645,19 +587,10 @@ TYPE
|
|||||||
You unregister a data ref by the XPLMDataRef you get back from
|
You unregister a data ref by the XPLMDataRef you get back from
|
||||||
registration. Once you unregister a data ref, your function pointer will
|
registration. Once you unregister a data ref, your function pointer will
|
||||||
not be called anymore.
|
not be called anymore.
|
||||||
|
|
||||||
For maximum compatibility, do not unregister your data accessors until
|
|
||||||
final shutdown (when your XPluginStop routine is called). This allows
|
|
||||||
other plugins to find your data reference once and use it for their entire
|
|
||||||
time of operation.
|
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMUnregisterDataAccessor(
|
PROCEDURE XPLMUnregisterDataAccessor(
|
||||||
inDataRef : XPLMDataRef);
|
inDataRef : XPLMDataRef);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* SHARING DATA BETWEEN MULTIPLE PLUGINS
|
* SHARING DATA BETWEEN MULTIPLE PLUGINS
|
||||||
@@ -677,16 +610,16 @@ TYPE
|
|||||||
Shared data references differ from the 'owned' data references from the
|
Shared data references differ from the 'owned' data references from the
|
||||||
previous section in a few ways:
|
previous section in a few ways:
|
||||||
|
|
||||||
- With shared data references, any plugin can create the data reference;
|
* With shared data references, any plugin can create the data reference;
|
||||||
with owned plugins one plugin must create the data reference and others
|
with owned plugins one plugin must create the data reference and others
|
||||||
subscribe. (This can be a problem if you don't know which set of plugins
|
subscribe. (This can be a problem if you don't know which set of plugins
|
||||||
will be present).
|
will be present).
|
||||||
|
|
||||||
- With shared data references, every plugin that is sharing the data is
|
* With shared data references, every plugin that is sharing the data is
|
||||||
notified when the data is changed. With owned data references, only the
|
notified when the data is changed. With owned data references, only the
|
||||||
one owner is notified when the data is changed.
|
one owner is notified when the data is changed.
|
||||||
|
|
||||||
- With shared data references, you cannot access the physical memory of the
|
* With shared data references, you cannot access the physical memory of the
|
||||||
data reference; you must use the XPLMGet... and XPLMSet... APIs. With an
|
data reference; you must use the XPLMGet... and XPLMSet... APIs. With an
|
||||||
owned data reference, the one owning data reference can manipulate the
|
owned data reference, the one owning data reference can manipulate the
|
||||||
data reference's memory in any way it sees fit.
|
data reference's memory in any way it sees fit.
|
||||||
@@ -698,7 +631,6 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDataChanged_f
|
XPLMDataChanged_f
|
||||||
|
|
||||||
@@ -731,15 +663,11 @@ TYPE
|
|||||||
zero if the data already exists but is of the wrong type.
|
zero if the data already exists but is of the wrong type.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMShareData(
|
FUNCTION XPLMShareData(
|
||||||
inDataName : Pchar;
|
inDataName : XPLMString;
|
||||||
inDataType : XPLMDataTypeID;
|
inDataType : XPLMDataTypeID;
|
||||||
inNotificationFunc : XPLMDataChanged_f;
|
inNotificationFunc : XPLMDataChanged_f;
|
||||||
inNotificationRefcon: pointer) : integer;
|
inNotificationRefcon: pointer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMUnshareData
|
XPLMUnshareData
|
||||||
@@ -750,15 +678,13 @@ TYPE
|
|||||||
since other plug-ins could be using it.
|
since other plug-ins could be using it.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMUnshareData(
|
FUNCTION XPLMUnshareData(
|
||||||
inDataName : Pchar;
|
inDataName : XPLMString;
|
||||||
inDataType : XPLMDataTypeID;
|
inDataType : XPLMDataTypeID;
|
||||||
inNotificationFunc : XPLMDataChanged_f;
|
inNotificationFunc : XPLMDataChanged_f;
|
||||||
inNotificationRefcon: pointer) : integer;
|
inNotificationRefcon: pointer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMDefs;
|
UNIT XPLMDefs;
|
||||||
@@ -20,9 +17,6 @@ INTERFACE
|
|||||||
}
|
}
|
||||||
|
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
{$DEFINE KYLIX}
|
{$DEFINE KYLIX}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@@ -52,7 +46,6 @@ TYPE
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* GLOBAL DEFINITIONS
|
* GLOBAL DEFINITIONS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
@@ -61,7 +54,6 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TYPE
|
TYPE
|
||||||
{
|
{
|
||||||
XPLMPluginID
|
XPLMPluginID
|
||||||
@@ -70,14 +62,15 @@ TYPE
|
|||||||
disable or enable a plug-in, or discover what plug-in is 'running' at the
|
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
|
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
|
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
|
For persistent identification of plug-ins, use XPLMFindPluginBySignature in
|
||||||
XPLMUtiltiies.h
|
XPLMUtiltiies.h
|
||||||
|
|
||||||
-1 indicates no plug-in.
|
-1 indicates no plug-in.
|
||||||
}
|
}
|
||||||
XPLMPluginID = integer;
|
XPLMPluginID = Integer;
|
||||||
PXPLMPluginID = ^XPLMPluginID;
|
PXPLMPluginID = ^XPLMPluginID;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
@@ -87,8 +80,8 @@ CONST
|
|||||||
{ X-Plane itself }
|
{ X-Plane itself }
|
||||||
XPLM_PLUGIN_XPLANE = (0);
|
XPLM_PLUGIN_XPLANE = (0);
|
||||||
|
|
||||||
{ The current XPLM revision is 2.10 (210). }
|
{ The current XPLM revision is 4.00 (400). }
|
||||||
kXPLM_Version = (210);
|
kXPLM_Version = (400);
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMKeyFlags
|
XPLMKeyFlags
|
||||||
@@ -134,13 +127,13 @@ TYPE
|
|||||||
codes. Not all key presses generate an ASCII value, so plugin code should
|
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
|
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
|
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
|
press. Use virtual key codes to find these key strokes.
|
||||||
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.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
@@ -188,10 +181,10 @@ CONST
|
|||||||
{
|
{
|
||||||
These are cross-platform defines for every distinct keyboard press on the
|
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
|
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
|
the "two" key on the top row of the main keyboard has a different code from
|
||||||
from the "two" key on the numeric key pad. But the 'w' and 'W' character
|
the "two" key on the numeric key pad. But the 'w' and 'W' character are
|
||||||
are indistinguishable by virtual key code because they are the same
|
indistinguishable by virtual key code because they are the same physical
|
||||||
physical key (one with and one without the shift key).
|
key (one with and one without the shift key).
|
||||||
|
|
||||||
Use virtual key codes to detect keystrokes that do not have ASCII
|
Use virtual key codes to detect keystrokes that do not have ASCII
|
||||||
equivalents, allow the user to map the numeric keypad separately from the
|
equivalents, allow the user to map the numeric keypad separately from the
|
||||||
@@ -205,16 +198,13 @@ CONST
|
|||||||
1. Modifier keys are not available as virtual key codes. You cannot get
|
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
|
distinct modifier press and release messages. Please do not try to use
|
||||||
modifier keys as regular keys; doing so will almost certainly interfere
|
modifier keys as regular keys; doing so will almost certainly interfere
|
||||||
with users' abilities to use the native x-plane key bindings.
|
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.
|
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
|
3. Do not assume that the values of these keystrokes are interchangeable
|
||||||
with MS v-keys.
|
with MS v-keys.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
XPLM_VK_BACK = $08;
|
XPLM_VK_BACK = $08;
|
||||||
|
|
||||||
@@ -442,5 +432,7 @@ CONST
|
|||||||
|
|
||||||
XPLM_VK_NUMPAD_EQ = $BD;
|
XPLM_VK_NUMPAD_EQ = $BD;
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
+1233
-438
File diff suppressed because it is too large
Load Diff
+154
-171
@@ -1,16 +1,11 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMGraphics;
|
UNIT XPLMGraphics;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
Graphics routines for X-Plane and OpenGL.
|
|
||||||
|
|
||||||
A few notes on coordinate systems:
|
A few notes on coordinate systems:
|
||||||
|
|
||||||
X-Plane uses three kinds of coordinates. Global coordinates are specified
|
X-Plane uses three kinds of coordinates. Global coordinates are specified
|
||||||
@@ -24,14 +19,15 @@ INTERFACE
|
|||||||
not truly straight up and down at other points). The Z axis is aligned
|
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
|
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).
|
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
|
One unit is one meter and the point 0,0,0 is on the surface of the earth at
|
||||||
at sea level for some latitude and longitude picked by the sim such that
|
sea level for some latitude and longitude picked by the sim such that the
|
||||||
the user's aircraft is reasonably nearby.
|
user's aircraft is reasonably nearby.
|
||||||
|
|
||||||
Cockpit coordinates are 2d, with the X axis horizontal and the Y axis
|
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
|
vertical. The point 0,0 is the bottom left and 1024,768 is the upper
|
||||||
of the screen. This is true no matter what resolution the user's monitor is
|
right of the screen. This is true no matter what resolution the user's
|
||||||
in; when running in higher resolution, graphics will be scaled.
|
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
|
Use X-Plane's routines to convert between global and local coordinates. Do
|
||||||
not attempt to do this conversion yourself; the precise 'roundness' of
|
not attempt to do this conversion yourself; the precise 'roundness' of
|
||||||
@@ -40,11 +36,9 @@ INTERFACE
|
|||||||
planet.
|
planet.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* X-PLANE GRAPHICS
|
* X-PLANE GRAPHICS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
@@ -53,23 +47,30 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMTextureID
|
XPLMTextureID
|
||||||
|
|
||||||
XPLM Texture IDs name well-known textures in the sim for you to use. This
|
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.
|
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.
|
||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPLMTextureID = (
|
XPLMTextureID = (
|
||||||
{ The bitmap that contains window outlines, button outlines, fonts, etc. }
|
{ The bitmap that contains window outlines, button outlines, fonts, etc. }
|
||||||
xplm_Tex_GeneralInterface = 0
|
xplm_Tex_GeneralInterface = 0
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ The exterior paint for the user's aircraft (daytime). }
|
{ The exterior paint for the user's aircraft (daytime). }
|
||||||
,xplm_Tex_AircraftPaint = 1
|
,xplm_Tex_AircraftPaint = 1
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ The exterior light map for the user's aircraft. }
|
{ The exterior light map for the user's aircraft. }
|
||||||
,xplm_Tex_AircraftLiteMap = 2
|
,xplm_Tex_AircraftLiteMap = 2
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
);
|
);
|
||||||
PXPLMTextureID = ^XPLMTextureID;
|
PXPLMTextureID = ^XPLMTextureID;
|
||||||
@@ -77,30 +78,27 @@ TYPE
|
|||||||
{
|
{
|
||||||
XPLMSetGraphicsState
|
XPLMSetGraphicsState
|
||||||
|
|
||||||
XPLMSetGraphicsState changes OpenGL's graphics state in a number of ways:
|
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);
|
- inEnableFog - enables or disables fog, equivalent to: glEnable(GL_FOG);
|
||||||
|
- inNumberTexUnits - enables or disables a number of multitexturing units.
|
||||||
inNumberTexUnits - enables or disables a number of multitexturing units. If
|
If the number is 0, 2d texturing is disabled entirely, as in
|
||||||
the number is 0, 2d texturing is disabled entirely, as in
|
|
||||||
glDisable(GL_TEXTURE_2D); Otherwise, 2d texturing is enabled, and a
|
glDisable(GL_TEXTURE_2D); Otherwise, 2d texturing is enabled, and a
|
||||||
number of multitexturing units are enabled sequentially, starting with
|
number of multitexturing units are enabled sequentially, starting with
|
||||||
unit 0, e.g. glActiveTextureARB(GL_TEXTURE0_ARB); glEnable
|
unit 0, e.g. glActiveTextureARB(GL_TEXTURE0_ARB); glEnable
|
||||||
(GL_TEXTURE_2D);
|
(GL_TEXTURE_2D);
|
||||||
|
- inEnableLighting - enables or disables OpenGL lighting, e.g.
|
||||||
inEnableLighting - enables or disables OpenGL lighting, e.g.
|
|
||||||
glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);
|
glEnable(GL_LIGHTING); glEnable(GL_LIGHT0);
|
||||||
|
- inEnableAlphaTesting - enables or disables the alpha test per pixel, e.g.
|
||||||
inEnableAlphaTesting - enables or disables the alpha test per pixel, e.g.
|
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
|
- inEnableAlphaBlending - enables or disables alpha blending per pixel,
|
||||||
inEnableAlphaBlending - enables or disables alpha blending per pixel, e.g.
|
e.g. glEnable(GL_BLEND);
|
||||||
glEnable(GL_BLEND);
|
- inEnableDepthTesting - enables per pixel depth testing, as in
|
||||||
|
|
||||||
inEnableDepthTesting - enables per pixel depth testing, as in
|
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
- inEnableDepthWriting - enables writing back of depth information to the
|
||||||
inEnableDepthWriting - enables writing back of depth information to the
|
|
||||||
depth bufffer, as in glDepthMask(GL_TRUE);
|
depth bufffer, as in glDepthMask(GL_TRUE);
|
||||||
|
|
||||||
The purpose of this function is to change OpenGL state while keeping
|
The purpose of this function is to change OpenGL state while keeping
|
||||||
@@ -109,95 +107,77 @@ TYPE
|
|||||||
having to set all state before all draws; XPLMSetGraphicsState internally
|
having to set all state before all draws; XPLMSetGraphicsState internally
|
||||||
skips calls to change state that is already properly enabled.
|
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
|
X-Plane does not have a 'default' OGL state for plug-ins with respect to
|
||||||
totally set OGL state before drawing. Use XPLMSetGraphicsState instead of
|
the above state vector; plug-ins should totally set OGL state using this
|
||||||
any of the above OpenGL calls.
|
API before drawing. Use XPLMSetGraphicsState instead of any of the above
|
||||||
|
OpenGL calls.
|
||||||
|
|
||||||
WARNING: Any routine that performs drawing (e.g. XPLMDrawString or widget
|
WARNING: Any routine that performs drawing (e.g. XPLMDrawString or widget
|
||||||
code) may change X-Plane's state. Always set state before drawing after
|
code) may change X-Plane's state. Always set state before drawing after
|
||||||
unknown code has executed.
|
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.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetGraphicsState(
|
PROCEDURE XPLMSetGraphicsState(
|
||||||
inEnableFog : integer;
|
inEnableFog : Integer;
|
||||||
inNumberTexUnits : integer;
|
inNumberTexUnits : Integer;
|
||||||
inEnableLighting : integer;
|
inEnableLighting : Integer;
|
||||||
inEnableAlphaTesting: integer;
|
inEnableAlphaTesting: Integer;
|
||||||
inEnableAlphaBlending: integer;
|
inEnableAlphaBlending: Integer;
|
||||||
inEnableDepthTesting: integer;
|
inEnableDepthTesting: Integer;
|
||||||
inEnableDepthWriting: integer);
|
inEnableDepthWriting: Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMBindTexture2d
|
XPLMBindTexture2d
|
||||||
|
|
||||||
XPLMBindTexture2d changes what texture is bound to the 2d texturing target.
|
XPLMBindTexture2d changes what texture is bound to the 2d texturing
|
||||||
This routine caches the current 2d texture across all texturing units in
|
target. This routine caches the current 2d texture across all texturing
|
||||||
the sim and plug-ins, preventing extraneous binding. For example, consider
|
units in the sim and plug-ins, preventing extraneous binding. For
|
||||||
several plug-ins running in series; if they all use the 'general interface'
|
example, consider several plug-ins running in series; if they all use the
|
||||||
bitmap to do UI, calling this function will skip the rebinding of the
|
'general interface' bitmap to do UI, calling this function will skip the
|
||||||
general interface texture on all but the first plug-in, which can provide
|
rebinding of the general interface texture on all but the first plug-in,
|
||||||
better frame rate son some graphics cards.
|
which can provide better frame rate son some graphics cards.
|
||||||
|
|
||||||
inTextureID is the ID of the texture object to bind; inTextureUnit is a
|
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
|
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.)
|
units. (This number may increase in future versions of X-Plane.)
|
||||||
|
|
||||||
Use this routine instead of glBindTexture(GL_TEXTURE_2D, ....);
|
Use this routine instead of glBindTexture(GL_TEXTURE_2D, ....);
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMBindTexture2d(
|
PROCEDURE XPLMBindTexture2d(
|
||||||
inTextureNum : integer;
|
inTextureNum : Integer;
|
||||||
inTextureUnit : integer);
|
inTextureUnit : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGenerateTextureNumbers
|
XPLMGenerateTextureNumbers
|
||||||
|
|
||||||
This routine generates unused texture numbers that a plug-in can use to
|
Use this routine instead of glGenTextures to generate new texture object
|
||||||
safely bind textures. Use this routine instead of glGenTextures;
|
IDs. This routine historically ensured that plugins don't use texure IDs
|
||||||
glGenTextures will allocate texture numbers in ranges that X-Plane reserves
|
that X-Plane is reserving for its own use.
|
||||||
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.
|
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMGenerateTextureNumbers(
|
PROCEDURE XPLMGenerateTextureNumbers(
|
||||||
outTextureIDs : Pinteger;
|
outTextureIDs : PInteger;
|
||||||
inCount : integer);
|
inCount : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{
|
{
|
||||||
XPLMGetTexture
|
XPLMGetTexture
|
||||||
|
|
||||||
XPLMGetTexture returns the OpenGL texture enumeration of an X-Plane texture
|
XPLMGetTexture returns the OpenGL texture ID of an X-Plane texture based on
|
||||||
based on a generic identifying code. For example, you can get the texture
|
a generic identifying code. For example, you can get the texture for
|
||||||
for X-Plane's UI bitmaps. This allows you to build new gauges that take
|
X-Plane's UI bitmaps.
|
||||||
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.
|
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetTexture(
|
FUNCTION XPLMGetTexture(
|
||||||
inTexture : XPLMTextureID) : integer;
|
inTexture : XPLMTextureID) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMWorldToLocal
|
XPLMWorldToLocal
|
||||||
@@ -208,17 +188,13 @@ TYPE
|
|||||||
meters in the local OpenGL coordinate system.
|
meters in the local OpenGL coordinate system.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMWorldToLocal(
|
PROCEDURE XPLMWorldToLocal(
|
||||||
inLatitude : real;
|
inLatitude : Real;
|
||||||
inLongitude : real;
|
inLongitude : Real;
|
||||||
inAltitude : real;
|
inAltitude : Real;
|
||||||
outX : Preal;
|
outX : PReal;
|
||||||
outY : Preal;
|
outY : PReal;
|
||||||
outZ : Preal);
|
outZ : PReal);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMLocalToWorld
|
XPLMLocalToWorld
|
||||||
@@ -232,17 +208,13 @@ TYPE
|
|||||||
try to avoid round tripping from local to world and back.
|
try to avoid round tripping from local to world and back.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMLocalToWorld(
|
PROCEDURE XPLMLocalToWorld(
|
||||||
inX : real;
|
inX : Real;
|
||||||
inY : real;
|
inY : Real;
|
||||||
inZ : real;
|
inZ : Real;
|
||||||
outLatitude : Preal;
|
outLatitude : PReal;
|
||||||
outLongitude : Preal;
|
outLongitude : PReal;
|
||||||
outAltitude : Preal);
|
outAltitude : PReal);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDrawTranslucentDarkBox
|
XPLMDrawTranslucentDarkBox
|
||||||
@@ -252,24 +224,15 @@ TYPE
|
|||||||
used by X-Plane to show text files and ATC info.
|
used by X-Plane to show text files and ATC info.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDrawTranslucentDarkBox(
|
PROCEDURE XPLMDrawTranslucentDarkBox(
|
||||||
inLeft : integer;
|
inLeft : Integer;
|
||||||
inTop : integer;
|
inTop : Integer;
|
||||||
inRight : integer;
|
inRight : Integer;
|
||||||
inBottom : integer);
|
inBottom : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* X-PLANE TEXT
|
* X-PLANE TEXT
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFontID
|
XPLMFontID
|
||||||
@@ -287,64 +250,98 @@ TYPE
|
|||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPLMFontID = (
|
XPLMFontID = (
|
||||||
{ Mono-spaced font for user interface. Available in all versions of the SDK. }
|
{ Mono-spaced font for user interface. Available in all versions of the SDK.}
|
||||||
xplmFont_Basic = 0
|
xplmFont_Basic = 0
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_Menus = 1
|
,xplmFont_Menus = 1
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_Metal = 2
|
,xplmFont_Metal = 2
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_Led = 3
|
,xplmFont_Led = 3
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_LedWide = 4
|
,xplmFont_LedWide = 4
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_PanelHUD = 5
|
,xplmFont_PanelHUD = 5
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_PanelEFIS = 6
|
,xplmFont_PanelEFIS = 6
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_PanelGPS = 7
|
,xplmFont_PanelGPS = 7
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_RadiosGA = 8
|
,xplmFont_RadiosGA = 8
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_RadiosBC = 9
|
,xplmFont_RadiosBC = 9
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_RadiosHM = 10
|
,xplmFont_RadiosHM = 10
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_RadiosGANarrow = 11
|
,xplmFont_RadiosGANarrow = 11
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_RadiosBCNarrow = 12
|
,xplmFont_RadiosBCNarrow = 12
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_RadiosHMNarrow = 13
|
,xplmFont_RadiosHMNarrow = 13
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_Timer = 14
|
,xplmFont_Timer = 14
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_FullRound = 15
|
,xplmFont_FullRound = 15
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_SmallRound = 16
|
,xplmFont_SmallRound = 16
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{ Deprecated, do not use. }
|
{ Deprecated, do not use. }
|
||||||
,xplmFont_Menus_Localized = 17
|
,xplmFont_Menus_Localized = 17
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{ Proportional UI font. }
|
{ Proportional UI font. }
|
||||||
,xplmFont_Proportional = 18
|
,xplmFont_Proportional = 18
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
|
||||||
);
|
);
|
||||||
PXPLMFontID = ^XPLMFontID;
|
PXPLMFontID = ^XPLMFontID;
|
||||||
@@ -360,17 +357,13 @@ TYPE
|
|||||||
to 1.0.
|
to 1.0.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDrawString(
|
PROCEDURE XPLMDrawString(
|
||||||
inColorRGB : Psingle;
|
inColorRGB : PSingle;
|
||||||
inXOffset : integer;
|
inXOffset : Integer;
|
||||||
inYOffset : integer;
|
inYOffset : Integer;
|
||||||
inChar : Pchar;
|
inChar : XPLMString;
|
||||||
inWordWrapWidth : Pinteger; { Can be nil }
|
inWordWrapWidth : PInteger; { Can be nil }
|
||||||
inFontID : XPLMFontID);
|
inFontID : XPLMFontID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDrawNumber
|
XPLMDrawNumber
|
||||||
@@ -383,19 +376,15 @@ TYPE
|
|||||||
string drawn.
|
string drawn.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDrawNumber(
|
PROCEDURE XPLMDrawNumber(
|
||||||
inColorRGB : Psingle;
|
inColorRGB : PSingle;
|
||||||
inXOffset : integer;
|
inXOffset : Integer;
|
||||||
inYOffset : integer;
|
inYOffset : Integer;
|
||||||
inValue : real;
|
inValue : Real;
|
||||||
inDigits : integer;
|
inDigits : Integer;
|
||||||
inDecimals : integer;
|
inDecimals : Integer;
|
||||||
inShowSign : integer;
|
inShowSign : Integer;
|
||||||
inFontID : XPLMFontID);
|
inFontID : XPLMFontID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetFontDimensions
|
XPLMGetFontDimensions
|
||||||
@@ -407,14 +396,10 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMGetFontDimensions(
|
PROCEDURE XPLMGetFontDimensions(
|
||||||
inFontID : XPLMFontID;
|
inFontID : XPLMFontID;
|
||||||
outCharWidth : Pinteger; { Can be nil }
|
outCharWidth : PInteger; { Can be nil }
|
||||||
outCharHeight : Pinteger; { Can be nil }
|
outCharHeight : PInteger; { Can be nil }
|
||||||
outDigitsOnly : Pinteger); { Can be nil }
|
outDigitsOnly : PInteger); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{
|
{
|
||||||
@@ -428,14 +413,12 @@ TYPE
|
|||||||
}
|
}
|
||||||
FUNCTION XPLMMeasureString(
|
FUNCTION XPLMMeasureString(
|
||||||
inFontID : XPLMFontID;
|
inFontID : XPLMFontID;
|
||||||
inChar : Pchar;
|
inChar : XPLMString;
|
||||||
inNumChars : integer) : single;
|
inNumChars : Integer) : Single;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM200}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
{
|
||||||
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT XPLMInstance;
|
||||||
|
INTERFACE
|
||||||
|
{
|
||||||
|
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.)
|
||||||
|
}
|
||||||
|
|
||||||
|
USES
|
||||||
|
XPLMDefs, XPLMScenery;
|
||||||
|
{$A4}
|
||||||
|
{___________________________________________________________________________
|
||||||
|
* Instance Creation and Destruction
|
||||||
|
___________________________________________________________________________}
|
||||||
|
{
|
||||||
|
Registers and unregisters instances.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TYPE
|
||||||
|
{
|
||||||
|
XPLMInstanceRef
|
||||||
|
|
||||||
|
An opaque handle to an instance.
|
||||||
|
}
|
||||||
|
XPLMInstanceRef = pointer;
|
||||||
|
PXPLMInstanceRef = ^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.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMCreateInstance(
|
||||||
|
obj : XPLMObjectRef;
|
||||||
|
datarefs : PXPLMString) : XPLMInstanceRef;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMDestroyInstance(
|
||||||
|
instance : XPLMInstanceRef);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{___________________________________________________________________________
|
||||||
|
* 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.
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMInstanceSetPosition(
|
||||||
|
instance : XPLMInstanceRef;
|
||||||
|
new_position : PXPLMDrawInfo_t;
|
||||||
|
data : PSingle);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENTATION
|
||||||
|
|
||||||
|
END.
|
||||||
@@ -0,0 +1,608 @@
|
|||||||
|
{
|
||||||
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
|
}
|
||||||
|
|
||||||
|
UNIT XPLMMap;
|
||||||
|
INTERFACE
|
||||||
|
{
|
||||||
|
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.)
|
||||||
|
}
|
||||||
|
|
||||||
|
USES
|
||||||
|
XPLMDefs;
|
||||||
|
{$A4}
|
||||||
|
{$IFDEF 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.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TYPE
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
XPLMMapLayerID = pointer;
|
||||||
|
PXPLMMapLayerID = ^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.
|
||||||
|
}
|
||||||
|
XPLMMapProjectionID = pointer;
|
||||||
|
PXPLMMapProjectionID = ^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).
|
||||||
|
}
|
||||||
|
XPLMMapStyle = (
|
||||||
|
xplm_MapStyle_VFR_Sectional = 0
|
||||||
|
|
||||||
|
,xplm_MapStyle_IFR_LowEnroute = 1
|
||||||
|
|
||||||
|
,xplm_MapStyle_IFR_HighEnroute = 2
|
||||||
|
|
||||||
|
);
|
||||||
|
PXPLMMapStyle = ^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.
|
||||||
|
}
|
||||||
|
XPLMMapDrawingCallback_f = PROCEDURE(
|
||||||
|
inLayer : XPLMMapLayerID;
|
||||||
|
inMapBoundsLeftTopRightBottom: PSingle;
|
||||||
|
zoomRatio : Single;
|
||||||
|
mapUnitsPerUserInterfaceUnit: Single;
|
||||||
|
mapStyle : XPLMMapStyle;
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
inRefcon : pointer); cdecl;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
XPLMMapIconDrawingCallback_f = PROCEDURE(
|
||||||
|
inLayer : XPLMMapLayerID;
|
||||||
|
inMapBoundsLeftTopRightBottom: PSingle;
|
||||||
|
zoomRatio : Single;
|
||||||
|
mapUnitsPerUserInterfaceUnit: Single;
|
||||||
|
mapStyle : XPLMMapStyle;
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
inRefcon : pointer); cdecl;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
XPLMMapLabelDrawingCallback_f = PROCEDURE(
|
||||||
|
inLayer : XPLMMapLayerID;
|
||||||
|
inMapBoundsLeftTopRightBottom: PSingle;
|
||||||
|
zoomRatio : Single;
|
||||||
|
mapUnitsPerUserInterfaceUnit: Single;
|
||||||
|
mapStyle : XPLMMapStyle;
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
inRefcon : pointer); cdecl;
|
||||||
|
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
{$IFDEF 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.
|
||||||
|
}
|
||||||
|
TYPE
|
||||||
|
XPLMMapPrepareCacheCallback_f = PROCEDURE(
|
||||||
|
inLayer : XPLMMapLayerID;
|
||||||
|
inTotalMapBoundsLeftTopRightBottom: PSingle;
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
inRefcon : pointer); cdecl;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
XPLMMapWillBeDeletedCallback_f = PROCEDURE(
|
||||||
|
inLayer : XPLMMapLayerID;
|
||||||
|
inRefcon : pointer); cdecl;
|
||||||
|
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
{$IFDEF 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.
|
||||||
|
}
|
||||||
|
TYPE
|
||||||
|
XPLMMapLayerType = (
|
||||||
|
{ 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
|
||||||
|
|
||||||
|
);
|
||||||
|
PXPLMMapLayerType = ^XPLMMapLayerType;
|
||||||
|
|
||||||
|
CONST
|
||||||
|
{ Globally unique identifier for X-Plane's Map window, used as the }
|
||||||
|
{ mapToCreateLayerIn parameter in XPLMCreateMapLayer_t }
|
||||||
|
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 }
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
TYPE
|
||||||
|
XPLMCreateMapLayer_t = RECORD
|
||||||
|
{ Used to inform XPLMCreateMapLayer() of the SDK version you compiled }
|
||||||
|
{ against; should always be set to sizeof(XPLMCreateMapLayer_t) }
|
||||||
|
structSize : Integer;
|
||||||
|
{ 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 }
|
||||||
|
mapToCreateLayerIn : XPLMString;
|
||||||
|
{ 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) }
|
||||||
|
layerType : XPLMMapLayerType;
|
||||||
|
{ Optional callback to inform you this layer is being deleted (due to its }
|
||||||
|
{ owning map being destroyed) }
|
||||||
|
willBeDeletedCallback : XPLMMapWillBeDeletedCallback_f;
|
||||||
|
{ 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) }
|
||||||
|
prepCacheCallback : XPLMMapPrepareCacheCallback_f;
|
||||||
|
{ 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) }
|
||||||
|
drawCallback : XPLMMapDrawingCallback_f;
|
||||||
|
{ 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) }
|
||||||
|
iconCallback : XPLMMapIconDrawingCallback_f;
|
||||||
|
{ 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) }
|
||||||
|
labelCallback : XPLMMapLabelDrawingCallback_f;
|
||||||
|
{ 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 }
|
||||||
|
showUiToggle : Integer;
|
||||||
|
{ Short label to use for this layer in the user interface }
|
||||||
|
layerName : XPLMString;
|
||||||
|
{ A reference to arbitrary data that will be passed to your callbacks }
|
||||||
|
refcon : pointer;
|
||||||
|
END;
|
||||||
|
PXPLMCreateMapLayer_t = ^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.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMCreateMapLayer(
|
||||||
|
inParams : PXPLMCreateMapLayer_t) : XPLMMapLayerID;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
XPLMDestroyMapLayer
|
||||||
|
|
||||||
|
Destroys a map layer you created (calling your
|
||||||
|
XPLMMapWillBeDeletedCallback_f if applicable). Returns true if a deletion
|
||||||
|
took place.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMDestroyMapLayer(
|
||||||
|
inLayer : XPLMMapLayerID) : Integer;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
TYPE
|
||||||
|
XPLMMapCreatedCallback_f = PROCEDURE(
|
||||||
|
mapIdentifier : XPLMString;
|
||||||
|
refcon : pointer); cdecl;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMRegisterMapCreationHook(
|
||||||
|
callback : XPLMMapCreatedCallback_f;
|
||||||
|
refcon : pointer);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMMapExists(
|
||||||
|
mapIdentifier : XPLMString) : Integer;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
{$IFDEF 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.
|
||||||
|
}
|
||||||
|
TYPE
|
||||||
|
XPLMMapOrientation = (
|
||||||
|
{ 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
|
||||||
|
|
||||||
|
);
|
||||||
|
PXPLMMapOrientation = ^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).
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMDrawMapIconFromSheet(
|
||||||
|
layer : XPLMMapLayerID;
|
||||||
|
inPngPath : XPLMString;
|
||||||
|
s : Integer;
|
||||||
|
t : Integer;
|
||||||
|
ds : Integer;
|
||||||
|
dt : Integer;
|
||||||
|
mapX : Single;
|
||||||
|
mapY : Single;
|
||||||
|
orientation : XPLMMapOrientation;
|
||||||
|
rotationDegrees : Single;
|
||||||
|
mapWidth : Single);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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).
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMDrawMapLabel(
|
||||||
|
layer : XPLMMapLayerID;
|
||||||
|
inText : XPLMString;
|
||||||
|
mapX : Single;
|
||||||
|
mapY : Single;
|
||||||
|
orientation : XPLMMapOrientation;
|
||||||
|
rotationDegrees : Single);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
{$IFDEF 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.)
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMMapProject(
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
latitude : Real;
|
||||||
|
longitude : Real;
|
||||||
|
outX : PSingle;
|
||||||
|
outY : PSingle);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.)
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMMapUnproject(
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
mapX : Single;
|
||||||
|
mapY : Single;
|
||||||
|
outLatitude : PReal;
|
||||||
|
outLongitude : PReal);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.)
|
||||||
|
}
|
||||||
|
FUNCTION XPLMMapScaleMeter(
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
mapX : Single;
|
||||||
|
mapY : Single) : Single;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
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.)
|
||||||
|
}
|
||||||
|
FUNCTION XPLMMapGetNorthHeading(
|
||||||
|
projection : XPLMMapProjectionID;
|
||||||
|
mapX : Single;
|
||||||
|
mapY : Single) : Single;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
|
||||||
|
IMPLEMENTATION
|
||||||
|
|
||||||
|
END.
|
||||||
+113
-95
@@ -1,43 +1,51 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMMenus;
|
UNIT XPLMMenus;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
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
|
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
|
opaque ID. Items are referred to by (zero-based) index number.
|
||||||
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
|
Menus are "sandboxed" between plugins---no plugin can access the menus of
|
||||||
are zero based.
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs, XPLMUtilities;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* XPLM MENUS
|
* XPLM MENUS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMMenuCheck
|
XPLMMenuCheck
|
||||||
|
|
||||||
These enumerations define the various 'check' states for an X-Plane menu.
|
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
|
'checking' in X-Plane actually appears as a light which may or may not be
|
||||||
lit. So there are three possible states.
|
lit. So there are three possible states.
|
||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
@@ -80,11 +88,26 @@ TYPE
|
|||||||
at startup.
|
at startup.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindPluginsMenu: XPLMMenuID;
|
FUNCTION XPLMFindPluginsMenu: XPLMMenuID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
{$IFDEF XPLM300}
|
||||||
cdecl; external '';
|
{
|
||||||
{$ENDIF}
|
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.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMFindAircraftMenu: XPLMMenuID;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCreateMenu
|
XPLMCreateMenu
|
||||||
@@ -101,16 +124,12 @@ TYPE
|
|||||||
a submenu where the title is not visible.
|
a submenu where the title is not visible.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMCreateMenu(
|
FUNCTION XPLMCreateMenu(
|
||||||
inName : Pchar;
|
inName : XPLMString;
|
||||||
inParentMenu : XPLMMenuID;
|
inParentMenu : XPLMMenuID;
|
||||||
inParentItem : integer;
|
inParentItem : Integer;
|
||||||
inHandler : XPLMMenuHandler_f;
|
inHandler : XPLMMenuHandler_f;
|
||||||
inMenuRef : pointer) : XPLMMenuID;
|
inMenuRef : pointer) : XPLMMenuID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDestroyMenu
|
XPLMDestroyMenu
|
||||||
@@ -120,11 +139,7 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMDestroyMenu(
|
PROCEDURE XPLMDestroyMenu(
|
||||||
inMenuID : XPLMMenuID);
|
inMenuID : XPLMMenuID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMClearAllMenuItems
|
XPLMClearAllMenuItems
|
||||||
@@ -134,46 +149,67 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMClearAllMenuItems(
|
PROCEDURE XPLMClearAllMenuItems(
|
||||||
inMenuID : XPLMMenuID);
|
inMenuID : XPLMMenuID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMAppendMenuItem
|
XPLMAppendMenuItem
|
||||||
|
|
||||||
This routine appends a new menu item to the bottom of a menu and returns
|
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
|
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
|
* ref for this item.
|
||||||
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
|
Returns a negative index if the append failed (due to an invalid parent
|
||||||
of why you'd want to do this is for a proper name.) See XPLMUtilities for
|
menu argument).
|
||||||
determining the current langauge.
|
|
||||||
|
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.)
|
||||||
}
|
}
|
||||||
FUNCTION XPLMAppendMenuItem(
|
FUNCTION XPLMAppendMenuItem(
|
||||||
inMenu : XPLMMenuID;
|
inMenu : XPLMMenuID;
|
||||||
inItemName : Pchar;
|
inItemName : XPLMString;
|
||||||
inItemRef : pointer;
|
inItemRef : pointer;
|
||||||
inForceEnglish : integer) : integer;
|
inDeprecatedAndIgnored: Integer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
{$IFDEF XPLM300}
|
||||||
cdecl; external '';
|
{
|
||||||
{$ENDIF}
|
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.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMAppendMenuItemWithCommand(
|
||||||
|
inMenu : XPLMMenuID;
|
||||||
|
inItemName : XPLMString;
|
||||||
|
inCommandToExecute : XPLMCommandRef) : Integer;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
{$ENDIF XPLM300}
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMAppendMenuSeparator
|
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).
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMAppendMenuSeparator(
|
PROCEDURE XPLMAppendMenuSeparator(
|
||||||
inMenu : XPLMMenuID);
|
inMenu : XPLMMenuID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetMenuItemName
|
XPLMSetMenuItemName
|
||||||
@@ -183,14 +219,10 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMSetMenuItemName(
|
PROCEDURE XPLMSetMenuItemName(
|
||||||
inMenu : XPLMMenuID;
|
inMenu : XPLMMenuID;
|
||||||
inIndex : integer;
|
inIndex : Integer;
|
||||||
inItemName : Pchar;
|
inItemName : XPLMString;
|
||||||
inForceEnglish : integer);
|
inDeprecatedAndIgnored: Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCheckMenuItem
|
XPLMCheckMenuItem
|
||||||
@@ -199,13 +231,9 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMCheckMenuItem(
|
PROCEDURE XPLMCheckMenuItem(
|
||||||
inMenu : XPLMMenuID;
|
inMenu : XPLMMenuID;
|
||||||
index : integer;
|
index : Integer;
|
||||||
inCheck : XPLMMenuCheck);
|
inCheck : XPLMMenuCheck);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCheckMenuItemState
|
XPLMCheckMenuItemState
|
||||||
@@ -215,13 +243,9 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMCheckMenuItemState(
|
PROCEDURE XPLMCheckMenuItemState(
|
||||||
inMenu : XPLMMenuID;
|
inMenu : XPLMMenuID;
|
||||||
index : integer;
|
index : Integer;
|
||||||
outCheck : PXPLMMenuCheck);
|
outCheck : PXPLMMenuCheck);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMEnableMenuItem
|
XPLMEnableMenuItem
|
||||||
@@ -230,13 +254,9 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMEnableMenuItem(
|
PROCEDURE XPLMEnableMenuItem(
|
||||||
inMenu : XPLMMenuID;
|
inMenu : XPLMMenuID;
|
||||||
index : integer;
|
index : Integer;
|
||||||
enabled : integer);
|
enabled : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -247,13 +267,11 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMRemoveMenuItem(
|
PROCEDURE XPLMRemoveMenuItem(
|
||||||
inMenu : XPLMMenuID;
|
inMenu : XPLMMenuID;
|
||||||
inIndex : integer);
|
inIndex : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM210}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMNavigation;
|
UNIT XPLMNavigation;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
XPLMNavigation - THEORY OF OPERATION
|
|
||||||
|
|
||||||
The XPLM Navigation APIs give you some access to the navigation databases
|
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
|
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
|
using these APIs you can gain access to most information without having to
|
||||||
@@ -18,22 +13,15 @@ INTERFACE
|
|||||||
|
|
||||||
You can also use this API to program the FMS. You must use the navigation
|
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
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* NAVIGATION DATABASE ACCESS
|
* NAVIGATION DATABASE ACCESS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMNavType
|
XPLMNavType
|
||||||
@@ -91,7 +79,7 @@ TYPE
|
|||||||
XPLM_NAV_NOT_FOUND is returned by functions that return an XPLMNavRef when
|
XPLM_NAV_NOT_FOUND is returned by functions that return an XPLMNavRef when
|
||||||
the iterator must be invalid.
|
the iterator must be invalid.
|
||||||
}
|
}
|
||||||
XPLMNavRef = integer;
|
XPLMNavRef = Integer;
|
||||||
PXPLMNavRef = ^XPLMNavRef;
|
PXPLMNavRef = ^XPLMNavRef;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
@@ -105,31 +93,19 @@ CONST
|
|||||||
empty.
|
empty.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetFirstNavAid: XPLMNavRef;
|
FUNCTION XPLMGetFirstNavAid: XPLMNavRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetNextNavAid
|
XPLMGetNextNavAid
|
||||||
|
|
||||||
Given a nav aid ref, this routine returns the next navaid. It returns
|
Given a valid nav aid ref, this routine returns the next navaid. It
|
||||||
XPLM_NAV_NOT_FOUND if the nav aid passed in was invalid or if the navaid
|
returns XPLM_NAV_NOT_FOUND if the nav aid passed in was invalid or if the
|
||||||
passed in was the last one in the database. Use this routine to iterate
|
navaid passed in was the last one in the database. Use this routine to
|
||||||
across all like-typed navaids or the entire database.
|
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.
|
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetNextNavAid(
|
FUNCTION XPLMGetNextNavAid(
|
||||||
inNavAidRef : XPLMNavRef) : XPLMNavRef;
|
inNavAidRef : XPLMNavRef) : XPLMNavRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFindFirstNavAidOfType
|
XPLMFindFirstNavAidOfType
|
||||||
@@ -137,18 +113,10 @@ CONST
|
|||||||
This routine returns the ref of the first navaid of the given type in the
|
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 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.
|
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.
|
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindFirstNavAidOfType(
|
FUNCTION XPLMFindFirstNavAidOfType(
|
||||||
inType : XPLMNavType) : XPLMNavRef;
|
inType : XPLMNavType) : XPLMNavRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFindLastNavAidOfType
|
XPLMFindLastNavAidOfType
|
||||||
@@ -156,18 +124,10 @@ CONST
|
|||||||
This routine returns the ref of the last navaid of the given type in the
|
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 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.
|
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.
|
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindLastNavAidOfType(
|
FUNCTION XPLMFindLastNavAidOfType(
|
||||||
inType : XPLMNavType) : XPLMNavRef;
|
inType : XPLMNavType) : XPLMNavRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFindNavAid
|
XPLMFindNavAid
|
||||||
@@ -177,37 +137,33 @@ CONST
|
|||||||
within inType (multiple types may be added together) and return any
|
within inType (multiple types may be added together) and return any
|
||||||
nav-aids found based on the following rules:
|
nav-aids found based on the following rules:
|
||||||
|
|
||||||
If inLat and inLon are not NULL, the navaid nearest to that lat/lon will be
|
* If inLat and inLon are not NULL, the navaid nearest to that lat/lon will
|
||||||
returned, otherwise the last navaid found will be returned.
|
be returned, otherwise the last navaid found will be returned.
|
||||||
|
|
||||||
If inFrequency is not NULL, then any navaids considered must match this
|
* 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. Note that this will screen out radio beacons that do not have
|
||||||
frequency data published (like inner markers) but not fixes and airports.
|
frequency data published (like inner markers) but not fixes and airports.
|
||||||
|
|
||||||
If inNameFragment is not NULL, only navaids that contain the fragment in
|
* If inNameFragment is not NULL, only navaids that contain the fragment in
|
||||||
their name will be returned.
|
their name will be returned.
|
||||||
|
|
||||||
If inIDFragment is not NULL, only navaids that contain the fragment in
|
* If inIDFragment is not NULL, only navaids that contain the fragment in
|
||||||
their IDs will be returned.
|
their IDs will be returned.
|
||||||
|
|
||||||
This routine provides a simple way to do a number of useful searches:
|
This routine provides a simple way to do a number of useful searches:
|
||||||
|
* Find the nearest navaid on this frequency.
|
||||||
Find the nearest navaid on this frequency. Find the nearest airport. Find
|
* Find the nearest airport.
|
||||||
the VOR whose ID is "KBOS". Find the nearest airport whose name contains
|
* Find the VOR whose ID is "KBOS".
|
||||||
"Chicago".
|
* Find the nearest airport whose name contains "Chicago".
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindNavAid(
|
FUNCTION XPLMFindNavAid(
|
||||||
inNameFragment : Pchar; { Can be nil }
|
inNameFragment : XPLMString; { Can be nil }
|
||||||
inIDFragment : Pchar; { Can be nil }
|
inIDFragment : XPLMString; { Can be nil }
|
||||||
inLat : Psingle; { Can be nil }
|
inLat : PSingle; { Can be nil }
|
||||||
inLon : Psingle; { Can be nil }
|
inLon : PSingle; { Can be nil }
|
||||||
inFrequency : Pinteger; { Can be nil }
|
inFrequency : PInteger; { Can be nil }
|
||||||
inType : XPLMNavType) : XPLMNavRef;
|
inType : XPLMNavType) : XPLMNavRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetNavAidInfo
|
XPLMGetNavAidInfo
|
||||||
@@ -231,19 +187,15 @@ CONST
|
|||||||
PROCEDURE XPLMGetNavAidInfo(
|
PROCEDURE XPLMGetNavAidInfo(
|
||||||
inRef : XPLMNavRef;
|
inRef : XPLMNavRef;
|
||||||
outType : PXPLMNavType; { Can be nil }
|
outType : PXPLMNavType; { Can be nil }
|
||||||
outLatitude : Psingle; { Can be nil }
|
outLatitude : PSingle; { Can be nil }
|
||||||
outLongitude : Psingle; { Can be nil }
|
outLongitude : PSingle; { Can be nil }
|
||||||
outHeight : Psingle; { Can be nil }
|
outHeight : PSingle; { Can be nil }
|
||||||
outFrequency : Pinteger; { Can be nil }
|
outFrequency : PInteger; { Can be nil }
|
||||||
outHeading : Psingle; { Can be nil }
|
outHeading : PSingle; { Can be nil }
|
||||||
outID : Pchar; { Can be nil }
|
outID : XPLMString; { Can be nil }
|
||||||
outName : Pchar; { Can be nil }
|
outName : XPLMString; { Can be nil }
|
||||||
outReg : Pchar); { Can be nil }
|
outReg : XPLMString); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* FLIGHT MANAGEMENT COMPUTER
|
* FLIGHT MANAGEMENT COMPUTER
|
||||||
@@ -259,42 +211,29 @@ CONST
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCountFMSEntries
|
XPLMCountFMSEntries
|
||||||
|
|
||||||
This routine returns the number of entries in the FMS.
|
This routine returns the number of entries in the FMS.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMCountFMSEntries: integer;
|
FUNCTION XPLMCountFMSEntries: Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDisplayedFMSEntry
|
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.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetDisplayedFMSEntry: integer;
|
FUNCTION XPLMGetDisplayedFMSEntry: Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetDestinationFMSEntry
|
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.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetDestinationFMSEntry: integer;
|
FUNCTION XPLMGetDestinationFMSEntry: Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDisplayedFMSEntry
|
XPLMSetDisplayedFMSEntry
|
||||||
@@ -302,12 +241,8 @@ CONST
|
|||||||
This routine changes which entry the FMS is showing to the index specified.
|
This routine changes which entry the FMS is showing to the index specified.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDisplayedFMSEntry(
|
PROCEDURE XPLMSetDisplayedFMSEntry(
|
||||||
inIndex : integer);
|
inIndex : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetDestinationFMSEntry
|
XPLMSetDestinationFMSEntry
|
||||||
@@ -315,37 +250,38 @@ CONST
|
|||||||
This routine changes which entry the FMS is flying the aircraft toward.
|
This routine changes which entry the FMS is flying the aircraft toward.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetDestinationFMSEntry(
|
PROCEDURE XPLMSetDestinationFMSEntry(
|
||||||
inIndex : integer);
|
inIndex : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetFMSEntryInfo
|
XPLMGetFMSEntryInfo
|
||||||
|
|
||||||
This routine returns information about a given FMS entry. A reference to a
|
This routine returns information about a given FMS entry. If the entry is
|
||||||
navaid can be returned allowing you to find additional information (such as
|
an airport or navaid, a reference to a nav entry can be returned allowing
|
||||||
a frequency, ILS heading, name, etc.). Some information is available
|
you to find additional information (such as a frequency, ILS heading, name,
|
||||||
immediately. For a lat/lon entry, the lat/lon is returned by this routine
|
etc.). Note that this reference can be XPLM_NAV_NOT_FOUND until the
|
||||||
but the navaid cannot be looked up (and the reference will be
|
information has been looked up asynchronously, so after flightplan changes,
|
||||||
XPLM_NAV_NOT_FOUND. FMS name entry buffers should be at least 256 chars in
|
it might take up to a second for this field to become populated. The other
|
||||||
length.
|
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.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMGetFMSEntryInfo(
|
PROCEDURE XPLMGetFMSEntryInfo(
|
||||||
inIndex : integer;
|
inIndex : Integer;
|
||||||
outType : PXPLMNavType; { Can be nil }
|
outType : PXPLMNavType; { Can be nil }
|
||||||
outID : Pchar; { Can be nil }
|
outID : XPLMString; { Can be nil }
|
||||||
outRef : PXPLMNavRef; { Can be nil }
|
outRef : PXPLMNavRef; { Can be nil }
|
||||||
outAltitude : Pinteger; { Can be nil }
|
outAltitude : PInteger; { Can be nil }
|
||||||
outLat : Psingle; { Can be nil }
|
outLat : PSingle; { Can be nil }
|
||||||
outLon : Psingle); { Can be nil }
|
outLon : PSingle); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetFMSEntryInfo
|
XPLMSetFMSEntryInfo
|
||||||
@@ -356,14 +292,10 @@ CONST
|
|||||||
support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
|
support VORs and NDBs. Use the routines below to clear or fly to a lat/lon.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetFMSEntryInfo(
|
PROCEDURE XPLMSetFMSEntryInfo(
|
||||||
inIndex : integer;
|
inIndex : Integer;
|
||||||
inRef : XPLMNavRef;
|
inRef : XPLMNavRef;
|
||||||
inAltitude : integer);
|
inAltitude : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetFMSEntryLatLon
|
XPLMSetFMSEntryLatLon
|
||||||
@@ -372,15 +304,11 @@ CONST
|
|||||||
coordinates.
|
coordinates.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetFMSEntryLatLon(
|
PROCEDURE XPLMSetFMSEntryLatLon(
|
||||||
inIndex : integer;
|
inIndex : Integer;
|
||||||
inLat : single;
|
inLat : Single;
|
||||||
inLon : single;
|
inLon : Single;
|
||||||
inAltitude : integer);
|
inAltitude : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMClearFMSEntry
|
XPLMClearFMSEntry
|
||||||
@@ -389,12 +317,8 @@ CONST
|
|||||||
plan.
|
plan.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMClearFMSEntry(
|
PROCEDURE XPLMClearFMSEntry(
|
||||||
inIndex : integer);
|
inIndex : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* GPS RECEIVER
|
* GPS RECEIVER
|
||||||
@@ -403,8 +327,6 @@ CONST
|
|||||||
These APIs let you read data from the GPS unit.
|
These APIs let you read data from the GPS unit.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetGPSDestinationType
|
XPLMGetGPSDestinationType
|
||||||
|
|
||||||
@@ -412,11 +334,7 @@ CONST
|
|||||||
one of fix, airport, VOR or NDB.
|
one of fix, airport, VOR or NDB.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetGPSDestinationType: XPLMNavType;
|
FUNCTION XPLMGetGPSDestinationType: XPLMNavType;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetGPSDestination
|
XPLMGetGPSDestination
|
||||||
@@ -424,11 +342,9 @@ CONST
|
|||||||
This routine returns the current GPS destination.
|
This routine returns the current GPS destination.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetGPSDestination: XPLMNavRef;
|
FUNCTION XPLMGetGPSDestination: XPLMNavRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
+101
-117
@@ -1,30 +1,25 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMPlanes;
|
UNIT XPLMPlanes;
|
||||||
INTERFACE
|
INTERFACE
|
||||||
{
|
{
|
||||||
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.
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* USER AIRCRAFT ACCESS
|
* USER AIRCRAFT ACCESS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetUsersAircraft
|
XPLMSetUsersAircraft
|
||||||
@@ -34,36 +29,45 @@ USES XPLMDefs;
|
|||||||
(hard drive and everything including the .acf extension) to the .acf file.
|
(hard drive and everything including the .acf extension) to the .acf file.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetUsersAircraft(
|
PROCEDURE XPLMSetUsersAircraft(
|
||||||
inAircraftPath : Pchar);
|
inAircraftPath : XPLMString);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{
|
{
|
||||||
XPLMPlaceUserAtAirport
|
XPLMPlaceUserAtAirport
|
||||||
|
|
||||||
This routine places the user at a given airport. Specify the airport by
|
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').
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMPlaceUserAtAirport(
|
PROCEDURE XPLMPlaceUserAtAirport(
|
||||||
inAirportCode : Pchar);
|
inAirportCode : XPLMString);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$IFDEF XPLM300}
|
||||||
{$ELSE}
|
{
|
||||||
cdecl; external '';
|
XPLMPlaceUserAtLocation
|
||||||
{$ENDIF}
|
|
||||||
|
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).
|
||||||
|
}
|
||||||
|
PROCEDURE XPLMPlaceUserAtLocation(
|
||||||
|
latitudeDegrees : Real;
|
||||||
|
longitudeDegrees : Real;
|
||||||
|
elevationMetersMSL : Single;
|
||||||
|
headingDegreesTrue : Single;
|
||||||
|
speedMetersPerSecond: Single);
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
{$ENDIF XPLM300}
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* GLOBAL AIRCRAFT ACCESS
|
* GLOBAL AIRCRAFT ACCESS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
{ The user's aircraft is always index 0. }
|
{ The user's aircraft is always index 0. }
|
||||||
XPLM_USER_AIRCRAFT = 0;
|
XPLM_USER_AIRCRAFT = 0;
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{
|
{
|
||||||
XPLMPlaneDrawState_t
|
XPLMPlaneDrawState_t
|
||||||
|
|
||||||
@@ -83,29 +87,30 @@ CONST
|
|||||||
TYPE
|
TYPE
|
||||||
XPLMPlaneDrawState_t = RECORD
|
XPLMPlaneDrawState_t = RECORD
|
||||||
{ The size of the draw state struct. }
|
{ The size of the draw state struct. }
|
||||||
structSize : integer;
|
structSize : Integer;
|
||||||
{ A ratio from [0..1] describing how far the landing gear is extended. }
|
{ A ratio from [0..1] describing how far the landing gear is extended. }
|
||||||
gearPosition : single;
|
gearPosition : Single;
|
||||||
{ Ratio of flap deployment, 0 = up, 1 = full deploy. }
|
{ Ratio of flap deployment, 0 = up, 1 = full deploy. }
|
||||||
flapRatio : single;
|
flapRatio : Single;
|
||||||
{ Ratio of spoiler deployment, 0 = none, 1 = full deploy. }
|
{ Ratio of spoiler deployment, 0 = none, 1 = full deploy. }
|
||||||
spoilerRatio : single;
|
spoilerRatio : Single;
|
||||||
{ Ratio of speed brake deployment, 0 = none, 1 = full deploy. }
|
{ Ratio of speed brake deployment, 0 = none, 1 = full deploy. }
|
||||||
speedBrakeRatio : single;
|
speedBrakeRatio : Single;
|
||||||
{ Ratio of slat deployment, 0 = none, 1 = full deploy. }
|
{ Ratio of slat deployment, 0 = none, 1 = full deploy. }
|
||||||
slatRatio : single;
|
slatRatio : Single;
|
||||||
{ Wing sweep ratio, 0 = forward, 1 = swept. }
|
{ Wing sweep ratio, 0 = forward, 1 = swept. }
|
||||||
wingSweep : single;
|
wingSweep : Single;
|
||||||
{ Thrust power, 0 = none, 1 = full fwd, -1 = full reverse. }
|
{ Thrust power, 0 = none, 1 = full fwd, -1 = full reverse. }
|
||||||
thrust : single;
|
thrust : Single;
|
||||||
{ Total pitch input for this plane. }
|
{ Total pitch input for this plane. }
|
||||||
yokePitch : single;
|
yokePitch : Single;
|
||||||
{ Total Heading input for this plane. }
|
{ Total Heading input for this plane. }
|
||||||
yokeHeading : single;
|
yokeHeading : Single;
|
||||||
{ Total Roll input for this plane. }
|
{ Total Roll input for this plane. }
|
||||||
yokeRoll : single;
|
yokeRoll : Single;
|
||||||
END;
|
END;
|
||||||
PXPLMPlaneDrawState_t = ^XPLMPlaneDrawState_t;
|
PXPLMPlaneDrawState_t = ^XPLMPlaneDrawState_t;
|
||||||
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
{
|
{
|
||||||
XPLMCountAircraft
|
XPLMCountAircraft
|
||||||
|
|
||||||
@@ -116,14 +121,10 @@ TYPE
|
|||||||
aircraft the user has enabled in the rendering options window.
|
aircraft the user has enabled in the rendering options window.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMCountAircraft(
|
PROCEDURE XPLMCountAircraft(
|
||||||
outTotalAircraft : Pinteger;
|
outTotalAircraft : PInteger;
|
||||||
outActiveAircraft : Pinteger;
|
outActiveAircraft : PInteger;
|
||||||
outController : PXPLMPluginID);
|
outController : PXPLMPluginID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{
|
{
|
||||||
XPLMGetNthAircraftModel
|
XPLMGetNthAircraftModel
|
||||||
|
|
||||||
@@ -133,14 +134,10 @@ TYPE
|
|||||||
length.
|
length.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMGetNthAircraftModel(
|
PROCEDURE XPLMGetNthAircraftModel(
|
||||||
inIndex : integer;
|
inIndex : Integer;
|
||||||
outFileName : Pchar;
|
outFileName : XPLMString;
|
||||||
outPath : Pchar);
|
outPath : XPLMString);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* EXCLUSIVE AIRCRAFT ACCESS
|
* EXCLUSIVE AIRCRAFT ACCESS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
@@ -150,7 +147,6 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMPlanesAvailable_f
|
XPLMPlanesAvailable_f
|
||||||
|
|
||||||
@@ -166,24 +162,23 @@ TYPE
|
|||||||
XPLMAcquirePlanes
|
XPLMAcquirePlanes
|
||||||
|
|
||||||
XPLMAcquirePlanes grants your plugin exclusive access to the aircraft. It
|
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
|
returns 1 if you gain access, 0 if you do not.
|
||||||
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
|
inAircraft - pass in an array of pointers to strings specifying the planes
|
||||||
strings should be full paths with the .acf extension. NULL terminates this
|
you want loaded. For any plane index you do not want loaded, pass a
|
||||||
array, or pass NULL if there are no planes you want loaded. If you pass in
|
0-length string. Other strings should be full paths with the .acf
|
||||||
a callback and do not receive access to the planes your callback will be
|
extension. NULL terminates this array, or pass NULL if there are no planes
|
||||||
called when the airplanes are available. If you do receive airplane access,
|
you want loaded.
|
||||||
your callback will not be called.
|
|
||||||
|
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.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMAcquirePlanes(
|
FUNCTION XPLMAcquirePlanes(
|
||||||
inAircraft : PPchar; { Can be nil }
|
inAircraft : PXPLMString; { Can be nil }
|
||||||
inCallback : XPLMPlanesAvailable_f;
|
inCallback : XPLMPlanesAvailable_f;
|
||||||
inRefcon : pointer) : integer;
|
inRefcon : pointer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMReleasePlanes
|
XPLMReleasePlanes
|
||||||
@@ -192,11 +187,7 @@ TYPE
|
|||||||
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.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMReleasePlanes;
|
PROCEDURE XPLMReleasePlanes;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetActiveAircraftCount
|
XPLMSetActiveAircraftCount
|
||||||
@@ -206,12 +197,8 @@ TYPE
|
|||||||
planes available is actually used.
|
planes available is actually used.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetActiveAircraftCount(
|
PROCEDURE XPLMSetActiveAircraftCount(
|
||||||
inCount : integer);
|
inCount : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetAircraftModel
|
XPLMSetAircraftModel
|
||||||
@@ -222,13 +209,9 @@ TYPE
|
|||||||
(use XPLMSetUsersAircraft to load the user's aircracft).
|
(use XPLMSetUsersAircraft to load the user's aircracft).
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMSetAircraftModel(
|
PROCEDURE XPLMSetAircraftModel(
|
||||||
inIndex : integer;
|
inIndex : Integer;
|
||||||
inAircraftPath : Pchar);
|
inAircraftPath : XPLMString);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDisableAIForPlane
|
XPLMDisableAIForPlane
|
||||||
@@ -237,16 +220,17 @@ TYPE
|
|||||||
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.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDisableAIForPlane(
|
PROCEDURE XPLMDisableAIForPlane(
|
||||||
inPlaneIndex : integer);
|
inPlaneIndex : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{
|
{
|
||||||
XPLMDrawAircraft
|
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
|
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
|
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
|
and the orientation of the plane. A 1 for full drawing indicates that the
|
||||||
@@ -254,28 +238,29 @@ TYPE
|
|||||||
drawn. (This saves rendering time when planes are far away.)
|
drawn. (This saves rendering time when planes are far away.)
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDrawAircraft(
|
PROCEDURE XPLMDrawAircraft(
|
||||||
inPlaneIndex : integer;
|
inPlaneIndex : Integer;
|
||||||
inX : single;
|
inX : Single;
|
||||||
inY : single;
|
inY : Single;
|
||||||
inZ : single;
|
inZ : Single;
|
||||||
inPitch : single;
|
inPitch : Single;
|
||||||
inRoll : single;
|
inRoll : Single;
|
||||||
inYaw : single;
|
inYaw : Single;
|
||||||
inFullDraw : integer;
|
inFullDraw : Integer;
|
||||||
inDrawStateInfo : PXPLMPlaneDrawState_t);
|
inDrawStateInfo : PXPLMPlaneDrawState_t);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{
|
{
|
||||||
XPLMReinitUsersPlane
|
XPLMReinitUsersPlane
|
||||||
|
|
||||||
|
WARNING: DO NOT USE. Use XPLMPlaceUserAtAirport or
|
||||||
|
XPLMPlaceUserAtLocation.
|
||||||
|
|
||||||
This function recomputes the derived flight model data from the aircraft
|
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
|
structure in memory. If you have used the data access layer to modify the
|
||||||
aircraft structure, use this routine to resynchronize x-plane; since
|
aircraft structure, use this routine to resynchronize X-Plane; since
|
||||||
X-plane works at least partly from derived values, the sim will not behave
|
X-Plane works at least partly from derived values, the sim will not behave
|
||||||
properly until this is called.
|
properly until this is called.
|
||||||
|
|
||||||
WARNING: this routine does not necessarily place the airplane at the
|
WARNING: this routine does not necessarily place the airplane at the
|
||||||
@@ -284,11 +269,10 @@ TYPE
|
|||||||
flight.
|
flight.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMReinitUsersPlane;
|
PROCEDURE XPLMReinitUsersPlane;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
+157
-125
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMPlugin;
|
UNIT XPLMPlugin;
|
||||||
@@ -13,11 +10,9 @@ INTERFACE
|
|||||||
manage other plugins.
|
manage other plugins.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* FINDING PLUGINS
|
* FINDING PLUGINS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
@@ -29,7 +24,6 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetMyID
|
XPLMGetMyID
|
||||||
|
|
||||||
@@ -37,11 +31,7 @@ USES XPLMDefs;
|
|||||||
get your own ID.
|
get your own ID.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetMyID: XPLMPluginID;
|
FUNCTION XPLMGetMyID: XPLMPluginID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMCountPlugins
|
XPLMCountPlugins
|
||||||
@@ -49,12 +39,8 @@ USES XPLMDefs;
|
|||||||
This routine returns the total number of plug-ins that are loaded, both
|
This routine returns the total number of plug-ins that are loaded, both
|
||||||
disabled and enabled.
|
disabled and enabled.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMCountPlugins: integer;
|
FUNCTION XPLMCountPlugins: Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetNthPlugin
|
XPLMGetNthPlugin
|
||||||
@@ -64,12 +50,8 @@ USES XPLMDefs;
|
|||||||
order.
|
order.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetNthPlugin(
|
FUNCTION XPLMGetNthPlugin(
|
||||||
inIndex : integer) : XPLMPluginID;
|
inIndex : Integer) : XPLMPluginID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFindPluginByPath
|
XPLMFindPluginByPath
|
||||||
@@ -79,12 +61,8 @@ USES XPLMDefs;
|
|||||||
path does not point to a currently loaded plug-in.
|
path does not point to a currently loaded plug-in.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindPluginByPath(
|
FUNCTION XPLMFindPluginByPath(
|
||||||
inPath : Pchar) : XPLMPluginID;
|
inPath : XPLMString) : XPLMPluginID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFindPluginBySignature
|
XPLMFindPluginBySignature
|
||||||
@@ -97,19 +75,15 @@ USES XPLMDefs;
|
|||||||
locate another plugin that your plugin interoperates with
|
locate another plugin that your plugin interoperates with
|
||||||
}
|
}
|
||||||
FUNCTION XPLMFindPluginBySignature(
|
FUNCTION XPLMFindPluginBySignature(
|
||||||
inSignature : Pchar) : XPLMPluginID;
|
inSignature : XPLMString) : XPLMPluginID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetPluginInfo
|
XPLMGetPluginInfo
|
||||||
|
|
||||||
This routine returns information about a plug-in. Each parameter should be
|
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
|
a pointer to a buffer of at least
|
||||||
the information.
|
256 characters, or NULL to not receive the information.
|
||||||
|
|
||||||
outName - the human-readable name of the plug-in. outFilePath - the
|
outName - the human-readable name of the plug-in. outFilePath - the
|
||||||
absolute file path to the file that contains this plug-in. outSignature - a
|
absolute file path to the file that contains this plug-in. outSignature - a
|
||||||
@@ -118,15 +92,11 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMGetPluginInfo(
|
PROCEDURE XPLMGetPluginInfo(
|
||||||
inPlugin : XPLMPluginID;
|
inPlugin : XPLMPluginID;
|
||||||
outName : Pchar; { Can be nil }
|
outName : XPLMString; { Can be nil }
|
||||||
outFilePath : Pchar; { Can be nil }
|
outFilePath : XPLMString; { Can be nil }
|
||||||
outSignature : Pchar; { Can be nil }
|
outSignature : XPLMString; { Can be nil }
|
||||||
outDescription : Pchar); { Can be nil }
|
outDescription : XPLMString); { Can be nil }
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* ENABLING/DISABLING PLUG-INS
|
* ENABLING/DISABLING PLUG-INS
|
||||||
@@ -137,19 +107,14 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMIsPluginEnabled
|
XPLMIsPluginEnabled
|
||||||
|
|
||||||
Returns whether the specified plug-in is enabled for running.
|
Returns whether the specified plug-in is enabled for running.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMIsPluginEnabled(
|
FUNCTION XPLMIsPluginEnabled(
|
||||||
inPluginID : XPLMPluginID) : integer;
|
inPluginID : XPLMPluginID) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMEnablePlugin
|
XPLMEnablePlugin
|
||||||
@@ -160,12 +125,8 @@ USES XPLMDefs;
|
|||||||
by returning 0 from their XPluginEnable callback.
|
by returning 0 from their XPluginEnable callback.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMEnablePlugin(
|
FUNCTION XPLMEnablePlugin(
|
||||||
inPluginID : XPLMPluginID) : integer;
|
inPluginID : XPLMPluginID) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDisablePlugin
|
XPLMDisablePlugin
|
||||||
@@ -174,11 +135,7 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMDisablePlugin(
|
PROCEDURE XPLMDisablePlugin(
|
||||||
inPluginID : XPLMPluginID);
|
inPluginID : XPLMPluginID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMReloadPlugins
|
XPLMReloadPlugins
|
||||||
@@ -190,11 +147,7 @@ USES XPLMDefs;
|
|||||||
up.
|
up.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMReloadPlugins;
|
PROCEDURE XPLMReloadPlugins;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* INTERPLUGIN MESSAGING
|
* INTERPLUGIN MESSAGING
|
||||||
@@ -203,6 +156,21 @@ USES XPLMDefs;
|
|||||||
Plugin messages are defined as 32-bit integers. Messages below 0x00FFFFFF
|
Plugin messages are defined as 32-bit integers. Messages below 0x00FFFFFF
|
||||||
are reserved for X-Plane and the plugin SDK.
|
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
|
Messages have two conceptual uses: notifications and commands. Commands
|
||||||
are sent from one plugin to another to induce behavior; notifications are
|
are sent from one plugin to another to induce behavior; notifications are
|
||||||
sent from one plugin to all others for informational purposes. It is
|
sent from one plugin to all others for informational purposes. It is
|
||||||
@@ -214,59 +182,94 @@ USES XPLMDefs;
|
|||||||
(e.g. be greater or equal to unsigned 0x8000000) while commands should have
|
(e.g. be greater or equal to unsigned 0x8000000) while commands should have
|
||||||
this bit be cleared.
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
{ 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. }
|
||||||
XPLM_MSG_PLANE_CRASHED = 101;
|
XPLM_MSG_PLANE_CRASHED = 101;
|
||||||
|
|
||||||
{ This message is sent to your plugin whenever a new plane is loaded. The }
|
{ 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 }
|
{ parameter contains the index number of the plane being loaded; 0 indicates }
|
||||||
{ plane. }
|
{ the user's plane. }
|
||||||
XPLM_MSG_PLANE_LOADED = 102;
|
XPLM_MSG_PLANE_LOADED = 102;
|
||||||
|
|
||||||
{ This messages is called whenever the user's plane is positioned at a new }
|
{ This messages is sent whenever the user's plane is positioned at a new }
|
||||||
{ airport. }
|
{ airport. The parameter is ignored. }
|
||||||
XPLM_MSG_AIRPORT_LOADED = 103;
|
XPLM_MSG_AIRPORT_LOADED = 103;
|
||||||
|
|
||||||
{ This message is sent whenever new scenery is loaded. Use datarefs to }
|
{ This message is sent whenever new scenery is loaded. Use datarefs to }
|
||||||
{ determine the new scenery files that were loaded. }
|
{ determine the new scenery files that were loaded. The parameter is ignored.}
|
||||||
XPLM_MSG_SCENERY_LOADED = 104;
|
XPLM_MSG_SCENERY_LOADED = 104;
|
||||||
|
|
||||||
{ This message is sent whenever the user adjusts the number of X-Plane }
|
{ 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 }
|
{ 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 }
|
{ are now available. This message will only be sent in XP7 and higher }
|
||||||
{ because in XP6 the number of aircraft is not user-adjustable. }
|
{ because in XP6 the number of aircraft is not user-adjustable. The parameter}
|
||||||
|
{ is ignored. }
|
||||||
XPLM_MSG_AIRPLANE_COUNT_CHANGED = 105;
|
XPLM_MSG_AIRPLANE_COUNT_CHANGED = 105;
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
|
CONST
|
||||||
{ This message is sent to your plugin whenever a plane is unloaded. The }
|
{ 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 }
|
{ parameter contains the index number of the plane being unloaded; 0 }
|
||||||
{ plane. The parameter is of type int, passed as the value of the pointer. }
|
{ indicates the user's plane. The parameter is of type int, passed as the }
|
||||||
{ (That is: the parameter is an int, not a pointer to an int.) }
|
{ value of the pointer. (That is: the parameter is an int, not a pointer to }
|
||||||
|
{ an int.) }
|
||||||
XPLM_MSG_PLANE_UNLOADED = 106;
|
XPLM_MSG_PLANE_UNLOADED = 106;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
|
CONST
|
||||||
{ This message is sent to your plugin right before X-Plane writes its }
|
{ 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 file. You can use this for two purposes: to write your own }
|
||||||
{ preferences, and to modify any datarefs to influence preferences output. }
|
{ preferences, and to modify any datarefs to influence preferences output. }
|
||||||
{ For example, if your plugin temporarily modifies saved preferences, you can }
|
{ 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 }
|
{ 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. }
|
{ persisted if your plugin is not loaded on the next invocation of X-Plane. }
|
||||||
|
{ The parameter is ignored. }
|
||||||
XPLM_MSG_WILL_WRITE_PREFS = 107;
|
XPLM_MSG_WILL_WRITE_PREFS = 107;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM210}
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{ This message is sent to your plugin right after a livery is loaded for an }
|
{ 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 }
|
{ 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 }
|
{ react accordingly. The parameter contains the index number of the aircraft}
|
||||||
{ pointer and represents the aicraft plane number - 0 is the user's plane. }
|
{ whose livery is changing. }
|
||||||
XPLM_MSG_LIVERY_LOADED = 108;
|
XPLM_MSG_LIVERY_LOADED = 108;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM210}
|
||||||
|
|
||||||
|
{$IFDEF XPLM301}
|
||||||
|
CONST
|
||||||
|
{ 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. }
|
||||||
|
XPLM_MSG_ENTERED_VR = 109;
|
||||||
|
{$ENDIF XPLM301}
|
||||||
|
|
||||||
|
{$IFDEF 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. }
|
||||||
|
XPLM_MSG_EXITING_VR = 110;
|
||||||
|
{$ENDIF XPLM301}
|
||||||
|
|
||||||
|
{$IFDEF XPLM303}
|
||||||
|
CONST
|
||||||
|
{ 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. }
|
||||||
|
XPLM_MSG_RELEASE_PLANES = 111;
|
||||||
|
{$ENDIF XPLM303}
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSendMessageToPlugin
|
XPLMSendMessageToPlugin
|
||||||
@@ -277,13 +280,9 @@ CONST
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMSendMessageToPlugin(
|
PROCEDURE XPLMSendMessageToPlugin(
|
||||||
inPlugin : XPLMPluginID;
|
inPlugin : XPLMPluginID;
|
||||||
inMessage : integer;
|
inMessage : Integer;
|
||||||
inParam : pointer);
|
inParam : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
@@ -298,11 +297,58 @@ CONST
|
|||||||
Each feature is defined by a permanent string name. The feature string
|
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.
|
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
|
XPLMFeatureEnumerator_f
|
||||||
|
|
||||||
@@ -312,7 +358,7 @@ CONST
|
|||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPLMFeatureEnumerator_f = PROCEDURE(
|
XPLMFeatureEnumerator_f = PROCEDURE(
|
||||||
inFeature : Pchar;
|
inFeature : XPLMString;
|
||||||
inRef : pointer); cdecl;
|
inRef : pointer); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -322,12 +368,8 @@ TYPE
|
|||||||
0 if it does not.
|
0 if it does not.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMHasFeature(
|
FUNCTION XPLMHasFeature(
|
||||||
inFeature : Pchar) : integer;
|
inFeature : XPLMString) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMIsFeatureEnabled
|
XPLMIsFeatureEnabled
|
||||||
@@ -337,12 +379,8 @@ TYPE
|
|||||||
feature.
|
feature.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMIsFeatureEnabled(
|
FUNCTION XPLMIsFeatureEnabled(
|
||||||
inFeature : Pchar) : integer;
|
inFeature : XPLMString) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMEnableFeature
|
XPLMEnableFeature
|
||||||
@@ -352,13 +390,9 @@ TYPE
|
|||||||
depending on the feature.
|
depending on the feature.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMEnableFeature(
|
PROCEDURE XPLMEnableFeature(
|
||||||
inFeature : Pchar;
|
inFeature : XPLMString;
|
||||||
inEnable : integer);
|
inEnable : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMEnumerateFeatures
|
XPLMEnumerateFeatures
|
||||||
@@ -370,12 +404,10 @@ TYPE
|
|||||||
PROCEDURE XPLMEnumerateFeatures(
|
PROCEDURE XPLMEnumerateFeatures(
|
||||||
inEnumerator : XPLMFeatureEnumerator_f;
|
inEnumerator : XPLMFeatureEnumerator_f;
|
||||||
inRef : pointer);
|
inRef : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
{$ENDIF XPLM200}
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMProcessing;
|
UNIT XPLMProcessing;
|
||||||
@@ -14,24 +11,32 @@ INTERFACE
|
|||||||
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.
|
and performing I/O.
|
||||||
|
|
||||||
|
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
|
WARNING: Do NOT use these callbacks to draw! You cannot draw during flight
|
||||||
loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
loop callbacks. Use the drawing callbacks (see XPLMDisplay for more info)
|
||||||
for graphics.
|
for graphics. (One exception: you can use a post-flight loop callback to
|
||||||
|
update your own off-screen FBOs.)
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* FLIGHT LOOP CALLBACKS
|
* FLIGHT LOOP CALLBACKS
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -50,7 +55,7 @@ TYPE
|
|||||||
|
|
||||||
);
|
);
|
||||||
PXPLMFlightLoopPhaseType = ^XPLMFlightLoopPhaseType;
|
PXPLMFlightLoopPhaseType = ^XPLMFlightLoopPhaseType;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM210}
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -62,35 +67,46 @@ TYPE
|
|||||||
}
|
}
|
||||||
XPLMFlightLoopID = pointer;
|
XPLMFlightLoopID = pointer;
|
||||||
PXPLMFlightLoopID = ^XPLMFlightLoopID;
|
PXPLMFlightLoopID = ^XPLMFlightLoopID;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM210}
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMFlightLoop_f
|
XPLMFlightLoop_f
|
||||||
|
|
||||||
This is your flight loop callback. Each time the flight loop is iterated
|
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
|
through, you receive this call at the end.
|
||||||
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
|
Flight loop callbacks receive a number of input timing parameters. These
|
||||||
receiving callbacks. Pass a positive number to specify how many seconds
|
input timing parameters are not particularly useful; you may need to track
|
||||||
until the next callback. (You will be called at or after this time, not
|
your own timing data (e.g. by reading datarefs). The input parameters are:
|
||||||
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
|
- inElapsedSinceLastCall: the wall time since your last callback.
|
||||||
to run your flight loop as infrequently as is practical, and suspend it
|
- 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
|
(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
|
Your callback will NOT be unregistered if you return 0; it will merely be
|
||||||
inactive.
|
inactive.
|
||||||
|
|
||||||
The reference constant you passed to your loop is passed back to you.
|
|
||||||
}
|
}
|
||||||
|
TYPE
|
||||||
XPLMFlightLoop_f = FUNCTION(
|
XPLMFlightLoop_f = FUNCTION(
|
||||||
inElapsedSinceLastCall: single;
|
inElapsedSinceLastCall: Single;
|
||||||
inElapsedTimeSinceLastFlightLoop: single;
|
inElapsedTimeSinceLastFlightLoop: Single;
|
||||||
inCounter : integer;
|
inCounter : Integer;
|
||||||
inRefcon : pointer) : single; cdecl;
|
inRefcon : pointer) : Single; cdecl;
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -100,27 +116,29 @@ TYPE
|
|||||||
callback. The strsucture can be expanded in future SDKs - always set
|
callback. The strsucture can be expanded in future SDKs - always set
|
||||||
structSize to the size of your structure in bytes.
|
structSize to the size of your structure in bytes.
|
||||||
}
|
}
|
||||||
|
TYPE
|
||||||
XPLMCreateFlightLoop_t = RECORD
|
XPLMCreateFlightLoop_t = RECORD
|
||||||
structSize : integer;
|
structSize : Integer;
|
||||||
phase : XPLMFlightLoopPhaseType;
|
phase : XPLMFlightLoopPhaseType;
|
||||||
callbackFunc : XPLMFlightLoop_f;
|
callbackFunc : XPLMFlightLoop_f;
|
||||||
refcon : pointer;
|
refcon : pointer;
|
||||||
END;
|
END;
|
||||||
PXPLMCreateFlightLoop_t = ^XPLMCreateFlightLoop_t;
|
PXPLMCreateFlightLoop_t = ^XPLMCreateFlightLoop_t;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM210}
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetElapsedTime
|
XPLMGetElapsedTime
|
||||||
|
|
||||||
This routine returns the elapsed time since the sim started up in decimal
|
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.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetElapsedTime: single;
|
FUNCTION XPLMGetElapsedTime: Single;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMGetCycleNumber
|
XPLMGetCycleNumber
|
||||||
@@ -128,48 +146,42 @@ TYPE
|
|||||||
This routine returns a counter starting at zero for each sim cycle
|
This routine returns a counter starting at zero for each sim cycle
|
||||||
computed/video frame rendered.
|
computed/video frame rendered.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMGetCycleNumber: integer;
|
FUNCTION XPLMGetCycleNumber: Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMRegisterFlightLoopCallback
|
XPLMRegisterFlightLoopCallback
|
||||||
|
|
||||||
This routine registers your flight loop callback. Pass in a pointer to a
|
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
|
flight loop function and a refcon. inInterval defines when you will be
|
||||||
called. Pass in a positive number to specify seconds from registration
|
called. Pass in a positive number to specify seconds from registration time
|
||||||
time to the next callback. Pass in a negative number to indicate when you
|
to the next callback. Pass in a negative number to indicate when you will
|
||||||
will be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to
|
be called (e.g. pass -1 to be called at the next cylcle). Pass 0 to not be
|
||||||
not be called; your callback will be inactive.
|
called; your callback will be inactive.
|
||||||
|
|
||||||
|
(This legacy function only installs pre-flight-loop callbacks; use
|
||||||
|
XPLMCreateFlightLoop for more control.)
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMRegisterFlightLoopCallback(
|
PROCEDURE XPLMRegisterFlightLoopCallback(
|
||||||
inFlightLoop : XPLMFlightLoop_f;
|
inFlightLoop : XPLMFlightLoop_f;
|
||||||
inInterval : single;
|
inInterval : Single;
|
||||||
inRefcon : pointer);
|
inRefcon : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMUnregisterFlightLoopCallback
|
XPLMUnregisterFlightLoopCallback
|
||||||
|
|
||||||
This routine unregisters your flight loop callback. Do NOT call it from
|
This routine unregisters your flight loop callback. Do NOT call it from
|
||||||
your flight loop callback. Once your flight loop callback is
|
your flight loop callback. Once your flight loop callback is unregistered,
|
||||||
unregistered, it will not be called again.
|
it will not be called again.
|
||||||
|
|
||||||
|
Only use this on flight loops registered via
|
||||||
|
XPLMRegisterFlightLoopCallback.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMUnregisterFlightLoopCallback(
|
PROCEDURE XPLMUnregisterFlightLoopCallback(
|
||||||
inFlightLoop : XPLMFlightLoop_f;
|
inFlightLoop : XPLMFlightLoop_f;
|
||||||
inRefcon : pointer);
|
inRefcon : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMSetFlightLoopCallbackInterval
|
XPLMSetFlightLoopCallbackInterval
|
||||||
@@ -186,14 +198,10 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMSetFlightLoopCallbackInterval(
|
PROCEDURE XPLMSetFlightLoopCallbackInterval(
|
||||||
inFlightLoop : XPLMFlightLoop_f;
|
inFlightLoop : XPLMFlightLoop_f;
|
||||||
inInterval : single;
|
inInterval : Single;
|
||||||
inRelativeToNow : integer;
|
inRelativeToNow : Integer;
|
||||||
inRefcon : pointer);
|
inRefcon : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -205,27 +213,20 @@ TYPE
|
|||||||
}
|
}
|
||||||
FUNCTION XPLMCreateFlightLoop(
|
FUNCTION XPLMCreateFlightLoop(
|
||||||
inParams : PXPLMCreateFlightLoop_t) : XPLMFlightLoopID;
|
inParams : PXPLMCreateFlightLoop_t) : XPLMFlightLoopID;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM210}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
XPLMDestroyFlightLoop
|
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.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDestroyFlightLoop(
|
PROCEDURE XPLMDestroyFlightLoop(
|
||||||
inFlightLoopID : XPLMFlightLoopID);
|
inFlightLoopID : XPLMFlightLoopID);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM210}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -239,38 +240,15 @@ TYPE
|
|||||||
If inRelativeToNow is true, ties are interpretted relative to the time this
|
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
|
routine is called; otherwise they are relative to the last call time or the
|
||||||
time the flight loop was registered (if never called).
|
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.
|
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMScheduleFlightLoop(
|
PROCEDURE XPLMScheduleFlightLoop(
|
||||||
inFlightLoopID : XPLMFlightLoopID;
|
inFlightLoopID : XPLMFlightLoopID;
|
||||||
inInterval : single;
|
inInterval : Single;
|
||||||
inRelativeToNow : integer);
|
inRelativeToNow : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM210}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
+134
-119
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
Copyright 2005-2012 Sandy Barbour and Ben Supnik
|
Copyright 2005-2012 Sandy Barbour and Ben Supnik All rights reserved. See
|
||||||
|
license.txt for usage. X-Plane SDK Version: 2.1.1
|
||||||
All rights reserved. See license.txt for usage.
|
|
||||||
|
|
||||||
X-Plane SDK Version: 2.1.1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNIT XPLMScenery;
|
UNIT XPLMScenery;
|
||||||
@@ -12,35 +9,36 @@ INTERFACE
|
|||||||
This package contains APIs to interact with X-Plane's scenery system.
|
This package contains APIs to interact with X-Plane's scenery system.
|
||||||
}
|
}
|
||||||
|
|
||||||
USES XPLMDefs;
|
USES
|
||||||
|
XPLMDefs;
|
||||||
{$A4}
|
{$A4}
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
{$DEFINE DELPHI}
|
|
||||||
{$ENDIF}
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* Terrain Y-Testing
|
* Terrain Y-Testing
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
{
|
{
|
||||||
The Y-testing API allows you to locate the physical scenery mesh. This
|
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
|
would be used to place dynamic graphics on top of the ground in a plausible
|
||||||
plausible way or do physics interactions.
|
way or do physics interactions.
|
||||||
|
|
||||||
The Y-test API works via probe objects, which are allocated by your plugin
|
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
|
and used to query terrain. Probe objects exist both to capture which
|
||||||
algorithm you have requested (see probe types) and also to cache query
|
algorithm you have requested (see probe types) and also to cache query
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Performance guidelines: It is generally faster to use the same probe for
|
Performance Guidelines
|
||||||
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
|
It is generally faster to use the same probe for nearby points and
|
||||||
via caching when possible.
|
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
|
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
|
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
|
that point. The velocity vector tells you if that terrain is moving (and is
|
||||||
is in meters/second). For example, if your Y test hits the aircraft carrier
|
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.
|
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,
|
Note: the Y-testing API is limited to probing the loaded scenery area,
|
||||||
@@ -49,8 +47,6 @@ USES XPLMDefs;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMProbeType
|
XPLMProbeType
|
||||||
|
|
||||||
@@ -104,30 +100,30 @@ TYPE
|
|||||||
}
|
}
|
||||||
XPLMProbeInfo_t = RECORD
|
XPLMProbeInfo_t = RECORD
|
||||||
{ Size of structure in bytes - always set this before calling the XPLM. }
|
{ Size of structure in bytes - always set this before calling the XPLM. }
|
||||||
structSize : integer;
|
structSize : Integer;
|
||||||
{ Resulting X location of the terrain point we hit, in local OpenGL }
|
{ Resulting X location of the terrain point we hit, in local OpenGL }
|
||||||
{ coordinates. }
|
{ coordinates. }
|
||||||
locationX : single;
|
locationX : Single;
|
||||||
{ Resulting Y location of the terrain point we hit, in local OpenGL }
|
{ Resulting Y location of the terrain point we hit, in local OpenGL }
|
||||||
{ coordinates. }
|
{ coordinates. }
|
||||||
locationY : single;
|
locationY : Single;
|
||||||
{ Resulting Z location of the terrain point we hit, in local OpenGL }
|
{ Resulting Z location of the terrain point we hit, in local OpenGL }
|
||||||
{ coordinates. }
|
{ coordinates. }
|
||||||
locationZ : single;
|
locationZ : Single;
|
||||||
{ X component of the normal vector to the terrain we found. }
|
{ X component of the normal vector to the terrain we found. }
|
||||||
normalX : single;
|
normalX : Single;
|
||||||
{ Y component of the normal vector to the terrain we found. }
|
{ Y component of the normal vector to the terrain we found. }
|
||||||
normalY : single;
|
normalY : Single;
|
||||||
{ Z component of the normal vector to the terrain we found. }
|
{ Z component of the normal vector to the terrain we found. }
|
||||||
normalZ : single;
|
normalZ : Single;
|
||||||
{ X component of the velocity vector of the terrain we found. }
|
{ X component of the velocity vector of the terrain we found. }
|
||||||
velocityX : single;
|
velocityX : Single;
|
||||||
{ Y component of the velocity vector of the terrain we found. }
|
{ Y component of the velocity vector of the terrain we found. }
|
||||||
velocityY : single;
|
velocityY : Single;
|
||||||
{ Z component of the velocity vector of the terrain we found. }
|
{ Z component of the velocity vector of the terrain we found. }
|
||||||
velocityZ : single;
|
velocityZ : Single;
|
||||||
{ Tells if the surface we hit is water (otherwise it is land). }
|
{ Tells if the surface we hit is water (otherwise it is land). }
|
||||||
is_wet : integer;
|
is_wet : Integer;
|
||||||
END;
|
END;
|
||||||
PXPLMProbeInfo_t = ^XPLMProbeInfo_t;
|
PXPLMProbeInfo_t = ^XPLMProbeInfo_t;
|
||||||
|
|
||||||
@@ -138,11 +134,7 @@ TYPE
|
|||||||
}
|
}
|
||||||
FUNCTION XPLMCreateProbe(
|
FUNCTION XPLMCreateProbe(
|
||||||
inProbeType : XPLMProbeType) : XPLMProbeRef;
|
inProbeType : XPLMProbeType) : XPLMProbeRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMDestroyProbe
|
XPLMDestroyProbe
|
||||||
@@ -151,11 +143,7 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMDestroyProbe(
|
PROCEDURE XPLMDestroyProbe(
|
||||||
inProbe : XPLMProbeRef);
|
inProbe : XPLMProbeRef);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMProbeTerrainXYZ
|
XPLMProbeTerrainXYZ
|
||||||
@@ -167,17 +155,63 @@ TYPE
|
|||||||
}
|
}
|
||||||
FUNCTION XPLMProbeTerrainXYZ(
|
FUNCTION XPLMProbeTerrainXYZ(
|
||||||
inProbe : XPLMProbeRef;
|
inProbe : XPLMProbeRef;
|
||||||
inX : single;
|
inX : Single;
|
||||||
inY : single;
|
inY : Single;
|
||||||
inZ : single;
|
inZ : Single;
|
||||||
outInfo : PXPLMProbeInfo_t) : XPLMProbeResult;
|
outInfo : PXPLMProbeInfo_t) : XPLMProbeResult;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
{$IFDEF 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.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMGetMagneticVariation(
|
||||||
|
latitude : Real;
|
||||||
|
longitude : Real) : Single;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
XPLMDegTrueToDegMagnetic
|
||||||
|
|
||||||
|
Converts a heading in degrees relative to true north into a value relative
|
||||||
|
to magnetic north at the user's current location.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMDegTrueToDegMagnetic(
|
||||||
|
headingDegreesTrue : Single) : Single;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{
|
||||||
|
XPLMDegMagneticToDegTrue
|
||||||
|
|
||||||
|
Converts a heading in degrees relative to magnetic north at the user's
|
||||||
|
current location into a value relative to true north.
|
||||||
|
}
|
||||||
|
FUNCTION XPLMDegMagneticToDegTrue(
|
||||||
|
headingDegreesMagnetic: Single) : Single;
|
||||||
|
cdecl; external XPLM_DLL;
|
||||||
|
|
||||||
|
{$ENDIF XPLM300}
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
* Object Drawing
|
* Object Drawing
|
||||||
___________________________________________________________________________}
|
___________________________________________________________________________}
|
||||||
@@ -189,7 +223,6 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
TYPE
|
TYPE
|
||||||
{
|
{
|
||||||
@@ -200,7 +233,7 @@ TYPE
|
|||||||
}
|
}
|
||||||
XPLMObjectRef = pointer;
|
XPLMObjectRef = pointer;
|
||||||
PXPLMObjectRef = ^XPLMObjectRef;
|
PXPLMObjectRef = ^XPLMObjectRef;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{
|
{
|
||||||
@@ -212,22 +245,22 @@ TYPE
|
|||||||
}
|
}
|
||||||
XPLMDrawInfo_t = RECORD
|
XPLMDrawInfo_t = RECORD
|
||||||
{ Set this to the size of this structure! }
|
{ Set this to the size of this structure! }
|
||||||
structSize : integer;
|
structSize : Integer;
|
||||||
{ X location of the object in local coordinates. }
|
{ X location of the object in local coordinates. }
|
||||||
x : single;
|
x : Single;
|
||||||
{ Y location of the object in local coordinates. }
|
{ Y location of the object in local coordinates. }
|
||||||
y : single;
|
y : Single;
|
||||||
{ Z location of the object in local coordinates. }
|
{ Z location of the object in local coordinates. }
|
||||||
z : single;
|
z : Single;
|
||||||
{ Pitch in degres to rotate the object, positive is up. }
|
{ Pitch in degres to rotate the object, positive is up. }
|
||||||
pitch : single;
|
pitch : Single;
|
||||||
{ Heading in local coordinates to rotate the object, clockwise. }
|
{ Heading in local coordinates to rotate the object, clockwise. }
|
||||||
heading : single;
|
heading : Single;
|
||||||
{ Roll to rotate the object. }
|
{ Roll to rotate the object. }
|
||||||
roll : single;
|
roll : Single;
|
||||||
END;
|
END;
|
||||||
PXPLMDrawInfo_t = ^XPLMDrawInfo_t;
|
PXPLMDrawInfo_t = ^XPLMDrawInfo_t;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM200}
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -242,27 +275,27 @@ TYPE
|
|||||||
plugin is re-enabled. If your plugin is unloaded before this callback is
|
plugin is re-enabled. If your plugin is unloaded before this callback is
|
||||||
ever called, the SDK will release the object handle for you.
|
ever called, the SDK will release the object handle for you.
|
||||||
}
|
}
|
||||||
|
TYPE
|
||||||
XPLMObjectLoaded_f = PROCEDURE(
|
XPLMObjectLoaded_f = PROCEDURE(
|
||||||
inObject : XPLMObjectRef;
|
inObject : XPLMObjectRef;
|
||||||
inRefcon : pointer); cdecl;
|
inRefcon : pointer); cdecl;
|
||||||
{$ENDIF}
|
{$ENDIF XPLM210}
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{
|
{
|
||||||
XPLMLoadObject
|
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.
|
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
|
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
|
call unload once for every load to avoid "leaking" objects. The object will
|
||||||
will be purged from memory when no plugins and no scenery are using it.
|
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 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 ./
|
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
|
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!
|
discouraged - your plugin should not dump art resources in the root folder!
|
||||||
|
|
||||||
|
|
||||||
XPLMLoadObject will return NULL if the object cannot be loaded (either
|
XPLMLoadObject will return NULL if the object cannot be loaded (either
|
||||||
because it is not found or the file is misformatted). This routine will
|
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.
|
load any object that can be used in the X-Plane scenery system.
|
||||||
@@ -272,13 +305,9 @@ TYPE
|
|||||||
defer object loading until the sim has fully started.
|
defer object loading until the sim has fully started.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMLoadObject(
|
FUNCTION XPLMLoadObject(
|
||||||
inPath : Pchar) : XPLMObjectRef;
|
inPath : XPLMString) : XPLMObjectRef;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM200}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM210}
|
{$IFDEF XPLM210}
|
||||||
{
|
{
|
||||||
@@ -286,8 +315,8 @@ TYPE
|
|||||||
|
|
||||||
This routine loads an object asynchronously; control is returned to you
|
This routine loads an object asynchronously; control is returned to you
|
||||||
immediately while X-Plane loads the object. The sim will not stop flying
|
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
|
while the object loads. For large objects, it may be several seconds before
|
||||||
before the load finishes.
|
the load finishes.
|
||||||
|
|
||||||
You provide a callback function that is called once the load has completed.
|
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
|
Note that if the object cannot be loaded, you will not find out until the
|
||||||
@@ -298,20 +327,19 @@ TYPE
|
|||||||
desired.
|
desired.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMLoadObjectAsync(
|
PROCEDURE XPLMLoadObjectAsync(
|
||||||
inPath : Pchar;
|
inPath : XPLMString;
|
||||||
inCallback : XPLMObjectLoaded_f;
|
inCallback : XPLMObjectLoaded_f;
|
||||||
inRefcon : pointer);
|
inRefcon : pointer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM210}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM_DEPRECATED}
|
||||||
{
|
{
|
||||||
XPLMDrawObjects
|
XPLMDrawObjects
|
||||||
|
|
||||||
|
__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
|
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
|
pass in the object and an array of XPLMDrawInfo_t structs, one for each
|
||||||
place you would like the object to be drawn.
|
place you would like the object to be drawn.
|
||||||
@@ -320,30 +348,25 @@ TYPE
|
|||||||
will pick the appropriate LOD.
|
will pick the appropriate LOD.
|
||||||
|
|
||||||
Lighting is a boolean; pass 1 to show the night version of object with
|
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
|
night-only lights lit up. Pass 0 to show the daytime version of the object.
|
||||||
object.
|
|
||||||
|
|
||||||
earth_relative controls the coordinate system. If this is 1, the rotations
|
earth_relative controls the coordinate system. If this is 1, the rotations
|
||||||
you specify are applied to the object after its coordinate system is
|
you specify are applied to the object after its coordinate system is
|
||||||
transformed from local to earth-relative coordinates -- that is, an object
|
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
|
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
|
against gravity. If this is 0, the object is drawn with your rotations from
|
||||||
from local coordanates -- that is, an object with no rotations is drawn
|
local coordanates -- that is, an object with no rotations is drawn pointing
|
||||||
pointing down the -Z axis and the Y axis of the object matches the local
|
down the -Z axis and the Y axis of the object matches the local coordinate
|
||||||
coordinate Y axis.
|
Y axis.
|
||||||
}
|
}
|
||||||
PROCEDURE XPLMDrawObjects(
|
PROCEDURE XPLMDrawObjects(
|
||||||
inObject : XPLMObjectRef;
|
inObject : XPLMObjectRef;
|
||||||
inCount : integer;
|
inCount : Integer;
|
||||||
inLocations : PXPLMDrawInfo_t;
|
inLocations : PXPLMDrawInfo_t;
|
||||||
lighting : integer;
|
lighting : Integer;
|
||||||
earth_relative : integer);
|
earth_relative : Integer);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM_DEPRECATED}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{
|
{
|
||||||
@@ -356,12 +379,8 @@ TYPE
|
|||||||
}
|
}
|
||||||
PROCEDURE XPLMUnloadObject(
|
PROCEDURE XPLMUnloadObject(
|
||||||
inObject : XPLMObjectRef);
|
inObject : XPLMObjectRef);
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
{$ENDIF XPLM200}
|
||||||
{$ELSE}
|
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$IFDEF XPLM200}
|
{$IFDEF XPLM200}
|
||||||
{___________________________________________________________________________
|
{___________________________________________________________________________
|
||||||
@@ -375,8 +394,6 @@ TYPE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMLibraryEnumerator_f
|
XPLMLibraryEnumerator_f
|
||||||
|
|
||||||
@@ -386,16 +403,16 @@ TYPE
|
|||||||
}
|
}
|
||||||
TYPE
|
TYPE
|
||||||
XPLMLibraryEnumerator_f = PROCEDURE(
|
XPLMLibraryEnumerator_f = PROCEDURE(
|
||||||
inFilePath : Pchar;
|
inFilePath : XPLMString;
|
||||||
inRef : pointer); cdecl;
|
inRef : pointer); cdecl;
|
||||||
|
|
||||||
{
|
{
|
||||||
XPLMLookupObjects
|
XPLMLookupObjects
|
||||||
|
|
||||||
This routine looks up a virtual path in the library system and returns all
|
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
|
matching elements. You provide a callback - one virtual path may match many
|
||||||
many objects in the library. XPLMLookupObjects returns the number of
|
objects in the library. XPLMLookupObjects returns the number of objects
|
||||||
objects found.
|
found.
|
||||||
|
|
||||||
The latitude and longitude parameters specify the location the object will
|
The latitude and longitude parameters specify the location the object will
|
||||||
be used. The library system allows for scenery packages to only provide
|
be used. The library system allows for scenery packages to only provide
|
||||||
@@ -403,17 +420,15 @@ TYPE
|
|||||||
latitude/longitude you provide will be returned.
|
latitude/longitude you provide will be returned.
|
||||||
}
|
}
|
||||||
FUNCTION XPLMLookupObjects(
|
FUNCTION XPLMLookupObjects(
|
||||||
inPath : Pchar;
|
inPath : XPLMString;
|
||||||
inLatitude : single;
|
inLatitude : Single;
|
||||||
inLongitude : single;
|
inLongitude : Single;
|
||||||
enumerator : XPLMLibraryEnumerator_f;
|
enumerator : XPLMLibraryEnumerator_f;
|
||||||
ref : pointer) : integer;
|
ref : pointer) : Integer;
|
||||||
{$IFDEF DELPHI}
|
cdecl; external XPLM_DLL;
|
||||||
cdecl; external 'XPLM.DLL';
|
|
||||||
{$ELSE}
|
{$ENDIF XPLM200}
|
||||||
cdecl; external '';
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
IMPLEMENTATION
|
IMPLEMENTATION
|
||||||
|
|
||||||
END.
|
END.
|
||||||
|
|||||||
+684
-660
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+45
-20
@@ -5,24 +5,12 @@
|
|||||||
This download contains the files necessary to build plugins for X-Plane. The
|
This download contains the files necessary to build plugins for X-Plane. The
|
||||||
X-Plane plugin website is:
|
X-Plane plugin website is:
|
||||||
|
|
||||||
http://www.xsquawkbox.net/xpsdk/
|
http://https://developer.x-plane.com/sdk/
|
||||||
|
|
||||||
The website contains full documentation on the SDK including tech notes, sample
|
The website contains full documentation on the SDK including tech notes, sample
|
||||||
plugins, sample code, contact information, and links to the latest versions of
|
plugins, sample code, contact information, and links to the latest versions of
|
||||||
this SDK.
|
this SDK.
|
||||||
|
|
||||||
The X-Plane SDK authors can be reached at:
|
|
||||||
|
|
||||||
xplanesdk@xsquawkbox.net
|
|
||||||
|
|
||||||
Please do not email Austin or Laminar Research for SDK questions or support;
|
|
||||||
the SDK is a third party effort.
|
|
||||||
|
|
||||||
the X-Plane developer mailing list is an unlisted yahoo group frequented by
|
|
||||||
many X-Plane developers.
|
|
||||||
|
|
||||||
x-plane-dev@yahoogroups.com
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
SDK FILES
|
SDK FILES
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@@ -38,19 +26,56 @@ Note: there are no import/link-time libraries for Linux; on Linux, plugins
|
|||||||
simply leave SDK symbols undefined and they are discovered at runtime. The
|
simply leave SDK symbols undefined and they are discovered at runtime. The
|
||||||
SDK website explains this process in more detail.
|
SDK website explains this process in more detail.
|
||||||
|
|
||||||
Mac CFM plugins are not supported by the SDK versions 2.0 and higher; the
|
|
||||||
2.0 SDK requires X-Plane 9.0 or newer, and X-Plane 9 will not run on
|
|
||||||
Mac OS 9. Therefore CFM plugins are not useful (and are probably
|
|
||||||
counterproductive since they cannot support x86 code). If you have a CFM
|
|
||||||
plugin, continue to use the 1.0 SDK to build it. You will have to port to
|
|
||||||
Mach-O if you want to use 2.0 features.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
RELEASE NOTES
|
RELEASE NOTES
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
This section contains per-release notes for the history of the X-Plane SDK.
|
This section contains per-release notes for the history of the X-Plane SDK.
|
||||||
|
|
||||||
|
X-PLane SDK Release 4.0.0 beta 1 9/18/2022
|
||||||
|
|
||||||
|
The 4.0.0 SDK adds support for ARM64 Macs. The 4.0 SDK is supported by X-Plane
|
||||||
|
12. The new SDK adds support for drawing hooks that draw directly to the G1000
|
||||||
|
and other avionic cockpit devices.
|
||||||
|
|
||||||
|
X-Plane SDK Release 3.0.2 4/29/2020
|
||||||
|
|
||||||
|
The SDK 3.0.2 adds the modern 3-d drawing callback for interoperability with
|
||||||
|
Metal and Vulkan, and deprecates most older drawing callbacks.
|
||||||
|
|
||||||
|
X-Plane SDK Release 3.0.1 3/5/2018
|
||||||
|
|
||||||
|
The SDK 3.0.1 API adds new messages and APIs to support VR.
|
||||||
|
|
||||||
|
X-Plane SDK Release 3.0.0 11/2/7/2017
|
||||||
|
|
||||||
|
The SDK 3.0 API supports new features and new packaging for plugins. The 3.0
|
||||||
|
SDK requires X-Plane 11.0 or newer. New features include:
|
||||||
|
|
||||||
|
- Display APIs to match X-Plane 11's UI.
|
||||||
|
- New map APIs. Legacy 2-d map draw callbacks are deprecated.
|
||||||
|
- Aircraft-plugins get their own menu
|
||||||
|
- Aircraft placement by lat-lon-elevation.
|
||||||
|
- Magnetic variation queries
|
||||||
|
- Chinese language support
|
||||||
|
- New instancing API
|
||||||
|
|
||||||
|
The 3.0 SDK supports a new plugin packaging schema:
|
||||||
|
|
||||||
|
<plugin name>/<ABI>/<plugin name>.xpl
|
||||||
|
|
||||||
|
where ABI is one of mac_x64, win_x64 or lin_x64. The new schema is preferred,
|
||||||
|
so you can pack a version of your plugin that requires 3.0 with this scheme
|
||||||
|
and include a legacy 2.x plugin using hte old scheme for X-Plane 10
|
||||||
|
compatibility.
|
||||||
|
|
||||||
|
Please use the new scheme where possible - having a unique file name for each
|
||||||
|
DLL makes crash reports easier to read and triage.
|
||||||
|
|
||||||
|
The 3.0 SDK drops support for 32-bit plugins; if you need to ship a 32-bit
|
||||||
|
plugin for 32-bit X-Plane 10, shipping using two schemes and two binaries may
|
||||||
|
be the best option.
|
||||||
|
|
||||||
X-Plane SDK Release 2.1.3 11/14/13
|
X-Plane SDK Release 2.1.3 11/14/13
|
||||||
|
|
||||||
Fixed XPC Wrappers to use int and intptr_t instead of long. This fixes
|
Fixed XPC Wrappers to use int and intptr_t instead of long. This fixes
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ if(APPLE)
|
|||||||
)
|
)
|
||||||
target_compile_options(ixwebsocket PRIVATE
|
target_compile_options(ixwebsocket PRIVATE
|
||||||
"SHELL:-arch x86_64"
|
"SHELL:-arch x86_64"
|
||||||
|
"SHELL:-arch arm64"
|
||||||
)
|
)
|
||||||
target_link_options(ixwebsocket PRIVATE
|
target_link_options(ixwebsocket PRIVATE
|
||||||
"SHELL:-arch x86_64"
|
"SHELL:-arch x86_64"
|
||||||
|
"SHELL:-arch arm64"
|
||||||
)
|
)
|
||||||
target_link_libraries(ixwebsocket PRIVATE
|
target_link_libraries(ixwebsocket PRIVATE
|
||||||
"-framework Foundation"
|
"-framework Foundation"
|
||||||
|
|||||||
Reference in New Issue
Block a user