Skip to content

Read controller events asynchronously #3

@Scindix

Description

@Scindix

I'm trying to figure out if there is a way to use this library asynchronously.
Currently I'm using the following (utilizing c++11 threads):

void handleController()
{
    while(running)
    {
        SteamControllerEvent sce;
        for(auto dev : devices)
            SteamController_ReadEvent(dev, &sce);
    }
}
// ...
std::thread hC(handleController);
// do something
hC.join();

The problem is that SteamController_ReadEvent blocks all execution until the next event is received. Which means that my application does not close until I press some button or move the joystick.
I also tried adding the following before hC.join(); hoping that it would cancel reading the events, but to no avail.

for(auto dev : devices)
    SteamController_Close(dev);

What's the intended way to do this? Or is this even possible?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions