Closed Jarrio closed 5 years ago
Hmm.. I can't reproduce that. I think I am having some issues with lix + openfl + haxe 4 preivew 4/5
Do you think you will be able to isolate a snippet that doesn't involve any game frameworks?
I think I figured out where this is going wrong
var sys:SystemInfo<Event> = {
system: new RenderSystem(this)
}
engine.states.add('playing', new ecs.state.State([sys]), ['gameover']);
That works as expected, below fails:
var state = new ecs.state.State([sys]);
engine.states.add('playing', {
system: new RenderSystem(this)
}, ['gameover']);
I believe this is because haxe can't infer the type inference that SystemInfo
requires
It would be nice if you can add a falling case in the test suite.
The asteroids example compiles fine for me with the bundled 4.0.0-preview.5+1aaf080
haxe in the current Kha extension pack 18.11.3
. What version are you using?
I do get some warnings though:
...system/BulletAsteroidCollisionHandlerSystem.hx:11: characters 60-108 : Warning : This pattern is unused
...system/SpaceshipAsteroidCollisionHandlerSystem.hx:11: characters 46-80 : Warning : This pattern is unused
Also, (just from reading the code, i don't know what goes on) shouldn't you pass an array in the second example [{ system: new RenderSystem() }]
or even wrap it in a State?
Yeah @sh-dave you are right, the correct version should be like this:
engine.states.add('playing', new EngineState([{
system: new RenderSystem(this)
}]), ['gameover']);
As for the warnings, I think it is more a compiler issue. Because obviously there are no unused patterns.
This is on haxe preview 4 so maybe it gets fixed in preview 5. @sh-dave That was a mistake whilst made while editing the code on github.
In the first image the error occurs and in the second it doesn't. I will add a test when I get time to figure out how to do unit tests :sweat_smile:
I think it is working fine now
https://github.com/kevinresol/ecs/blob/develop/sample/asteroid/src/Main.hx#L90 On this line the following error appears:
I think this might be an issue with haxe 4 as it seems to compile fine on haxe 3 (tested on a modified version of the sample on kha with a --haxe3 flag)