本文整理匯總了Python中rpcore.loader.RPLoader.load_font方法的典型用法代碼示例。如果您正苦於以下問題:Python RPLoader.load_font方法的具體用法?Python RPLoader.load_font怎麽用?Python RPLoader.load_font使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpcore.loader.RPLoader
的用法示例。
在下文中一共展示了RPLoader.load_font方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _load_fonts
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_font [as 別名]
def _load_fonts(self):
""" Loads the default font used for rendering and assigns it to
Globals.font for further usage """
Globals.font = RPLoader.load_font("/$$rp/data/font/roboto-medium.ttf")
Globals.font.set_pixels_per_unit(35)
Globals.font.set_poly_margin(0.0)
Globals.font.set_texture_margin(1)
示例2: _load_fonts
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_font [as 別名]
def _load_fonts(self):
""" Loads the default font used for rendering and assigns it to
Globals.font for further usage """
font = RPLoader.load_font("/$$rp/data/font/Roboto-Medium.ttf")
font.set_pixels_per_unit(35)
font.set_poly_margin(0.0)
font.set_texture_margin(1)
font.set_bg(Vec4(1, 1, 1, 0))
font.set_fg(Vec4(1, 1, 1, 1))
Globals.font = font
示例3: __init__
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_font [as 別名]
def __init__(self, font="/$$rp/data/font/roboto-bold.ttf", pixel_size=16, align="left",
pos=Vec2(0), color=Vec3(1), parent=None):
""" Constructs a new text node, forwaring the parameters to the internal
panda3d implementation """
RPObject.__init__(self)
self._node = TextNodeImpl('FTN')
self._node.set_text("")
self._node.set_align(getattr(TextNodeImpl, "A_" + align))
self._node.set_text_color(color.x, color.y, color.z, 1)
if parent is None:
parent = Globals.base.aspect2d
self._nodepath = parent.attach_new_node(self._node)
self._nodepath.set_pos(pos.x, 0, pos.y)
font = RPLoader.load_font(font)
font.set_outline(Vec4(0, 0, 0, 0.78), 1.6, 0.37)
font.set_scale_factor(1.0)
font.set_texture_margin(int(pixel_size / 4.0 * 2.0))
font.set_bg(Vec4(0, 0, 0, 0))
self._node.set_font(font)
self.set_pixel_size(pixel_size)