@utsp/types 0.14.0 → 0.14.2
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/dist/index.cjs +1 -1
- package/dist/index.d.ts +160 -8
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var ii=(t,e,c)=>e in t?k(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>k(t,"name",{value:e,configurable:!0});var ei=(t,e)=>{for(var c in e)k(t,c,{get:e[c],enumerable:!0})},ri=(t,e,c,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let m of K(e))!I.call(t,m)&&m!==c&&k(t,m,{get:()=>e[m],enumerable:!(f=p(e,m))||f.enumerable});return t};var ti=t=>ri(k({},"__esModule",{value:!0}),t);var w=(t,e,c)=>(ii(t,typeof e!="symbol"?e+"":e,c),c);var hi={};ei(hi,{GRID_DEFAULTS:()=>ni,GamepadInput:()=>P,InputDeviceType:()=>S,KeyboardInput:()=>u,MouseInput:()=>z,NetworkState:()=>R,POST_PROCESS_DEFAULTS:()=>si,ScalingMode:()=>_,ScalingModeValue:()=>b,TVRemoteInput:()=>A,TouchInput:()=>B,Vector2:()=>C,Vector3:()=>E,createInputDescriptor:()=>J,deserializeInputDescriptor:()=>y,gamepadAxisIndexToInput:()=>q,gamepadButtonIndexToInput:()=>F,getTouchXAxis:()=>W,getTouchYAxis:()=>O,inputDescriptorToString:()=>V,isAxis:()=>d,isButton:()=>M,isGamepadAxis:()=>H,isGamepadButton:()=>X,isMouseAxis:()=>Y,isMouseButton:()=>N,isTVRemoteAxis:()=>j,isTVRemoteButton:()=>Z,isTouchButton:()=>U,isTouchGesture:()=>$,isTouchPosition:()=>Q,keyCodeToKeyboardInput:()=>v,keyboardInputToKeyCode:()=>L,parseInputDescriptor:()=>T,scalingModeToValue:()=>ci,serializeInputDescriptor:()=>G,valueToScalingMode:()=>oi});module.exports=ti(hi);var S=(a=>(a[a.Keyboard=0]="Keyboard",a[a.Mouse=1]="Mouse",a[a.Gamepad=2]="Gamepad",a[a.Touch=3]="Touch",a[a.TVRemote=4]="TVRemote",a[a.TextInput=5]="TextInput",a[a.Motion=6]="Motion",a))(S||{});var u=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(u||{});function v(t){let e=u[t];return e!==void 0?e:null}o(v,"keyCodeToKeyboardInput");function L(t){return u[t]}o(L,"keyboardInputToKeyCode");var z=(h=>(h[h.LeftButton=0]="LeftButton",h[h.MiddleButton=1]="MiddleButton",h[h.RightButton=2]="RightButton",h[h.Button4=3]="Button4",h[h.Button5=4]="Button5",h[h.PositionX=100]="PositionX",h[h.PositionY=101]="PositionY",h[h.DeltaX=102]="DeltaX",h[h.DeltaY=103]="DeltaY",h[h.WheelDeltaY=104]="WheelDeltaY",h[h.WheelDeltaX=105]="WheelDeltaX",h))(z||{});function N(t){return t<100}o(N,"isMouseButton");function Y(t){return t>=100}o(Y,"isMouseAxis");var P=(n=>(n[n.ButtonA=0]="ButtonA",n[n.ButtonB=1]="ButtonB",n[n.ButtonX=2]="ButtonX",n[n.ButtonY=3]="ButtonY",n[n.LeftShoulder=4]="LeftShoulder",n[n.RightShoulder=5]="RightShoulder",n[n.LeftTrigger=6]="LeftTrigger",n[n.RightTrigger=7]="RightTrigger",n[n.Select=8]="Select",n[n.Start=9]="Start",n[n.LeftStick=10]="LeftStick",n[n.RightStick=11]="RightStick",n[n.DPadUp=12]="DPadUp",n[n.DPadDown=13]="DPadDown",n[n.DPadLeft=14]="DPadLeft",n[n.DPadRight=15]="DPadRight",n[n.Home=16]="Home",n[n.Touchpad=17]="Touchpad",n[n.LeftStickX=100]="LeftStickX",n[n.LeftStickY=101]="LeftStickY",n[n.RightStickX=102]="RightStickX",n[n.RightStickY=103]="RightStickY",n[n.LeftTriggerAxis=104]="LeftTriggerAxis",n[n.RightTriggerAxis=105]="RightTriggerAxis",n))(P||{});function X(t){return t<100}o(X,"isGamepadButton");function H(t){return t>=100}o(H,"isGamepadAxis");function F(t){return t>=0&&t<=19?t:null}o(F,"gamepadButtonIndexToInput");function q(t){return{0:100,1:101,2:102,3:103}[t]??null}o(q,"gamepadAxisIndexToInput");var B=(s=>(s[s.Touch0=0]="Touch0",s[s.Touch1=1]="Touch1",s[s.Touch2=2]="Touch2",s[s.Touch3=3]="Touch3",s[s.Touch4=4]="Touch4",s[s.Touch5=5]="Touch5",s[s.Touch6=6]="Touch6",s[s.Touch7=7]="Touch7",s[s.Touch8=8]="Touch8",s[s.Touch9=9]="Touch9",s[s.Touch0X=100]="Touch0X",s[s.Touch0Y=101]="Touch0Y",s[s.Touch1X=102]="Touch1X",s[s.Touch1Y=103]="Touch1Y",s[s.Touch2X=104]="Touch2X",s[s.Touch2Y=105]="Touch2Y",s[s.Touch3X=106]="Touch3X",s[s.Touch3Y=107]="Touch3Y",s[s.Touch4X=108]="Touch4X",s[s.Touch4Y=109]="Touch4Y",s[s.Touch5X=110]="Touch5X",s[s.Touch5Y=111]="Touch5Y",s[s.Touch6X=112]="Touch6X",s[s.Touch6Y=113]="Touch6Y",s[s.Touch7X=114]="Touch7X",s[s.Touch7Y=115]="Touch7Y",s[s.Touch8X=116]="Touch8X",s[s.Touch8Y=117]="Touch8Y",s[s.Touch9X=118]="Touch9X",s[s.Touch9Y=119]="Touch9Y",s[s.PinchScale=200]="PinchScale",s[s.RotationAngle=201]="RotationAngle",s[s.SwipeVelocityX=202]="SwipeVelocityX",s[s.SwipeVelocityY=203]="SwipeVelocityY",s))(B||{});function U(t){return t<100}o(U,"isTouchButton");function Q(t){return t>=100&&t<200}o(Q,"isTouchPosition");function $(t){return t>=200}o($,"isTouchGesture");function W(t){return t<0||t>9?null:100+t*2}o(W,"getTouchXAxis");function O(t){return t<0||t>9?null:101+t*2}o(O,"getTouchYAxis");var A=(r=>(r[r.DPadUp=0]="DPadUp",r[r.DPadDown=1]="DPadDown",r[r.DPadLeft=2]="DPadLeft",r[r.DPadRight=3]="DPadRight",r[r.DPadCenter=4]="DPadCenter",r[r.Play=5]="Play",r[r.Pause=6]="Pause",r[r.PlayPause=7]="PlayPause",r[r.Stop=8]="Stop",r[r.Rewind=9]="Rewind",r[r.FastForward=10]="FastForward",r[r.Previous=11]="Previous",r[r.Next=12]="Next",r[r.Record=13]="Record",r[r.VolumeUp=15]="VolumeUp",r[r.VolumeDown=16]="VolumeDown",r[r.Mute=17]="Mute",r[r.ChannelUp=18]="ChannelUp",r[r.ChannelDown=19]="ChannelDown",r[r.Back=20]="Back",r[r.Home=21]="Home",r[r.Menu=22]="Menu",r[r.Info=23]="Info",r[r.Guide=24]="Guide",r[r.Exit=25]="Exit",r[r.Red=30]="Red",r[r.Green=31]="Green",r[r.Yellow=32]="Yellow",r[r.Blue=33]="Blue",r[r.Digit0=40]="Digit0",r[r.Digit1=41]="Digit1",r[r.Digit2=42]="Digit2",r[r.Digit3=43]="Digit3",r[r.Digit4=44]="Digit4",r[r.Digit5=45]="Digit5",r[r.Digit6=46]="Digit6",r[r.Digit7=47]="Digit7",r[r.Digit8=48]="Digit8",r[r.Digit9=49]="Digit9",r[r.Input=50]="Input",r[r.Settings=51]="Settings",r[r.Subtitle=52]="Subtitle",r[r.Audio=53]="Audio",r[r.Power=54]="Power",r[r.PointerX=100]="PointerX",r[r.PointerY=101]="PointerY",r[r.GyroX=102]="GyroX",r[r.GyroY=103]="GyroY",r[r.GyroZ=104]="GyroZ",r))(A||{});function Z(t){return t<100}o(Z,"isTVRemoteButton");function j(t){return t>=100}o(j,"isTVRemoteAxis");function J(t,e){return{device:t,input:e}}o(J,"createInputDescriptor");function M(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 4:return t.input<100;default:return!1}}o(M,"isButton");function d(t){return!M(t)}o(d,"isAxis");function G(t){let e=new Uint8Array(3);return e[0]=t.device,e[1]=t.input&255,e[2]=t.input>>8&255,e}o(G,"serializeInputDescriptor");function y(t,e=0){let c=t[e],f=t[e+1]|t[e+2]<<8;return{device:c,input:f}}o(y,"deserializeInputDescriptor");function V(t){let e=S[t.device],c;switch(t.device){case 0:c=u[t.input];break;case 1:c=z[t.input];break;case 2:c=P[t.input];break;case 3:c=B[t.input];break;case 4:c=A[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(V,"inputDescriptorToString");function T(t){let[e,c]=t.split(":");if(!e||!c)return null;let f=Object.entries(S).find(([D,l])=>D.toLowerCase()===e.toLowerCase()&&typeof l=="number")?.[1];if(f===void 0)return null;let m;switch(f){case 0:m=u[c];break;case 1:m=z[c];break;case 2:m=P[c];break;case 3:m=B[c];break;case 4:m=A[c];break}return m===void 0?null:{device:f,input:m}}o(T,"parseInputDescriptor");var g=class g{constructor(e=0,c=0){w(this,"x");w(this,"y");this.x=e,this.y=c}static zero(){return new g(0,0)}static one(){return new g(1,1)}static up(){return new g(0,-1)}static down(){return new g(0,1)}static left(){return new g(-1,0)}static right(){return new g(1,0)}add(e){return new g(this.x+e.x,this.y+e.y)}subtract(e){return new g(this.x-e.x,this.y-e.y)}multiply(e){return new g(this.x*e,this.y*e)}divide(e){if(e===0)throw new Error("Division by zero");return new g(this.x/e,this.y/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let e=this.length();return e===0?g.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}rotate(e){let c=Math.cos(e),f=Math.sin(e);return new g(this.x*c-this.y*f,this.x*f+this.y*c)}lerp(e,c){return new g(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c)}clone(){return new g(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(e,c){return this.x=e,this.y=c,this}copy(e){return this.x=e.x,this.y=e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0):(this.x/=e,this.y/=e),this}};o(g,"Vector2");var C=g;var x=class x{constructor(e=0,c=0,f=0){w(this,"x");w(this,"y");w(this,"z");this.x=e,this.y=c,this.z=f}static zero(){return new x(0,0,0)}static one(){return new x(1,1,1)}static up(){return new x(0,1,0)}static down(){return new x(0,-1,0)}static left(){return new x(-1,0,0)}static right(){return new x(1,0,0)}static forward(){return new x(0,0,1)}static back(){return new x(0,0,-1)}add(e){return new x(this.x+e.x,this.y+e.y,this.z+e.z)}subtract(e){return new x(this.x-e.x,this.y-e.y,this.z-e.z)}multiply(e){return new x(this.x*e,this.y*e,this.z*e)}divide(e){if(e===0)throw new Error("Division by zero");return new x(this.x/e,this.y/e,this.z/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let e=this.length();return e===0?x.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new x(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}lerp(e,c){return new x(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c,this.z+(e.z-this.z)*c)}clone(){return new x(this.x,this.y,this.z)}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(e,c,f){return this.x=e,this.y=c,this.z=f,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this.z/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0,this.z=0):(this.x/=e,this.y/=e,this.z/=e),this}};o(x,"Vector3");var E=x;var si={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},ni={color:"rgba(144, 24, 24, 1)",lineWidth:1};var _=(l=>(l.None="none",l.Eighth="eighth",l.Quarter="quarter",l.Half="half",l.Integer="integer",l.Responsive="responsive",l))(_||{}),b=(l=>(l[l.None=0]="None",l[l.Eighth=1]="Eighth",l[l.Quarter=2]="Quarter",l[l.Half=3]="Half",l[l.Integer=4]="Integer",l[l.Responsive=5]="Responsive",l))(b||{});function ci(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}o(ci,"scalingModeToValue");function oi(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}o(oi,"valueToScalingMode");var R=(D=>(D[D.Disconnected=0]="Disconnected",D[D.Connecting=1]="Connecting",D[D.Connected=2]="Connected",D[D.Reconnecting=3]="Reconnecting",D[D.Error=4]="Error",D))(R||{});
|
|
1
|
+
"use strict";var C=Object.defineProperty;var si=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var li=Object.prototype.hasOwnProperty;var xi=(s,r,n)=>r in s?C(s,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[r]=n;var c=(s,r)=>C(s,"name",{value:r,configurable:!0});var ni=(s,r)=>{for(var n in r)C(s,n,{get:r[n],enumerable:!0})},ci=(s,r,n,D)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of ti(r))!li.call(s,o)&&o!==n&&C(s,o,{get:()=>r[o],enumerable:!(D=si(r,o))||D.enumerable});return s};var gi=s=>ci(C({},"__esModule",{value:!0}),s);var X=(s,r,n)=>(xi(s,typeof r!="symbol"?r+"":r,n),n);var Di={};ni(Di,{GRID_DEFAULTS:()=>ai,GamepadInput:()=>z,InputDeviceType:()=>S,KeyboardInput:()=>Y,MouseInput:()=>P,NetworkState:()=>ri,POST_PROCESS_DEFAULTS:()=>fi,ScalingMode:()=>ii,ScalingModeValue:()=>ei,TVRemoteInput:()=>k,TouchInput:()=>A,TouchZoneInput:()=>B,Vector2:()=>E,Vector3:()=>M,createInputDescriptor:()=>Z,deserializeInputDescriptor:()=>u,gamepadAxisIndexToInput:()=>$,gamepadButtonIndexToInput:()=>Q,getTouchXAxis:()=>J,getTouchYAxis:()=>d,getTouchZoneXAxis:()=>V,getTouchZoneYAxis:()=>b,inputDescriptorToString:()=>p,isAxis:()=>K,isButton:()=>v,isGamepadAxis:()=>U,isGamepadButton:()=>q,isMouseAxis:()=>F,isMouseButton:()=>H,isTVRemoteAxis:()=>R,isTVRemoteButton:()=>_,isTouchButton:()=>W,isTouchGesture:()=>j,isTouchPosition:()=>O,isTouchZoneButton:()=>G,isTouchZonePosition:()=>y,keyCodeToKeyboardInput:()=>L,keyboardInputToKeyCode:()=>N,parseInputDescriptor:()=>I,scalingModeToValue:()=>mi,serializeInputDescriptor:()=>T,valueToScalingMode:()=>hi});module.exports=gi(Di);var S=(h=>(h[h.Keyboard=0]="Keyboard",h[h.Mouse=1]="Mouse",h[h.Gamepad=2]="Gamepad",h[h.Touch=3]="Touch",h[h.TVRemote=4]="TVRemote",h[h.TextInput=5]="TextInput",h[h.Motion=6]="Motion",h[h.TouchZone=7]="TouchZone",h))(S||{});var Y=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(Y||{});function L(s){let r=Y[s];return r!==void 0?r:null}c(L,"keyCodeToKeyboardInput");function N(s){return Y[s]}c(N,"keyboardInputToKeyCode");var P=(g=>(g[g.LeftButton=0]="LeftButton",g[g.MiddleButton=1]="MiddleButton",g[g.RightButton=2]="RightButton",g[g.Button4=3]="Button4",g[g.Button5=4]="Button5",g[g.PositionX=100]="PositionX",g[g.PositionY=101]="PositionY",g[g.DeltaX=102]="DeltaX",g[g.DeltaY=103]="DeltaY",g[g.WheelDeltaY=104]="WheelDeltaY",g[g.WheelDeltaX=105]="WheelDeltaX",g))(P||{});function H(s){return s<100}c(H,"isMouseButton");function F(s){return s>=100}c(F,"isMouseAxis");var z=(x=>(x[x.ButtonA=0]="ButtonA",x[x.ButtonB=1]="ButtonB",x[x.ButtonX=2]="ButtonX",x[x.ButtonY=3]="ButtonY",x[x.LeftShoulder=4]="LeftShoulder",x[x.RightShoulder=5]="RightShoulder",x[x.LeftTrigger=6]="LeftTrigger",x[x.RightTrigger=7]="RightTrigger",x[x.Select=8]="Select",x[x.Start=9]="Start",x[x.LeftStick=10]="LeftStick",x[x.RightStick=11]="RightStick",x[x.DPadUp=12]="DPadUp",x[x.DPadDown=13]="DPadDown",x[x.DPadLeft=14]="DPadLeft",x[x.DPadRight=15]="DPadRight",x[x.Home=16]="Home",x[x.Touchpad=17]="Touchpad",x[x.LeftStickX=100]="LeftStickX",x[x.LeftStickY=101]="LeftStickY",x[x.RightStickX=102]="RightStickX",x[x.RightStickY=103]="RightStickY",x[x.LeftTriggerAxis=104]="LeftTriggerAxis",x[x.RightTriggerAxis=105]="RightTriggerAxis",x))(z||{});function q(s){return s<100}c(q,"isGamepadButton");function U(s){return s>=100}c(U,"isGamepadAxis");function Q(s){return s>=0&&s<=19?s:null}c(Q,"gamepadButtonIndexToInput");function $(s){return{0:100,1:101,2:102,3:103}[s]??null}c($,"gamepadAxisIndexToInput");var A=(l=>(l[l.Touch0=0]="Touch0",l[l.Touch1=1]="Touch1",l[l.Touch2=2]="Touch2",l[l.Touch3=3]="Touch3",l[l.Touch4=4]="Touch4",l[l.Touch5=5]="Touch5",l[l.Touch6=6]="Touch6",l[l.Touch7=7]="Touch7",l[l.Touch8=8]="Touch8",l[l.Touch9=9]="Touch9",l[l.Touch0X=100]="Touch0X",l[l.Touch0Y=101]="Touch0Y",l[l.Touch1X=102]="Touch1X",l[l.Touch1Y=103]="Touch1Y",l[l.Touch2X=104]="Touch2X",l[l.Touch2Y=105]="Touch2Y",l[l.Touch3X=106]="Touch3X",l[l.Touch3Y=107]="Touch3Y",l[l.Touch4X=108]="Touch4X",l[l.Touch4Y=109]="Touch4Y",l[l.Touch5X=110]="Touch5X",l[l.Touch5Y=111]="Touch5Y",l[l.Touch6X=112]="Touch6X",l[l.Touch6Y=113]="Touch6Y",l[l.Touch7X=114]="Touch7X",l[l.Touch7Y=115]="Touch7Y",l[l.Touch8X=116]="Touch8X",l[l.Touch8Y=117]="Touch8Y",l[l.Touch9X=118]="Touch9X",l[l.Touch9Y=119]="Touch9Y",l[l.PinchScale=200]="PinchScale",l[l.RotationAngle=201]="RotationAngle",l[l.SwipeVelocityX=202]="SwipeVelocityX",l[l.SwipeVelocityY=203]="SwipeVelocityY",l))(A||{});function W(s){return s<100}c(W,"isTouchButton");function O(s){return s>=100&&s<200}c(O,"isTouchPosition");function j(s){return s>=200}c(j,"isTouchGesture");function J(s){return s<0||s>9?null:100+s*2}c(J,"getTouchXAxis");function d(s){return s<0||s>9?null:101+s*2}c(d,"getTouchYAxis");var B=(e=>(e[e.Zone0=0]="Zone0",e[e.Zone1=1]="Zone1",e[e.Zone2=2]="Zone2",e[e.Zone3=3]="Zone3",e[e.Zone4=4]="Zone4",e[e.Zone5=5]="Zone5",e[e.Zone6=6]="Zone6",e[e.Zone7=7]="Zone7",e[e.Zone8=8]="Zone8",e[e.Zone9=9]="Zone9",e[e.Zone10=10]="Zone10",e[e.Zone11=11]="Zone11",e[e.Zone12=12]="Zone12",e[e.Zone13=13]="Zone13",e[e.Zone14=14]="Zone14",e[e.Zone15=15]="Zone15",e[e.Zone16=16]="Zone16",e[e.Zone17=17]="Zone17",e[e.Zone18=18]="Zone18",e[e.Zone19=19]="Zone19",e[e.Zone20=20]="Zone20",e[e.Zone21=21]="Zone21",e[e.Zone22=22]="Zone22",e[e.Zone23=23]="Zone23",e[e.Zone24=24]="Zone24",e[e.Zone25=25]="Zone25",e[e.Zone26=26]="Zone26",e[e.Zone27=27]="Zone27",e[e.Zone28=28]="Zone28",e[e.Zone29=29]="Zone29",e[e.Zone30=30]="Zone30",e[e.Zone31=31]="Zone31",e[e.Zone0X=100]="Zone0X",e[e.Zone0Y=101]="Zone0Y",e[e.Zone1X=102]="Zone1X",e[e.Zone1Y=103]="Zone1Y",e[e.Zone2X=104]="Zone2X",e[e.Zone2Y=105]="Zone2Y",e[e.Zone3X=106]="Zone3X",e[e.Zone3Y=107]="Zone3Y",e[e.Zone4X=108]="Zone4X",e[e.Zone4Y=109]="Zone4Y",e[e.Zone5X=110]="Zone5X",e[e.Zone5Y=111]="Zone5Y",e[e.Zone6X=112]="Zone6X",e[e.Zone6Y=113]="Zone6Y",e[e.Zone7X=114]="Zone7X",e[e.Zone7Y=115]="Zone7Y",e[e.Zone8X=116]="Zone8X",e[e.Zone8Y=117]="Zone8Y",e[e.Zone9X=118]="Zone9X",e[e.Zone9Y=119]="Zone9Y",e[e.Zone10X=120]="Zone10X",e[e.Zone10Y=121]="Zone10Y",e[e.Zone11X=122]="Zone11X",e[e.Zone11Y=123]="Zone11Y",e[e.Zone12X=124]="Zone12X",e[e.Zone12Y=125]="Zone12Y",e[e.Zone13X=126]="Zone13X",e[e.Zone13Y=127]="Zone13Y",e[e.Zone14X=128]="Zone14X",e[e.Zone14Y=129]="Zone14Y",e[e.Zone15X=130]="Zone15X",e[e.Zone15Y=131]="Zone15Y",e[e.Zone16X=132]="Zone16X",e[e.Zone16Y=133]="Zone16Y",e[e.Zone17X=134]="Zone17X",e[e.Zone17Y=135]="Zone17Y",e[e.Zone18X=136]="Zone18X",e[e.Zone18Y=137]="Zone18Y",e[e.Zone19X=138]="Zone19X",e[e.Zone19Y=139]="Zone19Y",e[e.Zone20X=140]="Zone20X",e[e.Zone20Y=141]="Zone20Y",e[e.Zone21X=142]="Zone21X",e[e.Zone21Y=143]="Zone21Y",e[e.Zone22X=144]="Zone22X",e[e.Zone22Y=145]="Zone22Y",e[e.Zone23X=146]="Zone23X",e[e.Zone23Y=147]="Zone23Y",e[e.Zone24X=148]="Zone24X",e[e.Zone24Y=149]="Zone24Y",e[e.Zone25X=150]="Zone25X",e[e.Zone25Y=151]="Zone25Y",e[e.Zone26X=152]="Zone26X",e[e.Zone26Y=153]="Zone26Y",e[e.Zone27X=154]="Zone27X",e[e.Zone27Y=155]="Zone27Y",e[e.Zone28X=156]="Zone28X",e[e.Zone28Y=157]="Zone28Y",e[e.Zone29X=158]="Zone29X",e[e.Zone29Y=159]="Zone29Y",e[e.Zone30X=160]="Zone30X",e[e.Zone30Y=161]="Zone30Y",e[e.Zone31X=162]="Zone31X",e[e.Zone31Y=163]="Zone31Y",e))(B||{});function G(s){return s<100}c(G,"isTouchZoneButton");function y(s){return s>=100}c(y,"isTouchZonePosition");function V(s){return s<0||s>31?null:100+s*2}c(V,"getTouchZoneXAxis");function b(s){return s<0||s>31?null:101+s*2}c(b,"getTouchZoneYAxis");var k=(t=>(t[t.DPadUp=0]="DPadUp",t[t.DPadDown=1]="DPadDown",t[t.DPadLeft=2]="DPadLeft",t[t.DPadRight=3]="DPadRight",t[t.DPadCenter=4]="DPadCenter",t[t.Play=5]="Play",t[t.Pause=6]="Pause",t[t.PlayPause=7]="PlayPause",t[t.Stop=8]="Stop",t[t.Rewind=9]="Rewind",t[t.FastForward=10]="FastForward",t[t.Previous=11]="Previous",t[t.Next=12]="Next",t[t.Record=13]="Record",t[t.VolumeUp=15]="VolumeUp",t[t.VolumeDown=16]="VolumeDown",t[t.Mute=17]="Mute",t[t.ChannelUp=18]="ChannelUp",t[t.ChannelDown=19]="ChannelDown",t[t.Back=20]="Back",t[t.Home=21]="Home",t[t.Menu=22]="Menu",t[t.Info=23]="Info",t[t.Guide=24]="Guide",t[t.Exit=25]="Exit",t[t.Red=30]="Red",t[t.Green=31]="Green",t[t.Yellow=32]="Yellow",t[t.Blue=33]="Blue",t[t.Digit0=40]="Digit0",t[t.Digit1=41]="Digit1",t[t.Digit2=42]="Digit2",t[t.Digit3=43]="Digit3",t[t.Digit4=44]="Digit4",t[t.Digit5=45]="Digit5",t[t.Digit6=46]="Digit6",t[t.Digit7=47]="Digit7",t[t.Digit8=48]="Digit8",t[t.Digit9=49]="Digit9",t[t.Input=50]="Input",t[t.Settings=51]="Settings",t[t.Subtitle=52]="Subtitle",t[t.Audio=53]="Audio",t[t.Power=54]="Power",t[t.PointerX=100]="PointerX",t[t.PointerY=101]="PointerY",t[t.GyroX=102]="GyroX",t[t.GyroY=103]="GyroY",t[t.GyroZ=104]="GyroZ",t))(k||{});function _(s){return s<100}c(_,"isTVRemoteButton");function R(s){return s>=100}c(R,"isTVRemoteAxis");function Z(s,r){return{device:s,input:r}}c(Z,"createInputDescriptor");function v(s){switch(s.device){case 0:return!0;case 1:return s.input<100;case 2:return s.input<100;case 3:return s.input<100;case 7:return s.input<100;case 4:return s.input<100;default:return!1}}c(v,"isButton");function K(s){return!v(s)}c(K,"isAxis");function T(s){let r=new Uint8Array(3);return r[0]=s.device,r[1]=s.input&255,r[2]=s.input>>8&255,r}c(T,"serializeInputDescriptor");function u(s,r=0){let n=s[r],D=s[r+1]|s[r+2]<<8;return{device:n,input:D}}c(u,"deserializeInputDescriptor");function p(s){let r=S[s.device],n;switch(s.device){case 0:n=Y[s.input];break;case 1:n=P[s.input];break;case 2:n=z[s.input];break;case 3:n=A[s.input];break;case 7:n=B[s.input];break;case 4:n=k[s.input];break;default:n="Unknown"}return`${r}:${n}`}c(p,"inputDescriptorToString");function I(s){let[r,n]=s.split(":");if(!r||!n)return null;let D=Object.entries(S).find(([w,f])=>w.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(D===void 0)return null;let o;switch(D){case 0:o=Y[n];break;case 1:o=P[n];break;case 2:o=z[n];break;case 3:o=A[n];break;case 4:o=k[n];break;case 7:o=B[n];break}return o===void 0?null:{device:D,input:o}}c(I,"parseInputDescriptor");var m=class m{constructor(r=0,n=0){X(this,"x");X(this,"y");this.x=r,this.y=n}static zero(){return new m(0,0)}static one(){return new m(1,1)}static up(){return new m(0,-1)}static down(){return new m(0,1)}static left(){return new m(-1,0)}static right(){return new m(1,0)}add(r){return new m(this.x+r.x,this.y+r.y)}subtract(r){return new m(this.x-r.x,this.y-r.y)}multiply(r){return new m(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new m(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?m.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let n=Math.cos(r),D=Math.sin(r);return new m(this.x*n-this.y*D,this.x*D+this.y*n)}lerp(r,n){return new m(this.x+(r.x-this.x)*n,this.y+(r.y-this.y)*n)}clone(){return new m(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,n){return this.x=r,this.y=n,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};c(m,"Vector2");var E=m;var a=class a{constructor(r=0,n=0,D=0){X(this,"x");X(this,"y");X(this,"z");this.x=r,this.y=n,this.z=D}static zero(){return new a(0,0,0)}static one(){return new a(1,1,1)}static up(){return new a(0,1,0)}static down(){return new a(0,-1,0)}static left(){return new a(-1,0,0)}static right(){return new a(1,0,0)}static forward(){return new a(0,0,1)}static back(){return new a(0,0,-1)}add(r){return new a(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new a(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new a(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new a(this.x/r,this.y/r,this.z/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let r=this.length();return r===0?a.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new a(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,n){return new a(this.x+(r.x-this.x)*n,this.y+(r.y-this.y)*n,this.z+(r.z-this.z)*n)}clone(){return new a(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,n,D){return this.x=r,this.y=n,this.z=D,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};c(a,"Vector3");var M=a;var fi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},ai={color:"rgba(144, 24, 24, 1)",lineWidth:1};var ii=(f=>(f.None="none",f.Eighth="eighth",f.Quarter="quarter",f.Half="half",f.Integer="integer",f.Responsive="responsive",f))(ii||{}),ei=(f=>(f[f.None=0]="None",f[f.Eighth=1]="Eighth",f[f.Quarter=2]="Quarter",f[f.Half=3]="Half",f[f.Integer=4]="Integer",f[f.Responsive=5]="Responsive",f))(ei||{});function mi(s){switch(s){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}c(mi,"scalingModeToValue");function hi(s){switch(s){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}c(hi,"valueToScalingMode");var ri=(w=>(w[w.Disconnected=0]="Disconnected",w[w.Connecting=1]="Connecting",w[w.Connected=2]="Connected",w[w.Reconnecting=3]="Reconnecting",w[w.Error=4]="Error",w))(ri||{});
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ declare enum InputDeviceType {
|
|
|
9
9
|
Touch = 3,
|
|
10
10
|
TVRemote = 4,
|
|
11
11
|
TextInput = 5,// For text input (captures event.key directly for input boxes, chat, etc.)
|
|
12
|
-
Motion = 6
|
|
12
|
+
Motion = 6,// Accelerometer, gyroscope, and device orientation sensors
|
|
13
|
+
TouchZone = 7
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -240,6 +241,10 @@ interface AxisSource {
|
|
|
240
241
|
touchId?: number;
|
|
241
242
|
/** Joystick axis */
|
|
242
243
|
touchAxis?: 'x' | 'y';
|
|
244
|
+
/** Touch zone ID (0-31) */
|
|
245
|
+
touchZoneId?: number;
|
|
246
|
+
/** Zone position axis */
|
|
247
|
+
touchZoneAxis?: 'x' | 'y';
|
|
243
248
|
/** Dead zone (default: 0.0) */
|
|
244
249
|
deadzone?: number;
|
|
245
250
|
/** Multiplier (default: 1.0) */
|
|
@@ -274,6 +279,8 @@ interface ButtonSource {
|
|
|
274
279
|
mouseButton?: MouseInput;
|
|
275
280
|
/** Touch button ID (0-9) */
|
|
276
281
|
touchButton?: number;
|
|
282
|
+
/** Touch zone ID (0-31) */
|
|
283
|
+
touchZoneId?: number;
|
|
277
284
|
}
|
|
278
285
|
|
|
279
286
|
/**
|
|
@@ -314,6 +321,28 @@ interface ButtonBinding {
|
|
|
314
321
|
sources: ButtonSource[];
|
|
315
322
|
}
|
|
316
323
|
|
|
324
|
+
/**
|
|
325
|
+
* Touch zone binding definition
|
|
326
|
+
*
|
|
327
|
+
* Defines a virtual touch zone in grid cell coordinates.
|
|
328
|
+
* Used by the server to define touch input regions that the client
|
|
329
|
+
* will interpret for multi-touch interaction.
|
|
330
|
+
*/
|
|
331
|
+
interface TouchZoneBinding {
|
|
332
|
+
/** Zone ID (0-31) */
|
|
333
|
+
zoneId: number;
|
|
334
|
+
/** Human-readable name for debugging */
|
|
335
|
+
name: string;
|
|
336
|
+
/** X position in grid cells */
|
|
337
|
+
x: number;
|
|
338
|
+
/** Y position in grid cells */
|
|
339
|
+
y: number;
|
|
340
|
+
/** Width in grid cells */
|
|
341
|
+
width: number;
|
|
342
|
+
/** Height in grid cells */
|
|
343
|
+
height: number;
|
|
344
|
+
}
|
|
345
|
+
|
|
317
346
|
/**
|
|
318
347
|
* Load packet for input bindings
|
|
319
348
|
*
|
|
@@ -335,6 +364,8 @@ interface InputBindingLoadPacket {
|
|
|
335
364
|
axes: AxisBinding[];
|
|
336
365
|
/** Button bindings configuration */
|
|
337
366
|
buttons: ButtonBinding[];
|
|
367
|
+
/** Touch zone bindings configuration (optional) */
|
|
368
|
+
touchZones?: TouchZoneBinding[];
|
|
338
369
|
}
|
|
339
370
|
|
|
340
371
|
/**
|
|
@@ -400,6 +431,118 @@ declare function getTouchXAxis(touchIndex: number): TouchInput | null;
|
|
|
400
431
|
*/
|
|
401
432
|
declare function getTouchYAxis(touchIndex: number): TouchInput | null;
|
|
402
433
|
|
|
434
|
+
/**
|
|
435
|
+
* TouchZone input enumeration
|
|
436
|
+
*
|
|
437
|
+
* Each zone exposes:
|
|
438
|
+
* - A button (active/inactive)
|
|
439
|
+
* - Two axes for last touch position inside the zone (X/Y)
|
|
440
|
+
*
|
|
441
|
+
* Zones are index-based (0-31) to allow static typing while remaining generic.
|
|
442
|
+
*/
|
|
443
|
+
declare enum TouchZoneInput {
|
|
444
|
+
Zone0 = 0,
|
|
445
|
+
Zone1 = 1,
|
|
446
|
+
Zone2 = 2,
|
|
447
|
+
Zone3 = 3,
|
|
448
|
+
Zone4 = 4,
|
|
449
|
+
Zone5 = 5,
|
|
450
|
+
Zone6 = 6,
|
|
451
|
+
Zone7 = 7,
|
|
452
|
+
Zone8 = 8,
|
|
453
|
+
Zone9 = 9,
|
|
454
|
+
Zone10 = 10,
|
|
455
|
+
Zone11 = 11,
|
|
456
|
+
Zone12 = 12,
|
|
457
|
+
Zone13 = 13,
|
|
458
|
+
Zone14 = 14,
|
|
459
|
+
Zone15 = 15,
|
|
460
|
+
Zone16 = 16,
|
|
461
|
+
Zone17 = 17,
|
|
462
|
+
Zone18 = 18,
|
|
463
|
+
Zone19 = 19,
|
|
464
|
+
Zone20 = 20,
|
|
465
|
+
Zone21 = 21,
|
|
466
|
+
Zone22 = 22,
|
|
467
|
+
Zone23 = 23,
|
|
468
|
+
Zone24 = 24,
|
|
469
|
+
Zone25 = 25,
|
|
470
|
+
Zone26 = 26,
|
|
471
|
+
Zone27 = 27,
|
|
472
|
+
Zone28 = 28,
|
|
473
|
+
Zone29 = 29,
|
|
474
|
+
Zone30 = 30,
|
|
475
|
+
Zone31 = 31,
|
|
476
|
+
Zone0X = 100,
|
|
477
|
+
Zone0Y = 101,
|
|
478
|
+
Zone1X = 102,
|
|
479
|
+
Zone1Y = 103,
|
|
480
|
+
Zone2X = 104,
|
|
481
|
+
Zone2Y = 105,
|
|
482
|
+
Zone3X = 106,
|
|
483
|
+
Zone3Y = 107,
|
|
484
|
+
Zone4X = 108,
|
|
485
|
+
Zone4Y = 109,
|
|
486
|
+
Zone5X = 110,
|
|
487
|
+
Zone5Y = 111,
|
|
488
|
+
Zone6X = 112,
|
|
489
|
+
Zone6Y = 113,
|
|
490
|
+
Zone7X = 114,
|
|
491
|
+
Zone7Y = 115,
|
|
492
|
+
Zone8X = 116,
|
|
493
|
+
Zone8Y = 117,
|
|
494
|
+
Zone9X = 118,
|
|
495
|
+
Zone9Y = 119,
|
|
496
|
+
Zone10X = 120,
|
|
497
|
+
Zone10Y = 121,
|
|
498
|
+
Zone11X = 122,
|
|
499
|
+
Zone11Y = 123,
|
|
500
|
+
Zone12X = 124,
|
|
501
|
+
Zone12Y = 125,
|
|
502
|
+
Zone13X = 126,
|
|
503
|
+
Zone13Y = 127,
|
|
504
|
+
Zone14X = 128,
|
|
505
|
+
Zone14Y = 129,
|
|
506
|
+
Zone15X = 130,
|
|
507
|
+
Zone15Y = 131,
|
|
508
|
+
Zone16X = 132,
|
|
509
|
+
Zone16Y = 133,
|
|
510
|
+
Zone17X = 134,
|
|
511
|
+
Zone17Y = 135,
|
|
512
|
+
Zone18X = 136,
|
|
513
|
+
Zone18Y = 137,
|
|
514
|
+
Zone19X = 138,
|
|
515
|
+
Zone19Y = 139,
|
|
516
|
+
Zone20X = 140,
|
|
517
|
+
Zone20Y = 141,
|
|
518
|
+
Zone21X = 142,
|
|
519
|
+
Zone21Y = 143,
|
|
520
|
+
Zone22X = 144,
|
|
521
|
+
Zone22Y = 145,
|
|
522
|
+
Zone23X = 146,
|
|
523
|
+
Zone23Y = 147,
|
|
524
|
+
Zone24X = 148,
|
|
525
|
+
Zone24Y = 149,
|
|
526
|
+
Zone25X = 150,
|
|
527
|
+
Zone25Y = 151,
|
|
528
|
+
Zone26X = 152,
|
|
529
|
+
Zone26Y = 153,
|
|
530
|
+
Zone27X = 154,
|
|
531
|
+
Zone27Y = 155,
|
|
532
|
+
Zone28X = 156,
|
|
533
|
+
Zone28Y = 157,
|
|
534
|
+
Zone29X = 158,
|
|
535
|
+
Zone29Y = 159,
|
|
536
|
+
Zone30X = 160,
|
|
537
|
+
Zone30Y = 161,
|
|
538
|
+
Zone31X = 162,
|
|
539
|
+
Zone31Y = 163
|
|
540
|
+
}
|
|
541
|
+
declare function isTouchZoneButton(input: TouchZoneInput): boolean;
|
|
542
|
+
declare function isTouchZonePosition(input: TouchZoneInput): boolean;
|
|
543
|
+
declare function getTouchZoneXAxis(zoneId: number): TouchZoneInput | null;
|
|
544
|
+
declare function getTouchZoneYAxis(zoneId: number): TouchZoneInput | null;
|
|
545
|
+
|
|
403
546
|
/**
|
|
404
547
|
* TV Remote input enumeration
|
|
405
548
|
* Common buttons found on TV remotes and set-top box controllers
|
|
@@ -474,7 +617,7 @@ declare function isTVRemoteAxis(input: TVRemoteInput): boolean;
|
|
|
474
617
|
/**
|
|
475
618
|
* Union type of all possible input enums
|
|
476
619
|
*/
|
|
477
|
-
type InputEnum = KeyboardInput | MouseInput | GamepadInput | TouchInput | TVRemoteInput;
|
|
620
|
+
type InputEnum = KeyboardInput | MouseInput | GamepadInput | TouchInput | TVRemoteInput | TouchZoneInput;
|
|
478
621
|
/**
|
|
479
622
|
* Generic input descriptor
|
|
480
623
|
* Identifies any input across all device types
|
|
@@ -502,6 +645,10 @@ interface TouchInputDescriptor {
|
|
|
502
645
|
device: InputDeviceType.Touch;
|
|
503
646
|
input: TouchInput;
|
|
504
647
|
}
|
|
648
|
+
interface TouchZoneInputDescriptor {
|
|
649
|
+
device: InputDeviceType.TouchZone;
|
|
650
|
+
input: TouchZoneInput;
|
|
651
|
+
}
|
|
505
652
|
interface TVRemoteInputDescriptor {
|
|
506
653
|
device: InputDeviceType.TVRemote;
|
|
507
654
|
input: TVRemoteInput;
|
|
@@ -509,11 +656,11 @@ interface TVRemoteInputDescriptor {
|
|
|
509
656
|
/**
|
|
510
657
|
* Discriminated union of all input descriptors
|
|
511
658
|
*/
|
|
512
|
-
type TypedInputDescriptor = KeyboardInputDescriptor | MouseInputDescriptor | GamepadInputDescriptor | TouchInputDescriptor | TVRemoteInputDescriptor;
|
|
659
|
+
type TypedInputDescriptor = KeyboardInputDescriptor | MouseInputDescriptor | GamepadInputDescriptor | TouchInputDescriptor | TVRemoteInputDescriptor | TouchZoneInputDescriptor;
|
|
513
660
|
/**
|
|
514
661
|
* Helper to create a typed input descriptor
|
|
515
662
|
*/
|
|
516
|
-
declare function createInputDescriptor<T extends InputDeviceType>(device: T, input: T extends InputDeviceType.Keyboard ? KeyboardInput : T extends InputDeviceType.Mouse ? MouseInput : T extends InputDeviceType.Gamepad ? GamepadInput : T extends InputDeviceType.Touch ? TouchInput : T extends InputDeviceType.TVRemote ? TVRemoteInput : never): InputDescriptor;
|
|
663
|
+
declare function createInputDescriptor<T extends InputDeviceType>(device: T, input: T extends InputDeviceType.Keyboard ? KeyboardInput : T extends InputDeviceType.Mouse ? MouseInput : T extends InputDeviceType.Gamepad ? GamepadInput : T extends InputDeviceType.Touch ? TouchInput : T extends InputDeviceType.TVRemote ? TVRemoteInput : T extends InputDeviceType.TouchZone ? TouchZoneInput : never): InputDescriptor;
|
|
517
664
|
/**
|
|
518
665
|
* Check if an input is a button (vs axis)
|
|
519
666
|
*/
|
|
@@ -1332,6 +1479,8 @@ interface SoundLoadPacket {
|
|
|
1332
1479
|
type: 'sound';
|
|
1333
1480
|
mode: 'file';
|
|
1334
1481
|
sounds: SoundFileEntry[];
|
|
1482
|
+
/** Total number of sounds expected (for loading progress tracking) */
|
|
1483
|
+
totalSounds?: number;
|
|
1335
1484
|
}
|
|
1336
1485
|
/**
|
|
1337
1486
|
* Sound External Load packet - External mode
|
|
@@ -1341,6 +1490,8 @@ interface SoundExternalLoadPacket {
|
|
|
1341
1490
|
type: 'sound';
|
|
1342
1491
|
mode: 'external';
|
|
1343
1492
|
sounds: SoundExternalEntry[];
|
|
1493
|
+
/** Total number of sounds expected (for loading progress tracking) */
|
|
1494
|
+
totalSounds?: number;
|
|
1344
1495
|
}
|
|
1345
1496
|
/**
|
|
1346
1497
|
* Union of all sound load packet types
|
|
@@ -1755,11 +1906,12 @@ interface IApplication<TCore = any, TUser = any, TRuntime = unknown> {
|
|
|
1755
1906
|
*/
|
|
1756
1907
|
init(core: TCore, runtime?: TRuntime): void | Promise<void>;
|
|
1757
1908
|
/**
|
|
1758
|
-
* Update global logic (called every frame, runs once)
|
|
1909
|
+
* Update global logic (called every frame, runs once) (optional)
|
|
1910
|
+
* Use this for logic that doesn't depend on specific users.
|
|
1759
1911
|
* @param core - Core instance
|
|
1760
1912
|
* @param deltaTime - Time since last update (seconds)
|
|
1761
1913
|
*/
|
|
1762
|
-
update(core: TCore, deltaTime: number): void;
|
|
1914
|
+
update?(core: TCore, deltaTime: number): void;
|
|
1763
1915
|
/**
|
|
1764
1916
|
* Initialize new user (called when user connects/joins)
|
|
1765
1917
|
* @param core - Core instance
|
|
@@ -1991,5 +2143,5 @@ interface IGamepadVibrationProcessor {
|
|
|
1991
2143
|
*/
|
|
1992
2144
|
type GamepadVibrationPreset = 'tap' | 'impact' | 'heavy' | 'success' | 'error' | 'explosion' | 'engine' | 'heartbeat';
|
|
1993
2145
|
|
|
1994
|
-
export { GRID_DEFAULTS, GamepadInput, InputDeviceType, KeyboardInput, MouseInput, NetworkState, POST_PROCESS_DEFAULTS, ScalingMode, ScalingModeValue, TVRemoteInput, TouchInput, Vector2, Vector3, createInputDescriptor, deserializeInputDescriptor, gamepadAxisIndexToInput, gamepadButtonIndexToInput, getTouchXAxis, getTouchYAxis, inputDescriptorToString, isAxis, isButton, isGamepadAxis, isGamepadButton, isMouseAxis, isMouseButton, isTVRemoteAxis, isTVRemoteButton, isTouchButton, isTouchGesture, isTouchPosition, keyCodeToKeyboardInput, keyboardInputToKeyCode, parseInputDescriptor, scalingModeToValue, serializeInputDescriptor, valueToScalingMode };
|
|
1995
|
-
export type { AmbientEffectConfig, AnyNetworkMessage, AnySoundLoadPacket, AudioAck, AudioAckBase, AudioAckHandler, AudioAckType, AudioConfigCommand, AudioPlayOptions, AudioPlayResult, AudioSpatialOptions, AxisBinding, AxisSource, BridgeClientHandler, BridgeServerHandler, ButtonBinding, ButtonSource, CancelVibrationCommand, ChatMessage, ClientInfo, ConfigureSpatialCommand, ConnectionHandler, DisconnectionHandler, ErrorMessage, FadeOutSoundCommand, GamepadCancelVibrationCommand, GamepadInputDescriptor, GamepadVibrateCommand, GamepadVibrationCommand, GamepadVibrationOptions, GamepadVibrationPreset, GridConfig, IApplication, IAudioProcessor, IColorPalette, IGamepadVibrationProcessor, IInputSystem, IMobileVibrationProcessor, INetworkClient, INetworkServer, IRenderer, ISoundLoader, InputBindingLoadPacket, InputDescriptor, InputEnum, InputMessage, JoinMessage, JoinResponseMessage, KeyboardInputDescriptor, LeaveMessage, LoadMessage, MessageType, MobileVibrationCommand, MobileVibrationPreset, MouseInputDescriptor, NetworkClientOptions, NetworkEventHandler, NetworkMessage, NetworkServerOptions, PauseSoundCommand, PingMessage, PlaySoundCommand, PlaybackEndedAck, PlaybackErrorAck, PlaybackStartedAck, PongMessage, PostProcessCommand, PostProcessCommandType, PostProcessConfig, RGBColor, RenderState, RenderedCell, ResumeSoundCommand, ScanlinesConfig, ServerEventHandler, SetListenerPositionCommand, SetSoundEffectsCommand, SoundErrorAck, SoundExternalEntry, SoundExternalLoadPacket, SoundFileEntry, SoundFormat, SoundInstanceId, SoundLoadPacket, SoundLoadType, SoundLoadedAck, SpatialAudioConfig, StopSoundCommand, TVRemoteInputDescriptor, TouchInputDescriptor, TypedInputDescriptor, UpdateMessage, UserMetadata, UserRenderState, VibrateCommand, VibrationPattern };
|
|
2146
|
+
export { GRID_DEFAULTS, GamepadInput, InputDeviceType, KeyboardInput, MouseInput, NetworkState, POST_PROCESS_DEFAULTS, ScalingMode, ScalingModeValue, TVRemoteInput, TouchInput, TouchZoneInput, Vector2, Vector3, createInputDescriptor, deserializeInputDescriptor, gamepadAxisIndexToInput, gamepadButtonIndexToInput, getTouchXAxis, getTouchYAxis, getTouchZoneXAxis, getTouchZoneYAxis, inputDescriptorToString, isAxis, isButton, isGamepadAxis, isGamepadButton, isMouseAxis, isMouseButton, isTVRemoteAxis, isTVRemoteButton, isTouchButton, isTouchGesture, isTouchPosition, isTouchZoneButton, isTouchZonePosition, keyCodeToKeyboardInput, keyboardInputToKeyCode, parseInputDescriptor, scalingModeToValue, serializeInputDescriptor, valueToScalingMode };
|
|
2147
|
+
export type { AmbientEffectConfig, AnyNetworkMessage, AnySoundLoadPacket, AudioAck, AudioAckBase, AudioAckHandler, AudioAckType, AudioConfigCommand, AudioPlayOptions, AudioPlayResult, AudioSpatialOptions, AxisBinding, AxisSource, BridgeClientHandler, BridgeServerHandler, ButtonBinding, ButtonSource, CancelVibrationCommand, ChatMessage, ClientInfo, ConfigureSpatialCommand, ConnectionHandler, DisconnectionHandler, ErrorMessage, FadeOutSoundCommand, GamepadCancelVibrationCommand, GamepadInputDescriptor, GamepadVibrateCommand, GamepadVibrationCommand, GamepadVibrationOptions, GamepadVibrationPreset, GridConfig, IApplication, IAudioProcessor, IColorPalette, IGamepadVibrationProcessor, IInputSystem, IMobileVibrationProcessor, INetworkClient, INetworkServer, IRenderer, ISoundLoader, InputBindingLoadPacket, InputDescriptor, InputEnum, InputMessage, JoinMessage, JoinResponseMessage, KeyboardInputDescriptor, LeaveMessage, LoadMessage, MessageType, MobileVibrationCommand, MobileVibrationPreset, MouseInputDescriptor, NetworkClientOptions, NetworkEventHandler, NetworkMessage, NetworkServerOptions, PauseSoundCommand, PingMessage, PlaySoundCommand, PlaybackEndedAck, PlaybackErrorAck, PlaybackStartedAck, PongMessage, PostProcessCommand, PostProcessCommandType, PostProcessConfig, RGBColor, RenderState, RenderedCell, ResumeSoundCommand, ScanlinesConfig, ServerEventHandler, SetListenerPositionCommand, SetSoundEffectsCommand, SoundErrorAck, SoundExternalEntry, SoundExternalLoadPacket, SoundFileEntry, SoundFormat, SoundInstanceId, SoundLoadPacket, SoundLoadType, SoundLoadedAck, SpatialAudioConfig, StopSoundCommand, TVRemoteInputDescriptor, TouchInputDescriptor, TouchZoneBinding, TypedInputDescriptor, UpdateMessage, UserMetadata, UserRenderState, VibrateCommand, VibrationPattern };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var v=(t,e,c)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var o=(t,e)=>E(t,"name",{value:e,configurable:!0});var u=(t,e,c)=>(v(t,typeof e!="symbol"?e+"":e,c),c);var S=(f=>(f[f.Keyboard=0]="Keyboard",f[f.Mouse=1]="Mouse",f[f.Gamepad=2]="Gamepad",f[f.Touch=3]="Touch",f[f.TVRemote=4]="TVRemote",f[f.TextInput=5]="TextInput",f[f.Motion=6]="Motion",f))(S||{});var w=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(w||{});function L(t){let e=w[t];return e!==void 0?e:null}o(L,"keyCodeToKeyboardInput");function N(t){return w[t]}o(N,"keyboardInputToKeyCode");var z=(h=>(h[h.LeftButton=0]="LeftButton",h[h.MiddleButton=1]="MiddleButton",h[h.RightButton=2]="RightButton",h[h.Button4=3]="Button4",h[h.Button5=4]="Button5",h[h.PositionX=100]="PositionX",h[h.PositionY=101]="PositionY",h[h.DeltaX=102]="DeltaX",h[h.DeltaY=103]="DeltaY",h[h.WheelDeltaY=104]="WheelDeltaY",h[h.WheelDeltaX=105]="WheelDeltaX",h))(z||{});function Y(t){return t<100}o(Y,"isMouseButton");function X(t){return t>=100}o(X,"isMouseAxis");var P=(n=>(n[n.ButtonA=0]="ButtonA",n[n.ButtonB=1]="ButtonB",n[n.ButtonX=2]="ButtonX",n[n.ButtonY=3]="ButtonY",n[n.LeftShoulder=4]="LeftShoulder",n[n.RightShoulder=5]="RightShoulder",n[n.LeftTrigger=6]="LeftTrigger",n[n.RightTrigger=7]="RightTrigger",n[n.Select=8]="Select",n[n.Start=9]="Start",n[n.LeftStick=10]="LeftStick",n[n.RightStick=11]="RightStick",n[n.DPadUp=12]="DPadUp",n[n.DPadDown=13]="DPadDown",n[n.DPadLeft=14]="DPadLeft",n[n.DPadRight=15]="DPadRight",n[n.Home=16]="Home",n[n.Touchpad=17]="Touchpad",n[n.LeftStickX=100]="LeftStickX",n[n.LeftStickY=101]="LeftStickY",n[n.RightStickX=102]="RightStickX",n[n.RightStickY=103]="RightStickY",n[n.LeftTriggerAxis=104]="LeftTriggerAxis",n[n.RightTriggerAxis=105]="RightTriggerAxis",n))(P||{});function H(t){return t<100}o(H,"isGamepadButton");function F(t){return t>=100}o(F,"isGamepadAxis");function q(t){return t>=0&&t<=19?t:null}o(q,"gamepadButtonIndexToInput");function U(t){return{0:100,1:101,2:102,3:103}[t]??null}o(U,"gamepadAxisIndexToInput");var B=(s=>(s[s.Touch0=0]="Touch0",s[s.Touch1=1]="Touch1",s[s.Touch2=2]="Touch2",s[s.Touch3=3]="Touch3",s[s.Touch4=4]="Touch4",s[s.Touch5=5]="Touch5",s[s.Touch6=6]="Touch6",s[s.Touch7=7]="Touch7",s[s.Touch8=8]="Touch8",s[s.Touch9=9]="Touch9",s[s.Touch0X=100]="Touch0X",s[s.Touch0Y=101]="Touch0Y",s[s.Touch1X=102]="Touch1X",s[s.Touch1Y=103]="Touch1Y",s[s.Touch2X=104]="Touch2X",s[s.Touch2Y=105]="Touch2Y",s[s.Touch3X=106]="Touch3X",s[s.Touch3Y=107]="Touch3Y",s[s.Touch4X=108]="Touch4X",s[s.Touch4Y=109]="Touch4Y",s[s.Touch5X=110]="Touch5X",s[s.Touch5Y=111]="Touch5Y",s[s.Touch6X=112]="Touch6X",s[s.Touch6Y=113]="Touch6Y",s[s.Touch7X=114]="Touch7X",s[s.Touch7Y=115]="Touch7Y",s[s.Touch8X=116]="Touch8X",s[s.Touch8Y=117]="Touch8Y",s[s.Touch9X=118]="Touch9X",s[s.Touch9Y=119]="Touch9Y",s[s.PinchScale=200]="PinchScale",s[s.RotationAngle=201]="RotationAngle",s[s.SwipeVelocityX=202]="SwipeVelocityX",s[s.SwipeVelocityY=203]="SwipeVelocityY",s))(B||{});function Q(t){return t<100}o(Q,"isTouchButton");function $(t){return t>=100&&t<200}o($,"isTouchPosition");function W(t){return t>=200}o(W,"isTouchGesture");function O(t){return t<0||t>9?null:100+t*2}o(O,"getTouchXAxis");function Z(t){return t<0||t>9?null:101+t*2}o(Z,"getTouchYAxis");var A=(r=>(r[r.DPadUp=0]="DPadUp",r[r.DPadDown=1]="DPadDown",r[r.DPadLeft=2]="DPadLeft",r[r.DPadRight=3]="DPadRight",r[r.DPadCenter=4]="DPadCenter",r[r.Play=5]="Play",r[r.Pause=6]="Pause",r[r.PlayPause=7]="PlayPause",r[r.Stop=8]="Stop",r[r.Rewind=9]="Rewind",r[r.FastForward=10]="FastForward",r[r.Previous=11]="Previous",r[r.Next=12]="Next",r[r.Record=13]="Record",r[r.VolumeUp=15]="VolumeUp",r[r.VolumeDown=16]="VolumeDown",r[r.Mute=17]="Mute",r[r.ChannelUp=18]="ChannelUp",r[r.ChannelDown=19]="ChannelDown",r[r.Back=20]="Back",r[r.Home=21]="Home",r[r.Menu=22]="Menu",r[r.Info=23]="Info",r[r.Guide=24]="Guide",r[r.Exit=25]="Exit",r[r.Red=30]="Red",r[r.Green=31]="Green",r[r.Yellow=32]="Yellow",r[r.Blue=33]="Blue",r[r.Digit0=40]="Digit0",r[r.Digit1=41]="Digit1",r[r.Digit2=42]="Digit2",r[r.Digit3=43]="Digit3",r[r.Digit4=44]="Digit4",r[r.Digit5=45]="Digit5",r[r.Digit6=46]="Digit6",r[r.Digit7=47]="Digit7",r[r.Digit8=48]="Digit8",r[r.Digit9=49]="Digit9",r[r.Input=50]="Input",r[r.Settings=51]="Settings",r[r.Subtitle=52]="Subtitle",r[r.Audio=53]="Audio",r[r.Power=54]="Power",r[r.PointerX=100]="PointerX",r[r.PointerY=101]="PointerY",r[r.GyroX=102]="GyroX",r[r.GyroY=103]="GyroY",r[r.GyroZ=104]="GyroZ",r))(A||{});function j(t){return t<100}o(j,"isTVRemoteButton");function J(t){return t>=100}o(J,"isTVRemoteAxis");function d(t,e){return{device:t,input:e}}o(d,"createInputDescriptor");function M(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 4:return t.input<100;default:return!1}}o(M,"isButton");function G(t){return!M(t)}o(G,"isAxis");function y(t){let e=new Uint8Array(3);return e[0]=t.device,e[1]=t.input&255,e[2]=t.input>>8&255,e}o(y,"serializeInputDescriptor");function V(t,e=0){let c=t[e],a=t[e+1]|t[e+2]<<8;return{device:c,input:a}}o(V,"deserializeInputDescriptor");function T(t){let e=S[t.device],c;switch(t.device){case 0:c=w[t.input];break;case 1:c=z[t.input];break;case 2:c=P[t.input];break;case 3:c=B[t.input];break;case 4:c=A[t.input];break;default:c="Unknown"}return`${e}:${c}`}o(T,"inputDescriptorToString");function _(t){let[e,c]=t.split(":");if(!e||!c)return null;let a=Object.entries(S).find(([m,l])=>m.toLowerCase()===e.toLowerCase()&&typeof l=="number")?.[1];if(a===void 0)return null;let D;switch(a){case 0:D=w[c];break;case 1:D=z[c];break;case 2:D=P[c];break;case 3:D=B[c];break;case 4:D=A[c];break}return D===void 0?null:{device:a,input:D}}o(_,"parseInputDescriptor");var g=class g{constructor(e=0,c=0){u(this,"x");u(this,"y");this.x=e,this.y=c}static zero(){return new g(0,0)}static one(){return new g(1,1)}static up(){return new g(0,-1)}static down(){return new g(0,1)}static left(){return new g(-1,0)}static right(){return new g(1,0)}add(e){return new g(this.x+e.x,this.y+e.y)}subtract(e){return new g(this.x-e.x,this.y-e.y)}multiply(e){return new g(this.x*e,this.y*e)}divide(e){if(e===0)throw new Error("Division by zero");return new g(this.x/e,this.y/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let e=this.length();return e===0?g.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}angle(){return Math.atan2(this.y,this.x)}angleTo(e){return Math.atan2(e.y-this.y,e.x-this.x)}rotate(e){let c=Math.cos(e),a=Math.sin(e);return new g(this.x*c-this.y*a,this.x*a+this.y*c)}lerp(e,c){return new g(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c)}clone(){return new g(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(e,c){return this.x=e,this.y=c,this}copy(e){return this.x=e.x,this.y=e.y,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0):(this.x/=e,this.y/=e),this}};o(g,"Vector2");var k=g;var x=class x{constructor(e=0,c=0,a=0){u(this,"x");u(this,"y");u(this,"z");this.x=e,this.y=c,this.z=a}static zero(){return new x(0,0,0)}static one(){return new x(1,1,1)}static up(){return new x(0,1,0)}static down(){return new x(0,-1,0)}static left(){return new x(-1,0,0)}static right(){return new x(1,0,0)}static forward(){return new x(0,0,1)}static back(){return new x(0,0,-1)}add(e){return new x(this.x+e.x,this.y+e.y,this.z+e.z)}subtract(e){return new x(this.x-e.x,this.y-e.y,this.z-e.z)}multiply(e){return new x(this.x*e,this.y*e,this.z*e)}divide(e){if(e===0)throw new Error("Division by zero");return new x(this.x/e,this.y/e,this.z/e)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let e=this.length();return e===0?x.zero():this.divide(e)}distance(e){return this.subtract(e).length()}distanceSquared(e){return this.subtract(e).lengthSquared()}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){return new x(this.y*e.z-this.z*e.y,this.z*e.x-this.x*e.z,this.x*e.y-this.y*e.x)}lerp(e,c){return new x(this.x+(e.x-this.x)*c,this.y+(e.y-this.y)*c,this.z+(e.z-this.z)*c)}clone(){return new x(this.x,this.y,this.z)}equals(e){return this.x===e.x&&this.y===e.y&&this.z===e.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(e,c,a){return this.x=e,this.y=c,this.z=a,this}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}addInPlace(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}subtractInPlace(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}multiplyInPlace(e){return this.x*=e,this.y*=e,this.z*=e,this}divideInPlace(e){if(e===0)throw new Error("Division by zero");return this.x/=e,this.y/=e,this.z/=e,this}normalizeInPlace(){let e=this.length();return e===0?(this.x=0,this.y=0,this.z=0):(this.x/=e,this.y/=e,this.z/=e),this}};o(x,"Vector3");var C=x;var Fi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},qi={color:"rgba(144, 24, 24, 1)",lineWidth:1};var b=(l=>(l.None="none",l.Eighth="eighth",l.Quarter="quarter",l.Half="half",l.Integer="integer",l.Responsive="responsive",l))(b||{}),R=(l=>(l[l.None=0]="None",l[l.Eighth=1]="Eighth",l[l.Quarter=2]="Quarter",l[l.Half=3]="Half",l[l.Integer=4]="Integer",l[l.Responsive=5]="Responsive",l))(R||{});function Qi(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}o(Qi,"scalingModeToValue");function $i(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}o($i,"valueToScalingMode");var p=(m=>(m[m.Disconnected=0]="Disconnected",m[m.Connecting=1]="Connecting",m[m.Connected=2]="Connected",m[m.Reconnecting=3]="Reconnecting",m[m.Error=4]="Error",m))(p||{});export{qi as GRID_DEFAULTS,P as GamepadInput,S as InputDeviceType,w as KeyboardInput,z as MouseInput,p as NetworkState,Fi as POST_PROCESS_DEFAULTS,b as ScalingMode,R as ScalingModeValue,A as TVRemoteInput,B as TouchInput,k as Vector2,C as Vector3,d as createInputDescriptor,V as deserializeInputDescriptor,U as gamepadAxisIndexToInput,q as gamepadButtonIndexToInput,O as getTouchXAxis,Z as getTouchYAxis,T as inputDescriptorToString,G as isAxis,M as isButton,F as isGamepadAxis,H as isGamepadButton,X as isMouseAxis,Y as isMouseButton,J as isTVRemoteAxis,j as isTVRemoteButton,Q as isTouchButton,W as isTouchGesture,$ as isTouchPosition,L as keyCodeToKeyboardInput,N as keyboardInputToKeyCode,_ as parseInputDescriptor,Qi as scalingModeToValue,y as serializeInputDescriptor,$i as valueToScalingMode};
|
|
1
|
+
var M=Object.defineProperty;var L=(t,r,n)=>r in t?M(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n;var c=(t,r)=>M(t,"name",{value:r,configurable:!0});var Y=(t,r,n)=>(L(t,typeof r!="symbol"?r+"":r,n),n);var S=(h=>(h[h.Keyboard=0]="Keyboard",h[h.Mouse=1]="Mouse",h[h.Gamepad=2]="Gamepad",h[h.Touch=3]="Touch",h[h.TVRemote=4]="TVRemote",h[h.TextInput=5]="TextInput",h[h.Motion=6]="Motion",h[h.TouchZone=7]="TouchZone",h))(S||{});var X=(i=>(i[i.KeyA=0]="KeyA",i[i.KeyB=1]="KeyB",i[i.KeyC=2]="KeyC",i[i.KeyD=3]="KeyD",i[i.KeyE=4]="KeyE",i[i.KeyF=5]="KeyF",i[i.KeyG=6]="KeyG",i[i.KeyH=7]="KeyH",i[i.KeyI=8]="KeyI",i[i.KeyJ=9]="KeyJ",i[i.KeyK=10]="KeyK",i[i.KeyL=11]="KeyL",i[i.KeyM=12]="KeyM",i[i.KeyN=13]="KeyN",i[i.KeyO=14]="KeyO",i[i.KeyP=15]="KeyP",i[i.KeyQ=16]="KeyQ",i[i.KeyR=17]="KeyR",i[i.KeyS=18]="KeyS",i[i.KeyT=19]="KeyT",i[i.KeyU=20]="KeyU",i[i.KeyV=21]="KeyV",i[i.KeyW=22]="KeyW",i[i.KeyX=23]="KeyX",i[i.KeyY=24]="KeyY",i[i.KeyZ=25]="KeyZ",i[i.Digit0=26]="Digit0",i[i.Digit1=27]="Digit1",i[i.Digit2=28]="Digit2",i[i.Digit3=29]="Digit3",i[i.Digit4=30]="Digit4",i[i.Digit5=31]="Digit5",i[i.Digit6=32]="Digit6",i[i.Digit7=33]="Digit7",i[i.Digit8=34]="Digit8",i[i.Digit9=35]="Digit9",i[i.ArrowUp=36]="ArrowUp",i[i.ArrowDown=37]="ArrowDown",i[i.ArrowLeft=38]="ArrowLeft",i[i.ArrowRight=39]="ArrowRight",i[i.Space=40]="Space",i[i.Enter=41]="Enter",i[i.Escape=42]="Escape",i[i.Backspace=43]="Backspace",i[i.Tab=44]="Tab",i[i.ShiftLeft=45]="ShiftLeft",i[i.ShiftRight=46]="ShiftRight",i[i.ControlLeft=47]="ControlLeft",i[i.ControlRight=48]="ControlRight",i[i.AltLeft=49]="AltLeft",i[i.AltRight=50]="AltRight",i[i.MetaLeft=51]="MetaLeft",i[i.MetaRight=52]="MetaRight",i[i.CapsLock=53]="CapsLock",i[i.Delete=54]="Delete",i[i.Insert=55]="Insert",i[i.Home=56]="Home",i[i.End=57]="End",i[i.PageUp=58]="PageUp",i[i.PageDown=59]="PageDown",i[i.F1=60]="F1",i[i.F2=61]="F2",i[i.F3=62]="F3",i[i.F4=63]="F4",i[i.F5=64]="F5",i[i.F6=65]="F6",i[i.F7=66]="F7",i[i.F8=67]="F8",i[i.F9=68]="F9",i[i.F10=69]="F10",i[i.F11=70]="F11",i[i.F12=71]="F12",i[i.Minus=72]="Minus",i[i.Equal=73]="Equal",i[i.BracketLeft=74]="BracketLeft",i[i.BracketRight=75]="BracketRight",i[i.Backslash=76]="Backslash",i[i.Semicolon=77]="Semicolon",i[i.Quote=78]="Quote",i[i.Comma=79]="Comma",i[i.Period=80]="Period",i[i.Slash=81]="Slash",i[i.Backquote=82]="Backquote",i[i.Numpad0=91]="Numpad0",i[i.Numpad1=92]="Numpad1",i[i.Numpad2=93]="Numpad2",i[i.Numpad3=94]="Numpad3",i[i.Numpad4=95]="Numpad4",i[i.Numpad5=96]="Numpad5",i[i.Numpad6=97]="Numpad6",i[i.Numpad7=98]="Numpad7",i[i.Numpad8=99]="Numpad8",i[i.Numpad9=100]="Numpad9",i[i.NumpadAdd=101]="NumpadAdd",i[i.NumpadSubtract=102]="NumpadSubtract",i[i.NumpadMultiply=103]="NumpadMultiply",i[i.NumpadDivide=104]="NumpadDivide",i[i.NumpadDecimal=105]="NumpadDecimal",i[i.NumpadEnter=106]="NumpadEnter",i[i.NumLock=107]="NumLock",i[i.PrintScreen=111]="PrintScreen",i[i.ScrollLock=112]="ScrollLock",i[i.Pause=113]="Pause",i[i.ContextMenu=114]="ContextMenu",i))(X||{});function N(t){let r=X[t];return r!==void 0?r:null}c(N,"keyCodeToKeyboardInput");function H(t){return X[t]}c(H,"keyboardInputToKeyCode");var P=(g=>(g[g.LeftButton=0]="LeftButton",g[g.MiddleButton=1]="MiddleButton",g[g.RightButton=2]="RightButton",g[g.Button4=3]="Button4",g[g.Button5=4]="Button5",g[g.PositionX=100]="PositionX",g[g.PositionY=101]="PositionY",g[g.DeltaX=102]="DeltaX",g[g.DeltaY=103]="DeltaY",g[g.WheelDeltaY=104]="WheelDeltaY",g[g.WheelDeltaX=105]="WheelDeltaX",g))(P||{});function F(t){return t<100}c(F,"isMouseButton");function q(t){return t>=100}c(q,"isMouseAxis");var z=(x=>(x[x.ButtonA=0]="ButtonA",x[x.ButtonB=1]="ButtonB",x[x.ButtonX=2]="ButtonX",x[x.ButtonY=3]="ButtonY",x[x.LeftShoulder=4]="LeftShoulder",x[x.RightShoulder=5]="RightShoulder",x[x.LeftTrigger=6]="LeftTrigger",x[x.RightTrigger=7]="RightTrigger",x[x.Select=8]="Select",x[x.Start=9]="Start",x[x.LeftStick=10]="LeftStick",x[x.RightStick=11]="RightStick",x[x.DPadUp=12]="DPadUp",x[x.DPadDown=13]="DPadDown",x[x.DPadLeft=14]="DPadLeft",x[x.DPadRight=15]="DPadRight",x[x.Home=16]="Home",x[x.Touchpad=17]="Touchpad",x[x.LeftStickX=100]="LeftStickX",x[x.LeftStickY=101]="LeftStickY",x[x.RightStickX=102]="RightStickX",x[x.RightStickY=103]="RightStickY",x[x.LeftTriggerAxis=104]="LeftTriggerAxis",x[x.RightTriggerAxis=105]="RightTriggerAxis",x))(z||{});function U(t){return t<100}c(U,"isGamepadButton");function Q(t){return t>=100}c(Q,"isGamepadAxis");function $(t){return t>=0&&t<=19?t:null}c($,"gamepadButtonIndexToInput");function W(t){return{0:100,1:101,2:102,3:103}[t]??null}c(W,"gamepadAxisIndexToInput");var A=(l=>(l[l.Touch0=0]="Touch0",l[l.Touch1=1]="Touch1",l[l.Touch2=2]="Touch2",l[l.Touch3=3]="Touch3",l[l.Touch4=4]="Touch4",l[l.Touch5=5]="Touch5",l[l.Touch6=6]="Touch6",l[l.Touch7=7]="Touch7",l[l.Touch8=8]="Touch8",l[l.Touch9=9]="Touch9",l[l.Touch0X=100]="Touch0X",l[l.Touch0Y=101]="Touch0Y",l[l.Touch1X=102]="Touch1X",l[l.Touch1Y=103]="Touch1Y",l[l.Touch2X=104]="Touch2X",l[l.Touch2Y=105]="Touch2Y",l[l.Touch3X=106]="Touch3X",l[l.Touch3Y=107]="Touch3Y",l[l.Touch4X=108]="Touch4X",l[l.Touch4Y=109]="Touch4Y",l[l.Touch5X=110]="Touch5X",l[l.Touch5Y=111]="Touch5Y",l[l.Touch6X=112]="Touch6X",l[l.Touch6Y=113]="Touch6Y",l[l.Touch7X=114]="Touch7X",l[l.Touch7Y=115]="Touch7Y",l[l.Touch8X=116]="Touch8X",l[l.Touch8Y=117]="Touch8Y",l[l.Touch9X=118]="Touch9X",l[l.Touch9Y=119]="Touch9Y",l[l.PinchScale=200]="PinchScale",l[l.RotationAngle=201]="RotationAngle",l[l.SwipeVelocityX=202]="SwipeVelocityX",l[l.SwipeVelocityY=203]="SwipeVelocityY",l))(A||{});function O(t){return t<100}c(O,"isTouchButton");function j(t){return t>=100&&t<200}c(j,"isTouchPosition");function J(t){return t>=200}c(J,"isTouchGesture");function d(t){return t<0||t>9?null:100+t*2}c(d,"getTouchXAxis");function G(t){return t<0||t>9?null:101+t*2}c(G,"getTouchYAxis");var B=(e=>(e[e.Zone0=0]="Zone0",e[e.Zone1=1]="Zone1",e[e.Zone2=2]="Zone2",e[e.Zone3=3]="Zone3",e[e.Zone4=4]="Zone4",e[e.Zone5=5]="Zone5",e[e.Zone6=6]="Zone6",e[e.Zone7=7]="Zone7",e[e.Zone8=8]="Zone8",e[e.Zone9=9]="Zone9",e[e.Zone10=10]="Zone10",e[e.Zone11=11]="Zone11",e[e.Zone12=12]="Zone12",e[e.Zone13=13]="Zone13",e[e.Zone14=14]="Zone14",e[e.Zone15=15]="Zone15",e[e.Zone16=16]="Zone16",e[e.Zone17=17]="Zone17",e[e.Zone18=18]="Zone18",e[e.Zone19=19]="Zone19",e[e.Zone20=20]="Zone20",e[e.Zone21=21]="Zone21",e[e.Zone22=22]="Zone22",e[e.Zone23=23]="Zone23",e[e.Zone24=24]="Zone24",e[e.Zone25=25]="Zone25",e[e.Zone26=26]="Zone26",e[e.Zone27=27]="Zone27",e[e.Zone28=28]="Zone28",e[e.Zone29=29]="Zone29",e[e.Zone30=30]="Zone30",e[e.Zone31=31]="Zone31",e[e.Zone0X=100]="Zone0X",e[e.Zone0Y=101]="Zone0Y",e[e.Zone1X=102]="Zone1X",e[e.Zone1Y=103]="Zone1Y",e[e.Zone2X=104]="Zone2X",e[e.Zone2Y=105]="Zone2Y",e[e.Zone3X=106]="Zone3X",e[e.Zone3Y=107]="Zone3Y",e[e.Zone4X=108]="Zone4X",e[e.Zone4Y=109]="Zone4Y",e[e.Zone5X=110]="Zone5X",e[e.Zone5Y=111]="Zone5Y",e[e.Zone6X=112]="Zone6X",e[e.Zone6Y=113]="Zone6Y",e[e.Zone7X=114]="Zone7X",e[e.Zone7Y=115]="Zone7Y",e[e.Zone8X=116]="Zone8X",e[e.Zone8Y=117]="Zone8Y",e[e.Zone9X=118]="Zone9X",e[e.Zone9Y=119]="Zone9Y",e[e.Zone10X=120]="Zone10X",e[e.Zone10Y=121]="Zone10Y",e[e.Zone11X=122]="Zone11X",e[e.Zone11Y=123]="Zone11Y",e[e.Zone12X=124]="Zone12X",e[e.Zone12Y=125]="Zone12Y",e[e.Zone13X=126]="Zone13X",e[e.Zone13Y=127]="Zone13Y",e[e.Zone14X=128]="Zone14X",e[e.Zone14Y=129]="Zone14Y",e[e.Zone15X=130]="Zone15X",e[e.Zone15Y=131]="Zone15Y",e[e.Zone16X=132]="Zone16X",e[e.Zone16Y=133]="Zone16Y",e[e.Zone17X=134]="Zone17X",e[e.Zone17Y=135]="Zone17Y",e[e.Zone18X=136]="Zone18X",e[e.Zone18Y=137]="Zone18Y",e[e.Zone19X=138]="Zone19X",e[e.Zone19Y=139]="Zone19Y",e[e.Zone20X=140]="Zone20X",e[e.Zone20Y=141]="Zone20Y",e[e.Zone21X=142]="Zone21X",e[e.Zone21Y=143]="Zone21Y",e[e.Zone22X=144]="Zone22X",e[e.Zone22Y=145]="Zone22Y",e[e.Zone23X=146]="Zone23X",e[e.Zone23Y=147]="Zone23Y",e[e.Zone24X=148]="Zone24X",e[e.Zone24Y=149]="Zone24Y",e[e.Zone25X=150]="Zone25X",e[e.Zone25Y=151]="Zone25Y",e[e.Zone26X=152]="Zone26X",e[e.Zone26Y=153]="Zone26Y",e[e.Zone27X=154]="Zone27X",e[e.Zone27Y=155]="Zone27Y",e[e.Zone28X=156]="Zone28X",e[e.Zone28Y=157]="Zone28Y",e[e.Zone29X=158]="Zone29X",e[e.Zone29Y=159]="Zone29Y",e[e.Zone30X=160]="Zone30X",e[e.Zone30Y=161]="Zone30Y",e[e.Zone31X=162]="Zone31X",e[e.Zone31Y=163]="Zone31Y",e))(B||{});function y(t){return t<100}c(y,"isTouchZoneButton");function V(t){return t>=100}c(V,"isTouchZonePosition");function b(t){return t<0||t>31?null:100+t*2}c(b,"getTouchZoneXAxis");function _(t){return t<0||t>31?null:101+t*2}c(_,"getTouchZoneYAxis");var k=(s=>(s[s.DPadUp=0]="DPadUp",s[s.DPadDown=1]="DPadDown",s[s.DPadLeft=2]="DPadLeft",s[s.DPadRight=3]="DPadRight",s[s.DPadCenter=4]="DPadCenter",s[s.Play=5]="Play",s[s.Pause=6]="Pause",s[s.PlayPause=7]="PlayPause",s[s.Stop=8]="Stop",s[s.Rewind=9]="Rewind",s[s.FastForward=10]="FastForward",s[s.Previous=11]="Previous",s[s.Next=12]="Next",s[s.Record=13]="Record",s[s.VolumeUp=15]="VolumeUp",s[s.VolumeDown=16]="VolumeDown",s[s.Mute=17]="Mute",s[s.ChannelUp=18]="ChannelUp",s[s.ChannelDown=19]="ChannelDown",s[s.Back=20]="Back",s[s.Home=21]="Home",s[s.Menu=22]="Menu",s[s.Info=23]="Info",s[s.Guide=24]="Guide",s[s.Exit=25]="Exit",s[s.Red=30]="Red",s[s.Green=31]="Green",s[s.Yellow=32]="Yellow",s[s.Blue=33]="Blue",s[s.Digit0=40]="Digit0",s[s.Digit1=41]="Digit1",s[s.Digit2=42]="Digit2",s[s.Digit3=43]="Digit3",s[s.Digit4=44]="Digit4",s[s.Digit5=45]="Digit5",s[s.Digit6=46]="Digit6",s[s.Digit7=47]="Digit7",s[s.Digit8=48]="Digit8",s[s.Digit9=49]="Digit9",s[s.Input=50]="Input",s[s.Settings=51]="Settings",s[s.Subtitle=52]="Subtitle",s[s.Audio=53]="Audio",s[s.Power=54]="Power",s[s.PointerX=100]="PointerX",s[s.PointerY=101]="PointerY",s[s.GyroX=102]="GyroX",s[s.GyroY=103]="GyroY",s[s.GyroZ=104]="GyroZ",s))(k||{});function R(t){return t<100}c(R,"isTVRemoteButton");function Z(t){return t>=100}c(Z,"isTVRemoteAxis");function K(t,r){return{device:t,input:r}}c(K,"createInputDescriptor");function v(t){switch(t.device){case 0:return!0;case 1:return t.input<100;case 2:return t.input<100;case 3:return t.input<100;case 7:return t.input<100;case 4:return t.input<100;default:return!1}}c(v,"isButton");function T(t){return!v(t)}c(T,"isAxis");function u(t){let r=new Uint8Array(3);return r[0]=t.device,r[1]=t.input&255,r[2]=t.input>>8&255,r}c(u,"serializeInputDescriptor");function p(t,r=0){let n=t[r],D=t[r+1]|t[r+2]<<8;return{device:n,input:D}}c(p,"deserializeInputDescriptor");function I(t){let r=S[t.device],n;switch(t.device){case 0:n=X[t.input];break;case 1:n=P[t.input];break;case 2:n=z[t.input];break;case 3:n=A[t.input];break;case 7:n=B[t.input];break;case 4:n=k[t.input];break;default:n="Unknown"}return`${r}:${n}`}c(I,"inputDescriptorToString");function ii(t){let[r,n]=t.split(":");if(!r||!n)return null;let D=Object.entries(S).find(([o,f])=>o.toLowerCase()===r.toLowerCase()&&typeof f=="number")?.[1];if(D===void 0)return null;let w;switch(D){case 0:w=X[n];break;case 1:w=P[n];break;case 2:w=z[n];break;case 3:w=A[n];break;case 4:w=k[n];break;case 7:w=B[n];break}return w===void 0?null:{device:D,input:w}}c(ii,"parseInputDescriptor");var m=class m{constructor(r=0,n=0){Y(this,"x");Y(this,"y");this.x=r,this.y=n}static zero(){return new m(0,0)}static one(){return new m(1,1)}static up(){return new m(0,-1)}static down(){return new m(0,1)}static left(){return new m(-1,0)}static right(){return new m(1,0)}add(r){return new m(this.x+r.x,this.y+r.y)}subtract(r){return new m(this.x-r.x,this.y-r.y)}multiply(r){return new m(this.x*r,this.y*r)}divide(r){if(r===0)throw new Error("Division by zero");return new m(this.x/r,this.y/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){let r=this.length();return r===0?m.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}angle(){return Math.atan2(this.y,this.x)}angleTo(r){return Math.atan2(r.y-this.y,r.x-this.x)}rotate(r){let n=Math.cos(r),D=Math.sin(r);return new m(this.x*n-this.y*D,this.x*D+this.y*n)}lerp(r,n){return new m(this.x+(r.x-this.x)*n,this.y+(r.y-this.y)*n)}clone(){return new m(this.x,this.y)}equals(r){return this.x===r.x&&this.y===r.y}toString(){return`Vector2(${this.x}, ${this.y})`}toArray(){return[this.x,this.y]}set(r,n){return this.x=r,this.y=n,this}copy(r){return this.x=r.x,this.y=r.y,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0):(this.x/=r,this.y/=r),this}};c(m,"Vector2");var C=m;var a=class a{constructor(r=0,n=0,D=0){Y(this,"x");Y(this,"y");Y(this,"z");this.x=r,this.y=n,this.z=D}static zero(){return new a(0,0,0)}static one(){return new a(1,1,1)}static up(){return new a(0,1,0)}static down(){return new a(0,-1,0)}static left(){return new a(-1,0,0)}static right(){return new a(1,0,0)}static forward(){return new a(0,0,1)}static back(){return new a(0,0,-1)}add(r){return new a(this.x+r.x,this.y+r.y,this.z+r.z)}subtract(r){return new a(this.x-r.x,this.y-r.y,this.z-r.z)}multiply(r){return new a(this.x*r,this.y*r,this.z*r)}divide(r){if(r===0)throw new Error("Division by zero");return new a(this.x/r,this.y/r,this.z/r)}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}lengthSquared(){return this.x*this.x+this.y*this.y+this.z*this.z}normalize(){let r=this.length();return r===0?a.zero():this.divide(r)}distance(r){return this.subtract(r).length()}distanceSquared(r){return this.subtract(r).lengthSquared()}dot(r){return this.x*r.x+this.y*r.y+this.z*r.z}cross(r){return new a(this.y*r.z-this.z*r.y,this.z*r.x-this.x*r.z,this.x*r.y-this.y*r.x)}lerp(r,n){return new a(this.x+(r.x-this.x)*n,this.y+(r.y-this.y)*n,this.z+(r.z-this.z)*n)}clone(){return new a(this.x,this.y,this.z)}equals(r){return this.x===r.x&&this.y===r.y&&this.z===r.z}toString(){return`Vector3(${this.x}, ${this.y}, ${this.z})`}toArray(){return[this.x,this.y,this.z]}set(r,n,D){return this.x=r,this.y=n,this.z=D,this}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}addInPlace(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}subtractInPlace(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}multiplyInPlace(r){return this.x*=r,this.y*=r,this.z*=r,this}divideInPlace(r){if(r===0)throw new Error("Division by zero");return this.x/=r,this.y/=r,this.z/=r,this}normalizeInPlace(){let r=this.length();return r===0?(this.x=0,this.y=0,this.z=0):(this.x/=r,this.y/=r,this.z/=r),this}};c(a,"Vector3");var E=a;var yi={scanlines:{opacity:.15,pattern:"horizontal",spacing:2,thickness:1,color:{r:0,g:0,b:0}},ambientEffect:{blur:30,scale:1.3,opacity:.7}},Vi={color:"rgba(144, 24, 24, 1)",lineWidth:1};var ei=(f=>(f.None="none",f.Eighth="eighth",f.Quarter="quarter",f.Half="half",f.Integer="integer",f.Responsive="responsive",f))(ei||{}),ri=(f=>(f[f.None=0]="None",f[f.Eighth=1]="Eighth",f[f.Quarter=2]="Quarter",f[f.Half=3]="Half",f[f.Integer=4]="Integer",f[f.Responsive=5]="Responsive",f))(ri||{});function _i(t){switch(t){case"none":return 0;case"eighth":return 1;case"quarter":return 2;case"half":return 3;case"integer":return 4;case"responsive":return 5;default:return 0}}c(_i,"scalingModeToValue");function Ri(t){switch(t){case 0:return"none";case 1:return"eighth";case 2:return"quarter";case 3:return"half";case 4:return"integer";case 5:return"responsive";default:return"none"}}c(Ri,"valueToScalingMode");var si=(o=>(o[o.Disconnected=0]="Disconnected",o[o.Connecting=1]="Connecting",o[o.Connected=2]="Connected",o[o.Reconnecting=3]="Reconnecting",o[o.Error=4]="Error",o))(si||{});export{Vi as GRID_DEFAULTS,z as GamepadInput,S as InputDeviceType,X as KeyboardInput,P as MouseInput,si as NetworkState,yi as POST_PROCESS_DEFAULTS,ei as ScalingMode,ri as ScalingModeValue,k as TVRemoteInput,A as TouchInput,B as TouchZoneInput,C as Vector2,E as Vector3,K as createInputDescriptor,p as deserializeInputDescriptor,W as gamepadAxisIndexToInput,$ as gamepadButtonIndexToInput,d as getTouchXAxis,G as getTouchYAxis,b as getTouchZoneXAxis,_ as getTouchZoneYAxis,I as inputDescriptorToString,T as isAxis,v as isButton,Q as isGamepadAxis,U as isGamepadButton,q as isMouseAxis,F as isMouseButton,Z as isTVRemoteAxis,R as isTVRemoteButton,O as isTouchButton,J as isTouchGesture,j as isTouchPosition,y as isTouchZoneButton,V as isTouchZonePosition,N as keyCodeToKeyboardInput,H as keyboardInputToKeyCode,ii as parseInputDescriptor,_i as scalingModeToValue,u as serializeInputDescriptor,Ri as valueToScalingMode};
|