|
@@ -14,15 +14,6 @@
|
14
|
14
|
|
15
|
15
|
using namespace std;
|
16
|
16
|
|
17
|
|
-string resourcesDir()
|
18
|
|
-{
|
19
|
|
-#ifdef SFML_SYSTEM_IOS
|
20
|
|
- return "";
|
21
|
|
-#else
|
22
|
|
- return "resources/";
|
23
|
|
-#endif
|
24
|
|
-}
|
25
|
|
-
|
26
|
17
|
|
27
|
18
|
////////////////////////////////////////////////////////////
|
28
|
19
|
/// Entry point of application
|
|
@@ -45,10 +36,7 @@ int main()
|
45
|
36
|
window.setVerticalSyncEnabled(true);
|
46
|
37
|
|
47
|
38
|
// Load the sounds used in the game
|
48
|
|
- sf::SoundBuffer ballSoundBuffer;
|
49
|
|
- if (!ballSoundBuffer.loadFromFile(resourcesDir() + "ball.wav"))
|
50
|
|
- return EXIT_FAILURE;
|
51
|
|
- sf::Sound ballSound(ballSoundBuffer);
|
|
39
|
+
|
52
|
40
|
|
53
|
41
|
// Create the left paddle
|
54
|
42
|
Paddle leftPaddle;
|
|
@@ -61,7 +49,7 @@ int main()
|
61
|
49
|
|
62
|
50
|
// Load the text font
|
63
|
51
|
sf::Font font;
|
64
|
|
- if (!font.loadFromFile(resourcesDir() + "sansation.ttf"))
|
|
52
|
+ if (!font.loadFromFile("resources/sansation.ttf"))
|
65
|
53
|
return EXIT_FAILURE;
|
66
|
54
|
|
67
|
55
|
// Initialize the pause message
|
|
@@ -198,14 +186,14 @@ int main()
|
198
|
186
|
pauseMessage.setString("You Won!\n" + inputString);
|
199
|
187
|
}
|
200
|
188
|
|
201
|
|
- ball.checkCollisions(ballSound);
|
|
189
|
+ ball.checkCollisions();
|
202
|
190
|
|
203
|
191
|
// Check the collisions between the ball and the paddles
|
204
|
192
|
// Left Paddle
|
205
|
|
- ball.checkLeftPaddle(leftPaddle, ballSound);
|
|
193
|
+ ball.checkLeftPaddle(leftPaddle);
|
206
|
194
|
|
207
|
195
|
// Right Paddle
|
208
|
|
- ball.checkRightPaddle(rightPaddle, ballSound);
|
|
196
|
+ ball.checkRightPaddle(rightPaddle);
|
209
|
197
|
|
210
|
198
|
}
|
211
|
199
|
|