Hardware Reference
In-Depth Information
Engage Thrusters
1.
In this project, the game needs to be launched fullscreen as soon as Raspberry Pi
(that has been set up to launch the desktop game) is powered up.
2.
The pygame.display.set_mode method is used to set the game to fullscreen
with the pygame.FULLSCREEN argument. The resoluion of the game will be
( Window width x Window height ), in this case, 640 x 480 pixels:
DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH,
WINDOWHEIGHT),pygame.FULLSCREEN)
3. In order to launch the game (the Python script: Connect_four.py ) ater
Raspberry Pi is powered up, let's create a shell script using a text editor
with the following contents and call it startup.sh :
#!/bin/sh
python Connect_four.py
4. The shell script needs to be saved to the /home/pi locaion. Alternaively,
the script can be saved at any other locaion.
5. The shell script has to be made an executable file using the chmod command:
sudo chmod 755 startup.sh
6. In order to execute startup.sh upon boot, the /etc/rc.local file needs to
be modified. In the command-line terminal of Raspberry Pi, the file can be opened
using a text editor such as nano :
sudo nano /etc/rc.local
7. Before the last line of the file, exit 0 , the following lines have to be added:
sleep 10
cd /home/pi/
/home/pi/startup.sh &
exit 0
8. The script is executed ater all the kernel modules are iniialized. The script is
executed from the directory where the files have been saved.
 
Search WWH ::




Custom Search