p5 working

This commit is contained in:
s-prechtl 2022-11-29 10:11:11 +01:00
parent 02391633c5
commit 5cc101db40
7 changed files with 4319 additions and 1 deletions

View file

@ -4,5 +4,6 @@
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="p5.js" level="application" />
</component> </component>
</module> </module>

View file

@ -1,3 +1,5 @@
function setup() { function setup() {
createCanvas(400, 400) createCanvas(400, 400)
background(187)
line(0,0, 400,400)
} }

5
frontend/global.d.ts vendored Normal file
View file

@ -0,0 +1,5 @@
// This file will add both p5 instanced and global intellisence
import * as p5Global from 'p5/global'
import module = require('p5');
export = module;
export as namespace p5;

View file

@ -3,7 +3,12 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Raspberyy Rocketeer</title> <title>Raspberyy Rocketeer</title>
<script lang="ts" src="game.ts"></script> <script src="build/build.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js"
integrity="sha512-N4kV7GkNv7QR7RX9YF/olywyIgIwNvfEe2nZtfyj73HdjCUkAfOBDbcuJ/cTaN04JKRnw1YG1wnUyNKMsNgg3g=="
crossorigin="anonymous"
referrerpolicy="no-referrer">
</script>
</head> </head>
<body> <body>
<main></main> <main></main>

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,14 @@
{ {
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "run-p start-compile start-run",
"start-compile": "tsc --watch",
"start-run": "browser-sync start --server -w"
},
"dependencies": { "dependencies": {
"@types/p5": "^1.4.3", "@types/p5": "^1.4.3",
"browser-sync": "^2.27.10",
"npm-run-all": "^4.1.5",
"p5": "^1.5.0" "p5": "^1.5.0"
} }
} }

13
frontend/tsconfig.json Normal file
View file

@ -0,0 +1,13 @@
{
"compilerOptions": {
"module": "none",
"noImplicitAny": true,
"outFile": "./build/build.js",
"preserveConstEnums": true,
"removeComments": true,
"rootDir": ".",
"sourceMap": true,
"target": "es5",
"moduleResolution": "node"
}
}