Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Using KbUp and KbDown in a TextInput on a Mac
- - By naiyt Date 2016-02-21 20:28
I want to be able to utilize the up and down arrow keys inside of a TextInput to do something custom on Mac OS X. It seems that the TextInput C++ code catches those inputs on Macs, however, and makes them cause the caret to go to the start and end of the lines. Seems to be the following lines of code:

https://github.com/gosu/gosu/blob/master/src/Input/TextInput.cpp#L235-L237

That seems to intercept the keypresses, so I never see them in my button_down or by doing Gosu.button_down?(Gosu::KbUp).

Does anyone know of any easy way to get around that? Or will I need to re-learn me some C++ in order to make that configurable somehow? :)
Parent - - By jlnr (dev) Date 2016-02-22 08:09
Nooooooo, don't break my up/down keys on OS X!! ;)

I think we could add an callback like filter() except that it is called for arrow/modifier combinations? Feel free to fork gosu and give it a try. Compiling Gosu is as easy as:

cd my-gosu-fork
export GOSU_RELEASE_VERSION=0.99.0 # whatever
rake gem
gem install pkg/gosu-0.99.0.gem


Hope that helps!
Parent - By naiyt Date 2016-02-23 20:15
Thanks for the tip! I'll give it a try.

(I'm implementing a terminal of sorts for the thing I'm working on, and want to be able to use the up and down arrow keys to cycle through the command history.)
Up Topic Gosu / Gosu Exchange / Using KbUp and KbDown in a TextInput on a Mac

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill