本文整理汇总了Python中theme.get_color函数的典型用法代码示例。如果您正苦于以下问题:Python get_color函数的具体用法?Python get_color怎么用?Python get_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_color函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawLives
def drawLives():
posx = (-stage.width / 2) + 3
for x in xrange(1, game.lives + 1):
posx += 1
drawTile(posx, (-stage.height / 2) - 1, theme.get_tile('lives'), theme.get_color('lives'))
posx += 1
drawTile(posx, (-stage.height / 2) - 1, theme.get_tile('border-h'), theme.get_color('border'))
示例2: drawInitGame
def drawInitGame():
drawTile(-5, -2, _(" Welcome to SNAKE "), theme.get_color('border'))
drawTile(-4, 2, _(" Press [ENTER] "), theme.get_color('border'))
left = u"\u2190"
up = u"\u2191"
down = u"\u2193"
right = u"\u2192"
drawTile(-5, 4, _(" Use [{0}{1}{2}{3}] to move ").format(left, up, down, right), theme.get_color('border'))
示例3: drawInitGame
def drawInitGame():
drawTile(-5, -2, " Welcome to SNAKE ", theme.get_color('border'))
drawTile(-4, 2, " Press [ENTER] ", theme.get_color('border'))
left = u"\u2190"
up = u"\u2191"
down = u"\u2193"
right = u"\u2192"
drawTile(-5, 4, " Use [" + left + up + down + right + "] to move ", theme.get_color('border'))
示例4: drawBorders
def drawBorders():
for y in range(stage.boundaries['top'], stage.boundaries['bottom']):
drawTile(stage.boundaries['left'] - 1, y, theme.get_tile('border-v'), theme.get_color('border'))
drawTile(stage.boundaries['right'], y, theme.get_tile('border-v'), theme.get_color('border'))
for x in range(stage.boundaries['left'], stage.boundaries['right']):
drawTile(x, stage.boundaries['top'] - 1, theme.get_tile('border-h'), theme.get_color('border'))
drawTile(x, stage.boundaries['bottom'], theme.get_tile('border-h'), theme.get_color('border'))
drawTile(stage.boundaries['left'] - 1, stage.boundaries['top'] - 1, theme.get_tile('border-c'), theme.get_color('border'))
drawTile(stage.boundaries['left'] - 1, stage.boundaries['bottom'], theme.get_tile('border-c'), theme.get_color('border'))
drawTile(stage.boundaries['right'], stage.boundaries['top'] - 1, theme.get_tile('border-c'), theme.get_color('border'))
drawTile(stage.boundaries['right'], stage.boundaries['bottom'], theme.get_tile('border-c'), theme.get_color('border'))
示例5: drawSnake
def drawSnake():
for part in game.snake:
drawTile(
part[0],
part[1],
theme.get_tile('snake-body'),
theme.get_color('snake')
)
# Clean last tile
drawTile(
game.lastPos[0],
game.lastPos[1],
theme.get_tile('bg'),
theme.get_color('bg')
)
示例6: drawScore
def drawScore():
score_formatted = str(game.score).zfill(2)
drawTile(
(stage.width / 2) - 1,
(-stage.height / 2) - 1,
score_formatted,
theme.get_color('border')
)
示例7: drawApples
def drawApples():
for apple in game.apples:
drawTile(
apple[0],
apple[1],
theme.get_tile('apple'),
theme.get_color('apple')
)
示例8: drawSnake
def drawSnake():
for part in game.snake:
drawTile(
part[0],
part[1],
theme.get_tile('snake-body'),
theme.get_color('snake')
)
示例9: drawGameOver
def drawGameOver():
speed = gameloop.speed
size = stage.passSize
lives = game.lives
sizeStr = ''
speedStr = ''
livesStr = str(lives)
# set speed string
if(speed == .2):
speedStr = 'Slow'
elif(speed == .12):
speedStr = 'Medium'
elif(speed == .07):
speedStr = 'Fast'
# set size string
if(size == 's'):
sizeStr = 'Small'
elif(size == 'm'):
sizeStr = 'Medium'
elif(size == 'l'):
sizeStr = 'Large'
drawTile(-4, -10, " GAME OVER ", theme.get_color('border'))
drawTile(-3, -8, "Score:" + str(game.score), theme.get_color('border'))
drawTile(-3, -6, "Speed:" + speedStr, theme.get_color('border'))
drawTile(-3, -4, "Size:" + sizeStr, theme.get_color('border'))
drawTile(-3, -2, "Lives:" + livesStr, theme.get_color('border'))
if parser.args.tutorial:
drawTile(-6, 2, " Press [ENTER] to exit ", theme.get_color('border'))
else:
drawTile(-7, 2, " Press [ENTER] to continue ", theme.get_color('border'))
示例10: drawTile
def drawTile(x, y, tile='', color=None):
color = color or theme.get_color('default')
x = x * 2 + stage.padding[3] * 2 + stage.width / 2
y += stage.padding[0] + stage.height / 2
screen.addstr(y, x, tile, color)
if (len(tile) < 2):
screen.addstr(y, x + 1, tile, color)
示例11: drawTile
def drawTile(x, y, tile='', color=None):
color = color or theme.get_color('default')
x = x * 2 + stage.padding[3] * 2 + stage.width / 2
y += stage.padding[0] + stage.height / 2
try:
screen.addstr(y, x, tile, color)
if (len(tile) < 2):
screen.addstr(y, x + 1, tile, color)
except:
# This is not the built-in exit, rather the one declared later on
exit()
示例12: drawHeader
def drawHeader():
header = []
header.append(".-------------------------------------------------------------.")
header.append("| .---._____ ______ ______ ______ _____ |")
header.append("| ( 8 ____ \___/ ____ \___/ ____ \___/ ____ \___/ ____`=- |")
header.append("| '---' \_____/ \_____/ \_____/ \_____/ |")
header.append("| ____ _ _____ _ _ _ |")
header.append("| / ___| _ __ __ _| | _____ | ____|__| (_) |_ ___ _ __ |")
header.append("| \___ \| '_ \ / _` | |/ / _ \ | _| / _` | | __/ _ \| '__| |")
header.append("| ___) | | | | (_| | < __/ | |__| (_| | | || (_) | | |")
header.append("| |____/|_| |_|\__,_|_|\_\___| |_____\__,_|_|\__\___/|_| |")
header.append("| |")
header.append("'-------------------------------------------------------------'")
x = (stage.width / 2) - 25
y = (-stage.height / 2) - 15
color = theme.get_color('menu')
for e in header:
drawTile(x, y, e, color)
y += 1
示例13: drawBorders
def drawBorders():
tile_v = theme.get_tile('border-v')
tile_h = theme.get_tile('border-h')
tile_c = theme.get_tile('border-c')
color = theme.get_color('border')
x_left = stage.boundaries['left']
x_right = stage.boundaries['right']
y_top = stage.boundaries['top']
y_bottom = stage.boundaries['bottom']
for y in range(y_top, y_bottom):
drawTile(x_left - 1, y, tile_v, color)
drawTile(x_right, y, tile_v, color)
for x in range(x_left, x_right):
drawTile(x, y_top - 1, tile_h, color)
drawTile(x, y_bottom, tile_h, color)
drawTile(x_left - 1, y_top - 1, tile_c, color)
drawTile(x_left - 1, y_bottom, tile_c, color)
drawTile(x_right, y_top - 1, tile_c, color)
drawTile(x_right, y_bottom, tile_c, color)
示例14: drawGame
def drawGame():
for y in range(stage.boundaries['top'], stage.boundaries['bottom']):
for x in range(stage.boundaries['left'], stage.boundaries['right']):
drawTile(x, y, theme.get_tile('bg'), theme.get_color('bg'))
drawBorders()
drawText()
示例15: drawText
def drawText():
color = theme.get_color('border')
score_text = _("score:")
drawTile((stage.width / 2) - (len(score_text) / 2) - 2, (-stage.height / 2) - 1, score_text, color)
drawTile((-stage.width / 2), (-stage.height / 2) - 1, _("lives:"), color)
drawTile(-5, (stage.height / 2), _(" Press Q to quit "), color)