This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyfive/src/index.tsx

35 lines
877 B
TypeScript

import * as PIXI from "pixi.js";
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { Stage } from "@inlet/react-pixi";
import { configureStore } from "@reduxjs/toolkit";
import UI from "~ui/UI";
import reducer from "~store/reducer";
import Game from "~game/scenes/Game";
PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;
const mounted = (app: PIXI.Application) => {
window.addEventListener("resize", () => {
app.queueResize();
});
app.queueResize();
};
const store = configureStore({ reducer });
ReactDOM.render(
<React.Fragment>
<Stage options={{ resolution: 1, resizeTo: window }} onMount={mounted}>
<Provider store={store}>
<Game />
</Provider>
</Stage>
<Provider store={store}>
<UI />
</Provider>
</React.Fragment>,
document.getElementById("app")
);