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

Incomplete frame with SDL renderer #63

Closed PFGimenez closed 5 years ago

PFGimenez commented 5 years ago

Hi.

Problem

I have a problem when drawing a frame with the SDL renderer: some parts are not drawn.

I force the renderer to be SDL because, otherwise, my custom fonts are not properly loaded (I might add another issue about this).

What I see (the yellow border is drawn by my OS): screenshot

The same code works normally with the libtcod version of http://rogueliketutorials.com

Minimal example code

import time

import tcod

# Setup the font.
tcod.console_set_custom_font(
    'arial10x10.png',
    tcod.FONT_LAYOUT_TCOD,
    )
# Initialize the root console in a context.
with tcod.console_init_root(10, 10, 'title', renderer=tcod.RENDERER_SDL) as root_console:
    tcod.console_print_frame(root_console,0,0,10,10)
    tcod.console_print_frame(root_console,3,3,5,5)
    tcod.console_flush() # Show the console.
    time.sleep(3) # Wait 3 seconds.
# The window is closed here, after the above context exits.

Configuration

I use python 3.7.2+, python-tcod 8.3.2 and SDL 2.0.9 on Debian testing. I got the same problem with another computer (Ubuntu 18.04) with SDL 2.0.8.

EDIT : add python version

HexDecimal commented 5 years ago

I'm able to reproduce the issue, but I don't have the yellow border.

PFGimenez commented 5 years ago

The yellow border is drawn by my OS !

PFGimenez commented 5 years ago

And I just remarked that I have the same problem without forcing the SDL renderer. Sorry, my issue is a bit messy. My default renderer is tcod.RENDERER_GLSL.

HexDecimal commented 5 years ago

Looks like this is two bugs:

Fonts are not loaded properly when using FONT_LAYOUT_TCOD or FONT_LAYOUT_CP437.

console_print_frame clears the wrong rectangle when it doesn't begin at the upper left corner.

PFGimenez commented 5 years ago

By the way, thanks for maintaining this library. It's really helpful for a wannabe roguelike dev like me !

HexDecimal commented 5 years ago

You're welcome.

Released version 8.4.2 which fixes the print_frame issue.

Added the tcod.FONT_TYPE_GREYSCALE flag to the documentation example which fixes the visible tileset corruption.

Be sure to reopen this issue if you still have problems.