// -*- Mode: c++ -*- #ifndef __UISTATE_H__ #define __UISTATE_H__ // include files #include // class definition // pointer to function taking void returning void typedef void ( *vFv )( void ); // so ... this class is a bit weird. It has no members but statics. Thus it // really is just a device to create a lexical scope for a number of things // associated with the ui. // this can be done with namespaces in recent versions of C++ compilers class UIState{ public: static const int UNDEF; // since there never is an object of this kind, none of the standard // functions are there. // accessors static vFv& Animate( void ) { return p_animate; } static float& Angle( void ) { return p_angle; } static float& AngleIncr( void ) { return p_angle_incr; } static int& MouseX( void ) { return p_mousex; } static int& MouseY( void ) { return p_mousey; } static float& TransX( void ) { return p_transx; } static float& TransY( void ) { return p_transy; } // methods static void ResetModelTransform( void ); static void ApplyModelTransform( void ); protected: private: // last know mouse position static int p_mousex, p_mousey; // animation function pointer static void ( *p_animate )( void ); // state variable for animation static float p_angle_incr; // state variable for rotation static float p_angle; // state variables for translation static float p_transx, p_transy; // can't make it, can't destroy it, and sure can't do anything else... // to make sure that it is not done accidentally, // abort the program when the constructor or destructor are called UIState( void ) { assert( 0 ); } ~UIState( void ) { assert( 0 ); } }; #endif /* __UISTATE_H__ */