summaryrefslogtreecommitdiffhomepage
path: root/x-plane-plugin
diff options
context:
space:
mode:
authorEnnio Barbaro <enniobarbaro@gmail.com>2015-07-02 22:08:40 +0200
committerEnnio Barbaro <enniobarbaro@gmail.com>2015-07-02 22:57:18 +0200
commit59144a96bf9e3391a32b9ad8f5240f02acb3f44a (patch)
tree6a36f3a7ce8f2b9efbd6dc9dbed32f4db32abb6f /x-plane-plugin
parente94be88e28b41610bab983a1cbf8f31133a4ced8 (diff)
Use XPLMRegisterFlightLoopCallback instead of XPLMRegisterDrawCallback
Diffstat (limited to 'x-plane-plugin')
-rw-r--r--x-plane-plugin/plugin.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c
index 3958c895..eed3c774 100644
--- a/x-plane-plugin/plugin.c
+++ b/x-plane-plugin/plugin.c
@@ -8,9 +8,7 @@
#include <unistd.h>
#include <XPLMPlugin.h>
-#include <XPLMDisplay.h>
#include <XPLMDataAccess.h>
-#include <XPLMCamera.h>
#include <XPLMProcessing.h>
#ifndef PLUGIN_API
@@ -87,10 +85,11 @@ void PortableLockedShm_unlock(PortableLockedShm* self)
flock(self->fd, LOCK_UN);
}
-int write_head_position(
- XPLMDrawingPhase OT_UNUSED(inPhase),
- int OT_UNUSED(inIsBefore),
- void * OT_UNUSED(inRefcon))
+float write_head_position(
+ float OT_UNUSED(inElapsedSinceLastCall),
+ float OT_UNUSED(inElapsedTimeSinceLastFlightLoop),
+ int OT_UNUSED(inCounter),
+ void * OT_UNUSED(inRefcon) )
{
if (lck_posix != NULL && shm_posix != NULL) {
PortableLockedShm_lock(lck_posix);
@@ -101,7 +100,7 @@ int write_head_position(
XPLMSetDataf(view_pitch, shm_posix->data[Pitch] * 180 / 3.141592654);
PortableLockedShm_unlock(lck_posix);
}
- return 1;
+ return -1.0;
}
PLUGIN_API int XPluginStart ( char * outName, char * outSignature, char * outDescription ) {
@@ -137,11 +136,11 @@ PLUGIN_API void XPluginStop ( void ) {
}
PLUGIN_API void XPluginEnable ( void ) {
- XPLMRegisterDrawCallback(write_head_position, xplm_Phase_LastScene, 1, NULL);
+ XPLMRegisterFlightLoopCallback(write_head_position, -1.0, NULL);
}
PLUGIN_API void XPluginDisable ( void ) {
- XPLMUnregisterDrawCallback(write_head_position, xplm_Phase_LastScene, 1, NULL);
+ XPLMUnregisterFlightLoopCallback(write_head_position, NULL);
}
PLUGIN_API void XPluginReceiveMessage(