Advertisement
Guest User

Untitled

a guest
Jan 17th, 2012
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.99 KB | None | 0 0
  1.  
  2. import org.newdawn.slick.CanvasGameContainer;
  3. import org.newdawn.slick.Game;
  4. import org.newdawn.slick.ScalableGame;
  5. import org.newdawn.slick.SlickException;
  6.  
  7. /**
  8.  * A wrapper equal to the {@link ScalableGame} container but with resize feature. This means you can resize the window
  9.  * of the game and let this container handle the adjustments. The container can be used like the
  10.  * {@link CanvasGameContainer}. It's a canvas which can be added to a panel.
  11.  *
  12.  * @author Stefan Lange
  13.  * @version 1.0.0
  14.  * @since 15.01.2012
  15.  */
  16. public class AutoScalableGame extends CanvasGameContainer {
  17.    
  18.     private static final long serialVersionUID = -5755115975328286634L;
  19.    
  20.     /**
  21.      * Create a new auto scalable game wrapper.
  22.      *
  23.      * @param game
  24.      *            The game to be wrapper and displayed at a different resolution
  25.      * @param normalWidth
  26.      *            The normal width of the game
  27.      * @param normalHeight
  28.      *            The normal height of the game
  29.      * @param maintainAspect
  30.      *            True if we should maintain the aspect ratio
  31.      * @throws SlickException
  32.      */
  33.     public AutoScalableGame(Game game, int normalWidth, int normalHeight, boolean maintainAspect) throws SlickException {
  34.         this(game, false, normalWidth, normalHeight, maintainAspect);
  35.     }
  36.     /**
  37.      * Create a new auto scalable game wrapper.
  38.      *
  39.      * @param game
  40.      *            The game to be wrapper and displayed at a different resolution
  41.      * @param shared
  42.      *            True if shared GL context should be enabled. This allows multiple panels
  43.      * @param normalWidth
  44.      *            The normal width of the game
  45.      * @param normalHeight
  46.      *            The normal height of the game
  47.      * @param maintainAspect
  48.      *            True if we should maintain the aspect ratio
  49.      * @throws SlickException
  50.      */
  51.     public AutoScalableGame(Game game, boolean shared, int normalWidth, int normalHeight, boolean maintainAspect) throws SlickException {
  52.         super(new ScalableGame(game, normalWidth, normalHeight, maintainAspect), shared);
  53.     }
  54.    
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement