Unit1.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // ---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. // ---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLBaseClasses"
  8. #pragma link "GLBitmapFont"
  9. #pragma link "GLCadencer"
  10. #pragma link "GLCoordinates"
  11. #pragma link "GLCrossPlatform"
  12. #pragma link "GLGeomObjects"
  13. #pragma link "GLHUDObjects"
  14. #pragma link "GLObjects"
  15. #pragma link "GLODEManager"
  16. #pragma link "GLScene"
  17. #pragma link "GLWin32Viewer"
  18. #pragma link "GLWindowsFont"
  19. #pragma resource "*.dfm"
  20. TForm1 *Form1;
  21. // ---------------------------------------------------------------------------
  22. __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
  23. TAffineVector av = {-250, 0, 0};
  24. ((TGLODEDynamic*)Pin2->Behaviours->Items[0])->AddForce(av);
  25. }
  26. // ---------------------------------------------------------------------------
  27. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender,
  28. TMouseButton Button, TShiftState Shift, int X, int Y) {
  29. my = Y;
  30. mx = X;
  31. }
  32. // ---------------------------------------------------------------------------
  33. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender,
  34. TShiftState Shift, int X, int Y) {
  35. if (Shift.Contains(ssShift))
  36. GLCamera1->MoveAroundTarget(my - Y, mx - X);
  37. my = Y;
  38. mx = X;
  39. }
  40. // ---------------------------------------------------------------------------
  41. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender,
  42. const double deltaTime, const double newTime) {
  43. GLODEManager1->Step(deltaTime);
  44. /*
  45. PdVector3 velWheel = dBodyGetAngularVel(TGLODEDynamic(Wheel->Behaviours)->Body);
  46. PdVector3 velPin2 = dBodyGetLinearVel(TGLODEDynamic(Pin2->Behaviours[0])->Body);
  47. GLHUDText1->Text = Format(
  48. "Wheel Angular Velocity (Y-Axis) = %.1f\r\
  49. Pin2 Linear Velocity (X-Axis) = %.1f",
  50. ARRAYOFCONST((velWheel[1], velPin2[0])));
  51. */
  52. }
  53. // ---------------------------------------------------------------------------