Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import org.lwjgl.opengl.Display;
- import org.newdawn.slick.AngelCodeFont;
- import org.newdawn.slick.AppGameContainer;
- import org.newdawn.slick.BasicGame;
- import org.newdawn.slick.GameContainer;
- import org.newdawn.slick.Graphics;
- import org.newdawn.slick.Input;
- import org.newdawn.slick.SlickException;
- public class SlickApp extends BasicGame
- {
- private boolean gamerun = true;
- //private Graphics2D gg = null;
- private Input input = null;
- // private MouseHandler debugMouse = null;
- private GStreamer_TestPlayer videoplayer;
- public SlickApp()
- {
- super("Test Chamber");
- }
- @Override
- public void init(GameContainer gc) throws SlickException
- {
- // gc.setVSync(true);
- gc.setShowFPS(true);
- gc.setClearEachFrame(true);
- gc.setUpdateOnlyWhenVisible(true);
- gc.setAlwaysRender(false);
- gc.setForceExit(false);
- }
- public static void main(String[] args) throws SlickException
- {
- AppGameContainer app = new AppGameContainer( new SlickApp() );
- app.setDisplayMode(1024, 768, false);
- app.start();
- System.exit(0);
- }
- private void checkInputs(GameContainer gc)
- {
- input = gc.getInput();
- if (input.isKeyPressed(Input.KEY_DELETE)) // DELETE
- {
- gamerun = false;
- }
- if (input.isKeyPressed(Input.KEY_F5)) // F5
- {
- }
- if (input.isKeyPressed(Input.KEY_F))
- {
- videoplayer = new GStreamer_TestPlayer(1024,512,"dmc4_1024x512.ogv", 14000);
- }
- }
- @Override
- public void update(GameContainer gc, int delta) throws SlickException
- {
- if (gamerun)
- {
- if (videoplayer == null)
- {
- }
- else
- {
- if (videoplayer.isDone())
- {
- videoplayer.destroy();
- videoplayer = null;
- }
- else
- {
- videoplayer.update();
- }
- }
- checkInputs(gc);
- }
- }
- @Override
- public void render(GameContainer gc, Graphics g) throws SlickException
- {
- if (gamerun)
- {
- Display.sync(60);
- }
- else
- {
- gc.exit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement