fMain1C.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <tchar.h>
  4. #pragma hdrstop
  5. #include "fMain1C.h"
  6. #include "Unit2.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)
  22. : TForm(Owner)
  23. {
  24. }
  25. //---------------------------------------------------------------------------
  26. void __fastcall TForm1::FormCreate(TObject *Sender)
  27. {
  28. switch (GetMeshResolutions())
  29. {
  30. // read our option
  31. case 0 :
  32. {// Low Res, this is one ugly torus
  33. Torus1->Rings = 8;
  34. Torus1->Sides = 6;
  35. } break;
  36. case 1 :
  37. {// High Res, should still look smooth at high resolutions
  38. Torus1->Rings = 64;
  39. Torus1->Sides = 32;
  40. }
  41. default: ;
  42. }
  43. }
  44. //---------------------------------------------------------------------------
  45. void __fastcall TForm1::FormShow(TObject *Sender)
  46. {
  47. // let the show begin :)
  48. GLCadencer1->Enabled = true;
  49. }
  50. //---------------------------------------------------------------------------
  51. void __fastcall TForm1::FormResize(TObject *Sender)
  52. {
  53. // "Rescale" when form size is changed so our saver always looks the same
  54. GLCamera1->FocalLength = (float)50*Width/400;
  55. }
  56. //---------------------------------------------------------------------------
  57. void __fastcall TForm1::GLScreenSaver1PropertiesRequested(TObject *Sender)
  58. {
  59. // we create the dialog dans display it
  60. // we do not need to free it (TApplication will take care of this)
  61. Application->CreateForm(__classid(TForm2), &Form2);
  62. Form2->ShowModal();
  63. }
  64. //---------------------------------------------------------------------------