资源简介
GLstudio航空仪表代码,作为初学GLStudio的参考代码
代码片段和文件信息
///////////////////////////////////////////////////////////////////////////////
// This file is generated by GL Studio from TestEHSI.gls. DO NOT EDIT.
// To modify run “glstudio TestEHSI.gls“ edit code and select Code/Generate All.
///////////////////////////////////////////////////////////////////////////////
#ifdef _AFXDLL
#include “stdafx.h“
#endif
#include “TestEHSIApp.h“
#include “version.h“
#include “disti_assert.h“
#include “live_component_accessor.h“
using namespace disti;
TestEHSIClass *testEHSI;
//////////////////// User Code from section: “file TestEHSIApp.cpp“ ////////////
///////////////////////////////////////////////////////////////////////////////
void TestEHSIClass::Initialize ()
{
_maxVal = 100.0f;
compass_direction = 0.0f;
}
void TestEHSIClass::Calculate (double time)
{
objects->Group::Calculate(time); // Do not remove (for normal operations)
if(RunTestValues())
{
TestValues(time);
}
}
void TestEHSIClass::TestValues (double time)
{
float TestVal = (sinf((float)time*0.07f)+1)*_maxVal/2.0f;
CompassHeading(TestVal*10.0f);
ArrowHeading(TestVal*20.0f);
HeadingBug(-TestVal*50.0f);
}
void TestEHSIClass::ArrowHeading (const float& value)
{
_arrowHeading = value;
EHSI_1_ArrowGrp->DynamicRotate(_arrowHeadingZ_AXIS);
}
float TestEHSIClass::ArrowHeading ()
{
return _arrowHeading;
}
void TestEHSIClass::CompassHeading (const float& value)
{
_compassHeading = -value;
char tempChar[256];
int adjusted_hdg;
EHSI_1_CompassGrp->DynamicRotate(_compassHeadingZ_AXIS);
adjusted_hdg = (int)fmodf(_compassHeading360.0f);
if(adjusted_hdg <=0)
adjusted_hdg += 360;
sprintf(tempChar“%03d“adjusted_hdg);
EHSI_1_CRS_numbers->SetString(tempChar);
}
float TestEHSIClass::CompassHeading ()
{
return _compassHeading;
}
void TestEHSIClass::HeadingBug (const float& value)
{
_headingBug = value;
EHSI_1_PointerGrp->DynamicRotate(_headingBugZ_AXIS);
}
float TestEHSIClass::HeadingBug ()
{
return _headingBug;
}
void TestEHSIClass::RunTestValues (const bool& value)
{
_runTestValues = value;
}
bool TestEHSIClass::RunTestValues ()
{
return _runTestValues;
}
// object generated implementations
InterfaceListType* TestEHSIClass::GetCppInterfaceDescription(InterfaceListType* addToThisList)
{
// Create a list if it doesn‘t exist
if (!addToThisList)
addToThisList = new InterfaceListType;
#ifndef GLS_NO_DEscriptION
static char* localList[][3] = {
{“““------ TestEHSIClass ------“““}
{“Initialize(““void Initialize()“““}
{“Calculate(““void Calculate(double time)“““}
{“TestValues(““void TestValues(double time)“““}
{“Resource(\“ArrowHeading\“)““DistiAttributebase& Resource(\“ArrowHeading\“)““Retrieves reference: “}
{“ArrowHe
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1210 2008-03-10 14:58 source\win_main.cpp
文件 5308 2008-03-10 17:12 source\TestEHSIApp.h
文件 1310173 2008-03-10 17:12 source\TestEHSIApp.cpp
目录 0 2008-03-10 14:58 source
文件 78452 2008-03-10 21:49 TestEHSI.gls
----------- --------- ---------- ----- ----
1395361 6
- 上一篇:用Flash画函数曲线(AS3.0)
- 下一篇:Libview 读三丰游标卡尺程序
评论
共有 条评论