tcod-rs icon indicating copy to clipboard operation
tcod-rs copied to clipboard

terminal.png not provided

Open jiri opened this issue 10 years ago • 6 comments

The tcod-rs build script could copy it to the root of the project?

jiri avatar Jan 31 '15 17:01 jiri

I'm not sure what you mean. terminal.png is checked into the tcod-rs repo:

https://github.com/tomassedovic/tcod-rs/blob/master/terminal.png

But if you mean your own projects that use the tcod crate, you should copy it yourself (either from tcod-rs or libtcod) or choose another font using tcod::Console::set_custom_font. terminal.png kind of sucks and it's there just to be able to run tests and examples easily. But in general, you should pick a font from libtcod/data/fonts/ or download a font in the same format from the internet.

tomassedovic avatar Jan 31 '15 18:01 tomassedovic

What I meant that the version checked out with the repo should be findable by the library by default.

So a solution that would use the one included when another isn't available would make most sense, perhaps? I just feel that for a total newbie, the absence of terminal.png could be confusing, especially when one is included with TCOD itself.

I propose adding a check that if the terminal.png isn't available, the provided one is used and a warning is generated in place of the "SDL : cannot load terminal.png" warning :)

jiri avatar Jan 31 '15 19:01 jiri

Sorry, I'm still not sure what your exact problem is.

Do you mean having a project that depends on the tcod crate? And when you try to run in, you get the cannot load terminal.png message? Or do you mean something else?

If that is the case, then the tcod crate and/or its build script can't really produce or load its own terminal.png. See here:

http://doc.crates.io/build-script.html

the build script has no way of knowing where the project that uses it is and it shouldn't interfere with it at all. The error message itself comes from libtcod -- the C version that tcod-rs provides Rust bindings for.

And you have the same problem with your C, C++ or Python libtcod code:

http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod,_part_1

I understand this can be frustrating for a Rust / libtcod newbie, but the best think we can do I think is just document this. Or maybe provide an engine-like function that looks for the font and if it isn't there and there isn't an alternative set, we could bail out.

But strictly speaking, with this library you're supposed to provide the fonts (just like any other assets) and the right calls yourself. Libtcod isn't as much an engine as it is a library that you write your roguelike engine on top of.

tomassedovic avatar Jan 31 '15 21:01 tomassedovic

Sorry for the latency.

Yeah, you raise some valid points there. Providing a default font with the library is probably not desirable.

Feel free to mark this as resolved ^^

jiri avatar Feb 09 '15 22:02 jiri

Cool :-). I'll keep this open because we should mention this in the docs and/or the examples.

I'd like people who aren't familiar with libtcod to use this with as few issues as possible.

tomassedovic avatar Feb 14 '15 22:02 tomassedovic

Hey, I started working on https://tomassedovic.github.io/roguelike-tutorial/part-1-graphics.html and I got stuck with the same issue as above. Not knowing enough Rust, it took me a while to find this issue which helped me solve the problem. Can the tutorial be updated to point to this issue?

fedgrant avatar Mar 17 '18 19:03 fedgrant