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 "GLBaseClasses"
  8. #pragma link "GLBehaviours"
  9. #pragma link "GLCadencer"
  10. #pragma link "GLCoordinates"
  11. #pragma link "GLCrossPlatform"
  12. #pragma link "GLFireFX"
  13. #pragma link "GLGeomObjects"
  14. #pragma link "GLObjects"
  15. #pragma link "GLScene"
  16. #pragma link "GLWin32Viewer"
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. int mx,my;
  20. //---------------------------------------------------------------------------
  21. __fastcall TForm1::TForm1(TComponent* Owner)
  22. : TForm(Owner)
  23. {
  24. }
  25. //---------------------------------------------------------------------------
  26. void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift, int WheelDelta,
  27. TPoint &MousePos, bool &Handled)
  28. {
  29. GLCamera1->AdjustDistanceToTarget(System::Math::Power(1.1, WheelDelta/120));
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  33. {
  34. Caption = "GLScene Fire - "+ Format("%.1f FPS", ARRAYOFCONST((GLSceneViewer1->FramesPerSecond())));
  35. GLSceneViewer1->ResetPerformanceMonitor();
  36. }
  37. //---------------------------------------------------------------------------
  38. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  39. int X, int Y)
  40. {
  41. if (Shift.Contains(ssLeft))
  42. GLCamera1->MoveAroundTarget(my-Y, mx-X);
  43. mx = X;
  44. my = Y;
  45. }
  46. //---------------------------------------------------------------------------
  47. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
  48. TShiftState Shift, int X, int Y)
  49. {
  50. mx = X; my = Y;
  51. }
  52. //---------------------------------------------------------------------------