Skip to content

Commit

Permalink
test: add font source to integration
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Nov 23, 2024
1 parent 9176e5b commit ca3d277
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Binary file added sandbox/html/Gorgeous Pixel.ttf
Binary file not shown.
21 changes: 21 additions & 0 deletions sandbox/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,15 @@ svgActor.graphics.add(
// svgActor.graphics.add(svgExternal.toSprite());
game.add(svgActor);

var fontSource = new ex.FontSource('./html/Gorgeous Pixel.ttf', 'Gorgeous Pixel');

var boot = new ex.Loader();
// var boot = new ex.Loader({
// fullscreenAfterLoad: true,
// fullscreenContainer: document.getElementById('container')
// });
// boot.suppressPlayButton = true;
boot.addResource(fontSource);
boot.addResource(svgExternal);
boot.addResource(svgImage);
boot.addResource(heartImageSource);
Expand Down Expand Up @@ -622,6 +625,24 @@ follower.graphics.add(new ex.Rectangle({ color: ex.Color.Black, width: 20, heigh
follower.body.collisionType = ex.CollisionType.PreventCollision;
game.add(follower);

var font2 = fontSource.toFont({
family: 'Gorgeous Pixel',
color: ex.Color.White,
size: 30,
shadow: {
blur: 15,
color: ex.Color.Black
}
});

game.add(
new ex.Label({
text: 'Hello this is a pixel font',
pos: ex.vec(200, 200),
font: font2
})
);

// Create the player
var player = new ex.Actor({
name: 'player',
Expand Down

0 comments on commit ca3d277

Please sign in to comment.