Skip to content

User Input, "Camera", isTouching update 1.0.8#13

Merged
Moderrek merged 3 commits intoreleasefrom
dev-1.0.8
Apr 4, 2023
Merged

User Input, "Camera", isTouching update 1.0.8#13
Moderrek merged 3 commits intoreleasefrom
dev-1.0.8

Conversation

@Moderrek
Copy link
Copy Markdown
Owner

@Moderrek Moderrek commented Apr 4, 2023

JSGL - User Input, "Camera", isTouching update 1.0.8

  • Added changelogs
  • Game Events
    • mouseScroll - emits GameMouseEvent
    • keyDown - emits GameKeyEvent
    • keyUp - emits GameKeyEvent
  • "Camera" is more like to view offset. You can find it in game.canvasViewOffset. This property is a Vector2.
  • Added DrawableGameObject.IsTouching(drawGameObj, drawGameObj2) static method and drawableGameObject.isTouching(drawGameObj)
  • Added JSGL.log(content), JSGL.warn(content), JSGL.error(content). Prints message to dev console with format [DATE] [LEVEL] content

Changes

  • Deprecated
    • game.mousePos - Instead use game.input.mouseWorldPosition
    • game.mouseClientPos - Instead use game.input.mouseClientPosition
    • game.mousePrecisePos - Instead use game.input.mousePreciseWorldPosition
    • game.isMousePrimaryButtonDown() - Instead use game.input.isMousePrimaryButtonDown
  • Now GameMouseEvent has properties from game.input. (Only about mouse)

Fixes

  • None.

Presentation of news

Mouse wheel handling

In GameObject

...
Update(event){
    event.game.input.mouseScrollDelta.y; // x is ignored
}
...

Without GameObject

game.on('mouseScroll', (event) => {
    event.mouseScrollDelta.y; // x is ignored
});

How to work with input

In GameObject

...
Update(event){
    event.game.input.isKeyDown('w'); // <-- returns is 'w' pressed down
    event.game.input.isKeyUp('s'); // <-- returns is 's' clicked
}
...

Without GameObject

...
game.on('keyUp' (event) => {
    event.input.isKeyUp('s'); // <-- returns is 's' clicked
});
game.on('keyDown' (event) => {
    event.input.isKeyDown('w'); // <-- returns is 'w' pressed down
});
...

@Moderrek Moderrek merged commit 5e7f417 into release Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant