fGuiDemoC.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "fGuiDemoC.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "GLS.BaseClasses"
  8. #pragma link "GLS.BitmapFont"
  9. #pragma link "GLS.Cadencer"
  10. #pragma link "GLS.Coordinates"
  11. #pragma link "GLS.Material"
  12. #pragma link "GLS.Scene"
  13. #pragma link "GLS.SceneViewer"
  14. #pragma link "GLS.Windows"
  15. #pragma link "GLS.WindowsFont"
  16. #pragma resource "*.dfm"
  17. TForm1 *Form1;
  18. //---------------------------------------------------------------------------
  19. __fastcall TForm1::TForm1(TComponent* Owner)
  20. : TForm(Owner)
  21. {
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::FormCreate(TObject *Sender)
  25. {
  26. TFileName MediaDir;
  27. SetGLSceneMediaDir();
  28. GLMaterialLibrary1->TexturePaths = GetCurrentDir();
  29. GLForm1->Caption = "Unicode caption..."; //#$0699#$069A#$963f#$54c0;
  30. WindowsBitmapFont1->EnsureString(GLForm1->Caption);
  31. }
  32. //---------------------------------------------------------------------------
  33. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  34. const double newTime)
  35. {
  36. GLForm1->DoChanges();
  37. // make things move a little
  38. GLSceneViewer1->Invalidate();
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  42. {
  43. miFPS->Caption = Format("%.1f FPS",
  44. ARRAYOFCONST ((GLSceneViewer1->FramesPerSecond())));
  45. GLSceneViewer1->ResetPerformanceMonitor();
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TForm1::WindowsFont1Click(TObject *Sender)
  49. {
  50. FontDialog1->Font = WindowsBitmapFont1->Font;
  51. if (FontDialog1->Execute())
  52. WindowsBitmapFont1->Font = FontDialog1->Font;
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TForm1::GLSceneViewer1MouseDown(TObject *Sender, TMouseButton Button,
  56. TShiftState Shift, int X, int Y)
  57. {
  58. GLForm1->MouseDown(Sender,TMouseButton(Button),Shift,X,Y);
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TForm1::GLSceneViewer1MouseMove(TObject *Sender, TShiftState Shift,
  62. int X, int Y)
  63. {
  64. GLForm1->MouseMove(Sender,Shift,X,Y);
  65. }
  66. //---------------------------------------------------------------------------
  67. void __fastcall TForm1::GLSceneViewer1MouseUp(TObject *Sender, TMouseButton Button,
  68. TShiftState Shift, int X, int Y)
  69. {
  70. GLForm1->MouseUp(Sender,TMouseButton(Button),Shift,X,Y);
  71. }
  72. //---------------------------------------------------------------------------
  73. void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
  74. {
  75. GLForm1->KeyDown(Sender,Key,Shift);
  76. }
  77. //---------------------------------------------------------------------------
  78. void __fastcall TForm1::FormKeyPress(TObject *Sender, System::WideChar &Key)
  79. {
  80. GLForm1->KeyPress(Sender,Key);
  81. }
  82. //---------------------------------------------------------------------------
  83. void __fastcall TForm1::FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift)
  84. {
  85. GLForm1->KeyUp(Sender,Key,Shift);
  86. }
  87. //---------------------------------------------------------------------------
  88. void __fastcall TForm1::GLButton1ButtonClick(TObject *Sender)
  89. {
  90. String OldCaption;
  91. OldCaption = GLForm1->Caption;
  92. GLForm1->Caption = GLEdit1->Caption;
  93. GLEdit1->Caption = OldCaption;
  94. }
  95. //---------------------------------------------------------------------------