本文整理汇总了Python中context.Context.get_instance方法的典型用法代码示例。如果您正苦于以下问题:Python Context.get_instance方法的具体用法?Python Context.get_instance怎么用?Python Context.get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类context.Context
的用法示例。
在下文中一共展示了Context.get_instance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import get_instance [as 别名]
def update(self, dt):
"""Update the local player.
This method computes player's game logic as a function of time and sends
the appropriate event.
:param dt: Time delta from last update.
:type dt: float
"""
super(Player, self).update(dt)
# map player game position to world (x,y -> x,z)
x, z = self.position
# update camera position and orientation
context = Context.get_instance()
camera = context.camera
camera.position = Vec(x, 20, z + 5)
camera.look_at(camera.position, Vec(x, 0, z))
示例2: __new__
# 需要导入模块: from context import Context [as 别名]
# 或者: from context.Context import get_instance [as 别名]
def __new__(cls, *args, **kwargs):
"""Injects the client instance in the event object."""
inst = super(Event, cls).__new__(cls)
inst.context = Context.get_instance()
return inst