mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 14:21:52 +09:00
added sources for Slick
Former-commit-id: 1647fa32ef6894bd7db44f741f07c2f4dcdf9054 Former-commit-id: 0e5810dcfbe1fd59b13e7cabe9f1e93c5542da2d
This commit is contained in:
71
lib/slick-source/org/newdawn/slick/state/GameState.java
Normal file
71
lib/slick-source/org/newdawn/slick/state/GameState.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package org.newdawn.slick.state;
|
||||
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.InputListener;
|
||||
import org.newdawn.slick.SlickException;
|
||||
|
||||
/**
|
||||
* A single state building up part of the game. The state include rendering, logic and input handling
|
||||
* for the state.
|
||||
*
|
||||
* @author kevin
|
||||
*/
|
||||
public interface GameState extends InputListener {
|
||||
/**
|
||||
* Get the ID of this state
|
||||
*
|
||||
* @return The game unique ID of this state
|
||||
*/
|
||||
public int getID();
|
||||
|
||||
/**
|
||||
* Initialise the state. It should load any resources it needs at this stage
|
||||
*
|
||||
* @param container The container holding the game
|
||||
* @param game The game holding this state
|
||||
* @throws SlickException Indicates a failure to initialise a resource for this state
|
||||
*/
|
||||
public void init(GameContainer container, StateBasedGame game) throws SlickException;
|
||||
|
||||
/**
|
||||
* Render this state to the game's graphics context
|
||||
*
|
||||
* @param container The container holding the game
|
||||
* @param game The game holding this state
|
||||
* @param g The graphics context to render to
|
||||
* @throws SlickException Indicates a failure to render an artifact
|
||||
*/
|
||||
public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException;
|
||||
|
||||
/**
|
||||
* Update the state's logic based on the amount of time thats passed
|
||||
*
|
||||
* @param container The container holding the game
|
||||
* @param game The game holding this state
|
||||
* @param delta The amount of time thats passed in millisecond since last update
|
||||
* @throws SlickException Indicates an internal error that will be reported through the
|
||||
* standard framework mechanism
|
||||
*/
|
||||
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException ;
|
||||
|
||||
/**
|
||||
* Notification that we've entered this game state
|
||||
*
|
||||
* @param container The container holding the game
|
||||
* @param game The game holding this state
|
||||
* @throws SlickException Indicates an internal error that will be reported through the
|
||||
* standard framework mechanism
|
||||
*/
|
||||
public void enter(GameContainer container, StateBasedGame game) throws SlickException;
|
||||
|
||||
/**
|
||||
* Notification that we're leaving this game state
|
||||
*
|
||||
* @param container The container holding the game
|
||||
* @param game The game holding this state
|
||||
* @throws SlickException Indicates an internal error that will be reported through the
|
||||
* standard framework mechanism
|
||||
*/
|
||||
public void leave(GameContainer container, StateBasedGame game) throws SlickException;
|
||||
}
|
||||
Reference in New Issue
Block a user