home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / MSVCPUZL.ZIP / PIECE.H < prev    next >
C/C++ Source or Header  |  1993-11-07  |  2KB  |  55 lines

  1. // CPiece class definition
  2. //////////////////////////////////////////////////////////////////////////////
  3. #ifndef __PIECE_H
  4. #define __PIECE_H
  5.  
  6. #define CPIECE_UNIT 50
  7.  
  8. class CPiece : public CObject
  9. {
  10. public:
  11.   CPiece(void);
  12.   CPiece(int,int,int,int);
  13.   ~CPiece(void);
  14.   void draw(CDC*);
  15.   CSize  GetSize(void);    //Gets logical size
  16.   CPoint GetPos(void);     //Gets logical position
  17.   void   SetPos(const CPoint&);
  18.   void   SetPos(int x, int y);
  19.   BOOL PtInPiece(CPoint&); //See in an actual point is within this piece
  20.   void SetMoveLimits(int,int,int,int);
  21.   void Move(CPoint&);
  22.   void Stop(CPoint&);
  23.   CRect rectPiece(void);
  24.   int GetUnitSizeX(void) {return CPIECE_UNIT;};
  25.   int GetUnitSizeY(void) {return CPIECE_UNIT;};
  26.  
  27. private:
  28.   //State vars
  29.   CSize  m_szActSize;  //Actual size
  30.   CPoint m_ptActPos;   //Actual position
  31.   CSize  m_szLogSize;  //Logical size
  32.   CPoint m_ptLogPos;   //Logical position
  33.  
  34.   //Motion vars
  35.   int    m_nUpLim;         //Limits of motion inlogical units
  36.   int    m_nDownLim;
  37.   int    m_nLeftLim;
  38.   int    m_nRightLim;
  39.   BOOL   m_bInMotion;      //True if piece is being moved
  40.   BOOL   m_bHoriz;         //Motion is horizontal
  41.   BOOL   m_bVert;          //Motion is verticle
  42.   int    m_nMouseUpLim;    //Limits, within which I'll follow the mouse
  43.   int    m_nMouseRightLim;
  44.   int    m_nMouseDownLim;
  45.   int    m_nMouseLeftLim;
  46.   CPoint m_ptMouseOrg;     //The position of the mouse at LBUTTONDOWN
  47.   CPoint m_ptMouseLast;    //The position of the mouse at the last move msg
  48.  
  49.   //Helper vars
  50.   int m_xHiliteWidth;      //The width of the hilight on the pieces
  51.   int m_yHiliteWidth;
  52. };
  53.  
  54. #endif
  55.