コード例 #1
0
    def __init__(self, screen=None):
        # See if we've been given a screen to use
        if screen is None:
            self.screen = pygame.display.set_mode((600, 600))
        else:
            self.screen = screen

        self.running = True
        self.clock = pygame.time.Clock()

        # Gots to have us a background and a walkable mask
        self.background = None
        self.mask = None

        # If anyone takes screenshots, they can do so with this!
        self.screenshot_counter = 0

        # Initialize our reusable robotic girl
        self.girl = Girl()

        # What is the current state of our game
        self.state = "Running"

        # Load our music player
        self.music_player = MusicPlayer()
        self.sound_player = SoundPlayer()
        self.girl.sound_player = self.sound_player
コード例 #2
0
class PlaySound(Executor):
    sound_player = SoundPlayer()

    def __init__(self, sound_file):
        self.sound_file = self.sound_player.clear_sound(sound_file)

    def execute(self, *args, **kwargs):
        self.sound_player.play(self.sound_file)
コード例 #3
0
 def __init__(self):
     self.__listener = SampleListener()
     self.__controller = Leap.Controller()
     self.__controller.add_listener(self.__listener)
     self.__listener.set_callBack(self.on_feature)
     self.sound_player = SoundPlayer()
     self.__model = pickle.load(open("classifier.pkl", 'rb'))
     self.__scaler = pickle.load(open("scaler.pkl", 'rb'))
コード例 #4
0
    def __init__(self):
        # self.task_holders = [TaskHolder() for i in range(3)]
        self.cap_to_process_to_queue = deque()
        self.process_to_display_queue = deque()
        self.img_processor = ImageProcessor()
        self.sound_player = SoundPlayer()

        # thread_capture = threading.Thread(target=self.capture, args=())
        # thread_process = threading.Thread(target=self.process, args=())
        # thread_display = threading.Thread(target=self.display, args=())

        # thread_cap_disp = threading.Thread(target=self.cap_display, args=())
        thread_process = threading.Thread(target=self.process, args=())

        thread_process.start()
        self.cap_display_independent()
コード例 #5
0
 def __init__(self):
     self.is_running = True
     self.transportation = False
     self.dt = 0
     self.language = None
     #self.screen = pygame.display.set_mode((c.SCR_W, c.SCR_H), pygame.FULLSCREEN |
     #                                      pygame.HWSURFACE | pygame.DOUBLEBUF)
     self.screen = pygame.display.set_mode((c.SCR_W, c.SCR_H))
     self.sound_player = SoundPlayer()
     self.clock = pygame.time.Clock()
     self.level_generator = LevelGenerator()
     self.room = Room()
     self.player = None
     self.camera = Camera()
     self.background = Background()
     self.gui = Gui()
     self.key_handlers = defaultdict(list)
コード例 #6
0
DRS_STARTS_ON_LAP = 3

#DRS COLORS
DRS_GOOD = (0.25, 1.00, 0.10, 1)
DRS_BAD = (1., .0, .0, 1)
DRS_AVAILABLE = (1., 1., 0.1, 1)
DRS_POSSIBLE = (0.86, 0.86, 0.86, 1)

# ERS MODES TEXT
ERS_MODES = ['Charging', 'Low', 'High', 'Overtake', 'Speed', 'Hotlap']
# ERS COLORS [green to red gradient]
ERS_COLORS = [(.47, 1., .2, 1), (.73, 1., .2, 1), (1, 1, .2, 1),
              (1., .7, .1, 1), (1., .33, 0, 1), (1., .0, .0, 1)]

audio = ('apps/python/%s/beep.wav' % APP_NAME)
sound_player = SoundPlayer(audio)

# TEXTURES
DRS_GOOD_TEXTURE = "apps/python/%s/ui/drs_good.png" % APP_NAME
DRS_BAD_TEXTURE = "apps/python/%s/ui/drs_bad.png" % APP_NAME
DRS_AVAILABLE_TEXTURE = "apps/python/%s/ui/drs_available.png" % APP_NAME
DRS_POSSIBLE_TEXTURE = "apps/python/%s/ui/drs_possible.png" % APP_NAME
DRS_PENALTY_TEXTURE = "apps/python/%s/ui/drs_penalty_background.png" % APP_NAME

ERS_MODES_TEXTURE = [
    "apps/python/%s/ui/ers_mode_%d.png" % (APP_NAME, i) for i in range(6)
]

#timers
timer0 = 0
timer1 = 0
コード例 #7
0
DOT_BAR = BarGraph(ARRAY, [4, 22, 12], 'sweep')
BARS = [
    RED_BAR,
    GREEN_BAR,
    ORANGE_BAR,
    ]

OUTPUTS = BARS + [
    DISPLAY,
    INTEGRITY,
    ARRAY,
    MAPLE,
    ]

from sound_player import SoundPlayer
SOUNDS = SoundPlayer()

ALL = INPUTS + OUTPUTS
def read_all():
  for p in ALL:
    p.communicate()

def toggle_reset():
  GPIO.setup(RESET_PIN, GPIO.OUT)
  GPIO.output(RESET_PIN, 0)
  time.sleep(0.1)
  GPIO.output(RESET_PIN, 1)

def reset_all():
  """resets all peripherals"""
  toggle_reset()