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


Python Rect.unionall_ip方法代码示例

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


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

示例1: test_unionall_ip

# 需要导入模块: from pygame import Rect [as 别名]
# 或者: from pygame.Rect import unionall_ip [as 别名]
 def test_unionall_ip( self ):
     r1 = Rect( 0, 0, 1, 1 )
     r2 = Rect( -2, -2, 1, 1 )
     r3 = Rect( 2, 2, 1, 1 )
     
     r1.unionall_ip( [r2,r3] )
     self.assertEqual( Rect(-2, -2, 5, 5), r1 )
开发者ID:CTPUG,项目名称:pygame_cffi,代码行数:9,代码来源:rect_test.py

示例2: set_screen_background

# 需要导入模块: from pygame import Rect [as 别名]
# 或者: from pygame.Rect import unionall_ip [as 别名]
    def set_screen_background(self):
        """ Update the background """
        logger.log( 9, 'set_screen_background()')
        if not self.background:
            self.background = osd.get_singleton().getsurface(rect=self.rect)
            self.updates = []

        elif len(self.updates) > 0:

            # find the topleft corner
            x = self.rect.right
            y = self.rect.bottom
            for i in self.updates:
                x = min(x, i.left)
                y = min(y, i.top)

            # find the total rect of the collisions
            upd = Rect(x, y, 0, 0)
            upd.unionall_ip(self.updates)
            self.updates = []

            x      = upd[0] - self.rect.left
            y      = upd[1] - self.rect.top
            bg_tmp = osd.get_singleton().getsurface(rect=upd)

            self.background.blit(bg_tmp, (x, y))

        self.surface.blit(self.background, (0,0))
开发者ID:adozenlines,项目名称:freevo1,代码行数:30,代码来源:base.py

示例3: test_unionall_ip

# 需要导入模块: from pygame import Rect [as 别名]
# 或者: from pygame.Rect import unionall_ip [as 别名]
    def test_unionall_ip( self ):
        r1 = Rect( 0, 0, 1, 1 )
        r2 = Rect( -2, -2, 1, 1 )
        r3 = Rect( 2, 2, 1, 1 )
        
        r1.unionall_ip( [r2,r3] )
        self.assertEqual( Rect(-2, -2, 5, 5), r1 )

        # Bug for an empty list. Would return a Rect instead of None.
        self.assertTrue(r1.unionall_ip( [] ) is None)
开发者ID:Yarrcad,项目名称:CPSC-386-Pong,代码行数:12,代码来源:rect_test.py


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