Skip to content

Commit

Permalink
game with pixi.js v7, copied from book-gamelets repo
Browse files Browse the repository at this point in the history
  • Loading branch information
haskasu committed Mar 11, 2024
1 parent c5d1e02 commit 88f4358
Show file tree
Hide file tree
Showing 103 changed files with 8,437 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
book-gamelets.keystore
android/
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
}
]
}
53 changes: 53 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 這個專案從pixi.js v7升級到v8所做的變更

# package.json

- "pixi.js": "^8.0.1"
- "@pixi/gif": "^3.0.0",
- "@pixi/sound": "^6.0.0",
- "eventemitter3": "^5.0.1", (新增,原本是包在pixi.js裏面)

# app.js

```typescript
let app = new Application<HTMLCanvasElement>();
document.body.appendChild(app.view);
//改成
let app = new Application();
document.body.appendChild(app.canvas);
```
```typescript
stageFrame.lineStyle({
color: 0xFF0000,
width: 2,
});
stageFrame.drawRect(
0, // x
0, // y
stageSize.width, //
stageSize.height //
);
// 改成
stageFrame.setStrokeStyle({
color: 0xFF0000,
width: 2,
});
stageFrame.rect(
0, // x
0, // y
stageSize.width, //
stageSize.height //
);
```

# RectUtils.ts

```typescript
class Rectangle {
...
}
// 改成
interface ShapePrimitive {
...
}
```
10 changes: 10 additions & 0 deletions capacitor.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
appId: 'com.gamelets.app',
appName: 'Gamelets',
webDir: 'dist',
bundledWebRuntime: false
};

export default config;
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Cache-control" content="no-cache">
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Gamelets</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit 88f4358

Please sign in to comment.