@nativewrappers/redm 0.0.84 → 0.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RawControls.d.ts +25 -4
- package/RawControls.js +31 -8
- package/RawKeymaps.d.ts +49 -0
- package/RawKeymaps.js +79 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -1
package/RawControls.d.ts
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import type { RawKeys } from "./enums/RawKeys";
|
|
2
2
|
export declare class RawControls {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Disables the raw key this frame, making any calls return false even if they
|
|
5
|
+
* are currently pressed/released.
|
|
6
|
+
*/
|
|
7
|
+
static DisableKeyThisFrame(rawKey: RawKeys): void;
|
|
8
|
+
/**
|
|
9
|
+
* If the raw key is was just pressed down, will return false if disabled with {@link DisableKeyThisFrame}
|
|
10
|
+
* and {@link canBeDisabled} is set to true
|
|
11
|
+
*/
|
|
12
|
+
static WasJustPressed(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If the raw key is currently pressed down, will return false if disabled with {@link DisableKeyThisFrame}
|
|
15
|
+
* and {@link canBeDisabled} is set to true
|
|
16
|
+
*/
|
|
17
|
+
static IsKeyPressed(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If the raw key is in its up state, will return false if disabled with {@link DisableKeyThisFrame}
|
|
20
|
+
* and {@link canBeDisabled} is set to true
|
|
21
|
+
*/
|
|
22
|
+
static IsKeyReleased(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* If the raw key is was just released, will return false if disabled with {@link DisableKeyThisFrame}
|
|
25
|
+
* and {@link canBeDisabled} is set to true
|
|
26
|
+
*/
|
|
27
|
+
static WasJustReleased(rawKey: RawKeys, canBeDisabled?: boolean): boolean;
|
|
7
28
|
}
|
package/RawControls.js
CHANGED
|
@@ -4,17 +4,40 @@ class RawControls {
|
|
|
4
4
|
static {
|
|
5
5
|
__name(this, "RawControls");
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Disables the raw key this frame, making any calls return false even if they
|
|
9
|
+
* are currently pressed/released.
|
|
10
|
+
*/
|
|
11
|
+
static DisableKeyThisFrame(rawKey) {
|
|
12
|
+
DisableRawKeyThisFrame(rawKey);
|
|
9
13
|
}
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
/**
|
|
15
|
+
* If the raw key is was just pressed down, will return false if disabled with {@link DisableKeyThisFrame}
|
|
16
|
+
* and {@link canBeDisabled} is set to true
|
|
17
|
+
*/
|
|
18
|
+
static WasJustPressed(rawKey, canBeDisabled = true) {
|
|
19
|
+
return canBeDisabled ? IsRawKeyDown(rawKey) : IsDisabledRawKeyDown(rawKey);
|
|
12
20
|
}
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
/**
|
|
22
|
+
* If the raw key is currently pressed down, will return false if disabled with {@link DisableKeyThisFrame}
|
|
23
|
+
* and {@link canBeDisabled} is set to true
|
|
24
|
+
*/
|
|
25
|
+
static IsKeyPressed(rawKey, canBeDisabled = true) {
|
|
26
|
+
return canBeDisabled ? IsRawKeyPressed(rawKey) : IsDisabledRawKeyPressed(rawKey);
|
|
15
27
|
}
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
/**
|
|
29
|
+
* If the raw key is in its up state, will return false if disabled with {@link DisableKeyThisFrame}
|
|
30
|
+
* and {@link canBeDisabled} is set to true
|
|
31
|
+
*/
|
|
32
|
+
static IsKeyReleased(rawKey, canBeDisabled = true) {
|
|
33
|
+
return canBeDisabled ? IsRawKeyReleased(rawKey) : IsDisabledRawKeyReleased(rawKey);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* If the raw key is was just released, will return false if disabled with {@link DisableKeyThisFrame}
|
|
37
|
+
* and {@link canBeDisabled} is set to true
|
|
38
|
+
*/
|
|
39
|
+
static WasJustReleased(rawKey, canBeDisabled = true) {
|
|
40
|
+
return canBeDisabled ? IsRawKeyUp(rawKey) : IsDisabledRawKeyUp(rawKey);
|
|
18
41
|
}
|
|
19
42
|
}
|
|
20
43
|
export {
|
package/RawKeymaps.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { RawKeys } from "./enums/RawKeys";
|
|
2
|
+
export type KeymapFunction = () => void;
|
|
3
|
+
/**
|
|
4
|
+
* A builder for RawKeymap, you should call {@link finish} to actually register the raw keymap
|
|
5
|
+
* This should be usable across resource bounds, so you can create the keymap
|
|
6
|
+
* and pass the object to a manager to handle rebinding the maps with calls.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RawKeymap {
|
|
9
|
+
#private;
|
|
10
|
+
/**
|
|
11
|
+
* @param keymapName the name of the keymap to register to, this should be unique across all resources.
|
|
12
|
+
* @param rawKey the key to bind to initially, this can be rebound with {@link setRawKey}
|
|
13
|
+
* @param canBeDisabled if the key can be disabled with {@link RawControls.DisableKeyThisFrame}
|
|
14
|
+
*/
|
|
15
|
+
constructor(keymapName: string, rawKey: RawKeys, canBeDisabled: boolean);
|
|
16
|
+
getKeymapName: () => string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the current raw keymap
|
|
19
|
+
*/
|
|
20
|
+
getRawKeymap: () => RawKeys;
|
|
21
|
+
/**
|
|
22
|
+
* Sets the function to be used onKeyUp
|
|
23
|
+
*/
|
|
24
|
+
setOnKeyUp: (fn: KeymapFunction) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the function to be used on onKeyDown
|
|
27
|
+
*/
|
|
28
|
+
setOnKeyDown: (fn: KeymapFunction) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Remaps the current {@link RawKeymap}'s raw key to {@link key}
|
|
31
|
+
*/
|
|
32
|
+
setRawKey: (key: RawKeys) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Sets the function to be used on onKeyUp, if you need to use this across
|
|
35
|
+
* resource bounds you should use {@link setOnKeyUp}
|
|
36
|
+
*/
|
|
37
|
+
set OnKeyUp(fn: KeymapFunction);
|
|
38
|
+
/**
|
|
39
|
+
* Sets the function to be used on onKeyDown, if you need to use this across
|
|
40
|
+
* resource bounds you should use {@link setOnKeyDown}
|
|
41
|
+
*/
|
|
42
|
+
set OnKeyDown(fn: KeymapFunction);
|
|
43
|
+
/**
|
|
44
|
+
* Changes the {@link RawKeymap} to use the {@link key} for its keymap
|
|
45
|
+
*/
|
|
46
|
+
set RawKey(key: RawKeys);
|
|
47
|
+
get KeymapName(): string;
|
|
48
|
+
finish(): void;
|
|
49
|
+
}
|
package/RawKeymaps.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
class RawKeymap {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "RawKeymap");
|
|
6
|
+
}
|
|
7
|
+
#keymapName;
|
|
8
|
+
#rawKey;
|
|
9
|
+
#canBeDisabled;
|
|
10
|
+
#onKeyUp = null;
|
|
11
|
+
#onKeyDown = null;
|
|
12
|
+
/**
|
|
13
|
+
* @param keymapName the name of the keymap to register to, this should be unique across all resources.
|
|
14
|
+
* @param rawKey the key to bind to initially, this can be rebound with {@link setRawKey}
|
|
15
|
+
* @param canBeDisabled if the key can be disabled with {@link RawControls.DisableKeyThisFrame}
|
|
16
|
+
*/
|
|
17
|
+
constructor(keymapName, rawKey, canBeDisabled) {
|
|
18
|
+
this.#keymapName = keymapName;
|
|
19
|
+
this.#rawKey = rawKey;
|
|
20
|
+
this.#canBeDisabled = canBeDisabled;
|
|
21
|
+
}
|
|
22
|
+
getKeymapName = /* @__PURE__ */ __name(() => {
|
|
23
|
+
return this.#keymapName;
|
|
24
|
+
}, "getKeymapName");
|
|
25
|
+
/**
|
|
26
|
+
* Gets the current raw keymap
|
|
27
|
+
*/
|
|
28
|
+
getRawKeymap = /* @__PURE__ */ __name(() => {
|
|
29
|
+
return this.#rawKey;
|
|
30
|
+
}, "getRawKeymap");
|
|
31
|
+
/**
|
|
32
|
+
* Sets the function to be used onKeyUp
|
|
33
|
+
*/
|
|
34
|
+
setOnKeyUp = /* @__PURE__ */ __name((fn) => {
|
|
35
|
+
this.#onKeyUp = fn;
|
|
36
|
+
}, "setOnKeyUp");
|
|
37
|
+
/**
|
|
38
|
+
* Sets the function to be used on onKeyDown
|
|
39
|
+
*/
|
|
40
|
+
setOnKeyDown = /* @__PURE__ */ __name((fn) => {
|
|
41
|
+
this.#onKeyDown = fn;
|
|
42
|
+
}, "setOnKeyDown");
|
|
43
|
+
/**
|
|
44
|
+
* Remaps the current {@link RawKeymap}'s raw key to {@link key}
|
|
45
|
+
*/
|
|
46
|
+
setRawKey = /* @__PURE__ */ __name((key) => {
|
|
47
|
+
this.#rawKey = key;
|
|
48
|
+
RemapRawKeymap(this.#keymapName, key);
|
|
49
|
+
}, "setRawKey");
|
|
50
|
+
/**
|
|
51
|
+
* Sets the function to be used on onKeyUp, if you need to use this across
|
|
52
|
+
* resource bounds you should use {@link setOnKeyUp}
|
|
53
|
+
*/
|
|
54
|
+
set OnKeyUp(fn) {
|
|
55
|
+
this.#onKeyUp = fn;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets the function to be used on onKeyDown, if you need to use this across
|
|
59
|
+
* resource bounds you should use {@link setOnKeyDown}
|
|
60
|
+
*/
|
|
61
|
+
set OnKeyDown(fn) {
|
|
62
|
+
this.#onKeyDown = fn;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Changes the {@link RawKeymap} to use the {@link key} for its keymap
|
|
66
|
+
*/
|
|
67
|
+
set RawKey(key) {
|
|
68
|
+
this.setRawKey(key);
|
|
69
|
+
}
|
|
70
|
+
get KeymapName() {
|
|
71
|
+
return this.#keymapName;
|
|
72
|
+
}
|
|
73
|
+
finish() {
|
|
74
|
+
RegisterRawKeymap(this.#keymapName, this.#onKeyUp, this.#onKeyDown, this.#rawKey, this.#canBeDisabled);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
RawKeymap
|
|
79
|
+
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"type": "module",
|
|
11
|
-
"version": "0.0.
|
|
11
|
+
"version": "0.0.86",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "https://github.com/nativewrappers/nativewrappers.git"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"./**/*.js",
|
|
29
29
|
"./**/*.d.ts"
|
|
30
30
|
],
|
|
31
|
+
"sideEffects": false,
|
|
31
32
|
"exports": {
|
|
32
33
|
".": "./index.js",
|
|
33
34
|
"./*": "./*"
|