#ifndef SCREEN_HPP
#define SCREEN_HPP

#include <SDL.h>

#include <Vector/Vector.hpp>
#include <Vector/Box.hpp>

/*
 * This is the generic 'screen' class which encompases a current displayed
 * game state.
 */

class Screen {
public:
	Screen(); //sets up screen to occupy, well, the entire screen.
	virtual ~Screen() { }

	//update the current world
	virtual void update(float elapsed_time) { }
	
	//handle the given sdl input event
	virtual void handle_event(SDL_Event const &event) { }
	
	//draw the current game world.
	virtual void draw() { }

	//internally, a screen is [-aspectf(),aspectf()]x[-1,1].
	float aspectf();

	void update_screen_mouse_relative(SDL_MouseMotionEvent const &motion, Vector2f &mouse);
	void update_screen_mouse_absolute(SDL_MouseMotionEvent const &motion, Vector2f &mouse);

private:
	Box2f pixel_extents; //size in pixels.
	Box2f extents; //size and location in ambient units.
};

//run the given screen. When it calls 'quit' return.
void start_screen( Screen *screen );

//call from the running screen to quit.
void quit_screen( Screen *me );

//if a frame took less than this amount of time to render, wait.
// (This prevents the cpu from being hogged.)
extern Uint32 min_ms_per_frame;
	
//if a frame took more than this amount of time to render, pretend it
//didn't (results in a game slow-down)
extern Uint32 max_ms_per_frame;


#endif //SCREEN_HPP
