paulofmandown / rotLove

Roguelike Toolkit in Love. A Love2D/lua port of rot.js
http://paulofmandown.github.io/rotLove/
Other
258 stars 25 forks source link

TTY display? #28

Open airstruck opened 7 years ago

airstruck commented 7 years ago

I'd like to get rotLove working in a regular linux terminal. Has anyone tried this?

I threw a quick WIP together here: https://github.com/rotLua/rotLove/tree/ttydisplay

This seems to work pretty well, but needs a custom love.run. Ideally a demo like preciseWithMovingPlayer could load "ttyDisplay" instead of "display" and things would work with no (or few) other changes.

Using Love's APIs at all for ttyDisplay is questionable, but the goal is to allow display backend to be switched out without changing a bunch of other stuff, for example by using a command line switch when running a game. There doesn't seem to be any way around using Love's APIs directly since those APIs are only intended for end-users and not for library authors (anything destructive like love.update = func or love.keypressed = func is not really designed for library code), meaning the library can't simply encapsulate this functionality and abstract it away with its own API.

As far as I can tell, this means there's really no way to achieve an API like the display from rot.js, which uses stuff like requestAnimationFrame internally rather than requiring the client to call methods like display:update() and display:draw().

Anyway, TLDR, I'm wondering two things: