Updated versions and improved comments.

This commit is contained in:
Jason Watkins
2015-05-11 15:07:41 -07:00
parent a2c1f83629
commit a406b82f44
7 changed files with 27 additions and 14 deletions

View File

@@ -142,10 +142,10 @@ namespace XPC
/// Marshals data between the plugin and X-Plane.
///
/// \author Jason Watkins
/// \version 1.0.1
/// \version 1.1
/// \since 1.0.0
/// \date Intial Version: 2015-04-13
/// \date Last Updated: 2015-04-29
/// \date Last Updated: 2015-05-11
class DataManager
{
public:

View File

@@ -65,6 +65,8 @@ namespace XPC
XPLMDataRef planeZref;
//Internal Functions
/// Comparse two size_t integers. Used by qsort in RemoveWaypoints.
static int cmp(const void * a, const void * b)
{
std::size_t sa = *(size_t*)a;
@@ -80,6 +82,12 @@ namespace XPC
return 0;
}
/// Draws a cube centered at the specified OpenGL world coordinates.
///
/// \param x The X coordinate.
/// \param y The Y coordinate.
/// \param z The Z coordinate.
/// \param d The distance from the player airplane to the center of the cube.
static void gl_drawCube(float x, float y, float z, float d)
{
//tan(0.25) degrees. Should scale all markers to appear about the same size
@@ -118,18 +126,21 @@ namespace XPC
glEnd();
}
/// Draws the string set by the TEXT command.
static int MessageDrawCallback(XPLMDrawingPhase inPhase, int inIsBefore, void * inRefcon)
{
const int LINE_HEIGHT = 16;
XPLMDrawString(rgb, msgX, msgY, msgVal, NULL, xplmFont_Basic);
int y = msgY - 16;
int y = msgY - LINE_HEIGHT;
for (size_t i = 0; i < newLineCount; ++i)
{
XPLMDrawString(rgb, msgX, y, msgVal + newLines[i], NULL, xplmFont_Basic);
y -= 16;
y -= LINE_HEIGHT;
}
return 1;
}
/// Draws waypoints.
static int RouteDrawCallback(XPLMDrawingPhase inPhase, int inIsBefore, void * inRefcon)
{
float px = XPLMGetDataf(planeXref);
@@ -190,8 +201,7 @@ namespace XPC
void Drawing::SetMessage(int x, int y, char* msg)
{
//Determine size of message and clear instead if the message string
//is empty.
// Determine the size of the message and clear it if it is empty.
size_t len = strnlen(msg, MSG_MAX - 1);
if (len == 0)
{

View File

@@ -45,6 +45,9 @@ namespace XPC
return;
}
// Note: Mode "w" deletes an existing file with the same name. This means that we only
// ever get the log from the last run. This matches the way that X-Plane treats its
// log.
fd = std::fopen("XPCLog.txt", "w");
if (fd != NULL)
{

View File

@@ -32,10 +32,10 @@ namespace XPC
///
/// \details Provides functions to write lines to the XPC log file.
/// \author Jason Watkins
/// \version 1.0
/// \version 1.1
/// \since 1.0
/// \date Intial Version: 2015-04-09
/// \date Last Updated: 2015-04-09
/// \date Last Updated: 2015-05-11
class Log
{
public:

View File

@@ -10,10 +10,10 @@ namespace XPC
/// Represents a message received from an XPC client.
///
/// \author Jason Watkins
/// \version 1.0
/// \version 1.1
/// \since 1.0
/// \date Intial Version: 2015-04-11
/// \date Last Updated: 2015-04-11
/// \date Last Updated: 2015-05-11
class Message
{
public:

View File

@@ -15,10 +15,10 @@ namespace XPC
/// Handles incommming messages and manages connections.
///
/// \author Jason Watkins
/// \version 1.0
/// \version 1.1
/// \since 1.0
/// \date Intial Version: 2015-04-12
/// \date Last Updated: 2015-04-12
/// \date Last Updated: 2015-05-11
class MessageHandlers
{
public:

View File

@@ -23,10 +23,10 @@ namespace XPC
/// data to XPC clients.
///
/// \author Jason Watkins
/// \version 1.0
/// \version 1.1
/// \since 1.0
/// \date Intial Version: 2015-04-10
/// \date Last Updated: 2015-04-11
/// \date Last Updated: 2015-05-11
class UDPSocket
{
public: