-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b30d5e
commit f7c0190
Showing
18 changed files
with
299 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.DS_Store | ||
|
||
.turbo | ||
node_modules |
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
Empty file.
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,3 @@ | ||
.turbo | ||
node_modules | ||
dist |
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,3 @@ | ||
import { BASE_WORKSPACE_ESLINT_CONFIG } from "@wds/tools.eslint"; | ||
|
||
export default BASE_WORKSPACE_ESLINT_CONFIG; |
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,18 @@ | ||
{ | ||
"name": "@wds/pixi", | ||
"scripts": { | ||
"build": "vite build", | ||
"dev": "vite", | ||
"lint": "prettier . --check && eslint .", | ||
"lint:fix": "prettier . --write && eslint . --fix" | ||
}, | ||
"dependencies": { | ||
"pixi.js": "^8.4.1" | ||
}, | ||
"devDependencies": { | ||
"@wds/tools.prettier": "*", | ||
"@wds/tools.eslint": "*", | ||
"typescript": "^5.6.2", | ||
"vite": "^5.4.8" | ||
} | ||
} |
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,3 @@ | ||
import { BASE_WORKSPACE_PRETTIER_CONFIG } from "@wds/tools.prettier"; | ||
|
||
export default BASE_WORKSPACE_PRETTIER_CONFIG; |
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 @@ | ||
/// <reference types="vite/client" /> |
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,4 @@ | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} |
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,22 @@ | ||
<html> | ||
<head> | ||
<title>Pixi</title> | ||
|
||
<meta | ||
id="viewport" | ||
name="viewport" | ||
content="width=device-width, minimum-scale=1.0, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no, viewport-fit=cover" | ||
/> | ||
<meta | ||
name="mobile-web-app-capable" | ||
content="yes" | ||
/> | ||
</head> | ||
|
||
<body> | ||
<script | ||
type="module" | ||
src="/index.ts" | ||
></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,44 @@ | ||
import { Application, Assets, Sprite, type Texture, type TickerCallback } from "pixi.js"; | ||
|
||
import "./index.css"; | ||
|
||
(async () => { | ||
const app = new Application(); | ||
|
||
await app.init({ | ||
resizeTo: window, | ||
resolution: window.devicePixelRatio || 1, | ||
autoDensity: true, | ||
backgroundColor: 0x6495ed, | ||
}); | ||
|
||
app.ticker.maxFPS = 60; | ||
|
||
const clampyTexture = await Assets.load<Texture>("clampy.png"); | ||
|
||
document.addEventListener("click", (event) => { | ||
const clampySprite = new Sprite({ | ||
texture: clampyTexture, | ||
height: clampyTexture.height / 10, | ||
width: clampyTexture.width / 10, | ||
anchor: 0.5, | ||
x: event.clientX, | ||
y: event.clientY, | ||
}); | ||
|
||
const tickerHandler: TickerCallback<void> = (time) => { | ||
console.debug(document.body.clientWidth, document.body.clientHeight); | ||
clampySprite.rotation += 0.1 * time.deltaTime; | ||
}; | ||
|
||
app.ticker.add(tickerHandler); | ||
app.stage.addChild(clampySprite); | ||
|
||
setTimeout(() => { | ||
app.stage.removeChild(clampySprite); | ||
app.ticker.remove(tickerHandler); | ||
}, 2000); | ||
}); | ||
|
||
document.body.appendChild(app.canvas); | ||
})(); |
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.
Binary file not shown.
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,27 @@ | ||
{ | ||
"compilerOptions": { | ||
// Settings for the compiler | ||
"outDir": "./dist/", | ||
"sourceMap": true, | ||
"target": "es2015", | ||
"module": "ESNext", | ||
|
||
// Rules for your code | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noUnusedParameters": true, | ||
"noUnusedLocals": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitOverride": true, | ||
|
||
// Settings for linking source files | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"allowSyntheticDefaultImports": true, | ||
"experimentalDecorators": true | ||
}, | ||
// Folder for your code | ||
"include": ["src"] | ||
} |
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,23 @@ | ||
import { defineConfig } from "vite"; | ||
|
||
const DEFAULT_PORT = 3000; | ||
|
||
/** | ||
* Application build configuration. | ||
* | ||
* https://vitejs.dev/config/ | ||
*/ | ||
export default defineConfig({ | ||
root: "src", | ||
build: { | ||
outDir: "../dist", | ||
emptyOutDir: true, | ||
}, | ||
server: { | ||
port: DEFAULT_PORT, | ||
}, | ||
preview: { | ||
port: DEFAULT_PORT, | ||
}, | ||
plugins: [], | ||
}); |
Oops, something went wrong.