/////////////////////////////////////////////////////////////////////////////
//
//  wall.h   definition of class Wall
//

// These preprocessor directives prevent the text from being
// #include'd more than once from different files

#ifndef WALL_H
#define WALL_H

#include "ct_emu.h"
#include "utils.h"

class Wall {
    Rect rect;
    double v_factor;

    myRGB color; 

public:
    Wall() {}  // Empty constructor is needed to create arrays. Not expected
               //   to be used otherwise

    // The arguments starting with the second arg have default values. Thus
    // both declarations 
    //       Wall wa( MakeRect( 150, 100, 250, 130 ), 1.5, 255, 0, 0 ); 
    //       Wall wb( MakeRect( 150, 100, 250, 130 ) );
    // are legal, and  wa  is a red accelerating wall, while  wb  is
    // a black (default) normal (default) wall.

    Wall( const Rect& r, double vf = 1.0, int rc = 0, int gc = 0, int bc = 0) : 
        rect( r ),
        v_factor( vf ), 
        color( myRGB( rc, gc, bc ) )
        {}
        
    // returns the rectangular region occupied by the wall
    Rect Region() const {
        return rect;
    }

    void Draw() const {
        SetForeColor( color.red, color.green, color.blue );
        PaintRect( rect );
    }

    // Changes the speed of the ball that hits it. Called from Ball::Reflect(..) 
    int ChangeSpeed( int vel ) const {
        return -( vel * v_factor ); 
    }

};

#endif  // WALL_H


