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TQC AAKN4XJLZ2GARZMUFYX3CJZKYHTRRZDYNTFRLMY7VPAY7K6W4N3QC ZHOSSPNKGFIKSFPDXCGLMSYMMX2J433VU2BUUWBKUH7TOLQUBSPQC RSF65T43YUPY7YJ56XUDB2VECU7SE6PH2ORQXFGKIN5ZDLH6FSIAC 4UKXFJRZYO5WEPH5PKMYDZCWVWSEAXFSPL35G5NFIUBCMH3BCXEQC THNMNMVRZQVPZTEXHIK6WGYN3QDEFPKFOVOCB5HTWCYC5BOBYQ5AC VQJBTLNEKPLH62WALLZABSTLHLEMS4SFVEVFUOXJ4EFABHISYF5QC import { PointNodeRef } from "../data/GameState";
import { GameState, PointNodeRef } from "../data/GameState";import { PixiWrapperComponent } from "./PixiWrapperComponent";import { DeepReadonly, UpdaterGeneratorType } from "../lib/util/misc";export type PixiComponentState = {innerWidth: number,innerHeight: number,}
export function PixiComponent({onFocusedNodeChange,}: {whatever?: any;
export function PixiComponent(props: {// gameState: DeepReadonly<GameState>,// gameStateUpdaters: UpdaterGeneratorType<GameState>,
// application.register(container.current!);container.current!.appendChild(newApp.app.view);// container.current!.appendChild(application.app.view)// console.log(container.current!)
// // application.register(container.current!);// container.current!.appendChild(newApp.app.view);// // container.current!.appendChild(application.app.view)// // console.log(container.current!)
import React, { useContext, useEffect, useRef } from "react";import { UseGameStateContext } from "../contexts";import { GameState } from "../data/GameState";import { DeepReadonly, UpdaterGeneratorType } from "../lib/util/misc";import { Application } from "../pixi/Application";export function PixiWrapperComponent(props: {application: Application | undefined}) {const container = useRef<HTMLDivElement>(null);const [gameState, gameStateUpdaters] = useContext(UseGameStateContext);useEffect(() => {if (props.application) {container.current!.appendChild(props.application.app.view);}}, [props.application]);// Trigger component rerender when game state is updatedprops.application?.rerender({gameState})return (<><div ref={container} /></>);}
// should be OK, just remember to populate the contextexport const GameContext = React.createContext<GameState>(null as any);
// nullable, but should be OK, just remember to populate the context// export const GameContext = React.createContext<GameState>(null as any);// export const GameUpdatersContext = React.createContext<UpdaterGeneratorType<GameState>>(null as any);export const UseGameStateContext = React.createContext<[DeepReadonly<GameState>, UpdaterGeneratorType<GameState>]>([] as any);