//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, RGB c);
        void set_message(char m[50],float xx,float yy,float mmx, float mmy);
        int move_message(void);
	};

int wdisplay::move_message(void)
	{
	 int ret=0;//returns 1 when the message is done
     if(exist==1)
       {
        x+=mx;
        y+=my;

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

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, RGB c)
	{
     if(exist==1)
       {
        for(int n=0; n<6 ; n++)
            textprintf_centre_ex(backgr,f,(int)x-n,(int)y-n,0,-1,"%s",message);
        textprintf_centre_ex(backgr,f,(int)x,(int)y,makecol(c.r,c.g,c.b),-1,"%s",message);
       }
    }

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