1 #if ! defined _SCREENSAVER_H 2 #define _SCREENSAVER_H 3 4 #include <BeBuild.h> 5 #include <DirectWindow.h> // for direct_buffer_info 6 #include <image.h> 7 #include <Message.h> 8 9 class BView; 10 11 class BScreenSaver 12 { 13 public: 14 BScreenSaver(BMessage *archive, image_id); 15 virtual ~BScreenSaver(); 16 17 // Return an error if something goes wrong or if you don't 18 // like the running environment (lack of 3D acceleration, 19 // lack of sound, ...). 20 virtual status_t InitCheck(); 21 22 // Animation start and stop. The view is not yet visible when 23 // StartSaver is called. 24 virtual status_t StartSaver(BView *view, bool preview); 25 virtual void StopSaver(); 26 27 // This hook is called periodically, you should 28 // override it to do the drawing. Notice that you 29 // should clear the screen when frame == 0 if you 30 // don't want to paint over the desktop. 31 virtual void Draw(BView *view, int32 frame); 32 33 // These hooks are for direct screen access, the first is 34 // called every time the settings change, the second is 35 // the equivalent of Draw to be called to access the screen 36 // directly. Draw and DirectDraw can be used at the same time. 37 virtual void DirectConnected(direct_buffer_info *info); 38 virtual void DirectDraw(int32 frame); 39 40 // configuration dialog methods 41 virtual void StartConfig(BView *configView); 42 virtual void StopConfig(); 43 44 // Module should fill this in with metadata 45 // example: randomizable = true 46 virtual void SupplyInfo(BMessage *info) const; 47 48 // Send all the metadata info to the module 49 virtual void ModulesChanged(const BMessage *info); 50 51 // BArchivable like parameter saver method 52 virtual status_t SaveState(BMessage *into) const; 53 54 // These methods can be used to control drawing frequency. 55 void SetTickSize(bigtime_t ts); 56 bigtime_t TickSize() const; 57 58 // These methods can be used to control animation loop cycles 59 void SetLoop(int32 on_count, int32 off_count); 60 int32 LoopOnCount() const; 61 int32 LoopOffCount() const; 62 63 private: 64 virtual void _ReservedScreenSaver1(); 65 virtual void _ReservedScreenSaver2(); 66 virtual void _ReservedScreenSaver3(); 67 virtual void _ReservedScreenSaver4(); 68 virtual void _ReservedScreenSaver5(); 69 virtual void _ReservedScreenSaver6(); 70 virtual void _ReservedScreenSaver7(); 71 virtual void _ReservedScreenSaver8(); 72 73 bigtime_t ticksize; 74 int32 looponcount; 75 int32 loopoffcount; 76 77 uint32 _reservedScreenSaver[6]; 78 }; 79 80 extern "C" _EXPORT BScreenSaver *instantiate_screen_saver(BMessage *msg, image_id id); 81 82 #endif 83