Skip to content

How to replace the call to console_put_char_ex with the new API #126

Answered by HexDecimal
Andres6936 asked this question in Q&A
Discussion options

You must be logged in to vote

Okay. I've done some investigation. This line:

console.print(x, y + SCREEN_HEIGHT // 2 - WORLD_HEIGHT // 2, str(Chars[x][y]), Colors[x][y], libtcod.black)

When you call str(Chars[x][y]) it converts numbers like 176 into "176" and then the function prints the entire string. This is where the numbers are coming from. This line:

libtcod.console_put_char_ex(0, x, y + SCREEN_HEIGHT // 2 - WORLD_HEIGHT // 2, Chars[x][y], Colors[x][y], libtcod.black)

The first parameter is 0, but this should be console. Otherwise this function is ignored when a root console is missing which the new API doesn't use.

Next Chars has mixed strings and ints and the characters are all EASCII codepoints. These should b…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by HexDecimal
Comment options

You must be logged in to vote
4 replies
@HexDecimal
Comment options

@Andres6936
Comment options

@HexDecimal
Comment options

@HexDecimal
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants