Basic p5, parcel, typescript setup
This commit is contained in:
parent
a6616f5f21
commit
d0e3e51a7d
11 changed files with 64 additions and 114045 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
<link rel="stylesheet" href="./styles.scss" />
|
<link rel="stylesheet" href="./styles.scss" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script src="./main.js"></script>
|
<div class="ui"></div>
|
||||||
|
<script src="./main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
109651
lib/p5.js
109651
lib/p5.js
File diff suppressed because one or more lines are too long
4390
lib/p5.play.js
4390
lib/p5.play.js
File diff suppressed because it is too large
Load diff
1
main.js
1
main.js
|
|
@ -1 +0,0 @@
|
||||||
console.log('Basic setup');
|
|
||||||
15
main.ts
Normal file
15
main.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
import p5 from 'p5';
|
||||||
|
import { SCREEN_WIDTH, SCREEN_HEIGHT } from './src/constants';
|
||||||
|
|
||||||
|
const sketch = (s) => {
|
||||||
|
s.setup = () => {
|
||||||
|
s.createCanvas(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
|
};
|
||||||
|
s.draw = () => {
|
||||||
|
s.background(220);
|
||||||
|
s.rect(200, 200, 200, 200);
|
||||||
|
s.print(s.mouseX, s.mouseY);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const p5Instance = new p5(sketch);
|
||||||
|
|
@ -12,6 +12,10 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"parcel-bundler": "^1.12.5",
|
"parcel-bundler": "^1.12.5",
|
||||||
"prettier": "^2.3.2",
|
"prettier": "^2.3.2",
|
||||||
"sass": "^1.35.2"
|
"sass": "^1.35.2",
|
||||||
|
"typescript": "^4.3.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"p5": "^1.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/Player.ts
Normal file
13
src/Player.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
export class Player {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
sketch: any;
|
||||||
|
|
||||||
|
constructor(sketch: any, x: number, y: number) {
|
||||||
|
this.sketch = sketch;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw() {}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
export const colors = {
|
export const colors: { [key: string]: string } = {
|
||||||
greyLighter: '#EBEEF2',
|
greyLighter: '#EBEEF2',
|
||||||
greyLight: '#D0D5D9',
|
greyLight: '#D0D5D9',
|
||||||
grey: '#B0B7BF',
|
grey: '#B0B7BF',
|
||||||
2
src/constants.ts
Normal file
2
src/constants.ts
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
export const SCREEN_WIDTH = document.body.clientWidth;
|
||||||
|
export const SCREEN_HEIGHT = document.body.clientHeight;
|
||||||
16
styles.scss
16
styles.scss
|
|
@ -0,0 +1,16 @@
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
10
yarn.lock
10
yarn.lock
|
|
@ -3675,6 +3675,11 @@ os-browserify@^0.3.0:
|
||||||
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
|
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
|
||||||
integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=
|
integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=
|
||||||
|
|
||||||
|
p5@^1.4.0:
|
||||||
|
version "1.4.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p5/-/p5-1.4.0.tgz#d4d0f001c297525831861af5e017cdb5ef517a75"
|
||||||
|
integrity sha512-U888W2ChcIzPhRhnv4FkNhaa4f5BDIWZfLhzvx9ZrQ5KtkZr/+o1UPIicV3yWTRy0HEG23NviHyDR3kgjaJ9wA==
|
||||||
|
|
||||||
pako@^0.2.5:
|
pako@^0.2.5:
|
||||||
version "0.2.9"
|
version "0.2.9"
|
||||||
resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75"
|
resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75"
|
||||||
|
|
@ -5116,6 +5121,11 @@ typedarray@^0.0.6:
|
||||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||||
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
|
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
|
||||||
|
|
||||||
|
typescript@^4.3.5:
|
||||||
|
version "4.3.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
|
||||||
|
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
|
||||||
|
|
||||||
unbox-primitive@^1.0.1:
|
unbox-primitive@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471"
|
resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471"
|
||||||
|
|
|
||||||
Reference in a new issue