本文整理匯總了Python中texture.Texture.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Python Texture.setColor方法的具體用法?Python Texture.setColor怎麽用?Python Texture.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類texture.Texture
的用法示例。
在下文中一共展示了Texture.setColor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import setColor [as 別名]
class Menu_log:
#-------------------------------------------------------------------------------------------------------
def __init__( self ):
self.text = Text( "menu/KGHAPPY.ttf", 27, 255 )
self.texture = Texture( "menu/exit.png", 255 )
self.type = 0
#-------------------------------------------------------------------------------------------------------
def load( self, width, height ):
self.texture.setX( width/2 - self.texture.getWidth()/2 )
self.texture.setY( height/2 - self.texture.getHeight()/2 )
self.texture.setColor( 30, 0, 255 )
self.text.createText( "m-menu b-back", [ 0xFF, 0xFF, 0xFF ] )
self.text.setX( width/2 - self.text.getWidth()/2 )
self.text.setY( height/2 - self.text.getHeight()/2 )
#-------------------------------------------------------------------------------------------------------
def draw( self, window ):
if self.type == 1:
self.texture.draw( window )
self.text.draw( window )
#-------------------------------------------------------------------------------------------------------
def getState( self ):
return self.type
#-------------------------------------------------------------------------------------------------------
def setState( self, t ):
self.type = t
#-------------------------------------------------------------------------------------------------------
def handle( self, event ):
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_m:
if self.type == 0:
self.type = 1
elif self.type == 1:
self.type = 2
elif event.key == pygame.K_b:
if self.type == 1:
self.type = 0