I have an idea of using Chinese characters as an entities in my ASCII-like roguelike console game. I'm using python-tcod, but I don't know if there is a way to use Chinese characters in it.
I tried setting Chinese fonts through console_set_custom_font function, which worked good in displaying English characters, but not the Chinese ones. They just don't display.
libtcod.console_set_custom_font('GoJuOn.TTF', libtcod.FONT_TYPE_GREYSCALE)
libtcod.console_init_root(constants['screen_width'], constants['screen_height'], constants['window_title'], False, libtcod.RENDERER_SDL2)
I tried to make my character look like 你, but got this. (You can see the character moving by it's FOV and how it covers items.)
For example, that's how it worked before.
The source code is taken from libtcod python tutorial
upd: I tried using '你'.encode() with gb18030, gbk, gb2312, hz, cp950, bi0ghkscs, big5, iso2022_jp_2 encodings, but it gave me output of wrong symbols. For example, paragraph sign or tilda ('~'), or a few letters with dots over it.
upd2: code I tried to use with another encoding
player = Entity(0, 0, '你'.encode('gb18030'), libtcod.white, 'Player',
render_order=RenderOrder.ACTOR, blocks=True,
fighter=fighter_component, inventory=inventory_component, level=level_component)
Code in common which renders char ('你' char is entity's char property)
def draw_entity(con, entity, fov_map, game_map):
if libtcod.map_is_in_fov(fov_map, entity.x, entity.y) or (entity.stairs and game_map.tiles[entity.x][entity.y].explored):
libtcod.console_set_default_foreground(con, entity.color)
libtcod.console_put_char(con, entity.x, entity.y, entity.char, libtcod.BKGND_NONE)