fPFXGallaryC.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "fPFXGallaryC.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "GLS.BaseClasses"
  9. #pragma link "GLS.Behaviours"
  10. #pragma link "GLS.BitmapFont"
  11. #pragma link "GLS.Blur"
  12. #pragma link "GLS.Cadencer"
  13. #pragma link "GLS.Coordinates"
  14. #pragma link "GLS.HUDObjects"
  15. #pragma link "GLS.Navigator"
  16. #pragma link "GLS.Objects"
  17. #pragma link "GLS.ParticleFX"
  18. #pragma link "GLS.PerlinPFX"
  19. #pragma link "GLS.Scene"
  20. #pragma link "GLS.SpaceText"
  21. #pragma link "GLS.SceneViewer"
  22. #include "Stage.Keyboard.hpp"
  23. #pragma resource "*.dfm"
  24. TForm1 *Form1;
  25. int cRunBoost = 10;
  26. int cWalkStep = 20;
  27. int cStrafeStep =20;
  28. //---------------------------------------------------------------------------
  29. __fastcall TForm1::TForm1(TComponent* Owner)
  30. : TForm(Owner)
  31. {
  32. }
  33. //---------------------------------------------------------------------------
  34. void __fastcall TForm1::FormCreate(TObject *Sender)
  35. {
  36. chkFloorClick(Sender);
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TForm1::chkFloorClick(TObject *Sender)
  40. {
  41. GLPlane1->Visible = chkFloor->Checked;
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TForm1::chkBlurClick(TObject *Sender)
  45. {
  46. GLBlur1->Visible = chkBlur->Checked;
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TForm1::chkMouseLookClick(TObject *Sender)
  50. {
  51. GLUserInterface1->MouseLookActive = chkMouseLook->Checked;
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  55. {
  56. GLSceneViewer1->ResetPerformanceMonitor();
  57. }
  58. //---------------------------------------------------------------------------
  59. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  60. const double newTime)
  61. {
  62. HandleKeys(deltaTime);
  63. GLUserInterface1->MouseLook();
  64. GLSceneViewer1->Invalidate();
  65. GLUserInterface1->MouseUpdate();
  66. GLSceneViewer1->Invalidate();
  67. }
  68. //---------------------------------------------------------------------------
  69. void __fastcall TForm1::HandleKeys(double deltaTime)
  70. {
  71. float boost;
  72. if (IsKeyDown(vkEscape)) {
  73. chkMouseLook->Checked = false;
  74. chkMouseLookClick(this);
  75. }
  76. if (IsKeyDown(vkShift))
  77. boost = cRunBoost*deltaTime;
  78. else
  79. if (IsKeyDown(vkControl))
  80. boost = cRunBoost*0.01*deltaTime;
  81. else
  82. boost = deltaTime;
  83. if (IsKeyDown('W'))
  84. GLCamera1->Move(cWalkStep*boost);
  85. if (IsKeyDown('S'))
  86. GLCamera1->Move(-cWalkStep*boost);
  87. if (IsKeyDown('A'))
  88. GLCamera1->Slide(-cStrafeStep*boost);
  89. if (IsKeyDown('D'))
  90. GLCamera1->Slide(cStrafeStep*boost);
  91. }
  92. //---------------------------------------------------------------------------