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
Raw Normal View History

2020-09-27 00:38:43 +00:00
import * as PIXI from "pixi.js";
2020-09-29 08:52:39 +00:00
import React from "react";
2020-09-27 00:38:43 +00:00
import ReactDOM from "react-dom";
2020-09-29 08:52:39 +00:00
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";
2020-09-29 09:31:55 +00:00
import Game from "~game/scenes/Game";
2020-09-27 00:38:43 +00:00
PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;
const mounted = (app: PIXI.Application) => {
window.addEventListener("resize", () => {
app.queueResize();
});
app.queueResize();
};
2020-09-29 08:52:39 +00:00
const store = configureStore({ reducer });
2020-09-27 00:38:43 +00:00
ReactDOM.render(
<React.Fragment>
<Stage options={{ resolution: 1, resizeTo: window }} onMount={mounted}>
2020-09-29 08:52:39 +00:00
<Provider store={store}>
2020-09-29 09:31:55 +00:00
<Game />
2020-09-29 08:52:39 +00:00
</Provider>
2020-09-27 00:38:43 +00:00
</Stage>
2020-09-29 08:52:39 +00:00
<Provider store={store}>
<UI />
</Provider>
2020-09-27 00:38:43 +00:00
</React.Fragment>,
document.getElementById("app")
);