public class GApplet extends JApplet {
/**
*
*/
private static final long serialVersionUID = 1994280929713148311L;
String gmname = "";
Class<?> gmClass = null;
Game game = null;
/**
* Construct an applet with a game.
* @param gmname The name of the game class with package name
*/
public GApplet(String gmname) {
this.gmname = gmname;
}
/**
* Initializes the applet mode
*/
public void init(){
Global.WEB_MODE = true;
try {
gmClass = getClass().getClassLoader().loadClass(gmname);
game = (Game)gmClass.newInstance();
} catch (ClassNotFoundException e) {
System.err.println("Error finding class : " + gmname);
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
public void showGame(){
if (!Game.isRunning()){
GWindow.setup(game);
}
}
}