Unit1.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLS.BaseClasses"
  8. #pragma link "GLS.Behaviours"
  9. #pragma link "GLS.Cadencer"
  10. #pragma link "GLS.Coordinates"
  11. #pragma link "GLS.FireFX"
  12. #pragma link "GLS.GeomObjects"
  13. #pragma link "GLS.Objects"
  14. #pragma link "GLS.Scene"
  15. #pragma link "GLS.SceneViewer"
  16. #pragma resource "*.dfm"
  17. TForm1 *Form1;
  18. int mx,my;
  19. //---------------------------------------------------------------------------
  20. __fastcall TForm1::TForm1(TComponent* Owner)
  21. : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
  26. TPoint &MousePos, bool &Handled)
  27. {
  28. GLCamera1->AdjustDistanceToTarget(System::Math::Power(1.1, WheelDelta/120));
  29. }
  30. //---------------------------------------------------------------------------
  31. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  32. {
  33. Caption = "GLS.Scene Fire - "+ Format("%.1f FPS", ARRAYOFCONST((GLSceneViewer1->FramesPerSecond())));
  34. GLSceneViewer1->ResetPerformanceMonitor();
  35. }
  36. //---------------------------------------------------------------------------
  37. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  38. int X, int Y)
  39. {
  40. if (Shift.Contains(ssLeft))
  41. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  42. mx = X;
  43. my = Y;
  44. }
  45. //---------------------------------------------------------------------------
  46. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
  47. TShiftState Shift, int X, int Y)
  48. {
  49. mx = X; my = Y;
  50. }
  51. //---------------------------------------------------------------------------