Changeset View
Changeset View
Standalone View
Standalone View
wall.h
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 44 | public: | |||
---|---|---|---|---|---|
46 | 46 | | |||
47 | /** | 47 | /** | ||
48 | * Constructor | 48 | * Constructor | ||
49 | * @param dir is set in construction and does not change in gameplay | 49 | * @param dir is set in construction and does not change in gameplay | ||
50 | * that means there will be no two walls extending in the same direction | 50 | * that means there will be no two walls extending in the same direction | ||
51 | * in the same time | 51 | * in the same time | ||
52 | */ | 52 | */ | ||
53 | KBounceWall( Direction dir, KBounceRenderer* renderer, KBounceBoard* board ); | 53 | KBounceWall( Direction dir, KBounceRenderer* renderer, KBounceBoard* board ); | ||
54 | | ||||
55 | /** | ||||
56 | * KBounceWall destructor | ||||
57 | * @see wall.cpp | ||||
58 | */ | ||||
54 | ~KBounceWall(); | 59 | ~KBounceWall(); | ||
55 | 60 | | |||
56 | /** | 61 | /** | ||
57 | * Changes object's state when collisions have been detected | 62 | * Changes object's state when collisions have been detected | ||
58 | * Called once per frame before advance() and update() | 63 | * Called once per frame before advance() and update() | ||
64 | * @see wall.cpp | ||||
59 | */ | 65 | */ | ||
60 | void collide( KBounceCollision collision ); | 66 | void collide( KBounceCollision collision ); | ||
67 | | ||||
61 | /** | 68 | /** | ||
62 | * Performs various movement and state calculations non-related | 69 | * Performs various movement and state calculations non-related | ||
63 | * to collision responses. Also updates m_boundingRect and | 70 | * to collision responses. Also updates m_boundingRect and | ||
64 | * m_nextBoundingRect. This method is called once per frame | 71 | * m_nextBoundingRect. This method is called once per frame | ||
65 | * after collide() and before update() | 72 | * after collide() and before update() | ||
73 | * @see wall.cpp | ||||
66 | */ | 74 | */ | ||
67 | void goForward(); | 75 | void goForward(); | ||
76 | | ||||
68 | /** | 77 | /** | ||
69 | * Updates object's pixmap and position on screen | 78 | * Updates object's pixmap and position on screen | ||
70 | * Called once per frame after update() | 79 | * Called once per frame after update() | ||
80 | * @see wall.cpp | ||||
71 | */ | 81 | */ | ||
72 | void update(); | 82 | void update(); | ||
73 | 83 | | |||
74 | /** | 84 | /** | ||
75 | * Starts building wall beginning from tile specified by x and y | 85 | * Starts building wall beginning from tile specified by x and y | ||
76 | * The direction has been specified in constructor | 86 | * The direction has been specified in constructor | ||
87 | * @see wall.cpp | ||||
77 | */ | 88 | */ | ||
78 | void build( int x, int y ); | 89 | void build(int x, int y); | ||
90 | | ||||
79 | /** | 91 | /** | ||
80 | * Returns the bounding rect that is expected for wall to | 92 | * Returns the bounding rect that is expected for wall to | ||
81 | * have in next frame. Collision in KBounceBoard are based on | 93 | * have in next frame. Collision in KBounceBoard are based on | ||
82 | * the result of this method | 94 | * the result of this method | ||
95 | * @see wall.cpp | ||||
83 | */ | 96 | */ | ||
84 | QRectF nextBoundingRect() const; | 97 | QRectF nextBoundingRect() const; | ||
85 | 98 | | |||
86 | /** | 99 | /** | ||
87 | * Changes on-screen dimensions of the wall. | 100 | * Changes on-screen dimensions of the wall. | ||
88 | * Calculations are based on tile size, that is the on-screen | 101 | * Calculations are based on tile size, that is the on-screen | ||
89 | * size of board's tile | 102 | * size of board's tile | ||
103 | * @see wall.cpp | ||||
90 | */ | 104 | */ | ||
91 | void resize( const QSize& tileSize ); | 105 | void resize( const QSize& tileSize ); | ||
92 | 106 | | |||
93 | /** | 107 | /** | ||
94 | * Set the wall velocity for wall filling speed. | 108 | * Set the wall velocity for wall filling speed. | ||
109 | * @param velocity new wall velocity | ||||
110 | * @see wall.cpp | ||||
95 | */ | 111 | */ | ||
96 | void setWallVelocity(qreal velocity); | 112 | void setWallVelocity(qreal velocity); | ||
97 | 113 | | |||
98 | /** | 114 | /** | ||
99 | * Load all sprites for top, down, left and right walls as well as for | 115 | * Load all sprites for top, down, left and right walls as well as for | ||
100 | * the vertical and horizontal semi transparent bars drawn before a wall is | 116 | * the vertical and horizontal semi transparent bars drawn before a wall is | ||
101 | * built. | 117 | * built. | ||
118 | * @see wall.cpp | ||||
102 | */ | 119 | */ | ||
103 | void static loadSprites(); | 120 | void static loadSprites(); | ||
104 | 121 | | |||
105 | signals: | 122 | signals: | ||
106 | void finished( int left, int top, int right, int bottom ); | 123 | void finished( int left, int top, int right, int bottom ); | ||
107 | void died(); | 124 | void died(); | ||
108 | 125 | | |||
109 | private: | 126 | private: | ||
127 | | ||||
110 | /** | 128 | /** | ||
111 | * Returns true if rect2 intersects the edge at the end of wall | 129 | * Returns true if rect2 intersects the edge at the end of wall | ||
112 | * e.g for wall extending in direction Up this will be the upper | 130 | * e.g for wall extending in direction Up this will be the upper | ||
113 | * edge. | 131 | * edge. | ||
114 | */ | 132 | */ | ||
115 | bool safeEdgeHit( const QRectF& rect2 ) const; | 133 | bool safeEdgeHit( const QRectF& rect2 ) const; | ||
134 | | ||||
116 | /** | 135 | /** | ||
117 | * Helper function replacing emiting long finished signal | 136 | * Helper function replacing emiting long finished signal | ||
118 | * It also hides the wall and plays corresponding sound | 137 | * It also hides the wall and plays corresponding sound | ||
119 | * If ¶m shorten is true the wall will be one unit in | 138 | * If ¶m shorten is true the wall will be one unit in | ||
120 | * direction ¶m dir shorter than normal | 139 | * direction ¶m dir shorter than normal | ||
140 | * @see wall.cpp | ||||
121 | */ | 141 | */ | ||
122 | void finish( bool shorten = false, Direction dir = Up); | 142 | void finish( bool shorten = false, Direction dir = Up); | ||
123 | 143 | | |||
124 | KBounceBoard *m_board; | 144 | KBounceBoard *m_board; | ||
125 | Direction m_dir; | 145 | Direction m_dir; | ||
126 | 146 | | |||
127 | KgSound m_soundWallstart; | 147 | KgSound m_soundWallstart; | ||
128 | KgSound m_soundReflect; | 148 | KgSound m_soundReflect; | ||
Show All 23 Lines |