vocksel / react-pixi-tilemap Goto Github PK
View Code? Open in Web Editor NEWUse .tmx maps created with Tiled in your React-based pixi.js games
Home Page: https://npmjs.com/package/react-pixi-tilemap
License: MIT License
Use .tmx maps created with Tiled in your React-based pixi.js games
Home Page: https://npmjs.com/package/react-pixi-tilemap
License: MIT License
Hi vocksel, I'm creating a map editor for https://github.com/CleverRaven/Cataclysm-DDA , it is not using Tiled, so I have to copy-paste and modify some of your code to achieve this, just let you know I'm using your code, thank you!
Hoping to load a map to my React ReduxTK project, but the map is not rendering. I installed react-pixi, and wrapped the Tilemap component inside Stage, but still all I get is a black screen. I don't have any sprites component either.
When calling a hook in the demo project, the following error message appears in the console (see screenshot)
Steps to reproduce:
yarn install
const mapHook = useMap()
just before the return statement and add it to importsyarn start
Here the modified code from App.js, just for redundancy:
import { Stage, Sprite } from '@inlet/react-pixi';
import { Texture } from '@pixi/core';
import { Tilemap, useTilemapLoader, useMap } from 'react-pixi-tilemap'
const tilemape = process.env.PUBLIC_URL + '/stages/map.tmx'
const App = () => {
const map = useTilemapLoader(tilemape)
const mapData = useMap()
// console.log(mapData)
return (
<Stage width={window.innerWidth} height={window.innerHeight} options={{ resizeTo: window }}>
<Tilemap map={map} scale={0.75}>
{/* These sprites show off the layering order */}
<Sprite texture={Texture.WHITE} x={120} y={380} width={64} height={64} />
<Sprite texture={Texture.WHITE} x={700} y={420} width={64} height={64} />
<Sprite texture={Texture.WHITE} x={500} y={700} width={64} height={64} />
</Tilemap>
</Stage>
)
}
export default App;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.