fScreenSaver1C.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "fScreenSaver1C.h"
  6. #include "fScreenSaver2C.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma link "GLS.BaseClasses"
  10. #pragma link "GLS.Behaviours"
  11. #pragma link "GLS.Cadencer"
  12. #pragma link "GLS.Coordinates"
  13. #pragma link "GLS.GeomObjects"
  14. #pragma link "GLS.Objects"
  15. #pragma link "GLS.Scene"
  16. #pragma link "GLS.SceneViewer"
  17. #pragma link "GLS.ScreenSaver"
  18. #pragma resource "*.dfm"
  19. TForm1* Form1;
  20. //---------------------------------------------------------------------------
  21. __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {}
  22. //---------------------------------------------------------------------------
  23. void __fastcall TForm1::FormCreate(TObject* Sender)
  24. {
  25. switch (GetMeshResolutions()) {
  26. // read our option
  27. case 0: { // Low Res, this is one ugly torus
  28. Torus1->Rings = 8;
  29. Torus1->Sides = 6;
  30. } break;
  31. case 1: { // High Res, should still look smooth at high resolutions
  32. Torus1->Rings = 64;
  33. Torus1->Sides = 32;
  34. }
  35. default:;
  36. }
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TForm1::FormShow(TObject* Sender)
  40. {
  41. // let the show begin :)
  42. GLCadencer1->Enabled = true;
  43. }
  44. //---------------------------------------------------------------------------
  45. void __fastcall TForm1::FormResize(TObject* Sender)
  46. {
  47. // "Rescale" when form size is changed so our saver always looks the same
  48. GLCamera1->FocalLength = (float)50 * Width / 400;
  49. }
  50. //---------------------------------------------------------------------------
  51. void __fastcall TForm1::GLScreenSaver1PropertiesRequested(TObject* Sender)
  52. {
  53. // we create the dialog dans display it
  54. // we do not need to free it (TApplication will take care of this)
  55. Application->CreateForm(__classid(TForm2), &Form2);
  56. Form2->ShowModal();
  57. }
  58. //---------------------------------------------------------------------------