sarkahn / bevy_ascii_terminal

A simple terminal for rendering ascii in bevy.
MIT License
86 stars 10 forks source link

Add support for rectangular fonts #2

Closed Illiux closed 2 years ago

Illiux commented 2 years ago

This turned out to be very simple to implement. I've tested that all existing examples still work as expected as well as testing this version of bevy_ascii_terminal against my project. I think it's probably worth adding one or two examples showing overlapping terminals with transparency as well as rectangular font use. Do you think that should be done in the context of this PR? Also, would it be a good idea to add at least rectangular font to the embedded fonts?

sarkahn commented 2 years ago

Great, thanks a lot!

RE adding more examples and a built in rectangular font - I'm not sure yet. Right now only TileScaling::Pixels supports non square fonts. With TileScaling::World one tile is meant to equal one world unit, this concept is at odds with non square fonts which would leave space on one axis. Meaning world scaling would leave gaps between tiles with rectangular fonts.

The only sensible way I could think to make it work with world scaling is to change the aspect ratio on the camera projection. Maybe I will add an optional built in camera for that purpose or something.

I would say for now we can just change the relevant docs to mention that non square fonts only work with pixel scaling and merge it.

Illiux commented 2 years ago

I'm not familiar with the internal details, but how does TileScaling::World handle multiple terminals with different font sizes, given you've only got the one camera projection?

sarkahn commented 2 years ago

It just builds each mesh tile so it's one world unit, how the fonts end up looking is entirely dependent on the camera projection. If you had two square fonts of different size you might get pixel artifacts unless they both happen to scale nicely with the target resolution of the camera