xref: /haiku/src/add-ons/screen_savers/flurry/Flurry.h (revision e711e6e42fd7ec3111ba9dc2324fa8efedd6674b)
1 /*
2  * Copyright Karsten Heimrich, host.haiku@gmx.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _FLURRY_H_
6 #define _FLURRY_H_
7 
8 
9 #include <DateTime.h>
10 #include <GLView.h>
11 #include <ScreenSaver.h>
12 
13 
14 struct flurry_info_t;
15 
16 
17 class FlurryView : public BGLView {
18 public:
19 									FlurryView(BRect bounds);
20 	virtual							~FlurryView();
21 
22 			status_t				InitCheck() const;
23 
24 	virtual	void					AttachedToWindow();
25 	virtual	void					DrawFlurryScreenSaver();
26 	virtual	void					FrameResized(float width, float height);
27 
28 private:
29 			void					_SetupFlurryBaseInfo();
30 
31 			double					_CurrentTime() const;
32 			double					_SecondsSinceStart() const;
33 
34 private:
35 			float					fWidth;
36 			float					fHeight;
37 
38 			double					fStartTime;
39 			double					fOldFrameTime;
40 			flurry_info_t*			fFlurryInfo;
41 
42 			BTime					fTime;
43 			BDateTime				fDateTime;
44 };
45 
46 
47 class Flurry : public BScreenSaver {
48 public:
49 									Flurry(BMessage* archive, image_id imageId);
50 	virtual							~Flurry();
51 
52 	virtual	status_t				InitCheck();
53 
54 	virtual	status_t				StartSaver(BView* view, bool preview);
55 	virtual	void					StopSaver();
56 
57 	virtual	void					Draw(BView*, int32 frame);
58 	virtual	void					DirectConnected(direct_buffer_info* info);
59 
60 	virtual	void					StartConfig(BView* configView);
61 	virtual	void					StopConfig();
62 
63 	virtual	status_t				SaveState(BMessage* into) const;
64 
65 private:
66 			FlurryView*				fFlurryView;
67 };
68 
69 
70 #endif	// _FLURRY_H_
71