Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTY display? #28

Open
airstruck opened this issue Jul 7, 2017 · 0 comments
Open

TTY display? #28

airstruck opened this issue Jul 7, 2017 · 0 comments
Projects

Comments

@airstruck
Copy link

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

  • src/ttyDisplay.lua has more or less the same interface as src/display.lua.
  • examples/tty.lua is almost identical to preciseWithMovingPlayer, but uses ttyDisplay.
  • examples/ttyNonblock.lua is similar, but sets stdin to non-blocking to support special keys (multi character escape sequences).

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:

  • Has anyone already worked on a TTY display for rotLove?
  • How to handle display backends unrelated to Love, with respect to maintaining unified interface among backend APIs, given the challenges presented by Love's "unique" design?
@paulofmandown paulofmandown added this to Review in rotLove Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
rotLove
  
Review
Development

No branches or pull requests

1 participant