Beispiel #1
0
    def __init__( self ) :
        pygame.mixer.init()
        self.gamesettings = GameSettings()
        self.sound_handler = SoundHandler( self.gamesettings )
        self.pause_time = 0
        self.time = 0
        self.garbage_body_list = []
        self.garbage_joint_list = []
        self.defaultZoom = 80.0
        self.minZoom = 15
        self.maxZoom = 285
        super(Game, self).__init__()
        self.current_scene = 0
        self.world.gravity = (0,0)
        self.image_handler = ImageHandler( self )

        #self.change_scene(SCENE_TYPE_GAME, 'res/maps/compiled_map1.js')

        self.reset_zoom()

        #-100 is the mouse
        self.pressed_keys = [ -100 ]
        self.change_scene( SCENE_TYPE_MENU )
Beispiel #2
0
    """Play one specific sound."""
    def put(self, sound_id):
        if soundhandler.play_sound(sound_id):
            return sound_id, 202
        else:
            abort('404', message='Sound {} not found'.format(sound_id))


# Resource Routing
api.add_resource(OctoBlaGeneral, "/")
api.add_resource(OctoBlaSound, '/sound/<string:sound_id>', '/sound')
api.add_resource(OctoBlaPlayer, '/play/<string:sound_id>')
api.add_resource(OctoBlaVolume, '/volume/<float:volume>', "/volume")

if __name__ == "__main__":
    # read configuration, configure environment
    base_path =os.path.dirname(__file__)
    config_path = os.path.join(base_path, 'settings.cfg')
    config = conf.ConfigParser()
    config.read(config_path)

    soundhandler = sh.SoundHandler(os.path.join(base_path, config.get('Paths', 'SoundDir')))
    soundhandler.set_volume(config.get('Audio', 'DefaultVolume'))

    # only accessible from localhost.
    # Don't use in productive environment!
    app.run(debug=True)

    # global accessible with optional ip range filter
    #app.run(host=config.get('General', 'Host'), port=config.get('General', 'Port'))