Ayfri / PIXI-Kotlin

Kotlin/JS bindings for PIXI.js library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Canvas not rendering anything

dosier opened this issue · comments

commented

Hey, first of all, thanks for putting in the work. I've been hoping for this mapping, and would like to contribute.

I am trying out one of the examples given in the project, but nothing is being drawn to the screen.

The canvas is created, and I can see the components on the screen through PixiJS debug tools in Chrome, but the rendering loop is not being started.

When I try to manually call app.render() after creating the app, it does draw the background color, if I then try to add a sprite and call app.render() again, it gives me

BatchSystem.ts:45 Uncaught TypeError: Cannot read properties of undefined (reading 'start')
    at BatchSystem.setObjectRenderer (BatchSystem.ts:45:30)
    at Sprite._render (Sprite.ts:369:24)
    at Container.render (Container.ts:643:18)
    at Container.render (Container.ts:647:34)
    at Renderer.render (Renderer.ts:511:23)
    at Application.render (Application.ts:133:23)
    at start (App.kt:69:9)
    at l (App.kt:47:47)
    at Signal.dispatch (Signal.ts:138:22)
    at Loader._onComplete (Loader.ts:548:25)

I suspect it has something to do with the ticker plugin not being loaded because when I invoke app.start() it tells me start is undefined.

Any clues?

I recently tried to do the examples and encountered similar issues. It appears that none of pixi's plugins are getting loaded automatically. Issues on the official pixi repo say that this is a webpack related issue, but most of the time this results from version mismatches between PIXI libraries which is not the case here. ¯\_(ツ)_/¯

I can't help with the ticker, but if you want to get manual rendering up and running, I got mine working by putting the following lines before I initialize my Application:

	val renderer = Renderer
	renderer.registerPlugin("batch", BatchRenderer.unsafeCast<IRendererPluginConstructor>())
commented

Hi, I replied to @dosier on Slack, but maybe the response was lost :)
Try and see the code of my 2D Minecraft game using PIXI-Kotlin, it was working perfectly when I was working on it (around Chrome 100-105 on Windows).

@Ayfri please update to v7

Sorry I don't have time anymore to work on this project, I also tried on my computer to create one module per JS module, but it's not working as optional dependencies isn't a concept present in Gradle.

I've just found out about the release of pixi 8.0.0-beta and maybe I will update this project as everything was moved into a single module.