Giter Site home page Giter Site logo

react-pixi-tilemap's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-pixi-tilemap's Issues

Would this work without react-pixi?

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.

Hooks cause error

When calling a hook in the demo project, the following error message appears in the console (see screenshot)
hookError

Steps to reproduce:

  • clone the repo and navigate to the demo section
  • change the directory of the react-pixi-tilemap path to fit the package or install it via npm/yarn
  • yarn install
  • insert const mapHook = useMap() just before the return statement and add it to imports
  • yarn 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;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.