Back to project page GameWorker.
The source code is released under:
Apache License
If you think the Android project GameWorker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.al.gameengine.sprite; //ww w . j a va 2 s . c o m import java.util.LinkedList; import android.graphics.Canvas; /** * This class manages a series of sprites that are added to it. * @author AL * */ public class SpriteManager { /** * List of sprites added. */ private static LinkedList<Sprite> spriteList; /** * Constructor */ public SpriteManager() { spriteList = new LinkedList<Sprite>(); } public void update() { for(Sprite spriteItem: spriteList) { spriteItem.update(); } } /** * Draws the sprites that are in the list. * @param canvas */ public void render(Canvas canvas) { for(Sprite spriteItem: spriteList) { spriteItem.draw(canvas); } } /** * Function used to add sprite to the manager. * @param sprite */ public void addSprite(Sprite sprite) { spriteList.add(sprite); } }