cubeforge 0.4.1 → 0.4.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.ts CHANGED
@@ -133,8 +133,10 @@ interface SpriteProps {
133
133
  tint?: string;
134
134
  /** Tint opacity 0-1 */
135
135
  tintOpacity?: number;
136
+ /** Overall opacity 0-1 (default 1) */
137
+ opacity?: number;
136
138
  }
137
- declare function Sprite({ width, height, color, src, offsetX, offsetY, zIndex, visible, flipX, flipY, anchorX, anchorY, frameIndex, frameWidth, frameHeight, frameColumns, atlas, frame, tileX, tileY, tileSizeX, tileSizeY, sampling, blendMode, layer, tint, tintOpacity, }: SpriteProps): null;
139
+ declare function Sprite({ width, height, color, src, offsetX, offsetY, zIndex, visible, flipX, flipY, anchorX, anchorY, frameIndex, frameWidth, frameHeight, frameColumns, atlas, frame, tileX, tileY, tileSizeX, tileSizeY, sampling, blendMode, layer, tint, tintOpacity, opacity, }: SpriteProps): null;
138
140
 
139
141
  interface TextProps {
140
142
  text: string;
package/dist/index.js CHANGED
@@ -1830,6 +1830,7 @@ function createSprite(opts) {
1830
1830
  frameIndex: 0,
1831
1831
  blendMode: "normal",
1832
1832
  layer: "default",
1833
+ opacity: 1,
1833
1834
  ...opts
1834
1835
  };
1835
1836
  }
@@ -12718,7 +12719,8 @@ function Sprite({
12718
12719
  blendMode = "normal",
12719
12720
  layer = "default",
12720
12721
  tint,
12721
- tintOpacity
12722
+ tintOpacity,
12723
+ opacity = 1
12722
12724
  }) {
12723
12725
  const resolvedFrameIndex = atlas && frame != null ? atlas[frame] ?? 0 : frameIndex;
12724
12726
  const engine = useContext6(EngineContext);
@@ -12759,7 +12761,8 @@ function Sprite({
12759
12761
  blendMode,
12760
12762
  layer,
12761
12763
  tint,
12762
- tintOpacity
12764
+ tintOpacity,
12765
+ opacity
12763
12766
  });
12764
12767
  engine.ecs.addComponent(entityId, comp);
12765
12768
  if (src) {
@@ -12786,7 +12789,22 @@ function Sprite({
12786
12789
  comp.layer = layer;
12787
12790
  comp.tint = tint;
12788
12791
  comp.tintOpacity = tintOpacity;
12789
- }, [color, visible, flipX, flipY, zIndex, resolvedFrameIndex, blendMode, layer, tint, tintOpacity, engine, entityId]);
12792
+ comp.opacity = opacity;
12793
+ }, [
12794
+ color,
12795
+ visible,
12796
+ flipX,
12797
+ flipY,
12798
+ zIndex,
12799
+ resolvedFrameIndex,
12800
+ blendMode,
12801
+ layer,
12802
+ tint,
12803
+ tintOpacity,
12804
+ opacity,
12805
+ engine,
12806
+ entityId
12807
+ ]);
12790
12808
  return null;
12791
12809
  }
12792
12810
 
@@ -12890,7 +12908,7 @@ function RigidBody({
12890
12908
  vy = 0,
12891
12909
  lockX = false,
12892
12910
  lockY = false,
12893
- lockRotation = false,
12911
+ lockRotation = true,
12894
12912
  ccd = false,
12895
12913
  angularVelocity = 0,
12896
12914
  angularDamping = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cubeforge",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "React-first 2D browser game engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,8 +21,8 @@
21
21
  "dist"
22
22
  ],
23
23
  "peerDependencies": {
24
- "react": "^18.0.0",
25
- "react-dom": "^18.0.0"
24
+ "react": "^18.0.0 || ^19.0.0",
25
+ "react-dom": "^18.0.0 || ^19.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsup": "^8.0.0"