本文整理汇总了Python中Theme.open方法的典型用法代码示例。如果您正苦于以下问题:Python Theme.open方法的具体用法?Python Theme.open怎么用?Python Theme.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme.open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: activateMod
# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import open [as 别名]
def activateMod(engine, modName):
modPath = _getModPath(engine)
m = os.path.join(modPath, modName)
t = os.path.join(m, "theme.ini")
if os.path.isdir(m):
engine.resource.addDataPath(m)
if os.path.isfile(t):
theme = Config.load(t)
Theme.open(theme)
示例2: __init__
# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import open [as 别名]
def __init__(self, config = None):
"""
Constructor.
@param config: L{Config} instance for settings
"""
if not config:
config = Config.load()
self.config = config
fps = self.config.get("video", "fps")
tickrate = self.config.get("engine", "tickrate")
Engine.__init__(self, fps = fps, tickrate = tickrate)
pygame.init()
self.title = _("Frets on Fire")
self.restartRequested = False
self.handlingException = False
self.video = Video(self.title)
self.audio = Audio()
Log.debug("Initializing audio.")
frequency = self.config.get("audio", "frequency")
bits = self.config.get("audio", "bits")
stereo = self.config.get("audio", "stereo")
bufferSize = self.config.get("audio", "buffersize")
self.audio.pre_open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)
pygame.init()
self.audio.open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)
Log.debug("Initializing video.")
width, height = [int(s) for s in self.config.get("video", "resolution").split("x")]
fullscreen = self.config.get("video", "fullscreen")
multisamples = self.config.get("video", "multisamples")
self.video.setMode((width, height), fullscreen = fullscreen, multisamples = multisamples)
# Enable the high priority timer if configured
if self.config.get("engine", "highpriority"):
Log.debug("Enabling high priority timer.")
self.timer.highPriority = True
viewport = glGetIntegerv(GL_VIEWPORT)
h = viewport[3] - viewport[1]
w = viewport[2] - viewport[0]
geometry = (0, 0, w, h)
self.img = ImgContext(geometry)
glViewport(int(viewport[0]), int(viewport[1]), int(viewport[2]), int(viewport[3]))
self.input = Input()
self.view = View(self, geometry)
self.resizeScreen(w, h)
self.resource = Resource(Version.dataPath())
self.server = None
self.sessions = []
self.mainloop = self.loading
# Load game modifications
Mod.init(self)
theme = Config.load(self.resource.fileName("theme.ini"))
Theme.open(theme)
# Make sure we are using the new upload URL
if self.config.get("game", "uploadurl").startswith("http://kempele.fi"):
self.config.set("game", "uploadurl", "http://fretsonfire.sourceforge.net/play")
self.addTask(self.audio, synchronized = False)
self.addTask(self.input, synchronized = False)
self.addTask(self.view)
self.addTask(self.resource, synchronized = False)
self.data = Data(self.resource, self.img)
self.input.addKeyListener(FullScreenSwitcher(self), priority = True)
self.input.addSystemEventListener(SystemEventHandler(self))
self.debugLayer = None
self.startupLayer = None
self.loadingScreenShown = False
Log.debug("Ready.")