The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.
SDL
Simple Directmedia Layer Forums
difference of SDL_CreateWindowFrom and SDL_CreateWindow
rchu
Joined: 14 May 2015
Posts: 1
Location: China
Posted: Thu May 14, 2015 5:10 pm
My workspace is Windows / MSVC / SDL2.
What I need is just catching the joystick actions in my application window (without OpenGL rendering).
When I use SDL_CreateWindow to create a new window in a worker thread, like this:
ThreadProc()
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_CreateWindow(...)
SDL_JoystickOpen(...)
while(1)
{
SDL_WaitEvent(...)
switch(event.type)
{
case SDL_JOYAXISMOTION:
case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
}
}
}
It works well. But when I use SDL_CreateWindowFrom instead of SDL_CreateWindow, I just want to attach the event pumping to a window of myself.
It looks strange that I can only get SDL_JOYBUTTONUP event, and the SDL_JOYAXISMOTION and SDL_JOYBUTTONDOWN are missing.
As a stranger of SDL, I wonder if I was using SDL improperly, or SDL2 does not support Windows well?