cubeforge 0.1.2 → 0.1.3
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/dist/index.d.mts +619 -0
- package/dist/{index.js → index.mjs} +758 -917
- package/package.json +10 -10
- package/dist/components/Animation.d.ts +0 -14
- package/dist/components/BoxCollider.d.ts +0 -17
- package/dist/components/Camera2D.d.ts +0 -27
- package/dist/components/Checkpoint.d.ts +0 -18
- package/dist/components/CircleCollider.d.ts +0 -11
- package/dist/components/DevTools.d.ts +0 -15
- package/dist/components/Entity.d.ts +0 -10
- package/dist/components/Game.d.ts +0 -52
- package/dist/components/MovingPlatform.d.ts +0 -22
- package/dist/components/ParallaxLayer.d.ts +0 -28
- package/dist/components/ParticleEmitter.d.ts +0 -26
- package/dist/components/RigidBody.d.ts +0 -15
- package/dist/components/ScreenFlash.d.ts +0 -4
- package/dist/components/Script.d.ts +0 -11
- package/dist/components/Sprite.d.ts +0 -22
- package/dist/components/SquashStretch.d.ts +0 -8
- package/dist/components/Tilemap.d.ts +0 -58
- package/dist/components/Transform.d.ts +0 -9
- package/dist/components/World.d.ts +0 -10
- package/dist/components/particlePresets.d.ts +0 -13
- package/dist/components/spriteAtlas.d.ts +0 -8
- package/dist/context.d.ts +0 -22
- package/dist/hooks/useCamera.d.ts +0 -37
- package/dist/hooks/useContact.d.ts +0 -57
- package/dist/hooks/useEntity.d.ts +0 -2
- package/dist/hooks/useEvents.d.ts +0 -3
- package/dist/hooks/useGame.d.ts +0 -2
- package/dist/hooks/useInput.d.ts +0 -2
- package/dist/hooks/useInputMap.d.ts +0 -25
- package/dist/hooks/usePlatformerController.d.ts +0 -32
- package/dist/hooks/useSnapshot.d.ts +0 -42
- package/dist/hooks/useTopDownMovement.d.ts +0 -22
- package/dist/index.d.ts +0 -60
- package/dist/systems/debugSystem.d.ts +0 -10
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { EntityId } from '@cubeforge/core';
|
|
2
|
-
export interface PlatformerControllerOptions {
|
|
3
|
-
/** Horizontal move speed in px/s (default 200) */
|
|
4
|
-
speed?: number;
|
|
5
|
-
/** Upward impulse on jump (default -500) */
|
|
6
|
-
jumpForce?: number;
|
|
7
|
-
/** Max consecutive jumps, e.g. 2 for double jump (default 1) */
|
|
8
|
-
maxJumps?: number;
|
|
9
|
-
/** Seconds after leaving ground the player can still jump (default 0.08) */
|
|
10
|
-
coyoteTime?: number;
|
|
11
|
-
/** Seconds to buffer a jump input before landing (default 0.08) */
|
|
12
|
-
jumpBuffer?: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Attaches platformer movement (WASD/Arrows + Space/Up to jump) to an entity.
|
|
16
|
-
* The entity must already have a RigidBody component.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* function Player() {
|
|
20
|
-
* const id = useEntity()
|
|
21
|
-
* usePlatformerController(id, { speed: 220, maxJumps: 2 })
|
|
22
|
-
* return (
|
|
23
|
-
* <Entity id="player">
|
|
24
|
-
* <Transform x={100} y={300} />
|
|
25
|
-
* <Sprite width={28} height={40} color="#4fc3f7" />
|
|
26
|
-
* <RigidBody />
|
|
27
|
-
* <BoxCollider width={26} height={40} />
|
|
28
|
-
* </Entity>
|
|
29
|
-
* )
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
export declare function usePlatformerController(entityId: EntityId, opts?: PlatformerControllerOptions): void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { WorldSnapshot } from '@cubeforge/core';
|
|
2
|
-
export interface SnapshotControls {
|
|
3
|
-
/**
|
|
4
|
-
* Capture a full serialisable snapshot of all ECS entity/component data.
|
|
5
|
-
* Safe to JSON-stringify and store externally (localStorage, server, etc.)
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const { save, restore } = useSnapshot()
|
|
10
|
-
* const checkpoint = save() // capture at checkpoint
|
|
11
|
-
* restore(checkpoint) // reset to that state
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
save(): WorldSnapshot;
|
|
15
|
-
/**
|
|
16
|
-
* Restore the world to a previously captured snapshot.
|
|
17
|
-
* All current entities are replaced with the snapshot's entities.
|
|
18
|
-
*
|
|
19
|
-
* Note: React component state is NOT rolled back — only ECS data is restored.
|
|
20
|
-
* For a full game reset, prefer remounting the `<Game>` key instead.
|
|
21
|
-
*/
|
|
22
|
-
restore(snapshot: WorldSnapshot): void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns save/restore controls for the ECS world snapshot system.
|
|
26
|
-
* Must be used inside `<Game>`.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```tsx
|
|
30
|
-
* function SaveButton() {
|
|
31
|
-
* const { save, restore } = useSnapshot()
|
|
32
|
-
* const [slot, setSlot] = useState<WorldSnapshot | null>(null)
|
|
33
|
-
* return (
|
|
34
|
-
* <>
|
|
35
|
-
* <button onClick={() => setSlot(save())}>Save</button>
|
|
36
|
-
* <button onClick={() => slot && restore(slot)}>Load</button>
|
|
37
|
-
* </>
|
|
38
|
-
* )
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function useSnapshot(): SnapshotControls;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { EntityId } from '@cubeforge/core';
|
|
2
|
-
export interface TopDownMovementOptions {
|
|
3
|
-
/** Movement speed in px/s (default 200) */
|
|
4
|
-
speed?: number;
|
|
5
|
-
/** Normalize diagonal movement to avoid faster diagonal movement (default true) */
|
|
6
|
-
normalizeDiagonal?: boolean;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Attaches 4-directional top-down movement (WASD/Arrows) to an entity.
|
|
10
|
-
* The entity must have a RigidBody with gravityScale=0 for top-down games.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* <Entity id="player">
|
|
14
|
-
* <Transform x={100} y={100} />
|
|
15
|
-
* <Sprite width={24} height={24} color="#4fc3f7" />
|
|
16
|
-
* <RigidBody gravityScale={0} />
|
|
17
|
-
* <BoxCollider width={24} height={24} />
|
|
18
|
-
* </Entity>
|
|
19
|
-
* // In a Script or parent component:
|
|
20
|
-
* useTopDownMovement(playerId, { speed: 180 })
|
|
21
|
-
*/
|
|
22
|
-
export declare function useTopDownMovement(entityId: EntityId, opts?: TopDownMovementOptions): void;
|
package/dist/index.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
export { Game } from './components/Game';
|
|
2
|
-
export { World } from './components/World';
|
|
3
|
-
export { Entity } from './components/Entity';
|
|
4
|
-
export { Transform } from './components/Transform';
|
|
5
|
-
export { Sprite } from './components/Sprite';
|
|
6
|
-
export { RigidBody } from './components/RigidBody';
|
|
7
|
-
export { BoxCollider } from './components/BoxCollider';
|
|
8
|
-
export { CircleCollider } from './components/CircleCollider';
|
|
9
|
-
export { Script } from './components/Script';
|
|
10
|
-
export { Camera2D } from './components/Camera2D';
|
|
11
|
-
export { Animation } from './components/Animation';
|
|
12
|
-
export { SquashStretch } from './components/SquashStretch';
|
|
13
|
-
export { ParticleEmitter } from './components/ParticleEmitter';
|
|
14
|
-
export { MovingPlatform } from './components/MovingPlatform';
|
|
15
|
-
export { Checkpoint } from './components/Checkpoint';
|
|
16
|
-
export { Tilemap } from './components/Tilemap';
|
|
17
|
-
export { ParallaxLayer } from './components/ParallaxLayer';
|
|
18
|
-
export { ScreenFlash } from './components/ScreenFlash';
|
|
19
|
-
export type { ScreenFlashHandle } from './components/ScreenFlash';
|
|
20
|
-
export type { TiledObject, TiledLayer } from './components/Tilemap';
|
|
21
|
-
export { useGame } from './hooks/useGame';
|
|
22
|
-
export { useCamera } from './hooks/useCamera';
|
|
23
|
-
export type { CameraControls } from './hooks/useCamera';
|
|
24
|
-
export { useSnapshot } from './hooks/useSnapshot';
|
|
25
|
-
export type { SnapshotControls } from './hooks/useSnapshot';
|
|
26
|
-
export { useEntity } from './hooks/useEntity';
|
|
27
|
-
export { useInput } from './hooks/useInput';
|
|
28
|
-
export { useInputMap } from './hooks/useInputMap';
|
|
29
|
-
export { useEvents, useEvent } from './hooks/useEvents';
|
|
30
|
-
export { usePlatformerController } from './hooks/usePlatformerController';
|
|
31
|
-
export { useTopDownMovement } from './hooks/useTopDownMovement';
|
|
32
|
-
export { useTriggerEnter, useTriggerExit, useCollisionEnter, useCollisionExit, useCircleEnter, useCircleExit } from './hooks/useContact';
|
|
33
|
-
export type { SpriteAtlas } from './components/spriteAtlas';
|
|
34
|
-
export { createAtlas } from './components/spriteAtlas';
|
|
35
|
-
export type { EngineState } from './context';
|
|
36
|
-
export type { GameControls } from './components/Game';
|
|
37
|
-
export type { DevToolsHandle } from './components/DevTools';
|
|
38
|
-
export type { PlatformerControllerOptions } from './hooks/usePlatformerController';
|
|
39
|
-
export type { TopDownMovementOptions } from './hooks/useTopDownMovement';
|
|
40
|
-
export type { EntityId, ECSWorld, ScriptUpdateFn, Plugin, WorldSnapshot } from '@cubeforge/core';
|
|
41
|
-
export { definePlugin, findByTag } from '@cubeforge/core';
|
|
42
|
-
export { overlapBox, raycast } from '@cubeforge/physics';
|
|
43
|
-
export type { RaycastHit } from '@cubeforge/physics';
|
|
44
|
-
export type { InputManager, ActionBindings, InputMap } from '@cubeforge/input';
|
|
45
|
-
export { createInputMap } from '@cubeforge/input';
|
|
46
|
-
export type { BoundInputMap } from './hooks/useInputMap';
|
|
47
|
-
export type { TransformComponent, Component } from '@cubeforge/core';
|
|
48
|
-
export { createTransform, createTag } from '@cubeforge/core';
|
|
49
|
-
export { createSprite } from '@cubeforge/renderer';
|
|
50
|
-
export type { RigidBodyComponent } from '@cubeforge/physics';
|
|
51
|
-
export type { BoxColliderComponent } from '@cubeforge/physics';
|
|
52
|
-
export type { CircleColliderComponent } from '@cubeforge/physics';
|
|
53
|
-
export type { SpriteComponent } from '@cubeforge/renderer';
|
|
54
|
-
export type { AnimationStateComponent } from '@cubeforge/renderer';
|
|
55
|
-
export type { SquashStretchComponent } from '@cubeforge/renderer';
|
|
56
|
-
export type { ParticlePoolComponent, Particle } from '@cubeforge/renderer';
|
|
57
|
-
export type { ParallaxLayerComponent } from '@cubeforge/renderer';
|
|
58
|
-
export type { TweenHandle } from '@cubeforge/core';
|
|
59
|
-
export { Ease, tween } from '@cubeforge/core';
|
|
60
|
-
export type { ParticlePreset } from './components/particlePresets';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { System, ECSWorld } from '@cubeforge/core';
|
|
2
|
-
import type { Canvas2DRenderer } from '@cubeforge/renderer';
|
|
3
|
-
export declare class DebugSystem implements System {
|
|
4
|
-
private readonly renderer;
|
|
5
|
-
private frameCount;
|
|
6
|
-
private lastFpsTime;
|
|
7
|
-
private fps;
|
|
8
|
-
constructor(renderer: Canvas2DRenderer);
|
|
9
|
-
update(world: ECSWorld, dt: number): void;
|
|
10
|
-
}
|