当前位置: 首页>>代码示例>>Python>>正文


Python DirectGuiGlobals.setDefaultFont方法代码示例

本文整理汇总了Python中direct.gui.DirectGuiGlobals.setDefaultFont方法的典型用法代码示例。如果您正苦于以下问题:Python DirectGuiGlobals.setDefaultFont方法的具体用法?Python DirectGuiGlobals.setDefaultFont怎么用?Python DirectGuiGlobals.setDefaultFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在direct.gui.DirectGuiGlobals的用法示例。


在下文中一共展示了DirectGuiGlobals.setDefaultFont方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from direct.gui import DirectGuiGlobals [as 别名]
# 或者: from direct.gui.DirectGuiGlobals import setDefaultFont [as 别名]
	def __init__(self):
		ShowBase.__init__(self)

		# Increase the texture resolution on DirectGui
		default_font = DirectGuiGlobals.getDefaultFont()
		default_font.clear()
		default_font.setPixelsPerUnit(64)
		DirectGuiGlobals.setDefaultFont(default_font)

		self.accept("f1", sys.exit)
		self.win.setCloseRequestEvent("f1")

		self.background = OnscreenImage(parent=self.render2dp, image="art/menu_background.png")
		self.cam2dp.node().getDisplayRegion(0).setSort(-20)

		# Setup camera
		self.disableMouse()
		self.camera.setPos(0, -5, 2.25)
		self.camera.setHpr(0, -10, 0)
		self.camLens.setFov(65)

		# Setup saves
		self.save_dir = os.path.join(appdirs.user_data_dir('ThorGame', roaming=True), 'saves')
		if not os.path.exists(self.save_dir):
			os.makedirs(self.save_dir)
		self.saved_trainer_ids = [i.split('.')[0] for i in os.listdir(self.save_dir)]

		# Setup UI
		self.ui = CEFPanda()
		src_dir = _file_dir
		template_folder = os.path.join(src_dir, 'ui')
		self.ui_env = Environment(loader=FileSystemLoader(template_folder),
								  trim_blocks=True)
		# HACK - CEFPython requires a regular LoadURL before LoadString works,
		# so we just give it something to work on. This doesn't render nicely,
		# but we replace it immediately with the UI for the first GameState.
		# CEFPython issue: https://code.google.com/p/chromiumembedded/issues/detail?id=763
		self.ui.load('ui/base.html')

		# Load monster data
		data_folder = os.path.join(src_dir, 'data')
		self.monster_data = []
		for i in os.listdir(data_folder):
			if i.startswith('race'):
				with open(os.path.join(data_folder, i)) as f:
					self.monster_data.append(json.load(f))

		# Setup the default player and monster
		self.player = Trainer(dont_save=True)
		self.player.monster = Monster.new_from_race("ogre")

		# Setup game states
		self.game_state = TitleState(self)
		self.taskMgr.add(self.main_loop, "MainLoop")
开发者ID:Kupoman,项目名称:thor,代码行数:56,代码来源:main.py

示例2: ConfigVariableDouble

# 需要导入模块: from direct.gui import DirectGuiGlobals [as 别名]
# 或者: from direct.gui.DirectGuiGlobals import setDefaultFont [as 别名]
base.transitions.FadeModelName = "phase_3/models/misc/fade.bam"
base.setFrameRateMeter(False)
base.accept("f9", base.screenshot, ["screenshots/screenshot"])
from direct.filter.CommonFilters import CommonFilters

print "CIStart: Setting display preferences..."
sm.applySettings(jsonfile)
if base.win == None:
    print "CIStart: Unable to open window; aborting."
    sys.exit()
else:
    print "CIStart: Successfully opened window."
ConfigVariableDouble("decompressor-step-time").setValue(0.01)
ConfigVariableDouble("extractor-step-time").setValue(0.01)
DirectGuiGlobals.setDefaultFontFunc(CIGlobals.getToonFont)
DirectGuiGlobals.setDefaultFont(CIGlobals.getToonFont())
DirectGuiGlobals.setDefaultRolloverSound(loader.loadSfx("phase_3/audio/sfx/GUI_rollover.mp3"))
DirectGuiGlobals.setDefaultClickSound(loader.loadSfx("phase_3/audio/sfx/GUI_create_toon_fwd.mp3"))
DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel("phase_3/models/gui/dialog_box_gui.bam"))


def maybeDoSomethingWithMusic(condition):
    width, height, fs, music, sfx, tex_detail, model_detail, aa, af = sm.getSettings(jsonfile)
    if condition == 0:
        if music == True:
            base.enableMusic(False)
    elif condition == 1:
        if music == True:
            base.enableMusic(True)

开发者ID:coginvasion,项目名称:src,代码行数:31,代码来源:CIStart.py


注:本文中的direct.gui.DirectGuiGlobals.setDefaultFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。