The SDL forums have moved to
This is just a read-only archive of the previous forums, to keep old links working.

SDL Forum Index
Simple Directmedia Layer Forums
Is it possible to get input from devices without a window?

Joined: 26 Jun 2016
Posts: 1
Location: UK
Hi Everyone,

I'm just curious if anyone knows a way of detecting input from a keyboard and/or gamepad using SDL2 without first creating a window. I want to be able to process input using SDL2 to use inside of the console (in windows) for a small console game I'm creating. So far I have tried the polling events method of getting input from the keyboard, and I've also tried using the keystates method. Neither method worked unless I generated a window first however I don't require a window for the game itself. Is it possible to detect input without generating a window?

My next step is going to be to try generating a window and then hiding it but I'm assuming as with most applications that if the focus isn't on the window (e.g. the window is minimized) then the input will stop being detected.

I thought before attempting this I would ask for any suggestions that might be better then this approach?

Thanks Very Happy


Joined: 03 Jul 2016
Posts: 7
Let's see the page -

As well, if need, you can create hidden window and handle events from it.