本文整理汇总了Python中direct.gui.DirectGuiGlobals.getDefaultFont方法的典型用法代码示例。如果您正苦于以下问题:Python DirectGuiGlobals.getDefaultFont方法的具体用法?Python DirectGuiGlobals.getDefaultFont怎么用?Python DirectGuiGlobals.getDefaultFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类direct.gui.DirectGuiGlobals
的用法示例。
在下文中一共展示了DirectGuiGlobals.getDefaultFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from direct.gui import DirectGuiGlobals [as 别名]
# 或者: from direct.gui.DirectGuiGlobals import getDefaultFont [as 别名]
def load(self):
guiModel = loader.loadModel('phase_3/models/gui/tt_m_gui_ups_logo_noText')
leftLocator = guiModel.find('**/bubbleLeft_locator')
rightLocator = guiModel.find('**/bubbleRight_locator')
haveFunNode = TextNode('Have Fun')
haveFunNode.setText(TTLocalizer.TeaserHaveFun)
haveFunNode.setTextColor(0, 0, 0, 1)
haveFunNode.setWordwrap(6)
haveFunNode.setAlign(TextNode.ACenter)
haveFunNode.setFont(DirectGuiGlobals.getDefaultFont())
haveFun = NodePath(haveFunNode)
haveFun.reparentTo(rightLocator)
haveFun.setScale(TTLocalizer.TPhaveFun)
JoinUsNode = TextNode('Join Us')
JoinUsNode.setText(TTLocalizer.TeaserJoinUs)
JoinUsNode.setTextColor(0, 0, 0, 1)
JoinUsNode.setWordwrap(6)
JoinUsNode.setAlign(TextNode.ACenter)
JoinUsNode.setFont(DirectGuiGlobals.getDefaultFont())
JoinUs = NodePath(JoinUsNode)
JoinUs.reparentTo(leftLocator)
JoinUs.setPos(0, 0, -0.025)
JoinUs.setScale(TTLocalizer.TPjoinUs)
for page in PageOrder:
textInfo = Pages.get(page)
textInfo = textInfo[0] + TTLocalizer.TeaserDefault
panel = DirectFrame(parent=self, relief=None, image=guiModel, image_scale=(0.65, 0.65, 0.65), image_pos=(0, 0, 0.0), text_align=TextNode.ACenter, text=textInfo, text_scale=TTLocalizer.TPpanel, text_pos=TTLocalizer.TPpanelPos)
self.addItem(panel)
guiModel.removeNode()
return
示例2: labelCells
# 需要导入模块: from direct.gui import DirectGuiGlobals [as 别名]
# 或者: from direct.gui.DirectGuiGlobals import getDefaultFont [as 别名]
def labelCells(self):
if self.cellLabelParent:
self.cellLabelParent.removeNode()
self.cellLabelParent = self.attachNewNode('cellLabels')
cw = self.cellWidth
scale = cw / 10.0
dx = cw * self.gridSize * .5
font = DirectGuiGlobals.getDefaultFont()
color = self.gridColor
for i in range(self.gridSize):
for j in range(self.gridSize):
zoneId = self.startingZone + ((j * self.gridSize) + i)
zoneStr = str(zoneId)
textNode = TextNode(zoneStr)
textNode.setText(zoneStr)
textNode.setFont(font)
textNode.setTextColor(color)
textNode.setAlign(TextNode.ACenter)
genTextNode = textNode.generate()
textNodePath = self.cellLabelParent.attachNewNode(genTextNode)
# Place the text node in the center of the cell
textNodePath.setPosHprScale((i * cw - dx) + (cw * 0.5), # x
(j * cw - dx) + (cw * 0.5), # y
GRID_Z_OFFSET+3.0, # z
# Lay them down flat
0, -90, 0, # hpr
scale, scale, scale)
self.cellLabelParent.flattenLight()
示例3: __init__
# 需要导入模块: from direct.gui import DirectGuiGlobals [as 别名]
# 或者: from direct.gui.DirectGuiGlobals import getDefaultFont [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")