----- project.h -----
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_BUILD 0
// magic to get the preprocessor to do what we want
#define lita(arg) #arg
#define xlita(arg) lita(arg)
#define cat3(w,x,z) w##.##x##.##z##\000
#define xcat3(w,x,z) cat3(w,x,z)
#define VERSION_STRING xlita(xcat3(VERSION_MAJOR,VERSION_MINOR,VERSION_BUILD))
#ifndef VS_VERSION_INFO
#define VS_VERSION_INFO 0x0001
#endif
#define BMP_NAME_SMALL_BACKGROUND 0x1000
----- project.c -----
#include "gauges.h"
#include "FSUIPC_User.h"
#include "project.h"
#define GAUGE_NAME "NAME" // replace "name" with whatever your own GAUGE_NAME will be
#define GAUGEHDR_VAR_NAME gaugehdr_name // -||-
#define GAUGE_W 0
#include "project.code.c"
GAUGE_TABLE_BEGIN()
GAUGE_TABLE_ENTRY(&gaugehdr_name)
GAUGE_TABLE_END()
----- project.code.c -----
char name_gauge_name[] = GAUGE_NAME;
extern PELEMENT_HEADER name_list;
GAUGE_CALLBACK gaugecall;
GAUGE_HEADER_FS700( GAUGE_W, name_gauge_name, &name_list, NULL, gaugecall, 0, 0, 0 );
DWORD dwResult;
int YOUR_VARIABLE = 0; // replace YOUR_VARIABLE with your own variable name
ID YOUR_VARIABLE_id; // -||-
void FSAPI gaugecall( PGAUGEHDR pgauge, int service_id, UINT32 extra_data )
{
switch(service_id)
{
case PANEL_SERVICE_PRE_INITIALIZE:
FSUIPC_Open(SIM_FS2K4 , &dwResult); // Let's get connected to FSUIPC
register_named_variable ( "XML_Variable_name" );
break;
case PANEL_SERVICE_PRE_UPDATE:
FSUIPC_Read(0x0000, 0, &YOUR_VARIABLE, &dwResult); // 0x0000, is the FSUIPC offset and 0, is the size of the offset (see FSUIPC SDK for info regarding this)
// If you need to read more variables then you can list them here aswell
FSUIPC_Process(&dwResult);
YOUR_VARIABLE_id = check_named_variable ( "XML_Variable_name" ) ;
set_named_variable_value ( YOUR_VARIABLE_id, (FLOAT64)YOUR_VARIABLE) ;
break;
}
}
MAKE_STATIC
(
name_background,
BMP_NAME_SMALL_BACKGROUND,
NULL,
NULL,
IMAGE_USE_TRANSPARENCY,
0,
0,0
)
PELEMENT_HEADER name_list = &name_background.header;
#undef GAUGE_NAME
#undef GAUGEHDR_VAR_NAME
#undef GAUGE_W
----- project.rc -----
#include "dhread.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,0,VERSION_BUILD
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,0,VERSION_BUILD
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x10004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "Flight Simulator 2004 Gauge\0"
VALUE "FileVersion", VERSION_STRING
VALUE "LegalCopyright", "\0"
VALUE "ProductName", "\0"
VALUE "ProductVersion", VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
BMP_NAME_SMALL_BACKGROUND BITMAP DISCARDABLE "res\\background.bg.BMP"