Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console black until it is moved #57

Closed
SpaceCadetEve opened this issue Nov 16, 2018 · 7 comments
Closed

Console black until it is moved #57

SpaceCadetEve opened this issue Nov 16, 2018 · 7 comments
Assignees
Labels

Comments

@SpaceCadetEve
Copy link

I am trying to run the same code given in https://python-tcod.readthedocs.io/en/latest/tcod.html. When I run it, the console is black. When I move the console window, "Hello, world" appears.

I am running MacOS Mojave and Python 3.7.1.

@HexDecimal HexDecimal self-assigned this Nov 16, 2018
@HexDecimal HexDecimal added the bug label Nov 16, 2018
@HexDecimal
Copy link
Collaborator

I can't reproduce this on Windows. I speculate that the issue might be caused by sleeping rather than waiting for an event.

You could try replacing the sleep with tcod.console_wait_for_keypress(False).

If that doesn't work then you could use a different renderer for tcod.console_init_root such as tcod.RENDERER_OPENGL2, renderers are listed here.

The tcod.FONT_LAYOUT_ASCII_INROW flag is wrong and will be removed.

@SpaceCadetEve
Copy link
Author

I need to make a correction (I’ve been trying a handful of things to see what works).
When I run what is on that page, and I run “python3 engine.py”, it never shows a screen at all.

I used a modified version of the code at http://www.rogueliketutorials.com/libtcod/1

`import tcod

def main():
screen_width = 80
screen_height = 50

tcod.console_set_custom_font(
    'dejavu16x16_gs_tc.png',
    tcod.FONT_TYPE_GRAYSCALE | tcod.FONT_LAYOUT_TCOD,
)

root_console = tcod.console_init_root(screen_width, screen_height, 'tcod tutorial revised', False)

while True:
    root_console.clear()

    root_console.print_(10,10, "hello, world")

    tcod.console_flush()

    key = tcod.console_check_for_keypress()

    if key.vk == tcod.KEY_ESCAPE:
        return True

`
When I run this, the screen shows up, but is black.

@SpaceCadetEve
Copy link
Author

Oh, and I tried the different render modes and they either caused a crash (probably because those aren't available) or had the same effect

@HexDecimal
Copy link
Collaborator

HexDecimal commented Nov 16, 2018

Your code looks correct.

Be sure to change the default background color, example: root_console.default_bg = (0,0,255) in case that gives you something other than a black background.

All renderer modes should work on a modern computer. If there's something in libtcod causing the issue then it'd be useful if I knew which renderers were crashing.

@HexDecimal
Copy link
Collaborator

I've tracked the issue down to SDL2, version 2.0.9 fixes this issue, so I'll get it updated.

@HexDecimal
Copy link
Collaborator

tcod 8.1.0 should fix the issue. SDL2's changelog was very specific:

Mac OS X:
* Fixed black screen at start on Mac OS X Mojave

@SpaceCadetEve
Copy link
Author

I can verify that it is fixed in 8.1.1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants