Class Game

  • All Implemented Interfaces:
    org.newdawn.slick.command.InputProviderListener, org.newdawn.slick.ControlledInputReciever, org.newdawn.slick.ControllerListener, org.newdawn.slick.Game, org.newdawn.slick.InputListener, org.newdawn.slick.KeyListener, org.newdawn.slick.MouseListener

    public class Game
    extends org.newdawn.slick.state.StateBasedGame
    implements org.newdawn.slick.command.InputProviderListener
    The "main" class, mostly for interacting with the Slick2D library
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean debug
      Whether or not to perform debug related operations
      static org.newdawn.slick.Input input
      Allows for keyboard, mouse and controller input to be read
      static int WINDOW_HEIGHT
      The "actual" height of the window (minus 1px borders)
      static int WINDOW_WIDTH
      The "actual" width of the window (minus 1px borders)
    • Constructor Summary

      Constructors 
      Constructor Description
      Game()
      Calls the constructor for StateBasedGame with a custom title
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void controlPressed​(org.newdawn.slick.command.Command command)  
      void controlReleased​(org.newdawn.slick.command.Command command)  
      void initStatesList​(org.newdawn.slick.GameContainer container)  
      void keyPressed​(int key, char c)  
      void keyReleased​(int key, char c)  
      static void main​(java.lang.String[] args)
      Creates a new AppGameContainer and starts it
      void mouseClicked​(int button, int x, int y, int clickCount)  
      void mouseDragged​(int oldx, int oldy, int newx, int newy)  
      void mouseMoved​(int oldx, int oldy, int newx, int newy)  
      void mousePressed​(int button, int x, int y)  
      void mouseReleased​(int button, int x, int y)  
      void mouseWheelMoved​(int change)  
      static void quit()
      Quits the game
      • Methods inherited from class org.newdawn.slick.state.StateBasedGame

        addState, closeRequested, controllerButtonPressed, controllerButtonReleased, controllerDownPressed, controllerDownReleased, controllerLeftPressed, controllerLeftReleased, controllerRightPressed, controllerRightReleased, controllerUpPressed, controllerUpReleased, enterState, enterState, getContainer, getCurrentState, getCurrentStateID, getState, getStateCount, getTitle, init, inputEnded, inputStarted, isAcceptingInput, postRenderState, postUpdateState, preRenderState, preUpdateState, render, setInput, update
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • WINDOW_WIDTH

        public static final int WINDOW_WIDTH
        The "actual" width of the window (minus 1px borders)
        See Also:
        Constant Field Values
      • WINDOW_HEIGHT

        public static final int WINDOW_HEIGHT
        The "actual" height of the window (minus 1px borders)
        See Also:
        Constant Field Values
      • debug

        public static boolean debug
        Whether or not to perform debug related operations
      • input

        public static org.newdawn.slick.Input input
        Allows for keyboard, mouse and controller input to be read
    • Constructor Detail

      • Game

        public Game()
        Calls the constructor for StateBasedGame with a custom title
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
        Creates a new AppGameContainer and starts it
        Parameters:
        args - Arguments supplied through command line/execution
      • initStatesList

        public void initStatesList​(org.newdawn.slick.GameContainer container)
                            throws org.newdawn.slick.SlickException
        Specified by:
        initStatesList in class org.newdawn.slick.state.StateBasedGame
        Throws:
        org.newdawn.slick.SlickException
      • quit

        public static void quit()
        Quits the game
      • mousePressed

        public void mousePressed​(int button,
                                 int x,
                                 int y)
        Specified by:
        mousePressed in interface org.newdawn.slick.MouseListener
        Overrides:
        mousePressed in class org.newdawn.slick.state.StateBasedGame
      • mouseReleased

        public void mouseReleased​(int button,
                                  int x,
                                  int y)
        Specified by:
        mouseReleased in interface org.newdawn.slick.MouseListener
        Overrides:
        mouseReleased in class org.newdawn.slick.state.StateBasedGame
      • mouseMoved

        public void mouseMoved​(int oldx,
                               int oldy,
                               int newx,
                               int newy)
        Specified by:
        mouseMoved in interface org.newdawn.slick.MouseListener
        Overrides:
        mouseMoved in class org.newdawn.slick.state.StateBasedGame
      • mouseDragged

        public void mouseDragged​(int oldx,
                                 int oldy,
                                 int newx,
                                 int newy)
        Specified by:
        mouseDragged in interface org.newdawn.slick.MouseListener
        Overrides:
        mouseDragged in class org.newdawn.slick.state.StateBasedGame
      • mouseWheelMoved

        public void mouseWheelMoved​(int change)
        Specified by:
        mouseWheelMoved in interface org.newdawn.slick.MouseListener
        Overrides:
        mouseWheelMoved in class org.newdawn.slick.state.StateBasedGame
      • keyPressed

        public void keyPressed​(int key,
                               char c)
        Specified by:
        keyPressed in interface org.newdawn.slick.KeyListener
        Overrides:
        keyPressed in class org.newdawn.slick.state.StateBasedGame
      • keyReleased

        public void keyReleased​(int key,
                                char c)
        Specified by:
        keyReleased in interface org.newdawn.slick.KeyListener
        Overrides:
        keyReleased in class org.newdawn.slick.state.StateBasedGame
      • mouseClicked

        public void mouseClicked​(int button,
                                 int x,
                                 int y,
                                 int clickCount)
        Specified by:
        mouseClicked in interface org.newdawn.slick.MouseListener
        Overrides:
        mouseClicked in class org.newdawn.slick.state.StateBasedGame
      • controlPressed

        public void controlPressed​(org.newdawn.slick.command.Command command)
        Specified by:
        controlPressed in interface org.newdawn.slick.command.InputProviderListener
      • controlReleased

        public void controlReleased​(org.newdawn.slick.command.Command command)
        Specified by:
        controlReleased in interface org.newdawn.slick.command.InputProviderListener