forked from schteppe/p2.js
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: bump @types/react and @types/react-dom * feat: defer addition and removal of objects while stepping instead of throwing an error * feat(sandbox): extract header from app.tsx, minor refactors, update deps * feat(sandbox): move body and spring entity logic from app.tsx to PhysicsSystem * chore(sandbox): update arancini to v5 * chore(actions): use node 20 * chore(sandbox): update arancini to v6 * Revert "feat: defer addition and removal of objects while stepping instead of throwing an error" This reverts commit 0fa49ba.
- Loading branch information
1 parent
ec9d5ac
commit 5e88a6c
Showing
17 changed files
with
416 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@p2-es/sandbox": patch | ||
--- | ||
|
||
feat(sandbox): move body and spring entity logic from app.tsx to PhysicsSystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
"@p2-es/sandbox": patch | ||
--- | ||
|
||
chore: update arancini to v4 | ||
chore: update arancini to v5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import { ECS, createECS } from 'arancini/react' | ||
import { World } from 'arancini' | ||
import { ReactAPI } from 'arancini/react' | ||
import { Executor } from 'arancini/systems' | ||
import React, { createContext, useContext } from 'react' | ||
import { Entity } from './entity' | ||
|
||
const ecsContext = createContext<ReturnType<typeof createECS>>(null!) | ||
export type EcsContext = { | ||
world: World<Entity> | ||
executor: Executor<Entity> | ||
react: ReactAPI<Entity> | ||
} | ||
|
||
const ecsContext = createContext<EcsContext>(null!) | ||
|
||
export const useECS = (): ECS<Entity> => { | ||
export const useECS = (): EcsContext => { | ||
return useContext(ecsContext) | ||
} | ||
|
||
export const EcsProvider = ({ children, ecs }: { children: React.ReactNode; ecs: ReturnType<typeof createECS> }) => { | ||
export const EcsProvider = ({ children, ecs }: { children: React.ReactNode; ecs: EcsContext }) => { | ||
return <ecsContext.Provider value={ecs}>{children}</ecsContext.Provider> | ||
} |
Oops, something went wrong.