/xbmc/screensavers/rsxs-0.9/src/flocks/bug.hh

http://github.com/xbmc/xbmc · C++ Header · 73 lines · 41 code · 10 blank · 22 comment · 0 complexity · bd3a1fd83b7bd7c18938d8b103d7a814 MD5 · raw file

  1. /*
  2. * Really Slick XScreenSavers
  3. * Copyright (C) 2002-2006 Michael Chapman
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. *
  18. *****************************************************************************
  19. *
  20. * This is a Linux port of the Really Slick Screensavers,
  21. * Copyright (C) 2002 Terence M. Welsh, available from www.reallyslick.com
  22. */
  23. #ifndef _BUG_HH
  24. #define _BUG_HH
  25. #include <common.hh>
  26. #include <color.hh>
  27. #include <vector.hh>
  28. class Bug {
  29. protected:
  30. static float _wide, _high, _deep;
  31. static GLuint _list;
  32. HSLColor _HSL;
  33. RGBColor _halfRGB;
  34. Vector _XYZ;
  35. Vector _speed;
  36. bool _right, _up, _forward;
  37. float _maxSpeed;
  38. float _accel;
  39. void update();
  40. Bug(const Vector&, bool, float, float);
  41. public:
  42. static void init();
  43. static void fini();
  44. static void initBoundaries();
  45. };
  46. class Follower;
  47. class Leader : public Bug {
  48. private:
  49. float _craziness; // How prone to switching direction is this leader
  50. float _nextChange; // Time until this leader's next direction change
  51. friend class Follower;
  52. public:
  53. Leader();
  54. void update();
  55. };
  56. class Follower : public Bug {
  57. private:
  58. std::vector<Leader>::const_iterator _leader;
  59. public:
  60. Follower(const std::vector<Leader>::const_iterator&);
  61. void update(const std::vector<Leader>&);
  62. };
  63. #endif // _BUG_HH