def _load_sound_library(): """ Special code for Windows so we grab the proper avbin from our directory. Otherwise hope the correct package is installed. """ # lazy loading if not _load_sound_library._sound_library_loaded: _load_sound_library._sound_library_loaded = True else: return import pyglet_ffmpeg pyglet_ffmpeg.load_ffmpeg()
def __init__(self, debug: bool = False): self.debug = debug if self.debug: if platform.system() == "Windows": # Set larger console os.system("mode con: cols=200 lines=9999") if platform.system() != "Linux": import pyglet_ffmpeg pyglet_ffmpeg.load_ffmpeg() # Enable Colours using black magic os.system("") # Setup Logging self.game_logger = self.setup_logging(debug) # Get basic system information self.system_data = {} self.system_info() # Basic classes self.game_config = Config() self.game_config.load() self.game_assets = Assets(self.game_config.get("language.lang")) # setup Pyglet pyglet.options['audio'] = ('openal', 'pulse', 'directsound', 'silent') vsync_enabled = self.game_config.get("graphics.vsync") self.window = Window(1280, 720) self.window.set_vsync(vsync_enabled) # TODO: Fix fullscreen mode # self.window.set_fullscreen(self.game_config.get("fullscreen")) self.window.set_caption(self.game_assets.get("lang.title.main_title")) fps_limit = self.game_config.get("graphics.fps") self.scene_manager = SceneManager(self.game_assets, self.window) if vsync_enabled: pyglet.clock.schedule(self.scene_manager.update) else: pyglet.clock.schedule_interval(self.scene_manager.update, 1.0 / fps_limit)
import config import tools import api import os import threading import tempfile import sys import time import queue import pyglet import pyglet_ffmpeg as ffmpeg ffmpeg.load_ffmpeg() if not os.path.exists(tempfile.gettempdir() + config.TEMP_SUBD_DIR): os.mkdir(tempfile.gettempdir() + config.TEMP_SUBD_DIR) for f in os.listdir(tempfile.gettempdir() + config.TEMP_SUBD_DIR): try: f = tempfile.gettempdir() + config.TEMP_SUBD_DIR + '\\' + f os.remove(f) print('Removed', f) except: pass query = input('Enter a search query: ') window = pyglet.window.Window(visible=False, resizable=True) fps_display = pyglet.window.FPSDisplay(window) batch = pyglet.graphics.Batch() batch_sprites = [] batch_sprites.clear
# # Copyright (c) 2013, 2015, Corey Goldberg # # Dev: https://github.com/cgoldberg/py-slideshow # License: GPLv3 import argparse import random import os import pyglet import pyglet_ffmpeg from Lib.filesystem import getPaths global step, img pyglet_ffmpeg.load_ffmpeg() player = pyglet.media.Player() player.eos_action = 'pause' source = pyglet.media.StreamingSource() step = -1 mediatype = "video" video_x = 0 screens = pyglet.canvas.get_display().get_screens() display = pyglet.canvas.get_display() window = pyglet.window.Window(fullscreen=True, screen=screens[2]) pyglet.gl.glClearColor(1, 1, 1, 1) def is_video(file): extension = os.path.splitext(file)[1] return extension == '.mp4'