Unit1.cpp 2.1 KB

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