libtcod / python-tcod

A high-performance Python port of libtcod. Includes the libtcodpy module for backwards compatibility with older projects.
BSD 2-Clause "Simplified" License
410 stars 36 forks source link

tcod.sys_get_char_size() always return (8, 8) #68

Closed FractalWire closed 5 years ago

FractalWire commented 5 years ago

Hey,

When using tcod.sys_get_char_size(), the value returned seem to always be (8,8) Tested the function with :

The flag used is : flag = tcod.FONT_LAYOUT_TCOD | tcod.FONT_TYPE_GREYSCALE

I want to use this in conjonction with sys_get_current_resolution() to get an appropriate width/height value for the root console.

HexDecimal commented 5 years ago

It will be fixed soon, this issue only affects the newer renderers.

Are you trying to set a window size from pixel coordinates? I need to remake the initialization function sometime.

FractalWire commented 5 years ago

I think I'm doing something fairly standard for the initialisation. Something like that :

    font = "data/fonts/terminal10x10_gs_tc.png"
    flag = tcod.FONT_LAYOUT_TCOD | tcod.FONT_TYPE_GREYSCALE
    tcod.console_set_custom_font(font, flag)
    root_console = tcod.console_init_root(width, height, "Libtcod character table lookup")

And here width and height would be something like :

r_width, r_height = tcod.sys_get_current_resolution()
c_width, c_height = tcod.sys_get_char_size()
width, height = r_width // c_width, r_height // c_height

If I wanted to have a fullscreen size.