FriedlandAaron / rs_snake

Rust implementation of the classic "Snake" game as a terminal app.
The Unlicense
0 stars 0 forks source link

Backend: Termion vs. Crossterm #13

Open FriedlandAaron opened 5 months ago

FriedlandAaron commented 5 months ago

I just had the thought, that I would like to make my app a bit more cross-platform, specifically Windows compatible (I know, Windows...). Anyway, I'm wondering if I made a mistake choosing Termion as my backend, and if I should rewrite in Crossterm instead. Perhaps I could support both? I could always rewrite the whole thing in a library like ratatui, and then have both supported, but I think I'll leave that idea for a later time.

ArielHorwitz commented 5 months ago

I know that ratatui supports both by just having a Backend trait which is implemented by both. Perhaps you can do something similar. Then you could provide both separately (possibly also with cargo features).

ArielHorwitz commented 5 months ago

I remembered there was a third as well (Termwiz)

FriedlandAaron commented 5 months ago

I know that ratatui supports both by just having a Backend trait which is implemented by both. Perhaps you can do something similar. Then you could provide both separately (possibly also with cargo features).

Yeah, this is what I was contemplating doing. I'm not familiar with cargo features yet, so I don't know what is possible with them or how to work with them.