本文整理汇总了Python中Camera.Camera.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.setup方法的具体用法?Python Camera.setup怎么用?Python Camera.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: IncantusLayer
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import setup [as 别名]
class IncantusLayer(Layer):
is_event_handler = True
def __init__(self):
super(IncantusLayer, self).__init__()
self.width, self.height = director.window.width, director.window.height
self.network = False
self.pending_actions = []
self.init()
self.clear_game()
self.soundfx = soundfx.SoundEffects()
def init(self):
self.camera = Camera(euclid.Point3(0,15, 0))
self.mainplayer_status = StatusView()
self.otherplayer_status = StatusView(is_opponent=True)
self.mana_controller = ManaController(self.mainplayer_status.manapool, self.otherplayer_status.manapool, self)
self.x_controller = XSelector(self.mainplayer_status.manapool, self.otherplayer_status.manapool, self)
self.card_selector = CardSelector(self.mainplayer_status, self.otherplayer_status, self)
#self.game_status = GameStatus()
self.phase_status = PhaseStatus()
self.phase_bar = PhaseBar()
self.phase_controller = PhaseController(self.phase_status, self)
self.status_controller = StatusController(self.mainplayer_status, self.otherplayer_status, self.phase_status, self)
self.selection = SelectionList()
self.list_selector = SelectController(self.selection, self)
self.msg_dialog = MessageDialog()
self.msg_controller = MessageController(self.msg_dialog, self)
self.table = Table()
self.mainplay = PlayView(z=3)
self.otherplay = PlayView(z=-3, is_opponent_view=True)
self.play_controller = PlayController(self.mainplay, self.otherplay, self)
self.damage_assignment = DamageSelector(self.mainplay, self.otherplay, self)
self.distribution_assignment = DistributionSelector(self.mainplay, self.otherplay, self)
self.player_hand = HandView()
self.hand_controller = HandController(self.player_hand, self)
self.otherplayer_hand = HandView(is_opponent=True)
self.otherhand_controller = HandController(self.otherplayer_hand, self)
self.stack = StackView()
self.stack_controller = StackController(self.stack, self)
self.zone_animator = ZoneAnimator(self)
self._keep_priority = False
self.finish_turn = False
self.p1_stop_next = False
self.p2_stop_next = False
def setup_lighting(self):
glEnable(GL_LIGHTING)
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, fourfv(0.5,0.5,0.5,1.0))
glEnable(GL_LIGHT0)
glLightfv(GL_LIGHT0, GL_AMBIENT, fourfv(0.5, 0.5, 0.5, 1.0))
glLightfv(GL_LIGHT0, GL_DIFFUSE, fourfv(0.8, 0.8, 0.8, 1.0))
glLightfv(GL_LIGHT0, GL_SPECULAR, fourfv(0.8, 0.8, 0.8, 1.0))
# ColorMaterial use inspired by: http://www.sjbaker.org/steve/omniv/opengl_lighting.html
glEnable ( GL_COLOR_MATERIAL )
glColorMaterial ( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
def on_enter(self):
super(IncantusLayer, self).on_enter()
self.on_resize(self.width, self.height)
self.setup_lighting()
self.play_controller.activate()
self.status_controller.activate()
self.hand_controller.activate()
self.otherhand_controller.activate()
self.stack_controller.activate()
self.mainplayer_status.show()
self.otherplayer_status.show()
def on_exit(self):
super(IncantusLayer, self).on_exit()
glDisable(GL_LIGHTING)
self.play_controller.deactivate()
self.status_controller.deactivate()
self.hand_controller.deactivate()
self.otherhand_controller.deactivate()
self.stack_controller.deactivate()
self.mainplayer_status.hide()
self.otherplayer_status.hide()
def on_resize(self, width, height):
self.width, self.height = width, height
glViewport(0, 0, width, height)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(80., width/float(height), 0.1, 3000.)
glMatrixMode(GL_MODELVIEW)
offset = 5
self.phase_bar.pos = euclid.Vector3(offset+self.phase_bar.width/2,offset+self.phase_bar.height/2, 0)
self.msg_dialog.pos = euclid.Vector3(offset+self.msg_dialog.width/2, 2*offset+self.phase_bar.height+self.msg_dialog.height/2,0)
self.mainplayer_status.pos = euclid.Vector3(offset, 3*offset+self.phase_bar.height+self.msg_dialog.height, 0)
self.mainplayer_status.resize(width, height)
self.otherplayer_status.pos = euclid.Vector3(offset, height-self.otherplayer_status.height-offset, 0)
self.otherplayer_status.resize(width, height)
self.stack.pos = euclid.Vector3(150,height/2,0)
self.player_hand.resize(width, height, width-self.msg_dialog.width)
#.........这里部分代码省略.........