C++ Builder interface
Moderator: Moderators
-
- Posts: 9
- Joined: Sat Jul 26, 2008 4:35 am
- Location: Cornwall, UK
C++ Builder interface
Does anyone have an example of using SpaceNavigator in a C++ Builder project?
TAT TWAM ASI
-
- Posts: 9
- Joined: Sat Jul 26, 2008 4:35 am
- Location: Cornwall, UK
-
- Posts: 9
- Joined: Sat Jul 26, 2008 4:35 am
- Location: Cornwall, UK
difficulties with C++ Builder
Dear Nuno Gomes,
I worked through all of Piotrex's code in the link you gave, but couldn't get it to work. Thinking this might have been because I was using C++ Builder Version 2007, I re-booted an old computer which had Version 6 running under XP, but found this even more complex than on Version 2007, and leading to the same sort of result as I had been getting from Version 2007. I posted a reply to Piotrex, but have had no response. Where can I go from here to get it to work? I think Piotrex's comments, although no doubt excellent guidelines for the knowledgable, assumed their reader knew what he/she was doing! As far as C++ under Windows is concerned, I'm still learning.
Regards,
Mark Heaton
I worked through all of Piotrex's code in the link you gave, but couldn't get it to work. Thinking this might have been because I was using C++ Builder Version 2007, I re-booted an old computer which had Version 6 running under XP, but found this even more complex than on Version 2007, and leading to the same sort of result as I had been getting from Version 2007. I posted a reply to Piotrex, but have had no response. Where can I go from here to get it to work? I think Piotrex's comments, although no doubt excellent guidelines for the knowledgable, assumed their reader knew what he/she was doing! As far as C++ under Windows is concerned, I'm still learning.
Regards,
Mark Heaton
TAT TWAM ASI
Hi All
Just a brief note on the creation of a C++ Builder project.
I found that the following procedure works fine for me:
1. Create a VCL project.
2. Components->Import Component->Import a Type Lib->Import 3D..->Add unit to project.
3. Convert TDxInput.dll (in 3DxWare\win32) to TdxInput.lib
4. Add the lib file to your project
Declare the following private variables in the main form header:
ISensorPtr aSensor;
TDevice* aDevice;
Then the following code work fine:
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
aDevice = new TDevice(this);
aSensor = aDevice->Sensor;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TimerTimer(TObject *Sender)
{
IVector3DPtr Translation = aSensor->get_Translation();
Label1->Caption = FloatToStr(Translation->X);
Label2->Caption = FloatToStr(Translation->Y);
Label3->Caption = FloatToStr(Translation->Z);
Label4->Caption = FloatToStr(Translation->Length);
IAngleAxisPtr Rotation = aSensor->get_Rotation();
Label5->Caption = FloatToStr(Rotation->Angle);
Label6->Caption = FloatToStr(Rotation->X);
Label7->Caption = FloatToStr(Rotation->Y);
Label8->Caption = FloatToStr(Rotation->Z);
}
//---------------------------------------------------------------------------
Nearly to simple to be true
Jorgen
Just a brief note on the creation of a C++ Builder project.
I found that the following procedure works fine for me:
1. Create a VCL project.
2. Components->Import Component->Import a Type Lib->Import 3D..->Add unit to project.
3. Convert TDxInput.dll (in 3DxWare\win32) to TdxInput.lib
4. Add the lib file to your project
Declare the following private variables in the main form header:
ISensorPtr aSensor;
TDevice* aDevice;
Then the following code work fine:
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
aDevice = new TDevice(this);
aSensor = aDevice->Sensor;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TimerTimer(TObject *Sender)
{
IVector3DPtr Translation = aSensor->get_Translation();
Label1->Caption = FloatToStr(Translation->X);
Label2->Caption = FloatToStr(Translation->Y);
Label3->Caption = FloatToStr(Translation->Z);
Label4->Caption = FloatToStr(Translation->Length);
IAngleAxisPtr Rotation = aSensor->get_Rotation();
Label5->Caption = FloatToStr(Rotation->Angle);
Label6->Caption = FloatToStr(Rotation->X);
Label7->Caption = FloatToStr(Rotation->Y);
Label8->Caption = FloatToStr(Rotation->Z);
}
//---------------------------------------------------------------------------
Nearly to simple to be true
Jorgen