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
413 stars 36 forks source link

Extend console.draw_frame to include additional decorations #73

Closed devonps closed 5 years ago

devonps commented 5 years ago

Specifically:

  1. Can the title string support colour controls to produce a multi-colour string?
  2. Can the point where the title string starts include an optional character as a decorator?

re: 2. The example I'm thinking of is Caves of Qud frames, as in ---| title string |--- Where the vertical pipe is the additional decorator.

HexDecimal commented 5 years ago

Can the title string support colour controls to produce a multi-colour string?

The frame functions defer to the normal print functions to handle the string, so this should already be supported.

Can the point where the title string starts include an optional character as a decorator?

The current implementation forces a space as padding if a string in given. So what you can do is call draw_frame without the title text, and then use a centered print_rect with the characters you actually want to draw on top of the frame. This is similar to what draw_frame already does internally.

If this isn't enough then I'm willing to add a new draw function. My own issue with it is that you can't change the border glyphs.

devonps commented 5 years ago

Thanks for the response, I think there's enough for me to work with - apart from the border glyphs, but that isn't a deal breaker.

Happy to close this request.