Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ButtonSystem update is overrided by LayerSystem #55

Open
HuangDev opened this issue Oct 18, 2015 · 1 comment
Open

ButtonSystem update is overrided by LayerSystem #55

HuangDev opened this issue Oct 18, 2015 · 1 comment

Comments

@HuangDev
Copy link

Hi The problem is.
After I create a Button on Overlap2d tool. In code, I add ButtonComponent to Entity.
After Debug. I can see the ButtonSystem is updating the button.

               if(childZComponent.layerName.equals("normal")) {
                    childMainItemComponent.visible = true;
                }
                if(childZComponent.layerName.equals("pressed")) {
                    childMainItemComponent.visible = false;
                }

But LayerSystem is updating the button too. in method updateLayers()

if(layerMapComponent.getLayer(zindexComponent.layerName) != null) {
                mainItemComponent.visible = layerMapComponent.getLayer(zindexComponent.layerName).isVisible;
            }

I think it is because the Button I created has CompositeTransformComponent too.

And I check the Engine systems.
The update order is like this
LayerSystem -> Overlap2dRender -> ButtonSystem.

So result is ButtonSystem is override by LayerSystem before Render.

To fix this. I can update the EntitySystem property priority. but Engine does not update order by calling
systems.sort(systemComparator);

and getSystems return ImmutableArray, so I can not update order.

QuickFix:

sceneLoader.getEngine().getSystem(Overlap2dRenderer.class).priority = 1;
sceneLoader.getEngine().addSystem(new ButtonSystem());
to update the order. 

PS. English is not my strong suit. Sorry...

@azakhary
Copy link
Contributor

I say we go for quick fix first, but probably need a better fix later on.
Can you do the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants