Advertisement
Guest User

Untitled

a guest
Jun 28th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.27 KB | None | 0 0
  1. package main;
  2.  
  3. import org.lwjgl.opengl.Display;
  4. import org.newdawn.slick.AngelCodeFont;
  5. import org.newdawn.slick.AppGameContainer;
  6. import org.newdawn.slick.BasicGame;
  7. import org.newdawn.slick.GameContainer;
  8. import org.newdawn.slick.Graphics;
  9. import org.newdawn.slick.Input;
  10. import org.newdawn.slick.SlickException;
  11.  
  12.  public class SlickApp extends BasicGame
  13.  {
  14.     private boolean gamerun = true;
  15.  
  16.     //private Graphics2D gg = null;
  17.     private Input input = null;
  18. //    private MouseHandler debugMouse = null;
  19.    
  20.     private GStreamer_TestPlayer videoplayer;
  21.  
  22.     public SlickApp()
  23.     {
  24.         super("Test Chamber");
  25.     }
  26.    
  27.     @Override
  28.     public void init(GameContainer gc) throws SlickException
  29.     {
  30. //        gc.setVSync(true);
  31.         gc.setShowFPS(true);
  32.         gc.setClearEachFrame(true);
  33.         gc.setUpdateOnlyWhenVisible(true);
  34.         gc.setAlwaysRender(false);
  35.         gc.setForceExit(false);
  36.        
  37.     }
  38.  
  39.     public static void main(String[] args) throws SlickException
  40.     {
  41.         AppGameContainer app = new AppGameContainer( new SlickApp() );
  42.        
  43.          app.setDisplayMode(1024, 768, false);
  44.          app.start();
  45.  
  46.         System.exit(0);
  47.     }
  48.  
  49.     private void checkInputs(GameContainer gc)
  50.     {
  51.         input = gc.getInput();
  52.        
  53.         if (input.isKeyPressed(Input.KEY_DELETE)) // DELETE
  54.         {
  55.             gamerun = false;
  56.         }
  57.  
  58.         if (input.isKeyPressed(Input.KEY_F5)) // F5
  59.         {
  60.         }
  61.        
  62.         if (input.isKeyPressed(Input.KEY_F))
  63.         {
  64.             videoplayer = new GStreamer_TestPlayer(1024,512,"dmc4_1024x512.ogv", 14000);
  65.         }
  66.     }
  67.  
  68.     @Override
  69.     public void update(GameContainer gc, int delta) throws SlickException
  70.     {
  71.         if (gamerun)
  72.         {
  73.             if (videoplayer == null)
  74.             {
  75.  
  76.             }
  77.             else
  78.             {
  79.                 if (videoplayer.isDone())
  80.                 {
  81.                     videoplayer.destroy();
  82.                     videoplayer = null;
  83.                 }
  84.                 else
  85.                 {
  86.                     videoplayer.update();
  87.                 }
  88.             }
  89.            
  90.             checkInputs(gc);
  91.         }
  92.     }
  93.  
  94.     @Override
  95.     public void render(GameContainer gc, Graphics g) throws SlickException
  96.     {
  97.         if (gamerun)
  98.         {
  99.  
  100.  
  101.             Display.sync(60);
  102.         }
  103.         else
  104.         {
  105.             gc.exit();
  106.         }
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement