//a class to display scrolling text messages onto the screen
class wdisplay
	{
     private:
     	char message[50];
        float x,y;
        float mx,my;
        int exist;
     public:
     	void init(void);
        void write_message(BITMAP *backgr, FONT *f, int c);
        void set_message(char m[50],float xx,float yy,float mmx, float mmy);
        void move_message(void);
	};

void wdisplay::move_message(void)
	{
     if(exist==1)
       {
        x+=mx;
        y+=my;

        if(x<-100 || x>740 || y<-100 || y>580)
          exist=0;
       }
    }

void wdisplay::set_message(char m[50], float xx, float yy, float mmx, float mmy)
	{
     strcpy(message,m);
     exist=1;
     x=xx;
     y=yy;
     mx=mmx;
     my=mmy;
    }

void wdisplay::write_message(BITMAP *backgr, FONT *f, int c)
	{
     if(exist==1)
       {
        for(int n=0; n<6 ; n++)
            textprintf_centre(backgr,f,(int)x-n,(int)y-n,0,"%s",message);
        textprintf_centre(backgr,f,(int)x,(int)y,c,"%s",message);
       }
    }

void wdisplay::init(void)
	{
     exist=0;
     strcpy(message,"");
     x=0;
     y=0;
     mx=0;
     my=0;
    }
