#ruby - 26 November 2018
« Back 1 day Forward 1 day »
[08:15:42] jnoon: does anyone have a solid understanding of ruby on windows? i have a solid understanding of it on osx and linux, but hardly know anything about windows in general. but now i need to, unfortunately. im trying to understand stuff related to native extensions. ill just ask and if anyone knows, great!…
[08:18:54] jnoon: my current understanding is basically rubyinstaller is the way people use ruby on windows. this is based on using mingw as the compiler. so if you build a native extension with say c++ code, that c++ code must also be compiled by mingw in order to work in ruby and link to other libraries. msvc for ruby is pretty much a non-starter and even if you can get it to work, you would be fighting most other gems that might not. is that
[21:58:29] Radar: How would I make a Ruby program pause, and then continue after _any_ key press? That's including modifier keys, like Cmd, Shift, etc.
[23:05:57] zenspider: Radar: I _believe_ you could do it with something like my graphics gem... using SDL's key scanning
[23:06:02] Radar: zenspider: yeah, a plain Ruby script. I don't think it's possible either. I'll just take my chances that whoever's going to press "any key" doesn't try pressing one of the modifiers.
[23:07:35] Radar: I'm writing a Ruby script as a part of trick that makes it seem like a "random" algorithm always determines a selected playing card. Trying to work out the flow of the trick at the moment.
[23:08:38] Radar: Like this, but deterministic: https://gist.github.com/radar/d06939eccc3d3088b3c1ab5e74b15a68
[23:16:15] eam: Radar: cannot be done through a terminal, but you can do it with any native windowing gem
[23:17:13] eam: you can probably create a windowing context from a program that looks like a terminal app
[23:17:54] eam: zenspider: I'm pretty sure there's simply no data passed along the tty when those keys are pressed
[23:26:55] eam: zenspider: you sent me on a goose chase because I was sure it's impossible. Turns out that method only works if you're linking PDCurses (not ncurses, etc) and the way PDCurses does it is .... create a native windowing context
[23:29:45] eam: so for sure, can't extract it from the terminal -- but if you're a terminal program and happen to know you can access the windowing context you can create one invisibly and interact with the keyboard directly