Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
44 changes: 25 additions & 19 deletions .config/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default [
"jsdoc/require-property": "error",
"jsdoc/require-property-type": "error",
// "jsdoc/require-property-description":"error",
eqeqeq: "error",
camelcase: "error",
"eqeqeq": "error",
"camelcase": "error",
"prefer-const": "error",
"new-cap": "error",
"no-const-assign": "error",
Expand All @@ -65,7 +65,6 @@ export default [
"prefer-destructuring": ["error",{ "object": true,"array": false }],
"prefer-template": "error",
"no-useless-concat": "error",
"template-curly-spacing": ["error","never"],
"no-eval": "error",
"no-implied-eval": "error",
"no-useless-escape": "error",
Expand Down Expand Up @@ -113,22 +112,37 @@ export default [
"semi": ["warn","never"],
"style/new-parens": "warn",
"style/rest-spread-spacing": ["warn","never"],
"style/space-infix-ops": "warn",
"style/space-unary-ops": "warn",
"style/spaced-comment": "warn",
"style/switch-colon-spacing": "warn",
"style/template-curly-spacing": "warn",
"style/template-tag-spacing": ["warn","never"],
"style/one-var-declaration-per-line": ["warn","initializations"],
"style/object-curly-spacing": ["warn","always"],
"style/operator-linebreak": ["warn","after"],
"style/nonblock-statement-body-position": ["warn","beside"],
//"style/no-trailing-spaces": "warn",

/** white-space rules */
"style/indent": ["warn", 2],
"style/no-trailing-spaces": "warn",
"style/space-before-function-paren": ["warn","never"],
"style/space-in-parens": ["warn", "never"],
"style/space-before-blocks": ["warn", "always"],
"style/space-infix-ops": "warn",
"style/space-unary-ops": ["warn",{words: true, nonwords: false}],
"style/keyword-spacing": ["warn", { "before": true, "after": true }],
"style/array-bracket-spacing": ["warn", "never"],
"style/object-curly-spacing": ["warn", "always"],
"style/computed-property-spacing": ["warn", "never"],
"style/template-curly-spacing": ["warn", "never"],
"style/comma-spacing": ["warn", { "before": false, "after": true }],
"style/semi-spacing": ["warn", { "before": false, "after": true }],
"style/block-spacing": ["warn", "always"],
"style/no-multi-spaces": "warn",
"style/no-multiple-empty-lines": "warn",
"style/no-multiple-empty-lines": ["warn", { "max": 1, "maxEOF": 0 }],
"style/eol-last": ["warn", "always"],
"style/linebreak-style": ["warn", "unix"],
// "style/padded-blocks": ["warn", "never"], conflicts with another rule
"style/newline-per-chained-call": ["warn", { "ignoreChainWithDepth": 2 }],

"style/no-floating-decimal": "warn",
"style/newline-per-chained-call": ["warn",{ ignoreChainWithDepth: 2 }],
"style/linebreak-style": ["warn","unix"],
"style/lines-around-comment": ["warn",{
beforeBlockComment: true,
afterBlockComment: false,
Expand All @@ -139,23 +153,15 @@ export default [
"style/quotes": ["warn","single"],
// "style/qoute-props": ["warn","as-needed"],
//"style/lines-between-class-members": ["warn", "never"],
"style/array-bracket-spacing": ["warn",{ beforeColon: false,afterColon: true,mode: "strict" }],
"style/function-call-spacing": ["warn","never"],
"style/line-comment-position": ["warn",{ position: "above" }],
"style/space-before-function-paren": ["warn","never"],
"style/eol-last": ["warn","never"],
"style/dot-location": ["warn","property"],
"style/array-bracket-spacing": ["warn","never"],
"style/generator-star-spacing": ["warn",{ before: false,after: true }],
"style/function-paren-newline": ["warn","multiline-arguments"],
"style/array-element-newline": ["warn",{ consistent: true,"multiline": true }],
"style/arrow-spacing": "warn",
"style/brace-style": ["warn","1tbs",{ allowSingleLine: true }],
"style/block-spacing": "warn",
"style/comma-spacing": ["warn",{ before: false,after: true }],
"style/comma-dangle": ["warn","never"],
"style/indent": ["warn", 2],
"style/computed-property-spacing": ["warn","never"],
"style/padding-line-between-statements": [
"warn",
{ blankLine: "always",prev: "for",next: "*" },
Expand Down
18 changes: 9 additions & 9 deletions demos/demos/animation/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ export function init(world) {
const rawClip = createClip()
const clip = clips.add(rawClip)
const mesh = meshes.add(Mesh.quad2D(50, 50))
const material = materials.add(new BasicMaterial())
const material = materials.add(new BasicMaterial())
const targetname = '/bone'
const animationplayer = new AnimationPlayer()

animationplayer.set(clip, {
duration: rawClip.duration,
repeatMode: PlaybackRepeat.Forever
Expand All @@ -51,7 +51,7 @@ export function init(world) {
.spawn()
.insert(animationplayer)
.build()

commands
.spawn()
.insertPrefab([
Expand All @@ -69,15 +69,15 @@ export function init(world) {
*/
function createClip() {
const clip = new AnimationClip()

const translate = new AnimationTrack(Position2DAnimationEffector)
const rotate = new AnimationTrack(Orientation2DAnimationEffector)
const scale = new AnimationTrack(Scale2DAnimationEffector)

translate.times = [0, 2, 4, 6, 8]
rotate.times = [0, 2, 4, 6, 8]
scale.times = [0, 2, 4, 6, 8]

translate.keyframes = [
-100,
100,
Expand Down Expand Up @@ -109,11 +109,11 @@ function createClip() {
1,
1
]

clip.add('/bone', translate)
clip.add('/bone', rotate)
clip.add('/bone', scale)
clip.calculateDuration()

return clip
}
}
2 changes: 1 addition & 1 deletion demos/demos/animation/basic3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ function createClip() {
clip.calculateDuration()

return clip
}
}
2 changes: 1 addition & 1 deletion demos/demos/animation/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as animation } from './basic.js'
export { default as basicAnimation3D } from './basic3d.js'
export { default as basicAnimation3D } from './basic3d.js'
14 changes: 7 additions & 7 deletions demos/demos/audio/audioGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default new Demo(
)
class Playing {
handle

/**
* @type {number?}
*/
value

/**
* @param {Handle<Audio>} handle
*/
Expand All @@ -36,7 +36,7 @@ class Playing {
function init(world) {
const server = world.getResource(AssetServer)
const handle = server.load(Audio, 'assets/audio/hit.mp3')

world.setResource(new Playing(handle))
}

Expand All @@ -48,19 +48,19 @@ function playAudio(world) {
const audioGraph = world.getResource(AudioGraph)
const audioSources = world.getResource(AudioAssets)
const audioSource = audioSources.get(current.handle)

if (current.value || !audioSource) {
return
}

const ctx = audioGraph.getContext()
const source = new AudioBufferSourceNode(ctx, {
buffer: audioSource.audiobuffer,
loop: true
})
const sourceId = audioGraph.add(source)

audioGraph.connect(sourceId, audioGraph.getRoot())
source.start()
current.value = sourceId
}
}
4 changes: 2 additions & 2 deletions demos/demos/audio/audioOscillator.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default new Demo(
*/
function init(world) {
const commands = world.getResource(EntityCommands)

commands
.spawn()
.insertPrefab([
Expand All @@ -30,4 +30,4 @@ function init(world) {
new Cleanup()
])
.build()
}
}
8 changes: 4 additions & 4 deletions demos/demos/audio/audioPlayback.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default new Demo(
function init(world) {
const server = world.getResource(AssetServer)
const commands = world.getResource(EntityCommands)

world.setResource(new AudioTimer({
mode: TimerMode.Repeat,
duration: 5
Expand Down Expand Up @@ -74,13 +74,13 @@ function update(world) {
} else if (count === 7) {
playback.speed = 1
playback.seek(200)
} else if(count === 8) {
} else if (count === 8) {
timer.reset()
}
}
})

timer.update(clock.getDelta())
}

class AudioTimer extends Timer {}
class AudioTimer extends Timer {}
2 changes: 1 addition & 1 deletion demos/demos/audio/audioPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ function init(world) {
new Cleanup()
])
.build()
}
}
2 changes: 1 addition & 1 deletion demos/demos/audio/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as audioGraph } from './audioGraph.js'
export { default as audioPlayer } from './audioPlayer.js'
export { default as audioPlayback } from './audioPlayback.js'
export { default as audioOscillator } from './audioOscillator.js'
export { default as audioOscillator } from './audioOscillator.js'
2 changes: 1 addition & 1 deletion demos/demos/ecs/despawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ function update(world) {
commands.despawn(entity[0])
}

class Marker { }
class Marker { }
2 changes: 1 addition & 1 deletion demos/demos/ecs/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as spawn } from './spawn.js'
export { default as despawn } from './despawn.js'
export { default as despawn } from './despawn.js'
2 changes: 1 addition & 1 deletion demos/demos/ecs/spawn.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ function update(world) {
.build()
}

class Marker { }
class Marker { }
2 changes: 1 addition & 1 deletion demos/demos/gizmos/arcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ function drawEllipticalArcs(world) {
.ellipse(radiusX, radiusY, new Color(1, 1, 1, 1))
.axes(20)
.reset()
}
}
2 changes: 1 addition & 1 deletion demos/demos/gizmos/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ function drawGrid(world) {
new BVector2(true, true)
)
.reset()
}
}
2 changes: 1 addition & 1 deletion demos/demos/gizmos/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { default as lineStyle2d } from './linestyle.js'
export { default as arcs2d } from './arcs.js'
export { default as shapes2d } from './shapes.js'
export { default as grid2d } from './grid.js'
export { default as grid2d } from './grid.js'
2 changes: 1 addition & 1 deletion demos/demos/gizmos/linestyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ function update(world) {
.line(new Vector2(100, 550), new Vector2(500, 550), new Color(0, 1, 1, 1))
.line(new Vector2(100, 650), new Vector2(500, 650), new Color(0, 0, 1, 1))
.line(new Vector2(100, 750), new Vector2(500, 750), new Color(1, 1, 1, 1))
}
}
2 changes: 1 addition & 1 deletion demos/demos/gizmos/shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ function update(world) {
.line(new Vector2(-50, 0), new Vector2(50, 0))
.axes(20)
.reset()
}
}
2 changes: 1 addition & 1 deletion demos/demos/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export * from './render/index.js'
export * from './ecs/index.js'
export * from './input/index.js'
export * from './tween/index.js'
export * from './gizmos/index.js'
export * from './gizmos/index.js'
2 changes: 1 addition & 1 deletion demos/demos/input/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { default as keyboard } from './keyboard.js'
export { default as mouse } from './mouse.js'
export { default as touch } from './touch.js'
export { default as touch } from './touch.js'
3 changes: 1 addition & 2 deletions demos/demos/input/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ function update(world) {
})
}


/**
* @param {World} world
*/
Expand Down Expand Up @@ -173,4 +172,4 @@ function spawnAlphabet(world) {

map.set(digit, entity)
}
}
}
3 changes: 1 addition & 2 deletions demos/demos/input/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ function spawnMouseFollower(world) {
world.setResource(new MouseEntity(entity))
}


/**
* @param {World} world
*/
Expand Down Expand Up @@ -150,4 +149,4 @@ function updateButtons(world) {
material.color.copy(Color.WHITE)
}
})
}
}
5 changes: 2 additions & 3 deletions demos/demos/input/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default new Demo(
/** @type {Map<number,Entity>} */
class TouchtoEntityMap extends Map { }


/**
* @param {World} world
*/
Expand Down Expand Up @@ -79,7 +78,7 @@ function update(world) {

const material = materials.get(components[1].handle)

if(!material) return
if (!material) return

if (touch) {
components[0].copy(touch.position)
Expand All @@ -88,4 +87,4 @@ function update(world) {
material.color.copy(Color.WHITE)
}
})
}
}
2 changes: 1 addition & 1 deletion demos/demos/render/canvas-2d/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default as materials } from './material.js'
export { default as materials } from './material.js'
Loading