home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri Kaikille K-CD 2003 #3 / K-CD_2003-03.iso / Winamp / winamp3_0-full.exe / Lib / rotationlayer.m < prev    next >
Text File  |  2002-05-30  |  2KB  |  64 lines

  1. //----------------------------------------------------------------------------------------
  2. //
  3. // rotationlayer.m
  4. //
  5. //----------------------------------------------------------------------------------------
  6. // Use like this :
  7. // #define ROTATION_LAYER_VAR MyVar
  8. // #include "rotationlayer.m"
  9. //
  10. //                       _MyVarInit(Group parentgroup, String layername); // init rotationlayer
  11. //                       _MyVarRotateDegree(double r);     // in degrees
  12. //                       _MyVarRotate(double r);           // in radians
  13. //                       double _MyVarGetRotationDegree(); // in degrees
  14. //                       double _MyVarGetRotation();       // in radians
  15. //
  16.  
  17. #ifndef PI
  18. #define PI 3.1415926536
  19. #endif
  20.  
  21. Global Double _##ROTATION_LAYER_VAR##R;
  22. Global Layer _##ROTATION_LAYER_VAR##Layer;
  23.  
  24. Function _##ROTATION_LAYER_VAR##Init(Group parentgroup, String layername);
  25. Function _##ROTATION_LAYER_VAR##RotateDegree(double r);
  26. Function _##ROTATION_LAYER_VAR##Rotate(double r);
  27. Function double _##ROTATION_LAYER_VAR##GetRotationDegree();
  28. Function double _##ROTATION_LAYER_VAR##GetRotation();
  29.  
  30. _##ROTATION_LAYER_VAR##RotateDegree(double r) {
  31.   _##ROTATION_LAYER_VAR##Rotate(r * PI / 180.0);
  32. }
  33.  
  34. _##ROTATION_LAYER_VAR##Rotate(double r) {
  35.   _##ROTATION_LAYER_VAR##R = r;
  36.   _##ROTATION_LAYER_VAR##Layer.fx_update();
  37. }
  38.  
  39. double _##ROTATION_LAYER_VAR##GetRotationDegree() {
  40.   return _##ROTATION_LAYER_VAR##R * 180 / PI;
  41. }
  42.  
  43. double _##ROTATION_LAYER_VAR##GetRotation() {
  44.   return _##ROTATION_LAYER_VAR##R;
  45. }
  46.  
  47. _##ROTATION_LAYER_VAR##Init(Group parentgroup, String layername) {
  48.   _##ROTATION_LAYER_VAR##Layer = parentgroup.getObject(layername);
  49.   _##ROTATION_LAYER_VAR##Layer.fx_setGridSize(1,1);
  50.   _##ROTATION_LAYER_VAR##Layer.fx_setBgFx(0);
  51.   _##ROTATION_LAYER_VAR##Layer.fx_setWrap(1);
  52.   _##ROTATION_LAYER_VAR##Layer.fx_setBilinear(1);
  53.   _##ROTATION_LAYER_VAR##Layer.fx_setRect(0);
  54.   _##ROTATION_LAYER_VAR##Layer.fx_setClear(0);
  55.   _##ROTATION_LAYER_VAR##Layer.fx_setLocalized(1);
  56.   _##ROTATION_LAYER_VAR##Layer.fx_setRealtime(0);
  57.   _##ROTATION_LAYER_VAR##Layer.fx_setEnabled(1);
  58. }
  59.  
  60. _##ROTATION_LAYER_VAR##Layer.fx_onGetPixelR(double r, double d, double x, double y) {
  61.   return r + _##ROTATION_LAYER_VAR##R;
  62. }
  63.  
  64.