Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the rest of the iSteamInput API #166

Open
codingMASTER398 opened this issue Sep 16, 2024 · 1 comment
Open

Implement the rest of the iSteamInput API #166

codingMASTER398 opened this issue Sep 16, 2024 · 1 comment

Comments

@codingMASTER398
Copy link

Steamworks-rs supports some functions that I'd really like, such as "get_glyph_for_action_origin", "get_motion_data", "show_binding_panel", "run_frame", etc. They're not in steamworks.js though, and that's a shame. I wasted about 3 days trying to get steamworks-node to work, to no avail either.

I'll try and implement them myself, but I know next to nothing about Rust. It'd be great to have official support for this.

@tomm1996
Copy link

tomm1996 commented Nov 3, 2024

+1, I'd also be very interested in GetDigitalActionHandle and GetAnalogActionHandle, since as I understand it the respective funcitons without Handle expect bigints that can only be queried with those.

edit: nvm, I figured it out.

const client = steamworks.init(<appID>);

client.input.init();

// query the IDs (bigints) the steamworks sdk assigns to your game actions
// action strings are the keys of the actions defined in <Steam Install Path>\controller_config\game_actions_<appID>.vdf
const jump = client.input.getDigitalAction('jump');
const move = client.input.getAnalogAction('move');

// replace setInterval with Ipc polls or query them directly in your requestAnimationFrame-Loop if you enabled native modules in renderer thread
setInterval(() => {
    client.input.getControllers().forEach((controller) => {
        // query the input state of your actions using the previously queried action IDs
        console.log(controller.isDigitalActionPressed(jump)); // true | false
        console.log(controller.getAnalogActionVector(move)); // {x: int, y: int}
    });
}, 1000);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants