initial commit
This commit is contained in:
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
3
client/.prettierrc
Normal file
3
client/.prettierrc
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"useTabs": true
|
||||
}
|
||||
20
client/eslint.config.mjs
Normal file
20
client/eslint.config.mjs
Normal file
@ -0,0 +1,20 @@
|
||||
import js from "@eslint/js";
|
||||
import prettier from "eslint-plugin-prettier/recommended";
|
||||
import tseslint from "typescript-eslint";
|
||||
|
||||
export default tseslint.config(
|
||||
{ ignores: ["dist"] },
|
||||
{
|
||||
extends: [
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
prettier,
|
||||
],
|
||||
files: ["**/*.{ts,tsx}"],
|
||||
languageOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
rules: {},
|
||||
},
|
||||
);
|
||||
17
client/index.html
Normal file
17
client/index.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<title>PixiJS - Template</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="pixi-container"></div>
|
||||
</div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
2918
client/package-lock.json
generated
Normal file
2918
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
client/package.json
Normal file
25
client/package.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "client",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "npm run dev",
|
||||
"build": "npm run lint && tsc && vite build",
|
||||
"lint": "eslint .",
|
||||
"dev": "vite"
|
||||
},
|
||||
"dependencies": {
|
||||
"pixi.js": "^8.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.21.0",
|
||||
"eslint": "^9.21.0",
|
||||
"eslint-config-prettier": "^10.1.2",
|
||||
"eslint-plugin-prettier": "^5.2.6",
|
||||
"prettier": "^3.5.3",
|
||||
"typescript": "~5.7.3",
|
||||
"typescript-eslint": "^8.25.0",
|
||||
"vite": "^6.2.0"
|
||||
}
|
||||
}
|
||||
BIN
client/public/assets/bunny.png
Executable file
BIN
client/public/assets/bunny.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 449 B |
949
client/public/assets/cards.json
Normal file
949
client/public/assets/cards.json
Normal file
@ -0,0 +1,949 @@
|
||||
{
|
||||
"frames": {
|
||||
"twoOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"threeOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 144,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fourOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 288,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fiveOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 432,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sixOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 576,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sevenOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 720,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"eightOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 864,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"nineOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1008,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"tenOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1152,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"jackOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1296,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"queenOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1440,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"kingOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1584,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"aceOfSpades": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1728,
|
||||
"y": 0
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"twoOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"threeOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 144,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fourOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 288,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fiveOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 432,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sixOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 576,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sevenOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 720,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"eightOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 864,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"nineOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1008,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"tenOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1152,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"jackOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1296,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"queenOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1440,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"kingOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1584,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"aceOfHearts": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1728,
|
||||
"y": 224
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"twoOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"threeOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 144,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fourOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 288,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fiveOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 432,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sixOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 576,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sevenOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 720,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"eightOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 864,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"nineOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1008,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"tenOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1152,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"jackOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1296,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"queenOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1440,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"kingOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1584,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"aceOfClubs": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1728,
|
||||
"y": 448
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"twoOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"threeOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 144,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fourOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 288,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"fiveOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 432,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sixOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 576,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"sevenOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 720,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"eightOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 864,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"nineOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1008,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"tenOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1152,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"jackOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1296,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"queenOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1440,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"kingOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1584,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"aceOfDiamonds": {
|
||||
"frame": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 1728,
|
||||
"y": 672
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 144,
|
||||
"h": 224
|
||||
},
|
||||
"spriteSourceSize": {
|
||||
"w": 144,
|
||||
"h": 224,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"image": "cards.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 1872,
|
||||
"h": 896
|
||||
},
|
||||
"scale": 1
|
||||
}
|
||||
}
|
||||
BIN
client/public/assets/cards.png
Normal file
BIN
client/public/assets/cards.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
54
client/public/assets/logo.svg
Normal file
54
client/public/assets/logo.svg
Normal file
@ -0,0 +1,54 @@
|
||||
<svg width="735" height="289" viewBox="0 0 735 289" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_7_84)">
|
||||
<path d="M304.17 288.01V89.99H244.97C244.77 89.99 244.56 89.99 244.34 90C233.7 90.37 225.15 99.12 225.05 109.76C225.05 109.82 225.05 109.88 225.05 109.93V268.4C225.05 268.73 225.07 269.1 225.1 269.51C226 279.71 234.54 287.53 244.77 287.97C245.2 287.99 245.61 288 245.99 288H304.17V288.01Z" fill="#E72264"/>
|
||||
<path d="M548.21 287.91C559.24 287.08 567.97 278 568.05 266.93C568.05 266.86 568.05 266.79 568.05 266.72V110.16C568.05 110.1 568.05 110.03 568.05 109.97C568 99.03 559.1 90.11 548.16 90C548.08 90 548 90 547.92 90H488.93V288.02H545.74C546.51 288.02 547.34 287.98 548.21 287.92V287.91Z" fill="#E72264"/>
|
||||
<path d="M293.07 90H355.07C361.15 90 369.75 94.92 374.29 101L505.76 277C510.3 283.08 509.05 288 502.98 288H440.98C434.9 288 426.3 283.08 421.76 277L290.28 101C285.74 94.93 286.99 90 293.06 90H293.07Z" fill="#E72264"/>
|
||||
<path d="M498.07 90H436.07C429.99 90 421.39 94.92 416.85 101L285.38 277C280.84 283.08 282.09 288 288.16 288H350.16C356.24 288 364.84 283.08 369.38 277L500.85 101C505.39 94.93 504.14 90 498.07 90Z" fill="#E72264"/>
|
||||
<path d="M529.07 0C550.05 0 567.07 17.01 567.07 38C567.07 58.99 550.06 76 529.07 76C508.08 76 491.07 58.99 491.07 38C491.07 17.01 508.08 0 529.07 0Z" fill="#E72264"/>
|
||||
<path d="M265.07 0C286.05 0 303.07 17.01 303.07 38C303.07 58.99 286.06 76 265.07 76C244.08 76 227.07 58.99 227.07 38C227.07 17.01 244.08 0 265.07 0Z" fill="#E72264"/>
|
||||
<path d="M695.07 0H635.07C613.53 0 596.07 17.46 596.07 39V99C596.07 120.54 613.53 138 635.07 138H695.07C716.61 138 734.07 120.54 734.07 99V39C734.07 17.46 716.61 0 695.07 0ZM655.44 39.34V79.84C655.44 85.3 654.35 90.04 652.17 94.05C649.99 98.06 646.88 101.17 642.84 103.38C638.8 105.59 634.01 106.7 628.48 106.7C623.78 106.7 619.72 105.85 616.29 104.16C612.86 102.47 609.98 100.1 607.63 97.06C607.63 97.06 601.08 89.99 607.08 85C613.21 79.9 618.52 86.58 618.52 86.58C619.76 88.31 621.23 89.61 622.93 90.47C624.62 91.34 626.54 91.77 628.69 91.77C630.69 91.77 632.46 91.36 633.98 90.53C635.5 89.7 636.71 88.46 637.61 86.8C638.51 85.14 638.96 83.1 638.96 80.68V39.35C638.96 39.35 638.8 31.01 647.08 31.01C655.36 31.01 655.45 39.35 655.45 39.35L655.44 39.34ZM714.35 98.38C709.82 102.86 703.15 105.56 694.35 106.48C688.3 107.12 683.02 106.7 678.52 105.23C674.02 103.76 669.81 101.21 665.88 97.59C665.88 97.59 659.8 92.35 664.7 85.77C668.38 80.82 675.3 85.96 675.3 85.96C677.92 88.4 680.73 90.2 683.74 91.38C686.75 92.56 690.14 92.95 693.93 92.55C697.3 92.2 699.86 91.28 701.62 89.81C703.38 88.34 704.14 86.5 703.91 84.3C703.71 82.38 702.94 80.86 701.61 79.75C700.28 78.64 698.53 77.75 696.37 77.07C694.21 76.39 691.89 75.79 689.4 75.25C686.91 74.71 684.39 74.02 681.83 73.18C679.27 72.34 676.9 71.23 674.7 69.86C672.5 68.49 670.66 66.64 669.16 64.29C667.66 61.94 666.72 58.95 666.34 55.31C665.86 50.77 666.54 46.77 668.36 43.31C670.19 39.85 672.97 37.07 676.71 34.97C680.45 32.87 684.8 31.56 689.75 31.04C694.91 30.5 699.68 30.9 704.06 32.24C708.44 33.59 712.17 35.63 715.24 38.36C715.24 38.36 719.54 41.97 716.05 48.18C713.34 53.01 705.73 50.11 705.73 50.11C703.29 48.07 700.89 46.62 698.55 45.76C696.2 44.9 693.65 44.61 690.9 44.9C688.08 45.2 685.9 45.97 684.36 47.2C682.82 48.44 682.16 50.06 682.37 52.05C682.56 53.84 683.33 55.23 684.69 56.24C686.05 57.24 687.78 58.05 689.9 58.66C692.01 59.27 694.34 59.86 696.86 60.43C699.39 61 701.93 61.69 704.48 62.5C707.03 63.31 709.4 64.47 711.57 65.98C713.74 67.49 715.6 69.45 717.14 71.86C718.68 74.27 719.65 77.4 720.06 81.25C720.79 88.2 718.89 93.91 714.35 98.38Z" fill="#E72264"/>
|
||||
<path d="M107.17 0.340088C47.98 0.340088 0 48.3201 0 107.51C0 108.67 0.02 109.82 0.06 110.97V213.96C0.06 213.96 0.06 213.97 0.06 213.98V224.45C0.06 224.45 0.06 224.45 0.07 224.44V250.33C0.07 250.53 0.06 250.72 0.06 250.92C0.06 251.12 0.07 251.32 0.08 251.52V252H0.09C0.66 271.89 16.95 287.84 36.98 287.84C57.01 287.84 73.47 271.89 74.04 252V213.98H104.66C105.49 214 106.33 214.01 107.16 214.01C166.35 214.01 214.33 166.7 214.33 107.51C214.33 48.3201 166.36 0.340088 107.17 0.340088ZM107.17 140.01C100.62 140.01 84.02 140.01 77.13 140.01H74.07V107.52C74.07 89.3101 88.96 74.5401 107.17 74.5401C125.38 74.5401 140.15 89.3101 140.15 107.52C140.15 125.73 125.38 140.02 107.17 140.02V140.01Z" fill="#E72264"/>
|
||||
<path opacity="0.15" d="M36.05 214H73.99V252.01H73.82C73.25 271.9 56.96 287.85 36.93 287.85C16.9 287.85 0.6 271.9 0.03 252.01H0.02V251.53C0.02 251.33 0 251.13 0 250.93C0 250.73 0.01 250.54 0.01 250.34V247.66C1.15 229.87 17.94 214 36.04 214H36.05Z" fill="#1D1D1B"/>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M0.0599976 168.28V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03V125.45C44.2 128.59 17.77 144.66 0.0599976 168.28Z" fill="black"/>
|
||||
<path d="M0.119995 248.37C8.84 241.97 19.42 238.2 30.84 238.2H74.06V213.98H37.03C17.47 213.98 1.48 229.15 0.119995 248.37Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V126.79C43.95 129.74 17.39 146.16 0.0599976 170.27V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C18 213.98 2.34001 228.35 0.26001 246.83C8.97001 240.03 19.73 236.01 31.4 236.01H74.05V213.99H37.02L37.03 213.98Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V128.12C43.68 130.87 16.95 147.69 0.0599976 172.34V213.97C0.0599976 173.71 33.89 140.57 74.05 140.02V140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C18.53 213.98 3.22002 227.55 0.460022 245.28C9.12002 238.09 20.06 233.8 31.96 233.8H74.05V213.98H37.02H37.03Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V129.46C43.37 132 16.46 149.28 0.0599976 174.53V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C19.06 213.98 4.08998 226.79 0.72998 243.77C9.31998 236.18 20.41 231.6 32.53 231.6H74.06V213.98H37.03Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V130.81C43.01 133.11 15.89 150.93 0.0599976 176.84V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C19.6 213.98 5.00001 226.03 1.07001 242.24C9.54001 234.26 20.77 229.39 33.09 229.39H74.05V213.97H37.02L37.03 213.98Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V132.16C42.6 134.22 15.22 152.65 0.0599976 179.32V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C20.15 213.98 5.92998 225.28 1.47998 240.71C9.79998 232.34 21.14 227.19 33.66 227.19H74.06V213.98H37.03Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V133.52C42.12 135.31 14.43 154.48 0.0599976 182.01V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C20.72 213.98 6.88001 224.54 1.95001 239.19C10.08 230.44 21.53 224.99 34.21 224.99H74.05V213.98H37.02H37.03Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V134.89C41.53 136.39 13.47 156.46 0.0599976 185V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C21.28 213.98 7.83999 223.83 2.48999 237.7C10.4 228.56 21.92 222.79 34.78 222.79H74.06V213.98H37.03Z" fill="black"/>
|
||||
</g>
|
||||
<g opacity="0.05">
|
||||
<path opacity="0.5" d="M74.05 140.03V136.29C40.78 137.48 12.24 158.68 0.0599976 188.47V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/>
|
||||
<path d="M37.03 213.98C21.85 213.98 8.80999 223.13 3.10999 236.21C10.74 226.68 22.34 220.59 35.35 220.59H74.06V213.98H37.03Z" fill="black"/>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_7_84">
|
||||
<rect width="734.07" height="288.01" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.5 KiB |
BIN
client/public/favicon.png
Normal file
BIN
client/public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 830 B |
15
client/public/style.css
Normal file
15
client/public/style.css
Normal file
@ -0,0 +1,15 @@
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
background-color: #000000;
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
53
client/src/Card.ts
Normal file
53
client/src/Card.ts
Normal file
@ -0,0 +1,53 @@
|
||||
export type Card =
|
||||
| "twoOfSpades"
|
||||
| "threeOfSpades"
|
||||
| "fourOfSpades"
|
||||
| "fiveOfSpades"
|
||||
| "sixOfSpades"
|
||||
| "sevenOfSpades"
|
||||
| "eightOfSpades"
|
||||
| "nineOfSpades"
|
||||
| "tenOfSpades"
|
||||
| "jackOfSpades"
|
||||
| "queenOfSpades"
|
||||
| "kingOfSpades"
|
||||
| "aceOfSpades"
|
||||
| "twoOfHearts"
|
||||
| "threeOfHearts"
|
||||
| "fourOfHearts"
|
||||
| "fiveOfHearts"
|
||||
| "sixOfHearts"
|
||||
| "sevenOfHearts"
|
||||
| "eightOfHearts"
|
||||
| "nineOfHearts"
|
||||
| "tenOfHearts"
|
||||
| "jackOfHearts"
|
||||
| "queenOfHearts"
|
||||
| "kingOfHearts"
|
||||
| "aceOfHearts"
|
||||
| "twoOfClubs"
|
||||
| "threeOfClubs"
|
||||
| "fourOfClubs"
|
||||
| "fiveOfClubs"
|
||||
| "sixOfClubs"
|
||||
| "sevenOfClubs"
|
||||
| "eightOfClubs"
|
||||
| "nineOfClubs"
|
||||
| "tenOfClubs"
|
||||
| "jackOfClubs"
|
||||
| "queenOfClubs"
|
||||
| "kingOfClubs"
|
||||
| "aceOfClubs"
|
||||
| "twoOfDiamonds"
|
||||
| "threeOfDiamonds"
|
||||
| "fourOfDiamonds"
|
||||
| "fiveOfDiamonds"
|
||||
| "sixOfDiamonds"
|
||||
| "sevenOfDiamonds"
|
||||
| "eightOfDiamonds"
|
||||
| "nineOfDiamonds"
|
||||
| "tenOfDiamonds"
|
||||
| "jackOfDiamonds"
|
||||
| "queenOfDiamonds"
|
||||
| "kingOfDiamonds"
|
||||
| "aceOfDiamonds";
|
||||
24
client/src/Hand.ts
Normal file
24
client/src/Hand.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { Assets, Container, Sprite } from "pixi.js";
|
||||
import { Card } from "./Card";
|
||||
|
||||
const spritesheet = await Assets.load("/public/assets/cards.json");
|
||||
|
||||
export class Hand {
|
||||
cards: Container;
|
||||
|
||||
constructor(cards: Card[] = []) {
|
||||
const sprites: Container = new Container();
|
||||
sprites.position.set(0, 0);
|
||||
sprites.height = 300;
|
||||
sprites.width = 300;
|
||||
|
||||
for (const card of cards) {
|
||||
const sprite = new Sprite(spritesheet.textures[card]);
|
||||
sprite.height /= 1.5;
|
||||
sprite.width /= 1.5;
|
||||
sprites.addChild(sprite);
|
||||
}
|
||||
|
||||
this.cards = sprites;
|
||||
}
|
||||
}
|
||||
50
client/src/main.ts
Normal file
50
client/src/main.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import { Application, Assets, Sprite } from "pixi.js";
|
||||
import { Hand } from "./hand";
|
||||
|
||||
(async () => {
|
||||
// Create a new application
|
||||
const app = new Application();
|
||||
|
||||
// Initialize the application
|
||||
await app.init({ background: "#1099bb", resizeTo: window });
|
||||
|
||||
// Append the application canvas to the document body
|
||||
document.getElementById("pixi-container")!.appendChild(app.canvas);
|
||||
|
||||
try {
|
||||
// Create the SpriteSheet from data and image
|
||||
const cards = await Assets.load("/public/assets/cards.json");
|
||||
|
||||
console.log(cards);
|
||||
|
||||
// Create a bunny Sprite
|
||||
const bunny = new Sprite(cards.textures["fourOfHearts"]);
|
||||
|
||||
console.log(bunny);
|
||||
|
||||
// Center the sprite's anchor point
|
||||
bunny.anchor.set(0.5);
|
||||
|
||||
// Move the sprite to the center of the screen
|
||||
bunny.position.set(app.screen.width / 2, app.screen.height / 2);
|
||||
|
||||
bunny.height /= 1.5;
|
||||
bunny.width /= 1.5;
|
||||
|
||||
// Add the bunny to the stage
|
||||
// app.stage.addChild(bunny);
|
||||
|
||||
const hand = new Hand(["fourOfDiamonds"]);
|
||||
app.stage.addChild(hand.cards);
|
||||
|
||||
// Listen for animate update
|
||||
// app.ticker.add((time) => {
|
||||
// // Just for fun, let's rotate mr rabbit a little.
|
||||
// // * Delta is 1 if running at 100% performance *
|
||||
// // * Creates frame-independent transformation *
|
||||
// bunny.rotation += 0.1 * time.deltaTime;
|
||||
// });
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
})();
|
||||
66
client/src/spritesheets/spritesheet.ts
Normal file
66
client/src/spritesheets/spritesheet.ts
Normal file
@ -0,0 +1,66 @@
|
||||
type Spritesheet = {
|
||||
frames: Record<
|
||||
string,
|
||||
{
|
||||
frame: { x: number; y: number; w: number; h: number };
|
||||
sourceSize: { w: number; h: number };
|
||||
spriteSourceSize: { x: number; y: number; w: number; h: number };
|
||||
}
|
||||
>;
|
||||
meta: {
|
||||
image: string;
|
||||
format: string;
|
||||
size: { w: number; h: number };
|
||||
scale: 1;
|
||||
};
|
||||
animations?: Record<string, string[]>;
|
||||
};
|
||||
|
||||
(function () {
|
||||
console.log(JSON.stringify(getCardSpritesheet(), null, "\t"));
|
||||
})();
|
||||
|
||||
function getCardSpritesheet() {
|
||||
const spriteSheet: Spritesheet = {
|
||||
frames: {},
|
||||
meta: {
|
||||
image: "/public/assets/cards.png",
|
||||
format: "RGBA8888",
|
||||
size: { w: 1872, h: 896 },
|
||||
scale: 1,
|
||||
},
|
||||
};
|
||||
|
||||
const suits = ["Spades", "Hearts", "Clubs", "Diamonds"];
|
||||
const values = [
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"six",
|
||||
"seven",
|
||||
"eight",
|
||||
"nine",
|
||||
"ten",
|
||||
"jack",
|
||||
"queen",
|
||||
"king",
|
||||
"ace",
|
||||
];
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
for (let j = 0; j < 13; j++) {
|
||||
const cardName = `${values[j]}Of${suits[i]}`;
|
||||
const size = { w: 144, h: 224 };
|
||||
const position = { x: j * size.w, y: i * size.h };
|
||||
|
||||
spriteSheet.frames[cardName] = {
|
||||
frame: { ...size, ...position },
|
||||
sourceSize: size,
|
||||
spriteSourceSize: { ...size, x: 0, y: 0 },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return spriteSheet;
|
||||
}
|
||||
1
client/src/vite-env.d.ts
vendored
Normal file
1
client/src/vite-env.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
25
client/tsconfig.json
Normal file
25
client/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
9
client/vite.config.ts
Normal file
9
client/vite.config.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
server: {
|
||||
port: 8080,
|
||||
open: true,
|
||||
},
|
||||
});
|
||||
9
server/http/requests.http
Normal file
9
server/http/requests.http
Normal file
@ -0,0 +1,9 @@
|
||||
GET http://localhost:3000/table HTTP/1.1
|
||||
|
||||
###
|
||||
|
||||
POST http://localhost:3000/table HTTP/1.1
|
||||
|
||||
###
|
||||
|
||||
GET http://localhost:3000/table/0 HTTP/1.1
|
||||
1003
server/package-lock.json
generated
Normal file
1003
server/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
server/package.json
Normal file
22
server/package.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "server",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
"type": "commonjs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"watch": "nodemon dist/index.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@koa/router": "^14.0.0",
|
||||
"koa": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/koa": "^3.0.0",
|
||||
"@types/koa__router": "^12.0.4",
|
||||
"nodemon": "^3.1.10"
|
||||
}
|
||||
}
|
||||
24
server/src/blackjack/Blackjack.ts
Normal file
24
server/src/blackjack/Blackjack.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { DatabaseEntry } from "../serverResponse";
|
||||
|
||||
interface BlackjackProperties {
|
||||
turn: "dealer" | "player";
|
||||
}
|
||||
|
||||
export class Blackjack implements DatabaseEntry {
|
||||
id: number;
|
||||
created: Date;
|
||||
modified: Date;
|
||||
deleted: Date | null;
|
||||
turn: "dealer" | "player";
|
||||
|
||||
constructor(entry: BlackjackProperties & DatabaseEntry);
|
||||
constructor(id: number);
|
||||
constructor(data: number | (BlackjackProperties & DatabaseEntry)) {
|
||||
const id = typeof data === "number" ? data : data.id;
|
||||
this.id = id;
|
||||
this.created = new Date();
|
||||
this.modified = this.created;
|
||||
this.deleted = null;
|
||||
this.turn = "dealer";
|
||||
}
|
||||
}
|
||||
35
server/src/index.ts
Normal file
35
server/src/index.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import Koa from "koa";
|
||||
import Router from "@koa/router";
|
||||
import { Blackjack } from "./blackjack/Blackjack";
|
||||
import { itemResponse, itemsResponse } from "./serverResponse";
|
||||
|
||||
const PORT = 3000;
|
||||
|
||||
const app = new Koa();
|
||||
const router = new Router();
|
||||
|
||||
const tables: Blackjack[] = [];
|
||||
|
||||
router.get("/table", (ctx) => {
|
||||
ctx.status = 200;
|
||||
ctx.body = itemsResponse(tables);
|
||||
});
|
||||
|
||||
router.get("/table/:id", (ctx) => {
|
||||
const id = ctx.params["id"];
|
||||
|
||||
ctx.status = 200;
|
||||
ctx.body = itemResponse(tables[Number(id)]);
|
||||
});
|
||||
|
||||
router.post("/table", (ctx) => {
|
||||
const id = tables.length;
|
||||
|
||||
tables.push(new Blackjack(id));
|
||||
ctx.status = 201;
|
||||
ctx.body = { id };
|
||||
});
|
||||
|
||||
app.use(router.routes());
|
||||
|
||||
app.listen(3000, () => console.log(`listening on port ${PORT}`));
|
||||
44
server/src/serverResponse.ts
Normal file
44
server/src/serverResponse.ts
Normal file
@ -0,0 +1,44 @@
|
||||
export interface ApiItem<T> {
|
||||
created: string;
|
||||
deleted?: string;
|
||||
id: number;
|
||||
item?: T;
|
||||
modified: string;
|
||||
}
|
||||
|
||||
export interface DatabaseEntry {
|
||||
created: Date;
|
||||
deleted: Date | null;
|
||||
id: number;
|
||||
modified: Date;
|
||||
}
|
||||
|
||||
export function createdResponse<T extends DatabaseEntry>({ id }: T) {
|
||||
return { id };
|
||||
}
|
||||
|
||||
export function itemResponse<T>(data: T & DatabaseEntry): ApiItem<T> {
|
||||
const { id, created, modified, deleted, ...rest } = data;
|
||||
const res: ApiItem<T> = {
|
||||
id: id,
|
||||
created: created.toISOString(),
|
||||
modified: modified.toISOString(),
|
||||
};
|
||||
|
||||
if (deleted) {
|
||||
res.deleted = deleted.toISOString();
|
||||
}
|
||||
|
||||
res.item = rest as T;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function itemsResponse<T>(data: (T & DatabaseEntry)[]): ApiItem<T>[] {
|
||||
const res: ApiItem<T>[] = [];
|
||||
for (const item of data) {
|
||||
res.push(itemResponse(item));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
103
server/tsconfig.json
Normal file
103
server/tsconfig.json
Normal file
@ -0,0 +1,103 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
|
||||
/* Modules */
|
||||
"module": "commonjs" /* Specify what module code is generated. */,
|
||||
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
||||
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [] /* Allow multiple folders to be treated as one when resolving modules. */,
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||
|
||||
/* Interop Constraints */
|
||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user