gameobjectmanager.java

来自「Java games programing--很好的java游戏编程源码」· Java 代码 · 共 74 行

JAVA
74
字号
package com.brackeen.javagamebook.game;

import java.awt.Rectangle;
import java.awt.Graphics2D;
import java.util.Iterator;
import com.brackeen.javagamebook.game.GameObjectRenderer;

/**
    The GameObjectManager interface provides methods to keep
    track of and draw GameObjects.
*/
public interface GameObjectManager {


    /**
        Marks all objects within the specified 2D bounds
        as potentially visible (should be drawn).
    */
    public void markVisible(Rectangle bounds);


    /**
        Marks all objects as potentially visible (should be drawn).
    */
    public void markAllVisible();


    /**
        Adds a GameObject to this manager.
    */
    public void add(GameObject object);


    /**
        Gets an iterator of all GameObjects (including the player).
    */
    public Iterator iterator();


    /**
        Adds a GameObject to this manager, specifying it as the
        player object. An existing player object, if any,
        is not removed.
    */
    public void addPlayer(GameObject player);


    /**
        Gets the object specified as the Player object, or null
        if no player object was specified.
    */
    public GameObject getPlayer();


    /**
        Removes a GameObject from this manager.
    */
    public void remove(GameObject object);


    /**
        Updates all objects based on the amount of time passed
        from the last update.
    */
    public void update(long elapsedTime);


    /**
        Draws all visible objects.
    */
    public void draw(Graphics2D g, GameObjectRenderer r);

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?