1. Paul Sexton
  2. cl-tcod
  3. Issues
Issue #1 resolved

Working around mouse event issues.

Owen Rodley
created an issue

There are issues with mouse handling in cl-tcod. I'm sure you're aware of this as there is a comment mentioning it in the source. You mention reading the current state, but I've also found that there are issues with mouse events. For example, I'll make a call to tcod:sys-wait-for-event and click all over the window, and get only sporadic :EVENT-MOUSE-MOVE events.

Mouse events are pretty important for my project, so I'm considering writing some code to interface with SDL directly to retrieve events. Does this sound useful to merge into the main library? If not I'll make it a separate little module in my project rather than integrating it with cl-tcod.

Of course the ideal solution would be to fix the cl-tcod event functions, but I have no idea where to even start with that. It seems to work correctly in the current libtcod-1.5.1, as the mouse section of the sample program functions perfectly. I don't know what it could be about cl-tcod that makes this particular usage of CFFI broken, as I have no experience working with it.

If you have any pointers as to what could be causing this I'd be happy to try and investigate, as fixing the existing functions would be much nicer than bypassing libtcod altogether.

Comments (3)

  1. Paul Sexton repo owner

    Hi, the cl-tcod mouse functions were working OK for me on OSX when I last checked them, but this was > 6 months ago. Unfortunately libtcod development seems to be quite sporadic and lacking in releases - a problem that is also rife among common lisp library authors ;). The author will stay on one minor revision number for years while making numerous backwards-incompatible changes to the API. So it's possible jice has changed something in libtcod in the last few months that has affected the mouse.

    In my "dormouse" library, which uses cl-tcod, there is a "gui-demo" program. You could try running this and seeing if the mouse works OK there.

    I am unlikely to be able to look at this problem myself for some time, but if you decide to write wrappers to SDL functions I would be happy to look at folding them into cl-tcod.

  2. Owen Rodley reporter

    Hmm. I tried out the dormouse demo as you suggested and the mouse worked fine there. I then tested it again in my program and it seems to work. I'm not quite sure what the problem was, probably something to do with the way I was testing it at the REPL.

    At any rate, it seems to work fine. Sorry for the trouble :)

    By the way, I think you forgot to update the demo after some more recent changes to dormouse - in particular I had to add :hotkey before add-item's 4th argument in a few places. I would open a pull request fixing this but it seems there are some graphical glitches you might want to look at as well. I'm not sure how it's supposed to look, but I couldn't see any text on any of the windows and the windows themselves looked a little peculiar. Hopefully you'll see what I mean, if not I can give you a more detailed description.

  3. Log in to comment