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

Components are added/removed immediately #187

Merged
merged 1 commit into from Oct 25, 2015

Conversation

Projects
None yet
2 participants
@dsaltares
Copy link
Member

dsaltares commented Oct 24, 2015

  • Listeners are notified after system update.
  • Fixes issue #186
  • Unit tests are passing

@dsaltares dsaltares force-pushed the dsaltares:listeners-fix branch from b6bfc0c to feceb63 Oct 24, 2015

@dsaltares dsaltares force-pushed the dsaltares:listeners-fix branch from feceb63 to 84de679 Oct 24, 2015

@@ -432,8 +432,12 @@ private void processComponentOperations() {
ComponentOperation operation = componentOperations.get(i);

switch(operation.type) {
case Add: operation.entity.addInternal(operation.component); break;

This comment has been minimized.

@dsaltares

dsaltares Oct 24, 2015

Member

Components are immediately added/removed. The only thing left to do (asynchronously) is listener notification and family membership update.

@@ -494,27 +498,20 @@ public void remove(Entity entity, Class<? extends Component> componentClass) {

public Type type;
public Entity entity;
public Component component;

This comment has been minimized.

@dsaltares

dsaltares Oct 24, 2015

Member

These are no longer needed.

componentOperationHandler.add(this, component);
} else {
addInternal(component);
if (addInternal(component)) {

This comment has been minimized.

@dsaltares

dsaltares Oct 24, 2015

Member

Naturally, only schedule operations or notify listeners if the component was actually added/removed.

@azakhary

This comment has been minimized.

Copy link

azakhary commented Oct 25, 2015

All seems legit, nothing crazy so far :D

@dsaltares

This comment has been minimized.

Copy link
Member

dsaltares commented Oct 25, 2015

Next step would be to start looking at #178 although that won't change the API.

dsaltares added a commit that referenced this pull request Oct 25, 2015

Merge pull request #187 from saltares/listeners-fix
Components are added/removed immediately

@dsaltares dsaltares merged commit 3b05b25 into libgdx:master Oct 25, 2015

1 check passed

default Build finished. No test results found.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment