forked from patadeloso/pypboy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
42 lines (35 loc) · 1.22 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python3
import pygame
import optparse
import os, sys
import config
import platform
parser = optparse.OptionParser(usage='python %prog -c True\nor:\npython %prog -c True', version="0.0.1", prog=sys.argv[0])
parser.add_option('-c','--cached-map', action="store_true", help="Loads the cached map file stored in map.cache", dest="load_cached", default=False)
options, args = parser.parse_args()
try:
import RPi.GPIO as GPIO
# GPIO.setmode(GPIO.BCM)
config.GPIO_AVAILABLE = True
except Exception:
_, err, _ = sys.exc_info()
print("GPIO UNAVAILABLE (%s)" % err)
config.GPIO_AVAILABLE = False
if config.GPIO_AVAILABLE:
# Init framebuffer/touchscreen environment variables
os.putenv('SDL_VIDEODRIVER', 'fbcon')
os.putenv('SDL_FBDEV' , '/dev/fb1')
os.putenv('SDL_MOUSEDRV' , 'TSLIB')
os.putenv('SDL_MOUSEDEV' , '/dev/input/touchscreen')
config.touchScale = 100
config.invertPosition = True
from pypboy.core import Pypboy
try:
pygame.mixer.init(44100, -16, 2, 2048)
config.SOUND_ENABLED = True
except Exception as e:
config.SOUND_ENABLED = False
if __name__ == "__main__":
boy = Pypboy('Pip-Boy 3000', config.WIDTH, config.HEIGHT)
print("RUN")
boy.run()