Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JSGL v1.0.8 - User Input, "Camera", isTouching Update #15

Moderrek started this conversation in General
Discussion options

New

  • 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
});
...

What's Changed

Full Changelog: v1.0.7...v1.0.8


This discussion was created from the release JSGL v1.0.8 - User Input, "Camera", isTouching Update.
You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /