fFontColorC.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "fFontColorC.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.Scene"
  14. #pragma link "GLS.GeomObjects"
  15. #pragma link "GLS.TimeEventsMgr"
  16. #pragma link "GLS.SceneViewer"
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. const int FadeOutMax = 100;
  20. const int FadeInMax = 100;
  21. const float OverallTrans = 0.7;
  22. //---------------------------------------------------------------------------
  23. __fastcall TForm1::TForm1(TComponent* Owner)
  24. : TForm(Owner)
  25. {
  26. }
  27. //---------------------------------------------------------------------------
  28. void __fastcall TForm1::FormCreate(TObject *Sender)
  29. {
  30. SetGLSceneMediaDir();
  31. BitmapFont->Glyphs->LoadFromFile("toonfont.bmp");
  32. }
  33. //---------------------------------------------------------------------------
  34. void __fastcall TForm1::GLTimeEventsMGR1Events0Event(TTimeEvent *event)
  35. {
  36. if (FadeOutCount < 0) exit;
  37. HUDText1->ModulateColor->Color = VectorMake(1, 1, 1, (FadeOutCount/FadeOutMax)*OverallTrans);
  38. FadeOutCount--;
  39. }
  40. //---------------------------------------------------------------------------
  41. void __fastcall TForm1::GLTimeEventsMGR1Events1Event(TTimeEvent *event)
  42. {
  43. FadeOutCount = FadeOutMax;
  44. FadeInCount = 0;
  45. OriginalColor = HUDText2->ModulateColor->Color;
  46. HUDText1->ModulateColor->Color = VectorMake(1, 1, 1, (FadeOutCount/FadeOutMax)*OverallTrans);
  47. HUDText2->ModulateColor->Color = VectorMake(1, 1, 1, 0);
  48. }
  49. //---------------------------------------------------------------------------
  50. void __fastcall TForm1::GLTimeEventsMGR1Events2Event(TTimeEvent *event)
  51. {
  52. TVector4f NewColor;
  53. if (FadeInCount >= FadeInMax) exit;
  54. NewColor = VectorScale(OriginalColor, FadeInCount/FadeInMax);
  55. HUDText2->ModulateColor->Color = NewColor;
  56. FadeInCount++;
  57. }
  58. //---------------------------------------------------------------------------