Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ napi = { version = "2.16.8", features = ["tokio_rt", "napi6", "serde-json"] }
napi-derive = "2.16.9"
lazy_static = "1"
tokio = { version = "1", features = ["sync", "time"] }
steamworks = { git = "https://github.com/Noxime/steamworks-rs/", rev = "fbb79635b06b4feea8261e5ca3e8ea3ef42facf9", features = ["serde"] }
steamworks = { git = "https://github.com/Noxime/steamworks-rs/", rev = "d05eaa60db328156aeee172b0b157f3f69c70b30", features = [
"serde",
] }
serde = "1"
serde_json = "1"

Expand Down
6 changes: 5 additions & 1 deletion client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export declare namespace callback {
P2PSessionRequest = 6,
P2PSessionConnectFail = 7,
GameLobbyJoinRequested = 8,
MicroTxnAuthorizationResponse = 9
MicroTxnAuthorizationResponse = 9,
GameOverlayActivated = 10
}
export function register<C extends keyof import('./callbacks').CallbackReturns>(steamCallback: C, handler: (value: import('./callbacks').CallbackReturns[C]) => void): Handle
export class Handle {
Expand Down Expand Up @@ -108,6 +109,8 @@ export declare namespace input {
activateActionSet(actionSetHandle: bigint): void
isDigitalActionPressed(actionHandle: bigint): boolean
getAnalogActionVector(actionHandle: bigint): AnalogActionVector
getAnalogActionBinds(actionSetHandle: bigint, actionHandle: bigint): Array<string>
getDigitalActionBinds(actionSetHandle: bigint, actionHandle: bigint): Array<string>
getType(): InputType
getHandle(): bigint
}
Expand Down Expand Up @@ -237,6 +240,7 @@ export declare namespace utils {
}
/** @returns true if the floating keyboard was shown, otherwise, false */
export function showFloatingGamepadTextInput(keyboardMode: FloatingGamepadTextInputMode, x: number, y: number, width: number, height: number): Promise<boolean>
export function isOverlayOpened(): boolean
}
export declare namespace workshop {
export interface UgcResult {
Expand Down
4 changes: 4 additions & 0 deletions src/api/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub mod callback {
P2PSessionConnectFail,
GameLobbyJoinRequested,
MicroTxnAuthorizationResponse,
GameOverlayActivated,
}

#[napi(ts_generic_types = "C extends keyof import('./callbacks').CallbackReturns")]
Expand Down Expand Up @@ -77,6 +78,9 @@ pub mod callback {
SteamCallback::MicroTxnAuthorizationResponse => {
register_callback::<steamworks::MicroTxnAuthorizationResponse>(threadsafe_handler)
}
SteamCallback::GameOverlayActivated => {
register_callback::<steamworks::GameOverlayActivated>(threadsafe_handler)
}
};

Handle {
Expand Down
38 changes: 38 additions & 0 deletions src/api/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,44 @@ pub mod input {
}
}

#[napi]
pub fn get_analog_action_binds(
&self,
action_set_handle: BigInt,
action_handle: BigInt,
) -> Vec<String> {
let client = crate::client::get_client();
client
.input()
.get_analog_action_origins(
self.handle.get_u64().1,
action_set_handle.get_u64().1,
action_handle.get_u64().1,
)
.into_iter()
.map(|origin| format!("{:?}", origin)) // Convert each enum variant to its string representation
.collect()
}

#[napi]
pub fn get_digital_action_binds(
&self,
action_set_handle: BigInt,
action_handle: BigInt,
) -> Vec<String> {
let client = crate::client::get_client();
client
.input()
.get_digital_action_origins(
self.handle.get_u64().1,
action_set_handle.get_u64().1,
action_handle.get_u64().1,
)
.into_iter()
.map(|origin| format!("{:?}", origin)) // Convert each enum variant to its string representation
.collect()
}

#[napi]
pub fn get_type(&self) -> InputType {
let client = crate::client::get_client();
Expand Down
6 changes: 6 additions & 0 deletions src/api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,10 @@ pub mod utils {
false
}
}

#[napi]
pub fn is_overlay_opened() -> bool {
let client = crate::client::get_client();
client.utils().is_overlay_enabled()
}
}
Loading