public final void addGameObject(TEGameObject gameObject) { TEManagerRender renderManager = TEManagerRender.sharedManager(); TEManagerTouch touchManager = TEManagerTouch.sharedManager(); TEManagerSound soundManager = TEManagerSound.sharedManager(); TEManagerStack stackManager = TEManagerStack.sharedManager(); TEManagerMovement movementManager = TEManagerMovement.sharedManager(); TEComponentContainer components = gameObject.getComponents(); final int size = components.size(); TEComponent component; for (int i = 0; i < size; ++i) { component = components.get(i); if (component instanceof TEComponentRender) { renderManager.addComponent(component); } else if (component instanceof TEComponentTouch) { touchManager.addComponent(component); } else if (component instanceof TEComponentSound) { soundManager.addComponent(component); } else if (component instanceof TEComponentStack) { stackManager.addComponent(component); } else if (component instanceof TEComponentMovement) { movementManager.addComponent(component); } } mGameObjects.add(gameObject); }
public TEEngine(int width, int height) { TEManagerGraphics.setScreenSize(width, height); mWidth = width; mHeight = height; mGameObjects = new Vector<TEGameObject>(); mManagers = new Vector<TEManager>(); mManagers.add(TEManagerTouch.sharedManager()); mManagers.add(TEManagerStack.sharedManager()); mManagers.add(TEManagerSound.sharedManager()); mManagers.add(TEManagerRender.sharedManager()); mManagers.add(TEManagerMovement.sharedManager()); }