fBmpfontC.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "fBmpfontC.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "GLS.BaseClasses"
  9. #pragma link "GLS.BitmapFont"
  10. #pragma link "GLS.Cadencer"
  11. #pragma link "GLS.Coordinates"
  12. #pragma link "GLS.HUDObjects"
  13. #pragma link "GLS.Objects"
  14. #pragma link "GLS.Scene"
  15. #pragma link "GLS.GeomObjects"
  16. #pragma link "GLS.SceneViewer"
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. //---------------------------------------------------------------------------
  20. __fastcall TForm1::TForm1(TComponent* Owner)
  21. : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TForm1::FormCreate(TObject *Sender)
  26. {
  27. // Load the font bitmap from media dir
  28. SetGLSceneMediaDir();
  29. BitmapFont1->Glyphs->LoadFromFile("darkgold_font.bmp");
  30. // sorry, couldn't resist...
  31. HUDText1->Text = "Hello World !\r\
  32. This is me, \r\
  33. the HUD Text.\r\
  34. Bitmap Fonts!";
  35. }
  36. //---------------------------------------------------------------------------
  37. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  38. const double newTime)
  39. {
  40. // make things move a little
  41. HUDText2->Rotation = HUDText2->Rotation+15*deltaTime;
  42. HUDText3->Scale->X = 0.5*sin(newTime)+1;
  43. HUDText3->Scale->Y = 0.5*cos(newTime)+1;
  44. GLSceneViewer1->Invalidate();
  45. }
  46. //---------------------------------------------------------------------------
  47. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  48. {
  49. HUDTextFPS->Text = Format("%.1f FPS",
  50. ARRAYOFCONST ((GLSceneViewer1->FramesPerSecond())));
  51. GLSceneViewer1->ResetPerformanceMonitor();
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TForm1::GLSceneViewer1Click(TObject *Sender)
  55. {
  56. Teapot1->Visible = !Teapot1->Visible;
  57. }
  58. //---------------------------------------------------------------------------