1 #ifndef _hockey_h 2 #define _hockey_h 3 4 #ifndef _vec2_h 5 # include "vec2.h" 6 #endif 7 #ifndef _game_h 8 # include "game.h" 9 #endif 10 11 class BallMover; // forward 12 class Goal; 13 class StaticBall; 14 class Wall; 15 16 class Hockey : public Game { 17 public: 18 static Real TableWidth; 19 static Real TableHeight; 20 21 Hockey(double wx=TableWidth, double wy=TableHeight); 22 virtual ~Hockey(); 23 24 virtual const Real & GetPresetA() const; 25 virtual const Real & GetPresetHaft() const; 26 virtual const Real & GetSlowGranularity() const; 27 28 virtual const Real & GetNormalBallSize() const; 29 30 virtual const Real AreaOffX() const; 31 virtual const Real AreaOffY() const; 32 virtual const Real AreaWidth() const; 33 virtual const Real AreaHeight() const; 34 35 virtual void InitPlayground(); 36 virtual void DrawBackground() const; 37 38 void InitArea( double wx, double wy ); 39 void InitTable(); 40 41 virtual void InPocket( Ball *b ); 42 virtual void StopBall( Ball *b ); 43 44 static Real PresetA; 45 static Real PresetHaft; 46 static Real SlowGranularity; 47 48 static Real FrameOffset; 49 static Real GoalSize; 50 51 static Real DiscRadius; 52 static Real HandRadius; 53 static Real DiscWeight; 54 static Real HandWeight; 55 56 static Real GoalFrame; 57 static Real GoalHeight; 58 59 protected: 60 Real area_off_x; 61 Real area_off_y; 62 Real area_width; 63 Real area_height; 64 65 BallMover *mdisc; 66 BallMover *mhand; 67 68 ColorId table_col; 69 ColorId table_dark_col; 70 ColorId red_bg_col; 71 ColorId blue_bg_col; 72 73 ColorId disc_col; 74 ColorId hand_col; 75 76 protected: 77 Vec2 mid; 78 Vec2 edge[4]; 79 Goal *goal[2]; 80 StaticBall *post[2][2]; 81 Wall *w[2][3]; 82 83 int disc_in_goal; 84 Ball *disc; 85 Ball *hand1, *hand2; 86 }; 87 88 class TestHockey : public Hockey { 89 public: 90 TestHockey(double speed=100.0); 91 virtual ~TestHockey(); 92 93 virtual const Real &GetPresetA() const; 94 virtual const Real &GetSlowGranularity() const; 95 96 virtual void InitPlayground(); 97 98 static Real PresetA; 99 static Real SlowGranularity; 100 101 private: 102 Real shot_speed; 103 104 Wall *w[4]; 105 }; 106 107 #endif 108