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


Python Img.cxblit方法代码示例

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


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

示例1: render

# 需要导入模块: import Img [as 别名]
# 或者: from Img import cxblit [as 别名]
 def render(self,p,screen):
     screenrect=screen.get_rect()
     sh,sw=screenrect.h,screenrect.w
     awscale=scales[self.wscale]
     aiscale=scales[self.invscale]
     riscale=self.invscale+1
     m=(sw/float(awscale)+1)/2.0
     rm=int(ceil(m))
     wconvmult=awscale/64.0
     if not (p.shop or (p.dead and not p.dt)):
         asx=p.x*awscale+ir(p.xoff)*wconvmult-(m-1)*awscale
         asy=p.y*awscale+ir(p.yoff)*wconvmult-(m-1)*awscale-aiscale
         r=(p.rumbling-1)//10+1
         rx=randint(-r,r)
         ry=randint(-r,r)
         sx=p.x
         sy=p.y
         for y in range(sy-rm-1,sy+rm+1):
             for x in range(sx-rm-1,sx+rm+1):
                 screen.blit(Tiles.tiles[self.get_t(x,y)].get_img()[self.wscale],(x*awscale-asx+rx,y*awscale-asy+ry))
         for y in range(sy-rm-1,sy+rm+1):
             for x in range(sx-rm-1,sx+rm+1):
                 objs=self.get_os(x,y)
                 for o in objs:
                     if not o.is_hidden(self,p):
                         screen.blit(o.get_img(self)[self.wscale],(x*awscale+ir(o.xoff)*wconvmult-asx+rx,y*awscale+ir(o.yoff)*wconvmult-asy-o.o3d*(self.wscale+1)+ry))
         pygame.draw.rect(screen,(200,200,200),pygame.Rect(0,0,sw,aiscale))
         for n,i in enumerate(p.iinv.inv if p.iinv else p.inv):
             screen.blit(i.get_img(p,self)[self.invscale],(n*aiscale,0))
             if i.stack>1:
                 screen.blit(numerals[i.stack-2][self.invscale],(n*aiscale+(11 if i.stack<10 else 9)*(self.invscale+1),36))
             if n==p.isel:
                 pygame.draw.rect(screen,p.col,pygame.Rect(n*aiscale,15*riscale,aiscale,riscale))
         if p.statuseffects:
             maxt=max([se[1] for se in p.statuseffects])
             maxse=[se for se in p.statuseffects if se[1]==maxt][0]
             pygame.draw.rect(screen,p.col,pygame.Rect(0,sh-9,maxt*sw//Players.etimes[maxse[0]],12))
     elif p.shop:
         screen.fill((150,150,150))
         pygame.draw.rect(screen,(200,200,200),pygame.Rect(0,0,sw,64))
         Img.bcentrex(bcfont,p.shop.title,screen,-16)
         for n,i in enumerate(p.shop.items):
             Img.cxblit(i[0].img[self.invscale],screen,n*aiscale+aiscale,-8*riscale)
             Img.bcentrex(cashfont,str(i[1]),screen,n*aiscale+aiscale,(255,255,0),8*riscale)
         screen.blit(p.simg[self.invscale],(0,p.ssel*aiscale+aiscale))
     else:
         p.dead.render(screen)
     Img.bcentrex(cashfont,str(p.cash),screen,sh-48,(255,255,0))
     pygame.draw.rect(screen,p.col,pygame.Rect(0,0,sw,sh),2)
开发者ID:NoNotCar,项目名称:TrapDungeon,代码行数:51,代码来源:World.py


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