Re: How can I get input using SDL without this strange edit box popping up

2020-09-24 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

Hi and thanks fo explaining.I was already ignoring repeated key events. It's a little bit more complicated than that. Each key has its own internal state, and my SDL event handling loop updates that keys state.I also have some logic which lets me check if the key has been held down for, say, 300 MS.

URL: https://forum.audiogames.net/post/573827/#p573827




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-24 Thread AudioGames . net Forum — Developers room : Ian Reed via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

@keithwipf1:Most games want to pay attention to both key down and key up events, as well as remember which keys are currently held.Consider jumping in Super Mario Brothers or Donkey Kong Country.When you press down the jump button, the code initiates your jump immediately.It then increases your height until you either release the key, or reach the maximum height you are allowed to jump.Then it reduces your height until you land.If you only paid attention to the key up event for a jump, then you would not jump until you released the key, which would both feel laggy, and not allow you to adjust how high your jump is based on how long you hold the button.Obviously you don't need behavior that advanced in a menu, but waiting for the key up event tends to add between 60 and 90ms of extra latency when I am trying to press and release the key quickly, and between 100 and 200ms when I am pressing keys in a more casual way as I would in a menu.I can send a network packet from San Francisco to London in about 70ms, so wasting that much latency on waiting for a key up instead of a key down seems unnecessary.Someone has a _javascript_ example that measures the time between your key down and key up events here, though it would be trivial to make your own more accessible test:http://jsfiddle.net/jfriend00/AveZP/It is not hard to ignore repeat key down events.Both SDL and win32 provide information with the key down event that tells you whether it was a repeat key or not, so just check that value and ignore the repeat keys.In addition, you usually want to remember which keys are currently held anyway, which would also allow you to know if a key down event is a repeat key by checking it against your array of held key states, just in case the input API were not telling you whether it was a repeat key.There are some situations where waiting to perform the action until you receive a key up is the right choice.For instance, the Humanware Victor Reader Stream waits for key up events before performing actions.This is because some of the keys perform a secondary action if you hold them instead of just quick pressing them.Obviously you can only determine if a user is going to quick press or hold for multiple seconds by waiting until the key up fires or a certain amount of time passes after receiving the key down event without receiving the key up event.In this case, the key down event is still important because it marks the start time.Players may appreciate key repeat in very large menus, such as an inventory with no limit to the number of items it can hold.I definitely had complaints when I accidentally disabled key repeat in Tactical Battle grids, as people would use it to move their review cursor across the map quickly.You can also support page down and page up keys, or control arrow keys to jump by larger amounts as an alternative to key repeat.If you actually want to use key repeat, but do not want players to configure it in windows themselves, you can always simulate key repeats within your game by recording the timestamp when a key was first held, then triggering repeats at certain intervals.Bokurano Daibouken 3 and ShadowRine seem to do something like this with their tile camera / field viewers.You could do something similar for a pistol that you have fire again after a cooldown time.For something with constant fire like a machine gun or flame thrower I would just pay attention to the fact that the key is held and deal a small amount of damage on every frame, keeping a constant fire sound looping seamlessly.Also worth realizing that double click or double tap actions either require you to always wait long enough to detect the second tap, or ensure the single click action is impotent or naturally extended by the double click action.An example of the latter would be how single clicking the mouse on an icon in windows selects that item, and double clicking activates it.It makes sense that activating an item would also select it, so having the single click perform the first part of that sequence is fine and can be responded to immediately.Fighter style games such as the Street Fighter, Mortal Kombat, or Killer Instinct series actually incorporate initiating animation sequences for actions and then aborting those if you follow them up quickly enough with additional key presses that change the initial action into a combo / special move.They also keep a history of key down and key up events with timestamps so they can detect those combos that are a sequence of key presses.Hope some of this information is helpful.

URL: https://forum.audiogames.net/post/573789/#p573789




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-23 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

Keyup gives you every time the player releases a key, which can be useful in menu contexts to prevent skipping items if the player happens to hold the button too long.  Also, the repeat rate of keydown in general--not just with sdl--is variable and you can literally go change it in a Windows control panel with a slider.  There's uses for it but probably not menu navigation, not unless you know people who know how long to hold the a key to get exactly 3 as in a row.But more to the general point, if you hook keydown directly to a gun or something without further processing, I can open control panel, up that slider, and now my gun shoots twice as fast.  It's easy to get keyup right, you only ever get one, but keydown in general is harder.

URL: https://forum.audiogames.net/post/573561/#p573561




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-23 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I decided to do menu navigation manually and keep SDL input around for things like virtual input boxes.BTW, why check for the key up event? I assume you're talking about detecting caps-lock?

URL: https://forum.audiogames.net/post/573505/#p573505




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-19 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

@7, your misusing the text input APIs. You have two options: you can either check for an SDL_KEYUP event (not SDL_KEYDOWN), and then analyze each possible key and do a search manually for that, or you can monitor for SDL_SYSWMEVENT. You can see that data structure over here. I don't know if you can check the unicode event field, just because the SDL_Event struct has a union in it, and I think the .unicode member is a member of one of those unions.

URL: https://forum.audiogames.net/post/572241/#p572241




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-19 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

@7, your misusing the text input APIs. You have two options: you can either check for an SDL_KEYUP event (not SDL_KEYDOWN), and then analyze each possible key and do a search manually for that, or you can monitor for SDL_SYSWMEVENT. You can see that data structure over here.

URL: https://forum.audiogames.net/post/572241/#p572241




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-19 Thread AudioGames . net Forum — Developers room : Ian Reed via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

@keithwipf1, I have not used SDL, but hopefully there is a way you can get the character inputs for your menus without rendering a textbox.Windows actually sends WM_KEYDOWN, WM_CHAR, and WM_KEYUP messages.The WM_CHAR messages give you the UTF16 character that was produced by the keyboard, taking into account whether shift was held, caps lock was on, and any OS keyboard layout or language settings that may affect it.I see that this page talks about getting the UTF16 unicode value from the SDL_keysym.unicode field:https://www.libsdl.org/release/SDL-1.2. … board.htmlIt looks to be documentation for an older version of SDL. Hopefully it still works in your version.

URL: https://forum.audiogames.net/post/572236/#p572236




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-19 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I suspect your problem is that you're overusing those APIs.  They're explicitly intended for the case where you want to render a textbox, not for the case where you want to arrow through a menu.  Just handle it yourself.

URL: https://forum.audiogames.net/post/57/#p57




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-19 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I feel like it's a bit more serious than that.My example has a menu. Every time you press enter on a menu item, or press escape to close the menu, this edit box thing comes up. Since it blocks the arrow keys but not the enter or escape keys for some reason, you have to alt+tab away from the window, then alt+tab back to continue scrolling around in the menu or what ever you were doing.This doesn't seem to be noticeable with sapi though, it works as intended in that case.I'm starting to suspect this isn't the on-screen keyboard at all, since I don't have it enabled, something more along the lines of SDL_SetTextInputRectEdit: I need text input in menus for first letter navigation.

URL: https://forum.audiogames.net/post/572212/#p572212




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-19 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I feel like it's a bit more serious than that.My example has a menu. Every time you press enter on a menu item, or press escape to close the menu, this edit box thing comes up. Since it blocks the arrow keys but not the enter or escape keys for some reason, you have to alt+tab away from the window, then alt+tab back to continue scrolling around in the menu or what ever you were doing.This doesn't seem to be noticeable with sapi though, it works as intended in that case.I'm starting to suspect this isn't the on-screen keyboard at all, since I don't have it enabled, something more along the lines of SDL_SetTextInputRect

URL: https://forum.audiogames.net/post/572212/#p572212




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-18 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

You can't fix this reliably for anyone in anything. Just tell people "sorry, the on-screen keyboard might come up".  because that's a thing, and it will happen, and I don't think that the framework you use will let you fix that (also: lots of languages need that kind of thing to even enter text in the first place).

URL: https://forum.audiogames.net/post/571968/#p571968




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-18 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

That's not going to solve the problem if I distribute my program.I feel like the fact that my code is calling SDL_StopTextInput() and then calling SDL_StartTextInput pretty much right after that is responsible for this, since this didn't happen in my test where I just called SDL_StartTextInput() and echoed the typed characters.I wanted to save a little bit of performance, but I guess you can't have everything.

URL: https://forum.audiogames.net/post/571960/#p571960




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-17 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I would recommend handling input using SDL instead of processing it yourself, given all the extra things you'd need to handle (it makes things much easier). Going into settings -> ease of access -> Keyboard, and toggling "On-Screen Keyboard," should fix that problem for you.

URL: https://forum.audiogames.net/post/571658/#p571658




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-17 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I only think it's the on-screen keyboard because that's the only odd thing that the SDL documentation mentions. I don't think my laptop has a touch screen though.

URL: https://forum.audiogames.net/post/571655/#p571655




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: How can I get input using SDL without this strange edit box popping up

2020-09-17 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: How can I get input using SDL without this strange edit box popping up

I think broadly speaking, you'll end up wanting to handle it yourself anyway.  But you're right that this is lame.  it's one of the reasons I was hoping to find a Rust library that does native GUI one of these days and is why I'm considering using something with WX instead.  Seemingly you can get a good library for game stuff or a good library for UI accessibility but never, ever both.If you're in Python you might look into popping open a wx textbox.  If you're in C/C++ you might look into making a little library that pops open a  textbox and blocks the thread. The latter is on my list plus a C binding.Not sure specifically about on-screen keyboards. I thought that only opened if your device had a touchscreen, in general, so if it does you might be getting that and can confirm it by actually touching the screen (NVDA supports what is basically explore by touch).

URL: https://forum.audiogames.net/post/571653/#p571653




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


How can I get input using SDL without this strange edit box popping up

2020-09-17 Thread AudioGames . net Forum — Developers room : keithwipf1 via Audiogames-reflector


  


How can I get input using SDL without this strange edit box popping up

Sometimes when I call SDL_StartTextInput and SDL_StopTextInput, some kind of edit field seems to pop up every time I press escape. I checked the documentation and it mentions that this can turn on the on-screen-keyboard and I assume it's related to that. Since this can prevent me from using the arrow keys, is there a way to turn that off?Or should I do my own input handling?My worry with the latter is that there doesn't seem to be a way to detect if the caps lock key is on, so I'd have to assume it was off and , toggle an internal state when you press it. There are probably other corner cases with this approach as well.Any ideas?

URL: https://forum.audiogames.net/post/571638/#p571638




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector