123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <tchar.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma link "GLS.BaseClasses"
- #pragma link "GLS.Behaviours"
- #pragma link "GLS.BitmapFont"
- #pragma link "GLS.Blur"
- #pragma link "GLS.Cadencer"
- #pragma link "GLS.Coordinates"
- #pragma link "GLS.HUDObjects"
- #pragma link "GLS.Navigator"
- #pragma link "GLS.Objects"
- #pragma link "GLS.ParticleFX"
- #pragma link "GLS.PerlinPFX"
- #pragma link "GLS.Scene"
- #pragma link "GLS.SpaceText"
- #pragma link "GLS.SceneViewer"
- #include "GLS.Keyboard.hpp"
- #pragma resource "*.dfm"
- TForm1 *Form1;
- int cRunBoost = 10;
- int cWalkStep = 20;
- int cStrafeStep =20;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- chkFloorClick(Sender);
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::chkFloorClick(TObject *Sender)
- {
- GLPlane1->Visible = chkFloor->Checked;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::chkBlurClick(TObject *Sender)
- {
- GLBlur1->Visible = chkBlur->Checked;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::chkMouseLookClick(TObject *Sender)
- {
- GLUserInterface1->MouseLookActive = chkMouseLook->Checked;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Timer1Timer(TObject *Sender)
- {
- Caption = "PFXGallery FPS - " + IntToStr(Round(GLSceneViewer1->FramesPerSecond()));
- GLSceneViewer1->ResetPerformanceMonitor();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
- const double newTime)
- {
- HandleKeys(deltaTime);
- GLUserInterface1->MouseLook();
- GLSceneViewer1->Invalidate();
- GLUserInterface1->MouseUpdate();
- GLSceneViewer1->Invalidate();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::HandleKeys(double deltaTime)
- {
- float boost;
- if (IsKeyDown(vkEscape)) {
- chkMouseLook->Checked = false;
- chkMouseLookClick(this);
- }
- if (IsKeyDown(vkShift))
- boost = cRunBoost*deltaTime;
- else
- if (IsKeyDown(vkControl))
- boost = cRunBoost*0.01*deltaTime;
- else
- boost = deltaTime;
- if (IsKeyDown('W'))
- GLCamera1->Move(cWalkStep*boost);
- if (IsKeyDown('S'))
- GLCamera1->Move(-cWalkStep*boost);
- if (IsKeyDown('A'))
- GLCamera1->Slide(-cStrafeStep*boost);
- if (IsKeyDown('D'))
- GLCamera1->Slide(cStrafeStep*boost);
- }
- //---------------------------------------------------------------------------
|