diff --git a/site/docs/02-fundamentals/04-architecture.mdx b/site/docs/02-fundamentals/04-architecture.mdx index 8dd3173d0..29092dc6e 100644 --- a/site/docs/02-fundamentals/04-architecture.mdx +++ b/site/docs/02-fundamentals/04-architecture.mdx @@ -27,7 +27,7 @@ const game = new ex.Engine({ height: 600, // the height of the canvas canvasElementId: '', // the DOM canvas element ID, if you are providing your own displayMode: ex.DisplayMode.FitScreen, // the display mode - pointerScope: ex.Input.PointerScope.Document // the scope of capturing pointer (mouse/touch) events + pointerScope: ex.PointerScope.Document // the scope of capturing pointer (mouse/touch) events }); // call game.start, which is a Promise game.start().then(function () { @@ -241,7 +241,7 @@ var player = new ex.Actor(...); // Enable pointer events for this actor player.enableCapturePointer = true; // subscribe to pointerdown event -player.on("pointerdown", function (evt: ex.Input.PointerEvent) { +player.on("pointerdown", function (evt: ex.PointerEvent) { console.log("Player was clicked!"); }); // turn off subscription diff --git a/site/docs/11-input/10.1-input.mdx b/site/docs/11-input/10.1-input.mdx index befd5fa31..d0f15ae08 100644 --- a/site/docs/11-input/10.1-input.mdx +++ b/site/docs/11-input/10.1-input.mdx @@ -20,8 +20,8 @@ Access [[Engine.input]] to see if any input is being tracked during the current class Player extends ex.Actor { public update(engine, delta) { if ( - engine.input.keyboard.isHeld(ex.Input.Keys.W) || - engine.input.gamepads.at(0).getAxes(ex.Input.Axes.LeftStickY) > 0.5 + engine.input.keyboard.isHeld(ex.Keys.W) || + engine.input.gamepads.at(0).getAxes(ex.Axes.LeftStickY) > 0.5 ) { // implement the code to move the player forward } diff --git a/site/docs/11-input/10.2-keyboard.mdx b/site/docs/11-input/10.2-keyboard.mdx index d381e2fea..35a6ec12e 100644 --- a/site/docs/11-input/10.2-keyboard.mdx +++ b/site/docs/11-input/10.2-keyboard.mdx @@ -27,13 +27,13 @@ It is recommended that keyboard actions that directly effect actors be queried, class Player extends ex.Actor { public update(engine, delta) { if ( - engine.input.keyboard.isHeld(ex.Input.Keys.W) || - engine.input.keyboard.isHeld(ex.Input.Keys.Up) + engine.input.keyboard.isHeld(ex.Keys.W) || + engine.input.keyboard.isHeld(ex.Keys.Up) ) { player._moveForward() } - if (engine.input.keyboard.wasPressed(ex.Input.Keys.Right)) { + if (engine.input.keyboard.wasPressed(ex.Keys.Right)) { player._fire() } } diff --git a/site/docs/11-input/10.3-pointer.mdx b/site/docs/11-input/10.3-pointer.mdx index a191d081c..c1bf98dbe 100644 --- a/site/docs/11-input/10.3-pointer.mdx +++ b/site/docs/11-input/10.3-pointer.mdx @@ -131,8 +131,8 @@ You can customize how pointer events are handled by setting the [[EngineOptions. /// // ---cut--- const game = new ex.Engine({ - pointerScope: ex.Input.PointerScope.C -// ^| + pointerScope: ex.PointerScope.C +// ^| }); ``` @@ -147,8 +147,8 @@ You also have the option to handle _all_ pointer events in the browser window by /// // ---cut--- const game = new ex.Engine({ - pointerScope: ex.Input.PointerScope.D -// ^| + pointerScope: ex.PointerScope.D +// ^| }); ``` @@ -241,15 +241,15 @@ Actors have the following **extra** events you can subscribe to: ## Checking the Pointer Type The primary pointer can be a mouse, stylus, or single finger touch event. You -can inspect what type of pointer it is from the [[Input.PointerEvent|PointerEvent]] handled. +can inspect what type of pointer it is from the [[PointerEvent|PointerEvent]] handled. ```ts twoslash // @include: ex // ---cut--- -engine.input.pointers.primary.on('down', function (pe: ex.Input.PointerEvent) { - if (pe.pointerType === ex.Input.PointerType.Mouse) { +engine.input.pointers.primary.on('down', function (pe: ex.PointerEvent) { + if (pe.pointerType === ex.PointerType.Mouse) { ex.Logger.getInstance().info('Mouse event:', pe); - } else if (pe.pointerType === ex.Input.PointerType.Touch) { + } else if (pe.pointerType === ex.PointerType.Touch) { ex.Logger.getInstance().info('Touch event:', pe); } }); @@ -280,8 +280,8 @@ know that there are _n_ touches on the screen at once. // ---cut--- function paint(color: ex.Color) { // create a handler for the event - return function (pe: ex.Input.PointerEvent) { - if (pe.pointerType === ex.Input.PointerType.Touch) { + return function (pe: ex.PointerEvent) { + if (pe.pointerType === ex.PointerType.Touch) { engine.graphicsContext.drawRectangle(pe.worldPos, 5, 5, color); } }; diff --git a/site/docs/11-input/10.4-gamepad.mdx b/site/docs/11-input/10.4-gamepad.mdx index 225ba9e7b..b74504eb9 100644 --- a/site/docs/11-input/10.4-gamepad.mdx +++ b/site/docs/11-input/10.4-gamepad.mdx @@ -44,17 +44,17 @@ Once you have a reference to a gamepad you may listen to changes on that gamepad - `axis` - Whenever an axis ```ts -engine.input.gamepads.on('connect', (ce: ex.Input.GamepadConnectEvent) => { +engine.input.gamepads.on('connect', (ce: ex.GamepadConnectEvent) => { const newPlayer = CreateNewPlayer() // pseudo-code for new player logic on gamepad connection console.log('Gamepad connected', ce) ce.gamepad.on('button', (be: ex.GamepadButtonEvent) => { - if (be.button === ex.Input.Buttons.Face1) { + if (be.button === ex.Buttons.Face1) { newPlayer.jump() } }) ce.gamepad.on('axis', (ae: ex.GamepadAxisEvent) => { - if (ae.axis === ex.Input.Axis.LeftStickX && ae.value > 0.5) { + if (ae.axis === ex.Axis.LeftStickX && ae.value > 0.5) { newPlayer.moveRight() } }) @@ -78,11 +78,11 @@ engine.input.gamepads.enabled = true // query gamepad on update engine.on('update', function (ev) { // access any gamepad by index - if (engine.input.gamepads.at(0).isButtonPressed(ex.Input.Buttons.Face1)) { + if (engine.input.gamepads.at(0).isButtonPressed(ex.Buttons.Face1)) { ex.Logger.getInstance().info('Controller A button pressed') } // query individual button - if (engine.input.gamepads.at(0).getButton(ex.Input.Buttons.DpadLeft) > 0.2) { + if (engine.input.gamepads.at(0).getButton(ex.Buttons.DpadLeft) > 0.2) { ex.Logger.getInstance().info('Controller D-pad left value is > 0.2') } }) @@ -108,7 +108,7 @@ engine.input.gamepads.enabled = true; // query gamepad on update engine.on('update', function(ev) { // access any gamepad by index - const axisValue = = engine.input.gamepads.at(0).getAxes(ex.Input.Axes.LeftStickX)); + const axisValue = = engine.input.gamepads.at(0).getAxes(ex.Axes.LeftStickX)); if (axisValue > 0.5) { ex.Logger.getInstance().info('Move right', axisValue); } diff --git a/site/docs/12-other/12-ui.mdx b/site/docs/12-other/12-ui.mdx index 1e493e5eb..1295f1f43 100644 --- a/site/docs/12-other/12-ui.mdx +++ b/site/docs/12-other/12-ui.mdx @@ -135,7 +135,7 @@ const game = new ex.Engine({ * Specify pointer scope to ensure that excalibur won't capture the mouse input * meant to be captured by HTML GUI */ - pointerScope: ex.Input.PointerScope.Canvas, + pointerScope: ex.PointerScope.Canvas, }) /**