[xswiftbus] Plane View Menu

FSX/P3D have a nice feature to follow a remote aircraft with the camera.
X-Plane was missing this feature, since for X-Plane the remote aircrafts
are not known. However, from a plugin point of view, we know them and where
they are. So we can manually control the camera and provide a similar
feature.
This is still very simple. As soon as you move the mouse, the PoV angle will
change. In future updates, it should be change only while the right mouse
button is pressed.
This commit is contained in:
Roland Winklmeier
2018-03-27 13:55:37 +02:00
parent 6a8ae67e06
commit 37e592759c
4 changed files with 86 additions and 0 deletions

View File

@@ -15,7 +15,9 @@
#include "dbusobject.h"
#include "datarefs.h"
#include "terrainprobe.h"
#include "menus.h"
#include "XPMPMultiplayer.h"
#include "XPLMCamera.h"
#include <XPLM/XPLMDisplay.h>
#include <functional>
#include <utility>
@@ -53,6 +55,9 @@ namespace XSwiftBus
return s;
}
//! Set plane view submenu
void setPlaneViewMenu(const CMenu &planeViewSubMenu) { m_planeViewSubMenu = planeViewSubMenu; }
//! Called by XPluginStart
static void initLegacyData();
@@ -113,9 +118,11 @@ namespace XSwiftBus
void emitSimFrame();
void emitRemoteAircraftData(const std::string &callsign, double latitude, double longitude, double elevation, double modelVerticalOffset);
void orbitRemotePlane(const std::string &callsign);
static int preferences(const char *section, const char *name, int def);
static float preferences(const char *section, const char *name, float def);
static int orbitPlaneFunc(XPLMCameraPosition_t *cameraPosition, int isLosingControl, void *refcon);
struct Plane
{
@@ -142,6 +149,10 @@ namespace XSwiftBus
std::unordered_map<void *, Plane *> m_planesById;
std::chrono::system_clock::time_point m_timestampLastSimFrame = std::chrono::system_clock::now();
CMenu m_planeViewSubMenu;
std::unordered_map<std::string, CMenuItem> m_planeViewMenuItems;
std::string m_planeViewCallsign;
int getPlaneData(void *id, int dataType, void *io_data);
static int getPlaneData(void *id, int dataType, void *io_data, void *self)
{