-
-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Closes #3126 Fixes an issue where key events (and other event types) get stuck in the previous scene `InputHost` and cause issues when switching back. This state will never be useful and has lost relevancy after the scene has switched. ## Changes: - Adds a `InputHost.clear()` to clear previous scene event state - `Director` clears the previous scene input host
- Loading branch information
Showing
7 changed files
with
8,245 additions
and
9,438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Scene Keyboard</title> | ||
</head> | ||
<body> | ||
<script src="../../lib/excalibur.js"></script> | ||
<script src="index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var a = new ex.Scene(); | ||
a.on('initialize', () => { | ||
console.log('a input:', a.input.keyboard); | ||
// console.log('b input:', b.input.keyboard); | ||
a.input.pointers.primary.on('down', (e) => { | ||
a.engine.goToScene('b'); | ||
}); | ||
a.input.keyboard.on('press', (e) => { | ||
console.log('a input:', a.input.keyboard.getKeys()); | ||
if (e.key === ex.Keys.Key1) { | ||
a.engine.goToScene('b'); | ||
} | ||
}); | ||
}); | ||
|
||
var b = new ex.Scene(); | ||
b.backgroundColor = ex.Color.DarkGray; | ||
b.on('initialize', () => { | ||
// console.log('a input:', a.input.keyboard); | ||
console.log('b input:', b.input.keyboard); | ||
b.input.pointers.primary.on('down', (e) => { | ||
b.engine.goToScene('a'); | ||
}); | ||
b.input.keyboard.on('press', (e) => { | ||
console.log('a input:', a.input.keyboard.getKeys()); | ||
console.log('b input:', b.input.keyboard.getKeys()); | ||
if (e.key === ex.Keys.Key2) { | ||
b.engine.goToScene('a'); | ||
} | ||
}); | ||
}); | ||
|
||
var game6 = new ex.Engine({ | ||
scenes: { a, b } | ||
}); | ||
|
||
game6.goToScene('a'); | ||
game6.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters