Skip to content

Instantly share code, notes, and snippets.

@jorgenpt
Created January 19, 2013 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jorgenpt/4570243 to your computer and use it in GitHub Desktop.
Save jorgenpt/4570243 to your computer and use it in GitHub Desktop.
interface Component {
public void update(int delta);
public void render();
}
import java.util.*;
class Entity {
private List<Component> components = new ArrayList<Component>();
public void addComponent(Component c) {
components.add(c);
}
public void update(int delta) {
for (Component c : components) {
c.update();
}
}
public void render() {
for (Component c : components) {
c.render();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment