-
-
Notifications
You must be signed in to change notification settings - Fork 195
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 #3047 After the performance update to `ImageRenderer` in v0.29.2 there was uninitialized shared state that leaks between draw calls, which `Raster`s are especially susceptible to based on the call pattern.
- Loading branch information
Showing
8 changed files
with
142 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
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>Polygon Animation Rendering</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,72 @@ | ||
var engine = new ex.Engine({ | ||
width: 500, | ||
height: 400 | ||
}); | ||
|
||
var image = new ex.ImageSource('test.png'); | ||
var spriteSheet = ex.SpriteSheet.fromImageSource({ | ||
image: image, | ||
grid: { | ||
rows: 1, | ||
columns: 4, | ||
spriteWidth: 100, | ||
spriteHeight: 100 | ||
} | ||
}); | ||
|
||
// Set up the moving object | ||
// var mover = new ex.Actor({ x: 100, y: 0 }); | ||
// mover.anchor = ex.vec(0, 0); | ||
// mover.actions.repeatForever((ctx) => ctx.moveTo(ex.vec(100, 300), 50).moveTo(ex.vec(100, 0), 50)); | ||
// mover.graphics.add('up', spriteSheet.sprites[0]); | ||
|
||
var down = ex.Animation.fromSpriteSheet(spriteSheet, [0, 1, 2, 3], 500); | ||
|
||
// mover.graphics.add('down', down); | ||
// mover.onPreUpdate = () => { | ||
// if (mover.vel.y < 0) { | ||
// mover.graphics.use('up'); | ||
// } | ||
// if (mover.vel.y > 0) { | ||
// mover.graphics.use('down'); | ||
// } | ||
// }; | ||
|
||
// set up the hexagon object | ||
// var static1 = new ex.Actor({ x: 350, y: 100 }); | ||
var polygon1 = new ex.Polygon({ | ||
points: [ex.vec(50, 0), ex.vec(150, 0), ex.vec(200, 86), ex.vec(150, 172), ex.vec(50, 172), ex.vec(0, 86)], | ||
color: ex.Color.fromRGB(0, 255, 0) | ||
}); | ||
// static1.graphics.use(polygon1); | ||
|
||
// set up the rectangle object | ||
// var static2 = new ex.Actor({ x: 300, y: 300 }); | ||
var rect = new ex.Rectangle({ width: 100, height: 100, color: ex.Color.fromRGB(255, 0, 0) }); | ||
// static2.graphics.use(rect); | ||
|
||
// set up the circle object | ||
// var static3 = new ex.Actor({ x: 400, y: 300 }); | ||
var circle = new ex.Circle({ radius: 50, color: ex.Color.fromRGB(0, 0, 255) }); | ||
// static3.graphics.use(circle); | ||
|
||
var loader = new ex.Loader([image]); | ||
|
||
engine.currentScene.onPostDraw = (ctx) => { | ||
down.draw(ctx, 100, 100); | ||
polygon1.draw(ctx, 350, 100); | ||
rect.draw(ctx, 300, 300); | ||
circle.draw(ctx, 400, 300); | ||
|
||
down.tick(500, 1); | ||
down.draw(ctx, 100, 100); | ||
polygon1.draw(ctx, 350, 100); | ||
rect.draw(ctx, 300, 300); | ||
circle.draw(ctx, 400, 300); | ||
}; | ||
|
||
// engine.add(mover); | ||
// engine.add(static1); | ||
// engine.add(static2); | ||
// engine.add(static3); | ||
engine.start(loader); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.