In the previous chapter we had a brief introduction of the tool-chain we will be using. Now it’s time to set it up for the game we will be developing. So lets begin by first downloading the individual components.
Python (version 2.7): http://www.python.org/download/
PySFML (version 1.6): http://www.sfml-dev.org/download.php
PyOpenGL (3.0.1): http://pypi.python.org/pypi/PyOpenGL
Optionally you can also install GIMP, Paint.NET and Notepad++.
Windows users will generally only need a one click installer, which most of the packages do provide. Most Linux distros will have Python bundled with distribution. If you have a 2.x version, there is no real need to install a separate version.
Installing PySFML for Windows is just as easy. For Linux and Mac users you need to either download the binaries provided or build SFML (C++) and then build the Python bindings.
After doing all that, it’s time to test if our setup works. Open your favorite text editor and type in the following code:
#!/usr/bin/python from PySFML import sf window = sf.RenderWindow(sf.VideoMode(800, 600), "Test Application") text = sf.String("Hello Game Development") running = True while running: event = sf.Event() while window.GetEvent(event): if event.Type == sf.Event.Closed: running = False window.Clear() window.Draw(text) window.Display() window.Close()
Save the file as ‘first.py’ in some folder. Open a command prompt navigate to the folder where the file was saved and type in:
python first.py
If you can see a window with the words “Hello Game Development” like the one below your installation and setup is correct.
Don’t worry if you don’t understand anything in the code we will get to it later.
Downloads :