@inglorious/create-game 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +54 -0
- package/bin/index.js +155 -0
- package/package.json +48 -0
- package/templates/ijs/.prettierrc.yml +6 -0
- package/templates/ijs/.vscode/settings.json +5 -0
- package/templates/ijs/LICENSE +9 -0
- package/templates/ijs/README.md +53 -0
- package/templates/ijs/eslint.config.js +1 -0
- package/templates/ijs/gitignore +48 -0
- package/templates/ijs/index.html +15 -0
- package/templates/ijs/package.json +30 -0
- package/templates/ijs/public/logo.png +0 -0
- package/templates/ijs/public/style.css +36 -0
- package/templates/ijs/src/game.ijs +1 -0
- package/templates/ijs/src/main.js +10 -0
- package/templates/ijs/vite.config.js +15 -0
- package/templates/its/.prettierrc.yml +6 -0
- package/templates/its/.vscode/settings.json +5 -0
- package/templates/its/LICENSE +9 -0
- package/templates/its/README.md +64 -0
- package/templates/its/eslint.config.js +1 -0
- package/templates/its/gitignore +48 -0
- package/templates/its/index.html +15 -0
- package/templates/its/package.json +32 -0
- package/templates/its/public/logo.png +0 -0
- package/templates/its/public/style.css +36 -0
- package/templates/its/src/game.its +1 -0
- package/templates/its/src/main.ts +10 -0
- package/templates/its/tsconfig.json +20 -0
- package/templates/its/vite.config.js +28 -0
- package/templates/js/.prettierrc.yml +1 -0
- package/templates/js/LICENSE +9 -0
- package/templates/js/README.md +29 -0
- package/templates/js/eslint.config.js +1 -0
- package/templates/js/gitignore +49 -0
- package/templates/js/index.html +15 -0
- package/templates/js/package.json +28 -0
- package/templates/js/public/logo.png +0 -0
- package/templates/js/public/style.css +36 -0
- package/templates/js/src/game.js +1 -0
- package/templates/js/src/main.js +10 -0
- package/templates/js/vite.config.js +3 -0
- package/templates/minimal/README.md +10 -0
- package/templates/minimal/gitignore +6 -0
- package/templates/minimal/index.html +37 -0
- package/templates/minimal/public/logo.png +0 -0
- package/templates/minimal/public/style.css +33 -0
- package/templates/minimal/src/game.js +1 -0
- package/templates/ts/.prettierrc.yml +1 -0
- package/templates/ts/LICENSE +9 -0
- package/templates/ts/README.md +30 -0
- package/templates/ts/eslint.config.js +1 -0
- package/templates/ts/gitignore +49 -0
- package/templates/ts/index.html +15 -0
- package/templates/ts/package.json +29 -0
- package/templates/ts/public/logo.png +0 -0
- package/templates/ts/public/style.css +36 -0
- package/templates/ts/src/game.ts +1 -0
- package/templates/ts/src/main.ts +10 -0
- package/templates/ts/tsconfig.json +20 -0
- package/templates/ts/vite.config.js +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @inglorious/create-game
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
|
|
5
|
+
The official scaffolding tool to quickly create a new game with the [Inglorious Engine](https://github.com/IngloriousCoderz/inglorious-engine).
|
|
6
|
+
|
|
7
|
+
This package allows you to generate a new project from a set of pre-configured templates, so you can start developing your game right away.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
To create a new game, run one of the following commands in your terminal. You will be prompted to choose a project name and select a template.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# with npm
|
|
15
|
+
npm create @inglorious/game@latest
|
|
16
|
+
|
|
17
|
+
# with yarn
|
|
18
|
+
yarn create @inglorious/game
|
|
19
|
+
|
|
20
|
+
# with pnpm
|
|
21
|
+
pnpm create @inglorious/game
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The CLI will guide you through the setup process, asking for a project name and which template you'd like to use.
|
|
25
|
+
|
|
26
|
+
## Templates
|
|
27
|
+
|
|
28
|
+
The following templates are available to get you started:
|
|
29
|
+
|
|
30
|
+
- **js**: A minimal starter for a plain JavaScript project.
|
|
31
|
+
- **ts**: A minimal starter for a plain TypeScript project.
|
|
32
|
+
- **ijs** (IngloriousScript): A starter template for a JavaScript project using IngloriousScript via Babel.
|
|
33
|
+
- **its** (IngloriousScript w/ TypeScript): A starter template for a TypeScript project that uses IngloriousScript.
|
|
34
|
+
|
|
35
|
+
## What it does
|
|
36
|
+
|
|
37
|
+
The tool will create a new directory with your chosen project name and copy the template files into it. It will also automatically update the `package.json` with your project's name.
|
|
38
|
+
|
|
39
|
+
After the project is created, you can navigate into the directory and install the dependencies.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 1. Change into your new project directory
|
|
43
|
+
cd my-awesome-game
|
|
44
|
+
|
|
45
|
+
# 2. Install dependencies
|
|
46
|
+
pnpm install
|
|
47
|
+
|
|
48
|
+
# 3. Start the development server
|
|
49
|
+
pnpm dev
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
This package is MIT licensed.
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from "child_process"
|
|
4
|
+
import fs from "fs"
|
|
5
|
+
import { EOL } from "os"
|
|
6
|
+
import path from "path"
|
|
7
|
+
import prompts from "prompts"
|
|
8
|
+
import { fileURLToPath } from "url"
|
|
9
|
+
|
|
10
|
+
const INDENTATION = 2
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
14
|
+
const templatesRoot = path.join(__dirname, "../templates")
|
|
15
|
+
|
|
16
|
+
let canceled = false
|
|
17
|
+
|
|
18
|
+
const onCancel = () => {
|
|
19
|
+
canceled = true
|
|
20
|
+
return false
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { projectName, template } = await prompts(
|
|
24
|
+
[
|
|
25
|
+
{
|
|
26
|
+
type: "text",
|
|
27
|
+
name: "projectName",
|
|
28
|
+
message: "What is your project named?",
|
|
29
|
+
initial: "my-game",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "select",
|
|
33
|
+
name: "template",
|
|
34
|
+
message: "Select a template",
|
|
35
|
+
choices: [
|
|
36
|
+
{
|
|
37
|
+
title: "Minimal",
|
|
38
|
+
description: "A single HTML file for a zero-build setup",
|
|
39
|
+
value: "minimal",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: "JavaScript",
|
|
43
|
+
description: "A vanilla JavaScript setup with Vite",
|
|
44
|
+
value: "js",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: "TypeScript",
|
|
48
|
+
description: "A TypeScript setup with Vite",
|
|
49
|
+
value: "ts",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: "IngloriousScript (JS)",
|
|
53
|
+
description:
|
|
54
|
+
"A JS superset with built-in vector math, powered by Vite",
|
|
55
|
+
value: "ijs",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "IngloriousScript (TS)",
|
|
59
|
+
description:
|
|
60
|
+
"A TS superset with built-in vector math, powered by Vite",
|
|
61
|
+
value: "its",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
{ onCancel },
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
if (canceled) {
|
|
70
|
+
console.log("Operation canceled.")
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const targetDir = path.join(process.cwd(), projectName)
|
|
75
|
+
const templateDir = path.join(templatesRoot, template)
|
|
76
|
+
|
|
77
|
+
// Create project directory and copy template files
|
|
78
|
+
copyDir(templateDir, targetDir)
|
|
79
|
+
|
|
80
|
+
// Update README.md with project name
|
|
81
|
+
const readmePath = path.join(targetDir, "README.md")
|
|
82
|
+
if (fs.existsSync(readmePath)) {
|
|
83
|
+
let readme = fs.readFileSync(readmePath, "utf-8")
|
|
84
|
+
readme = readme.replace(/# my-game/, `# ${projectName}`)
|
|
85
|
+
fs.writeFileSync(readmePath, readme)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (template === "minimal") {
|
|
89
|
+
console.log(`✅ Created ${projectName} at ${targetDir}`)
|
|
90
|
+
console.log(`\nNext steps:`)
|
|
91
|
+
console.log(` cd ${projectName}`)
|
|
92
|
+
console.log(` Open index.html in your browser`)
|
|
93
|
+
} else {
|
|
94
|
+
// Update package.json with project name
|
|
95
|
+
const pkgPath = path.join(targetDir, "package.json")
|
|
96
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"))
|
|
97
|
+
pkg.name = projectName
|
|
98
|
+
|
|
99
|
+
function getLatestVersion(packageName) {
|
|
100
|
+
try {
|
|
101
|
+
const version = execSync(`npm view ${packageName} version`, {
|
|
102
|
+
encoding: "utf-8",
|
|
103
|
+
}).trim()
|
|
104
|
+
return `^${version}`
|
|
105
|
+
} catch {
|
|
106
|
+
return "latest" // fallback
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
for (const depType of ["dependencies", "devDependencies"]) {
|
|
111
|
+
if (pkg[depType]) {
|
|
112
|
+
for (const [name, version] of Object.entries(pkg[depType])) {
|
|
113
|
+
if (version.startsWith("workspace:")) {
|
|
114
|
+
pkg[depType][name] = getLatestVersion(name)
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, INDENTATION) + EOL)
|
|
121
|
+
|
|
122
|
+
console.log(`✅ Created ${projectName} at ${targetDir}`)
|
|
123
|
+
console.log(`\nNext steps:`)
|
|
124
|
+
console.log(` cd ${projectName}`)
|
|
125
|
+
console.log(` pnpm install`)
|
|
126
|
+
console.log(` pnpm dev`)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function copyDir(src, dest) {
|
|
130
|
+
fs.mkdirSync(dest, { recursive: true })
|
|
131
|
+
|
|
132
|
+
const entries = fs.readdirSync(src, { withFileTypes: true })
|
|
133
|
+
|
|
134
|
+
for (const entry of entries) {
|
|
135
|
+
const srcPath = path.join(src, entry.name)
|
|
136
|
+
const destPath = path.join(dest, entry.name)
|
|
137
|
+
|
|
138
|
+
// Rename gitignore to .gitignore
|
|
139
|
+
if (entry.name === "gitignore") {
|
|
140
|
+
fs.copyFileSync(srcPath, path.join(dest, ".gitignore"))
|
|
141
|
+
continue
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (entry.isDirectory()) {
|
|
145
|
+
copyDir(srcPath, destPath)
|
|
146
|
+
} else {
|
|
147
|
+
fs.copyFileSync(srcPath, destPath)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
main().catch((e) => {
|
|
154
|
+
console.error(e)
|
|
155
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inglorious/create-game",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A scaffolding tool to quickly create a new game with the Inglorious Engine.",
|
|
5
|
+
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/IngloriousCoderz/inglorious-engine.git",
|
|
10
|
+
"directory": "packages/create-game"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://inglorious-engine.vercel.app/",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/IngloriousCoderz/inglorious-engine/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"cli",
|
|
18
|
+
"create-game",
|
|
19
|
+
"functional-programming",
|
|
20
|
+
"gamedev",
|
|
21
|
+
"game-engine",
|
|
22
|
+
"inglorious-engine",
|
|
23
|
+
"scaffolding"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"bin": {
|
|
27
|
+
"create-game": "./bin/index.js"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin",
|
|
31
|
+
"templates",
|
|
32
|
+
"src"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"prompts": "^2.4.2"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"prettier": "^3.6.2",
|
|
42
|
+
"@inglorious/eslint-config": "1.0.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"format": "prettier --write '**/*.{js,ijs,ts,its}'",
|
|
46
|
+
"lint": "eslint . --ext js,ijs,ts,its --report-unused-disable-directives --max-warnings 0"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# ijs-template
|
|
2
|
+
|
|
3
|
+
This project is a starter template for creating a game with the Inglorious Engine using **IngloriousScript**.
|
|
4
|
+
|
|
5
|
+
## What is IngloriousScript?
|
|
6
|
+
|
|
7
|
+
IngloriousScript is a superset of JavaScript that enables intuitive vector math using standard operators, transformed by Babel.
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
// Instead of this:
|
|
11
|
+
const newPosition = mod(add(position, scale(velocity, dt)), worldSize)
|
|
12
|
+
|
|
13
|
+
// You can write this:
|
|
14
|
+
const newPosition = (position + velocity * dt) % worldSize
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
This project was scaffolded with `@inglorious/create-game`.
|
|
20
|
+
|
|
21
|
+
To get started, follow these steps:
|
|
22
|
+
|
|
23
|
+
1. **Install dependencies**:
|
|
24
|
+
Navigate to your project directory and install the required packages.
|
|
25
|
+
```sh
|
|
26
|
+
pnpm install
|
|
27
|
+
```
|
|
28
|
+
2. **Start the development server**:
|
|
29
|
+
Run the following command to start the Vite development server.
|
|
30
|
+
```sh
|
|
31
|
+
pnpm dev
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This will start a Vite development server. Open your browser to the local URL provided to see it in action.
|
|
35
|
+
|
|
36
|
+
## Project Setup
|
|
37
|
+
|
|
38
|
+
- `index.html`: The main entry point for your game.
|
|
39
|
+
- `src/`: Contains your game's source code. Files ending in `.ijs` use IngloriousScript.
|
|
40
|
+
- `vite.config.js`: Vite configuration with the Babel plugin for IngloriousScript.
|
|
41
|
+
- `package.json`: Project metadata and dependencies.
|
|
42
|
+
|
|
43
|
+
## Editor Configuration (VS Code)
|
|
44
|
+
|
|
45
|
+
This template includes a `.vscode/settings.json` file that tells Visual Studio Code to treat `.ijs` files as JavaScript, enabling full syntax highlighting and IntelliSense.
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"files.associations": {
|
|
50
|
+
"*.ijs": "javascript"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@inglorious/eslint-config/browser"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Local env files
|
|
7
|
+
.env
|
|
8
|
+
.env.local
|
|
9
|
+
.env.development.local
|
|
10
|
+
.env.test.local
|
|
11
|
+
.env.production.local
|
|
12
|
+
|
|
13
|
+
# Testing
|
|
14
|
+
coverage
|
|
15
|
+
|
|
16
|
+
# Turbo
|
|
17
|
+
.turbo
|
|
18
|
+
|
|
19
|
+
# Vercel
|
|
20
|
+
.vercel
|
|
21
|
+
|
|
22
|
+
# Build Outputs
|
|
23
|
+
.next/
|
|
24
|
+
out/
|
|
25
|
+
build
|
|
26
|
+
dist
|
|
27
|
+
dist-ssr
|
|
28
|
+
storybook-static
|
|
29
|
+
vite.config.js.timestamp-*
|
|
30
|
+
|
|
31
|
+
# Debug
|
|
32
|
+
logs
|
|
33
|
+
*.log
|
|
34
|
+
npm-debug.log*
|
|
35
|
+
yarn-debug.log*
|
|
36
|
+
yarn-error.log*
|
|
37
|
+
pnpm-debug.log*
|
|
38
|
+
lerna-debug.log*
|
|
39
|
+
|
|
40
|
+
# Editor directories and files
|
|
41
|
+
.idea
|
|
42
|
+
.DS_Store
|
|
43
|
+
*.suo
|
|
44
|
+
*.ntvs*
|
|
45
|
+
*.njsproj
|
|
46
|
+
*.sln
|
|
47
|
+
*.sw?
|
|
48
|
+
.qodo
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/logo.png" />
|
|
7
|
+
<link rel="stylesheet" href="/style.css" />
|
|
8
|
+
<title>Inglorious Engine - Game</title>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<canvas id="canvas" width="800" height="600"></canvas>
|
|
13
|
+
<script type="module" src="./src/main.js"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ijs-template",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "A new game created with @inglorious/create-game",
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"format": "prettier --write '**/*.{js,ijs}'",
|
|
11
|
+
"lint": "eslint . --ext js,ijs --report-unused-disable-directives --max-warnings 0",
|
|
12
|
+
"dev": "vite",
|
|
13
|
+
"build": "vite build"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@inglorious/engine": "workspace:*",
|
|
17
|
+
"@inglorious/renderer-2d": "workspace:*"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@inglorious/babel-preset-inglorious-script": "workspace:*",
|
|
21
|
+
"@inglorious/eslint-config": "workspace:*",
|
|
22
|
+
"prettier": "^3.6.2",
|
|
23
|
+
"vite": "^7.1.6",
|
|
24
|
+
"vite-plugin-babel": "^1.3.2"
|
|
25
|
+
},
|
|
26
|
+
"packageManager": "pnpm@10.15.0",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">= 22"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
font-family: "Press Start 2P", system-ui;
|
|
7
|
+
width: 100vw;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
margin: 0;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background-color: #000;
|
|
16
|
+
color: #fff;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
canvas {
|
|
20
|
+
max-width: 1280px;
|
|
21
|
+
max-height: 720px;
|
|
22
|
+
width: 100vw;
|
|
23
|
+
height: auto;
|
|
24
|
+
cursor: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (orientation: landscape) {
|
|
28
|
+
canvas {
|
|
29
|
+
width: auto;
|
|
30
|
+
height: 100vh;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
img {
|
|
35
|
+
display: none;
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Engine } from "@inglorious/engine/core/engine"
|
|
2
|
+
import { createRenderer } from "@inglorious/renderer-2d"
|
|
3
|
+
|
|
4
|
+
import game from "./game.ijs"
|
|
5
|
+
|
|
6
|
+
const canvas = document.getElementById("canvas")
|
|
7
|
+
const renderer = createRenderer(canvas)
|
|
8
|
+
const engine = new Engine(renderer, game)
|
|
9
|
+
await engine.init()
|
|
10
|
+
engine.start()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import babel from "vite-plugin-babel"
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [
|
|
6
|
+
babel({
|
|
7
|
+
include: "src/**",
|
|
8
|
+
filter: /\.(js|ijs)$/,
|
|
9
|
+
|
|
10
|
+
babelConfig: {
|
|
11
|
+
presets: ["@inglorious/inglorious-script"],
|
|
12
|
+
},
|
|
13
|
+
}),
|
|
14
|
+
],
|
|
15
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# its-template
|
|
2
|
+
|
|
3
|
+
This project is a starter template for creating a game with the Inglorious Engine using **IngloriousScript with TypeScript**.
|
|
4
|
+
|
|
5
|
+
## What is IngloriousScript?
|
|
6
|
+
|
|
7
|
+
IngloriousScript is a superset of JavaScript that enables intuitive vector math using standard operators, transformed by Babel.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
// Instead of this:
|
|
11
|
+
const newPosition = mod(add(position, scale(velocity, dt)), worldSize)
|
|
12
|
+
|
|
13
|
+
// You can write this:
|
|
14
|
+
// @ts-expect-error - IngloriousScript operators are transformed by Babel
|
|
15
|
+
const newPosition = (position + velocity * dt) % worldSize
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Getting Started
|
|
19
|
+
|
|
20
|
+
This project was scaffolded with `@inglorious/create-game`.
|
|
21
|
+
|
|
22
|
+
To get started, follow these steps:
|
|
23
|
+
|
|
24
|
+
1. **Install dependencies**:
|
|
25
|
+
Navigate to your project directory and install the required packages.
|
|
26
|
+
```sh
|
|
27
|
+
pnpm install
|
|
28
|
+
```
|
|
29
|
+
2. **Start the development server**:
|
|
30
|
+
Run the following command to start the Vite development server.
|
|
31
|
+
```sh
|
|
32
|
+
pnpm dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This will start a Vite development server. Open your browser to the local URL provided to see it in action.
|
|
36
|
+
|
|
37
|
+
## Project Setup
|
|
38
|
+
|
|
39
|
+
- `index.html`: The main entry point for your game.
|
|
40
|
+
- `src/`: Contains your game's source code. Files ending in `.its` use IngloriousScript with TypeScript.
|
|
41
|
+
- `vite.config.js`: Vite configuration with the Babel plugin for IngloriousScript.
|
|
42
|
+
- `tsconfig.json`: TypeScript configuration.
|
|
43
|
+
- `package.json`: Project metadata and dependencies.
|
|
44
|
+
|
|
45
|
+
### Using `.its` files
|
|
46
|
+
|
|
47
|
+
The `.its` extension is for TypeScript files that use IngloriousScript's operator overloading. Since TypeScript doesn't natively support this, you must add a `@ts-expect-error` comment above lines with vector operations. This is normal and expected.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// @ts-expect-error - IngloriousScript operators are transformed by Babel
|
|
51
|
+
const newPosition = (position + velocity * deltaTime) % worldSize
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Editor Configuration (VS Code)
|
|
55
|
+
|
|
56
|
+
This template includes a `.vscode/settings.json` file that tells Visual Studio Code to treat `.its` files as TypeScript, enabling full syntax highlighting and IntelliSense.
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"files.associations": {
|
|
61
|
+
"*.its": "typescript"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@inglorious/eslint-config/browser"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# Local env files
|
|
7
|
+
.env
|
|
8
|
+
.env.local
|
|
9
|
+
.env.development.local
|
|
10
|
+
.env.test.local
|
|
11
|
+
.env.production.local
|
|
12
|
+
|
|
13
|
+
# Testing
|
|
14
|
+
coverage
|
|
15
|
+
|
|
16
|
+
# Turbo
|
|
17
|
+
.turbo
|
|
18
|
+
|
|
19
|
+
# Vercel
|
|
20
|
+
.vercel
|
|
21
|
+
|
|
22
|
+
# Build Outputs
|
|
23
|
+
.next/
|
|
24
|
+
out/
|
|
25
|
+
build
|
|
26
|
+
dist
|
|
27
|
+
dist-ssr
|
|
28
|
+
storybook-static
|
|
29
|
+
vite.config.js.timestamp-*
|
|
30
|
+
|
|
31
|
+
# Debug
|
|
32
|
+
logs
|
|
33
|
+
*.log
|
|
34
|
+
npm-debug.log*
|
|
35
|
+
yarn-debug.log*
|
|
36
|
+
yarn-error.log*
|
|
37
|
+
pnpm-debug.log*
|
|
38
|
+
lerna-debug.log*
|
|
39
|
+
|
|
40
|
+
# Editor directories and files
|
|
41
|
+
.idea
|
|
42
|
+
.DS_Store
|
|
43
|
+
*.suo
|
|
44
|
+
*.ntvs*
|
|
45
|
+
*.njsproj
|
|
46
|
+
*.sln
|
|
47
|
+
*.sw?
|
|
48
|
+
.qodo
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/logo.png" />
|
|
7
|
+
<link rel="stylesheet" href="/style.css" />
|
|
8
|
+
<title>Inglorious Engine - Game</title>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<canvas id="canvas" width="800" height="600"></canvas>
|
|
13
|
+
<script type="module" src="./src/main.js"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|