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


Python Base.tuple_add方法代码示例

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


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

示例1: OnDrag

# 需要导入模块: import Base [as 别名]
# 或者: from Base import tuple_add [as 别名]
 def OnDrag(self):
     """When the draggable is latched to the cursor, this is carried out. 
     By default it moves the draggable along with the cursor. TODO: Correct
     the unintentional displacement of the draggable if the mouse was moved 
     quickly right before dragging the box"""
     translation = Base.tuple_add(pygame.mouse.get_pos(), self.previous_pos, '-')
     self.Translate(translation, None, True)
     self.previous_pos = pygame.mouse.get_pos()
开发者ID:keerthik,项目名称:KRPEngine,代码行数:10,代码来源:UI.py

示例2: _blitToolTip

# 需要导入模块: import Base [as 别名]
# 或者: from Base import tuple_add [as 别名]
 def _blitToolTip(self):
     """Check if a tooltip is expected and draw it"""
     if not pygame.font or self.ToolItem == None:
         self.ToolTipBox = pygame.Surface((0,0)).convert()
         return True
     elif self.ToolItem.DrawToolTip:
         fontsize = 20
         self.surf.blit(self.ToolTipBox, Base.tuple_add(self.ToolItem.Sprite.rect.topleft,(10,fontsize+5), '-'))
         return False
开发者ID:keerthik,项目名称:KRPEngine,代码行数:11,代码来源:UI.py

示例3: RenderToolTip

# 需要导入模块: import Base [as 别名]
# 或者: from Base import tuple_add [as 别名]
 def RenderToolTip(self):
     """Prepares a tooltip for the UI class to draw if needed. TODO: Needs to
     be refactored"""
     if self.ToolTip == None:
         return False
     fontsize = 20
     font = pygame.font.Font(None, fontsize)
     text = font.render(self.ToolTip, 1, (250, 250, 250))
     hoverBox = pygame.Surface(Base.tuple_add(text.get_rect()[2:],(fontsize,6))).convert()
     hoverBox.fill((0,100,200))
     textpos = text.get_rect(centerx=hoverBox.get_width()/2, centery=hoverBox.get_height()/2)
     hoverBox.blit(text, textpos)
     return hoverBox
开发者ID:keerthik,项目名称:KRPEngine,代码行数:15,代码来源:UI.py

示例4: Translate

# 需要导入模块: import Base [as 别名]
# 或者: from Base import tuple_add [as 别名]
 def Translate(self, reposition, translim = None, clip = False, wrap = False):
     """This accumulates residual float movement and uses it to move the sprite over calls"""
     if translim == None:
         limx, limy = Base.tuple_add(self.surf.get_size(), self.rect.size, '-')
     else:
         limx, limy = translim
     oldpos = self.rect.topleft
     #Accumulate residue from new repositioning
     Base.tuple_add(self.translate_residue, [r-int(r) for r in reposition])
     #Trim reposition of float portion
     reposition = [int(x) for x in reposition]
     #Update reposition to take whole residues
     reposition = Base.tuple_add(reposition, [int(r) for r in self.translate_residue])
     #Update residue to remove whole portion used in reposition
     self.translate_residue = [r-int(r) for r in self.translate_residue]
     
     want_to = Base.tuple_add(oldpos, reposition)
     self.rect.topleft = Base.tuple_lim(Base.tuple_add(oldpos, reposition), limx, limy, wrap)
     if not clip:
         self.rect.topleft = want_to
     if self.rect.topleft == want_to:
         return True
     else:
         return wrap or False
开发者ID:keerthik,项目名称:KRPEngine,代码行数:26,代码来源:GameElements.py


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