vrshoot

diff src/screen.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/screen.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,55 @@
     1.4 +#ifndef SCREEN_H_
     1.5 +#define SCREEN_H_
     1.6 +
     1.7 +class Screen;
     1.8 +
     1.9 +void push_screen(Screen *screen);
    1.10 +Screen *pop_screen();
    1.11 +Screen *current_screen();
    1.12 +Screen *previous_screen();
    1.13 +
    1.14 +
    1.15 +class Screen {
    1.16 +public:
    1.17 +	virtual ~Screen();
    1.18 +
    1.19 +	virtual const char *get_name() const;
    1.20 +
    1.21 +	virtual bool init();
    1.22 +	virtual void cleanup();
    1.23 +
    1.24 +	/// start will be called just before a screen is going to be activated
    1.25 +	virtual void start();
    1.26 +	/// stop will be called when a screen is being deactivated
    1.27 +	virtual void stop();
    1.28 +
    1.29 +	/** each Screen subclass should override this function to specify
    1.30 +	 * the required redisplay interval:
    1.31 +	 * - 0 means no implcit redisplays are to be performed.
    1.32 +	 *   Use request_redisplay to queue up a redisplay.
    1.33 +	 * - Any values > 0 are treated as inter-frame intervals in milliseconds
    1.34 +	 * The default (if not overriden) is 0.
    1.35 +	 */
    1.36 +	virtual long redisplay_interval() const;
    1.37 +
    1.38 +	/// update will be called every frame before display
    1.39 +	virtual void update(unsigned long tmsec);
    1.40 +
    1.41 +	/// pre_draw will be called before display
    1.42 +	virtual void pre_draw() const;
    1.43 +	/// display will be called whenever a screen needs to redraw itself
    1.44 +	virtual void display() const;
    1.45 +	/// post_draw will be called after display
    1.46 +	virtual void post_draw() const;
    1.47 +
    1.48 +	/// keyboard event
    1.49 +	virtual void keyboard(int key, bool pressed);
    1.50 +	/// mouse motion event
    1.51 +	virtual void motion(int x, int y, bool pressed);
    1.52 +	/// mouse button event
    1.53 +	virtual void button(int bn, bool pressed, int x, int y);
    1.54 +	/// reshape event
    1.55 +	virtual void reshape(int x, int y);
    1.56 +};
    1.57 +
    1.58 +#endif	// SCREEN_H_