PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
26#include <common.hh>
27
28#include <color.hh>
29#include <vector.hh>
30
31class Bug {
32protected:
33	static float _wide, _high, _deep;
34	static GLuint _list;
35
36	HSLColor _HSL;
37	RGBColor _halfRGB;
38	Vector _XYZ;
39	Vector _speed;
40	bool _right, _up, _forward;
41	float _maxSpeed;
42	float _accel;
43
44	void update();
45	Bug(const Vector&, bool, float, float);
46public:
47	static void init();
48	static void fini();
49	static void initBoundaries();
50};
51
52class Follower;
53
54class Leader : public Bug {
55private:
56	float _craziness;	// How prone to switching direction is this leader
57	float _nextChange;	// Time until this leader's next direction change
58
59	friend class Follower;
60public:
61	Leader();
62	void update();
63};
64
65class Follower : public Bug {
66private:
67	std::vector<Leader>::const_iterator _leader;
68public:
69	Follower(const std::vector<Leader>::const_iterator&);
70	void update(const std::vector<Leader>&);
71};
72
73#endif // _BUG_HH