Skip to content

Commit

Permalink
Tests are working
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Jan 1, 2024
1 parent 30f6cdf commit 77202e8
Show file tree
Hide file tree
Showing 262 changed files with 9,367 additions and 9,889 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ actual-*.png
diff-*.png
coverage/
!files.d.ts
!karma.conf.js
!karma.conf.js
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,22 @@ To compile only:
To run tests:

npm test

To update snapshots

* Windows

```powershell
npx playwright test --update-snapshots
```

* Linux for CI

```powershell
docker run --rm --network host -v C:\projects\excalibur-tiled:/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.40.0-jammy /bin/bash
npm install
npx playwright test --update-snapshots
```



5 changes: 0 additions & 5 deletions example/collectable.tx

This file was deleted.

31 changes: 0 additions & 31 deletions example/collider.tmx

This file was deleted.

14 changes: 0 additions & 14 deletions example/example-city.tiled-project

This file was deleted.

120 changes: 0 additions & 120 deletions example/example-city.tiled-session

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
<option value="test-zlib.json">v0 zlib</option>
</select>

<script src="game.js"></script>
<script src="./test/test.js"></script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions example/isometric/external-fantasy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="external-fantasy" tilewidth="16" tileheight="16" tilecount="132" columns="12">
<editorsettings>
<export target="external-fantasy..tsj" format="json"/>
</editorsettings>
<image source="tilemap_packed.png" width="192" height="176"/>
<tile id="93">
<objectgroup draworder="index" id="2">
<object id="1" type="coin" x="3.27273" y="11.6364">
<polygon points="0,0 -0.272727,-8.18182 1.54545,-9.90909 7.36364,-9.90909 9.72727,-7.72727 9.72727,0.545455 7.63636,2.27273 2,2.27273"/>
</object>
</objectgroup>
</tile>
<tile id="95">
<objectgroup draworder="index" id="2">
<object id="1" x="2" y="2" width="12" height="14"/>
</objectgroup>
</tile>
<tile id="105">
<objectgroup draworder="index" id="2">
<object id="1" x="3.45455" y="15.2727">
<polygon points="0,0 -3.09091,-3.18182 -2.72727,-7.36364 8.27273,-14.4545 12.5455,-11.7273 12.5455,-5.54545 4.27273,-0.0909091"/>
</object>
</objectgroup>
</tile>
</tileset>
10 changes: 10 additions & 0 deletions example/isometric/external-iso-fantasy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="external-iso-fantasy" tilewidth="16" tileheight="17" tilecount="110" columns="11">
<grid orientation="isometric" width="16" height="8"/>
<image source="assets/Isometric_MedievalFantasy_Tiles.png" width="176" height="170"/>
<tile id="30">
<objectgroup draworder="index" id="2">
<object id="1" x="0.409091" y="0.5" width="7.22727" height="6.18182"/>
</objectgroup>
</tile>
</tileset>
15 changes: 15 additions & 0 deletions example/isometric/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Isometric Map Test</title>
<style>
body {
margin: 0;
}
</style>
</head>
<body>
<canvas id="game"></canvas>
<script src="isometric.js"></script>
</body>
</html>
File renamed without changes.
File renamed without changes.
64 changes: 64 additions & 0 deletions example/isometric/isometric.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import * as ex from 'excalibur';
import { TiledResource } from '@excalibur-tiled';

class Player extends ex.Actor {
override onPostUpdate(engine: ex.Engine) {
this.vel = ex.vec(0, 0)
const speed = 64;
if (engine.input.keyboard.isHeld(ex.Keys.Right)) {
this.vel.x = speed;
}
if (engine.input.keyboard.isHeld(ex.Keys.Left)) {
this.vel.x = -speed;
}
if (game.input.keyboard.isHeld(ex.Input.Keys.Up)) {
this.vel.y = -speed;
}
if (game.input.keyboard.isHeld(ex.Input.Keys.Down)) {
this.vel.y = speed;
}
}
}

const game = new ex.Engine({
width: 800,
height: 600,
canvasElementId: 'game',
pointerScope: ex.PointerScope.Canvas,
antialiasing: false
});
game.toggleDebug();

const tiledMap = new TiledResource('isometric.tmx', {
useMapBackgroundColor: true
});

const loader = new ex.Loader([tiledMap]);

let currentPointer!: ex.Vector;
game.input.pointers.primary.on('down', (moveEvent) => {
currentPointer = moveEvent.worldPos;
game.currentScene.camera.move(currentPointer, 300, ex.EasingFunctions.EaseInOutCubic);
});

game.input.pointers.primary.on('move', (moveEvent) => {
const tile = tiledMap.getTileByPoint('ground', moveEvent.worldPos);
if (tile) {
console.log(tile);
}
})

game.input.pointers.primary.on('wheel', (wheelEvent) => {
// wheel up
game.currentScene.camera.pos = currentPointer;
if (wheelEvent.deltaY < 0) {
game.currentScene.camera.zoom *= 1.2;
} else {
game.currentScene.camera.zoom /= 1.2;
}
});

game.start(loader).then(() => {
tiledMap.addToScene(game.currentScene);
currentPointer = game.currentScene.camera.pos;
});
30 changes: 0 additions & 30 deletions example/margin.tmx

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 77202e8

Please sign in to comment.