gamestate.java
来自「JAVA游戏编程光盘,内有18个实例,非常详细地阐述了JAVA游戏编程的知识.」· Java 代码 · 共 51 行
JAVA
51 行
package com.brackeen.javagamebook.state;
import java.awt.Graphics2D;
import com.brackeen.javagamebook.input.InputManager;
public interface GameState {
/**
Gets the name of this state. Used for
the checkForStateChange() method.
*/
public String getName();
/**
Returns the name of a state to change to if this state is
ready to change to another state, or null otherwise.
*/
public String checkForStateChange();
/**
Loads any resources for this state. This method is called
in a background thread before any GameStates are set.
*/
public void loadResources(ResourceManager resourceManager);
/**
Initializes this state and sets up the input manager
*/
public void start(InputManager inputManager);
/**
Performs any actions needed to stop this state.
*/
public void stop();
/**
Updates world, handles input.
*/
public void update(long elapsedTime);
/**
Draws to the screen.
*/
public void draw(Graphics2D g);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?