fBmpfontC.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. TFileName Path = GetCurrentAssetPath();
  29. SetCurrentDir(Path + "\\font");
  30. BitmapFont1->Glyphs->LoadFromFile("darkgold_font.bmp");
  31. // sorry, couldn't resist...
  32. HUDText1->Text = "Hello World !\r\
  33. This is me, \r\
  34. the HUD Text.\r\
  35. Bitmap Fonts!";
  36. }
  37. //---------------------------------------------------------------------------
  38. void __fastcall TForm1::GLCadencer1Progress(TObject *Sender, const double deltaTime,
  39. const double newTime)
  40. {
  41. // make things move a little
  42. HUDText2->Rotation = HUDText2->Rotation+15*deltaTime;
  43. HUDText3->Scale->X = 0.5*sin(newTime)+1;
  44. HUDText3->Scale->Y = 0.5*cos(newTime)+1;
  45. GLSceneViewer1->Invalidate();
  46. }
  47. //---------------------------------------------------------------------------
  48. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  49. {
  50. HUDTextFPS->Text = Format("%.1f FPS",
  51. ARRAYOFCONST ((GLSceneViewer1->FramesPerSecond())));
  52. GLSceneViewer1->ResetPerformanceMonitor();
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TForm1::GLSceneViewer1Click(TObject *Sender)
  56. {
  57. Teapot1->Visible = !Teapot1->Visible;
  58. }
  59. //---------------------------------------------------------------------------