本文整理匯總了Python中GameState.get_msg_queue方法的典型用法代碼示例。如果您正苦於以下問題:Python GameState.get_msg_queue方法的具體用法?Python GameState.get_msg_queue怎麽用?Python GameState.get_msg_queue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GameState
的用法示例。
在下文中一共展示了GameState.get_msg_queue方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: render_messages
# 需要導入模塊: import GameState [as 別名]
# 或者: from GameState import get_msg_queue [as 別名]
def render_messages():
Render.clear_layer(layers['messages'])
y = 3 + Constants.MAP_CONSOLE_HEIGHT
for line in GameState.get_msg_queue():
if y < Constants.SCREEN_HEIGHT - 1:
line_height = 1
Render.print_rect(layers['messages'], Constants.MSG_X, y, Constants.MSG_WIDTH, line_height, line)
y += line_height
示例2: message
# 需要導入模塊: import GameState [as 別名]
# 或者: from GameState import get_msg_queue [as 別名]
def message(new_msg, color=None):
import textwrap
# split the message if necessary, among multiple lines
if len(GameState.get_msg_queue()) == Constants.MSG_HEIGHT:
GameState.del_msg(0)
GameState.add_msg(new_msg)
'''
示例3: render_messages
# 需要導入模塊: import GameState [as 別名]
# 或者: from GameState import get_msg_queue [as 別名]
def render_messages():
Utils.clear_layer(layers['messages'])
y = 3 + Constants.MAP_CONSOLE_HEIGHT
for (line, color) in GameState.get_msg_queue():
if y < Constants.SCREEN_HEIGHT - 1:
set_foreground(layers['messages'], color)
# line_height = libtcod.console_get_height_rect(consoles['panel_console'], 0, 0, Constants.MSG_WIDTH, Constants.PANEL_HEIGHT - 3, line)
line_height = 1
print_rect(layers['messages'], Constants.MSG_X, y, Constants.MSG_WIDTH, line_height, line)
y += line_height