Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IMPORTANT TO READ THIS!
- The SDL version of the pong game can be compiled (almost) any platform, to compile it, you have to setup the SDL, SDL_TTF and the SDL_mixer:
- http://www.libsdl.org/download-1.2.php
- http://www.libsdl.org/projects/SDL_ttf/
- http://www.libsdl.org/projects/SDL_mixer/
- Download them extract them, and in your IDE (for example Code::Blocks) add the include folder at the compile section and the libs to the linker settings (as I showed you in the 0. tutorial), you have to use the following flags (in case of Windows):
- -lmingw32 -lSDL_main -lSDL_ttf -lSDL_mixer -lSDL
- In Linux, install the libraries like this:
- sudo apt-get install libsdl1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev
- And compile the program like this:
- g++ main.cpp ball.cpp paddle.cpp -o pong -lSDL -lSDL_ttf -lSDL_mixer
- IMPORTANT:
- Beside the runnable (binary) file you have to put a 10x50 bmp called paddle.bmp (the paddle) a 20x20 bmp called ball.bmp (the ball) a ttf called air.ttf, a wav called Hackbeat.wav and a bassdrum1.wav (obviusly you can change the names or the parameters of the files if you want, in the code)
- I admit, the design of the program not the best, but it does what I planned. You may want to rewrite the program and make the main file content to a class, so it could be easier to see it through.
- http://www.youtube.com/user/thecplusplusguy
Advertisement
Add Comment
Please, Sign In to add comment