CPaddle.h
上传用户:sycq158
上传日期:2008-10-22
资源大小:15361k
文件大小:3k
- ///////////////////////////////////////////////////////////////////////////////
- /// File: CPaddle.h
- /// Purpose: Declaration of CPaddle Class
- /// This class represents the moveable paddle at the bottom of the
- /// game area to reflect the balls.
- ///////////////////////////////////////////////////////////////////////////////
- /// Configuation Management
- ///
- /// Who When Description
- /// ===========================================================================
- /// R. Walter 28-Dec-2003 Initial Version/Release
- ///
- ///////////////////////////////////////////////////////////////////////////////
- /// Copyright 2003: Robert Walter All rights reserved
- ///////////////////////////////////////////////////////////////////////////////
- #ifndef CPADDLE_H_
- #define CPADDLE_H_
- /// HEADER DEFINES ////////////////////////////////////////////////////////////
- #define WIN32_LEAN_AND_MEAN
- /// HEADER FILE INCLUDES //////////////////////////////////////////////////////
- #include <windows.h>
- #include <windowsx.h>
- #include "CBall.h"
- /// CONSTANTS /////////////////////////////////////////////////////////////////
- const int PADDLE_COUNT_STANDARD = 1;
- const int PADDLE_COUNT_DOUBLE = 2;
- const int PADDLE_COUNT_ESCAPE = 1;
- const int DEFAULT_PADDLE_HOR_SPACE = 60;
- const int DEFAULT_PADDLE_HEIGHT = 15;
- const int DEFAULT_PADDLE_STANDARD_LENGTH = 100;
- const int DEFAULT_PADDLE_SHORT_LENGTH = 40;
- /// CONSTANTS /////////////////////////////////////////////////////////////////
- const int PADDLE_VELOCITY = 10;
- /// TYPE / CLASS DECLARATIONS /////////////////////////////////////////////////
- class CPaddle
- {
- private:
- int m_x_pos; /** current x position of left side of paddle **/
- int m_x_vel; /** current x axis velocity of paddle **/
-
- int m_cnt; /** number of horizontal paddles **/
- int m_length; /** current length of paddle **/
- int m_hor_space; /** number of pixels between paddle rows **/
- int m_height; /** height in pixels of each paddle row **/
-
- int m_min_limit; /** furtherest position in pixels paddle can move left **/
- int m_max_limit; /** furtherest position in pixels paddle can move right **/
- int m_bottom_limit; /** pixel position of bottom edge of bottom paddle **/
-
-
- public:
- // constructors
- CPaddle();
-
- // destructor
- ~CPaddle();
-
- // member functions
- int GetXPos();
- int GetXVel();
- int GetLength();
- void GetPaddleRects(int* v_rect_cnt, RECT* v_rects);
-
- void SetBaseProperties(int const p_cnt, int const p_hor_space, int const p_length, int const p_height);
- void SetPaddleLimits(int const p_min_limit, int const p_max_limit, int const p_bottom_limit);
- void SetXPos(int const p_x_pos);
- void SetXVel(int const p_x_vel);
- void SetLength(int const p_length);
- bool HitPaddle(CBall p_ball);
- bool IsPaddleAtPosition(int p_x, int p_y, RECT* p_rect);
-
- };
- #endif