// ConsoleDisplay.h: interface for the ConsoleDisplay class.
//
//////////////////////////////////////////////////////////////////////

#ifndef _CONSOLEDISPLAY_H_
#define _CONSOLEDISPLAY_H_

#include "DisplayInterface.h"
#include <windows.h>

const int def_display_width = 78;  // default display width
const int def_display_height = 24; // default display height

class ConsoleDisplay : public DisplayInterface  
{
public:
	ConsoleDisplay();
	virtual ~ConsoleDisplay();

	virtual void DrawSprite(int bx, int by, int obj_id);

	// Returns the display width
	virtual int get_width( );

	// Returns the display height
	virtual int get_height( );

	virtual void UpdateScoreStatus(int score) const;
	virtual void UpdateLivesStatus(int lives) const;
	virtual void UpdateLevelStatus(int level) const;

	virtual void DrawString (int bx, int by, const char *s);

	// Clears the screen
	virtual void clear();

	virtual bool readchar( char &c, bool &quit );

	// Pauses for a number of milliseconds
	virtual void pause( int time ) const;

private:

	// Write a character at a given x and y coordinate
	void writexy( int x, int y, char c ) const;
	void writexy( int x, int y, char c, WORD att ) const;

	// Write a string at a given x and y coordinate
	// if the string does not fit on the line, it will wrap around the screen
	void writexy( int x, int y, const char *s ) const;

	// Write an integer at a given x and y coordinate
	void writexy( int x, int y, int i ) const;

	int width, height; // width and height of the screen
	HANDLE screen;     // output screen
	HANDLE input;      // input buffer
	INPUT_RECORD ir;   // input record

};

#endif
