我正在尝试使用 python 和 libtcod 创建简单的 roguelike。问题是当我尝试执行此代码时,控制台显示:
"24 bits font.
key color 0 0 0
24bits greyscalefont. converting to 32bits
libtcod 1.6.2
SDL : cannot create window"
代码:
import libtcodpy as lib
s_width = 100 #screen width
s_heigth = 60 #screen heigth
fps_lim = 20 #limit fps
lib.console_set_custom_font('arial10x10.png', lib.FONT_TYPE_GRAYSCALE | lib.FONT_LAYOUT_TCOD)
lib.console_init_root(s_width, s_heigth, 'game', False)
lib.sys_set_fps(fps_lim)
while not lib.console_is_window_closed():
lib.console_set_default_foreground(0, lib.white)
lib.console_put_char(0, 1, 1, "@", lib.BKGND_NONE)
lib.console_flush()