Added support for VIEW command to the C client.
This commit is contained in:
@@ -48,9 +48,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
|
||||
void printError(char *functionName, char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -694,3 +691,31 @@ int sendWYPT(XPCSocket sock, WYPT_OP op, float points[], int count)
|
||||
/*****************************************************************************/
|
||||
/**** End Drawing functions ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** View functions ****/
|
||||
/*****************************************************************************/
|
||||
int sendVIEW(XPCSocket sock, VIEW_TYPE view)
|
||||
{
|
||||
// Validate Input
|
||||
if (view < XPC_VIEW_FORWARDS || view > XPC_VIEW_FULLSCREENNOHUD)
|
||||
{
|
||||
printError("sendVIEW", "Unrecognized view");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Setup Command
|
||||
char buffer[9] = "VIEW";
|
||||
*((int*)(buffer + 5)) = view;
|
||||
|
||||
// Send Command
|
||||
if (sendUDP(sock, buffer, 9) < 0)
|
||||
{
|
||||
printError("sendVIEW", "Failed to send command");
|
||||
return -2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*****************************************************************************/
|
||||
/**** End View functions ****/
|
||||
/*****************************************************************************/
|
||||
@@ -61,6 +61,23 @@ typedef enum
|
||||
XPC_WYPT_DEL = 2,
|
||||
XPC_WYPT_CLR = 3
|
||||
} WYPT_OP;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XPC_VIEW_FORWARDS = 73,
|
||||
XPC_VIEW_DOWN,
|
||||
XPC_VIEW_LEFT,
|
||||
XPC_VIEW_RIGHT,
|
||||
XPC_VIEW_BACK,
|
||||
XPC_VIEW_TOWER,
|
||||
XPC_VIEW_RUNWAY,
|
||||
XPC_VIEW_CHASE,
|
||||
XPC_VIEW_FOLLOW,
|
||||
XPC_VIEW_FOLLOWWITHPANEL,
|
||||
XPC_VIEW_SPOT,
|
||||
XPC_VIEW_FULLSCREENWITHHUD,
|
||||
XPC_VIEW_FULLSCREENNOHUD,
|
||||
} VIEW_TYPE;
|
||||
|
||||
// Low Level UDP Functions
|
||||
|
||||
@@ -214,6 +231,13 @@ int sendCTRL(XPCSocket sock, float values[], int size, char ac);
|
||||
/// \returns 0 if successful, otherwise a negative value.
|
||||
int sendTEXT(XPCSocket sock, char* msg, int x, int y);
|
||||
|
||||
/// Sets the camera view in X-Plane.
|
||||
///
|
||||
/// \param sock The socket to use to send the command.
|
||||
/// \param view The view to use.
|
||||
/// \returns 0 if successful, otherwise a negative value.
|
||||
int sendVIEW(XPCSocket sock, VIEW_TYPE view);
|
||||
|
||||
/// Adds, removes, or clears a set of waypoints. If the command is clear, the points are ignored
|
||||
/// and all points are removed.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user