-
-
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.
fix: [#2668] ScreenElement pointer capture configured properly
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Pointer on Screen Element</title> | ||
</head> | ||
<body> | ||
<p>Click the ScreenElement an alert should fire</p> | ||
<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,29 @@ | ||
|
||
class StartButton extends ex.ScreenElement { | ||
constructor(x: number, y: number) { | ||
super({ | ||
x, y | ||
}) | ||
} | ||
onInitialize() { | ||
this.graphics.use(new ex.Rectangle({ | ||
color: ex.Color.Green, | ||
width: 300, | ||
height: 50 | ||
})); | ||
// ... | ||
this.on('pointerup', () => { | ||
alert("I've been clicked"); | ||
}) | ||
// ... | ||
} | ||
} | ||
|
||
var engine = new ex.Engine({ | ||
width: 800, | ||
height: 400 | ||
}); | ||
|
||
engine.add(new StartButton(400, 200)); | ||
|
||
engine.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