Why libtcod samples_cpp run like this?

120 Views Asked by At

I had build libtocd dll in my machine (version 1.5.1), but when I run samples_cpp.cpp with a win32 console project. Some chaos font show as attached picture. Anyone who konws why this happend? Many thanks for your reply.

I found that if I comment this code in main function , the result will be fine. But I don't know the root cause. Former:

int fontFlags=TCOD_FONT_TYPE_GREYSCALE|TCOD_FONT_LAYOUT_TCOD, fontNewFlags=0; 

====>

Newer:

int fontFlags=TCOD_FONT_TYPE_GREYSCALE/*|TCOD_FONT_LAYOUT_TCOD*/, fontNewFlags=0;

Result img as follows: enter link description here

sorry for less than 10 reputations to post a image, using a image URL instead.

PS: anther problem when build libtcod dll: when using zlib-1.2.3, in the header file zconf.h, I need to change as follows, Former:

#if 1           /* HAVE_UNISTD_H -- this line is updated by ./configure */

====>

Newer:

#if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */

otherwise , complier output header file unistd.h not found.

1

There are 1 best solutions below

0
On

The font that Samples.cpp is using has a different layout than other fonts.

'|TCOD_FONT_LAYOUT_TCOD' tells the computer how to read the file and get the correct characters, so by commenting that part out, it uses the wrong layout for that file.

Out of curiosity, why are you building libtcod.dll? if you're just using libtcod itself, you shouldn't need to recompile the whole thing.