當前位置: 首頁>>代碼示例>>Java>>正文


Java SlickException類代碼示例

本文整理匯總了Java中org.newdawn.slick.SlickException的典型用法代碼示例。如果您正苦於以下問題:Java SlickException類的具體用法?Java SlickException怎麽用?Java SlickException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SlickException類屬於org.newdawn.slick包,在下文中一共展示了SlickException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: preRender

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.state.transition.Transition#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void preRender(StateBasedGame game, GameContainer container,
		Graphics g) throws SlickException {
	if (moveBackDone) {
		g.translate(xp1,yp1);
		g.scale(scale1, scale1);
		g.setClip((int) xp1,(int) yp1,(int) (scale1*container.getWidth()),(int) (scale1*container.getHeight()));
		prev.render(container, game, g);
		g.resetTransform();
		g.clearClip();
	}
	
	g.translate(xp2,yp2);
	g.scale(scale2, scale2);
	g.setClip((int) xp2,(int) yp2,(int) (scale2*container.getWidth()),(int) (scale2*container.getHeight()));
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:19,代碼來源:SelectTransition.java

示例2: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * This method inizializes map, images, animations and sounds 
 * @param container
 * @throws SlickException
 */

@Override
public void init(GameContainer container) throws SlickException {
    ready = new Image("data/ready.jpg");
    gameOver = new Image("data/gameover.png");
    youWin = new Image("data/youwin.png");
    
    mazeMap = new TiledMap("data/maze/Maze.tmx");
    initMapProperty();
    initAnimations();
    
    begin = new Sound("data/pacmanSound/begin.wav");
    begin.play();
    
    eatFruit = new Sound("data/pacmanSound/eatFruit.wav");
    pacmanGame.initMaze(mazeMap,this);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:23,代碼來源:MazeView.java

示例3: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	LoadingList.setDeferredLoading(true);
	
	new Sound("testdata/cbrown01.wav");
	new Sound("testdata/engine.wav");
	sound = new Sound("testdata/restart.ogg");
	new Music("testdata/testloop.ogg");
	music = new Music("testdata/SMB-X.XM");
	
	new Image("testdata/cursor.png");
	new Image("testdata/cursor.tga");
	new Image("testdata/cursor.png");
	new Image("testdata/cursor.png");
	new Image("testdata/dungeontiles.gif");
	new Image("testdata/logo.gif");
	image = new Image("testdata/logo.tga");
	new Image("testdata/logo.png");
	new Image("testdata/rocket.png");
	new Image("testdata/testpack.png");
	
	font = new AngelCodeFont("testdata/demo.fnt", "testdata/demo_00.tga");
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:26,代碼來源:DeferredLoadingTest.java

示例4: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.Game#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	awtFont = new java.awt.Font("Verdana", Font.PLAIN, 16);
	font = new TrueTypeFont(awtFont, false);

	for (int j = 0; j < 2; j++) {
		int lineLen = 90;
		for (int i = 0; i < text.length(); i += lineLen) {
			if (i + lineLen > text.length()) {
				lineLen = text.length() - i;
			}

			lines.add(text.substring(i, i + lineLen));
		}
		lines.add("");
	}
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:20,代碼來源:TrueTypeFontPerformanceTest.java

示例5: update

import org.newdawn.slick.SlickException; //導入依賴的package包/類
@Override
public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException {
	if(gameStart.inBounds(Globals.mouse.getPosition().x, Globals.mouse.getPosition().y)) {
		gameStart.mouseEnter();
		if(Globals.mouse.isMouseDown()) {
			Globals.resetEntityNum();
			Globals.resetInputs();
			game.enterState(GameState.ID, new FadeOutTransition(), new FadeInTransition()); 
		}
	} else gameStart.mouseExit();
	
	if(credits.inBounds(Globals.mouse.getPosition().x, Globals.mouse.getPosition().y)) credits.mouseEnter();
	else credits.mouseExit();
	
	if(exit.inBounds(Globals.mouse.getPosition().x, Globals.mouse.getPosition().y)) {
		exit.mouseEnter();
		if(Globals.mouse.isMouseDown()) gc.exit();
	}
	else exit.mouseExit();
	
	MusicPlayer.getInstance().update();
}
 
開發者ID:packetpirate,項目名稱:Generic-Zombie-Shooter-Redux,代碼行數:23,代碼來源:MenuState.java

示例6: render

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, Graphics g) throws SlickException {
	g.setColor(Color.gray);
	drawMarker(g, p1);
	drawMarker(g, p2);
	g.setColor(Color.red);
	drawMarker(g, c1);
	drawMarker(g, c2);
	
	g.setColor(Color.black);
	g.draw(curve);
	g.fill(curve);
	
	g.draw(poly);
	g.fill(poly);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:19,代碼來源:CurveTest.java

示例7: getWriterForFormat

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * Get a Slick image writer for the given format
 *  
 * @param format The format of the image to write
 * @return The image write to use to produce these images
 * @throws SlickException
 */
public static ImageWriter getWriterForFormat(String format) throws SlickException
{
	ImageWriter writer = (ImageWriter) writers.get(format);
	if (writer != null) {
		return writer;
	}
	
	writer = (ImageWriter) writers.get(format.toLowerCase());
	if (writer != null) {
		return writer;
	}
	
	writer = (ImageWriter) writers.get(format.toUpperCase());
	if (writer != null) {
		return writer;
	}
	
	throw new SlickException("No image writer available for: "+format);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:27,代碼來源:ImageWriterFactory.java

示例8: rotate

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * change texture of ghost current frame
 * according with rotation of the ghost
 * @throws SlickException 
 */
@Override
public void rotate(int value) throws SlickException {
               
    switch(value) {
        case 0:
            this.getImage(0).setTexture(textureData[6]);
            this.getImage(1).setTexture(textureData[7]);
            break;
        case 90:
            this.getImage(0).setTexture(textureData[2]);
            this.getImage(1).setTexture(textureData[3]);
            break;
        case 180:
            this.getImage(0).setTexture(textureData[4]);
            this.getImage(1).setTexture(textureData[5]);
            break;
        case 270:
            this.getImage(0).setTexture(textureData[0]);
            this.getImage(1).setTexture(textureData[1]);
            break;
    }
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:28,代碼來源:GhostAnimation.java

示例9: showPauseButton

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * Draw Pause button
 * @param gc	GameContainer
 * @param g	Graphics
 * @throws SlickException
 */
public static void showPauseButton(GameContainer gc, Graphics g) throws SlickException {
	pauseButton.draw(pauseButtonPosX, pauseButtonPosY, pauseButtonWidth, pauseButtonHeight);

	if (Controller.mouseInArea(pauseButtonPosX, pauseButtonPosY, pauseButtonPosX + pauseButtonHeight,
								pauseButtonPosY + pauseButtonHeight)) {
		pauseButton.draw(pauseButtonPosX, pauseButtonPosY, pauseButtonWidth, pauseButtonHeight, new Color(0, 0, 0, 50));

		if (Mouse.getEventButtonState() && Mouse.getEventButton() == 0) {
			gc.setPaused(!gc.isPaused());
			try {
				TimeUnit.MILLISECONDS.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
 
開發者ID:hungthuanmk,項目名稱:HCMIU_PlantsAndZombies,代碼行數:24,代碼來源:PlayUI.java

示例10: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;

	rect = new Rectangle(400,100,200,150);
	round = new RoundedRectangle(150,100,200,150,50);
	round2 = new RoundedRectangle(150,300,200,150,50);
	center = new Rectangle(350,250,100,100);
	
	poly = new Polygon();
	poly.addPoint(400,350);
	poly.addPoint(550,320);
	poly.addPoint(600,380);
	poly.addPoint(620,450);
	poly.addPoint(500,450);
	
	gradient = new GradientFill(0,-75,Color.red,0,75,Color.yellow,true);
	gradient2 = new GradientFill(0,-75,Color.blue,0,75,Color.white,true);
	gradient4 = new GradientFill(-50,-40,Color.green,50,40,Color.cyan,true);
}
 
開發者ID:j-dong,項目名稱:trashjam2017,代碼行數:23,代碼來源:GradientTest.java

示例11: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public final void init(GameContainer container) throws SlickException {
	this.container = container;
	initStatesList(container);
	
	Iterator gameStates = states.values().iterator();
	
	while (gameStates.hasNext()) {
		GameState state = (GameState) gameStates.next();
	
		state.init(container, this);
	}
	
	if (currentState != null) {
		currentState.enter(container, this);
	}
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:20,代碼來源:StateBasedGame.java

示例12: render

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, Graphics g) throws SlickException {
	g.scale(2,2);
	g.fillRect(0, 0, 800, 600, back, 0, 0);
	g.resetTransform();
	
	g.drawImage(image,100,100);
	image.draw(100,200,80,200);
	
	font.drawString(100,200,"Text Drawn before the callable");
	
	SlickCallable callable = new SlickCallable() {
		protected void performGLOperations() throws SlickException {
			renderGL();
		}
	};
	callable.call();
	
	homer.draw(450,250,80,200);
	font.drawString(150,300,"Text Drawn after the callable");
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:24,代碼來源:SlickCallableTest.java

示例13: addFont

import org.newdawn.slick.SlickException; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public void addFont(String key, String file, int size, boolean bold, boolean italic, Effect [] effects) throws SlickException {
	try {
		AssetManager.ASSETS_TO_LOAD++;
		
		UnicodeFont uni = new UnicodeFont(file, size, bold, italic);
		uni.addAsciiGlyphs();
		uni.addGlyphs(400, 600);
		uni.getEffects().add(new ColorEffect(Color.WHITE));
		uni.getEffects().addAll(Arrays.asList(effects));
		uni.loadGlyphs();
		if((fonts != null) && (uni != null)) {
			fonts.put(key, uni);
			
			AssetManager.ASSETS_LOADED++;
			System.out.println(String.format("Font Loaded: %s", key));
		}
	} catch(Exception ex) {
		ex.printStackTrace();
		System.out.printf("ERROR: Font \"%s\" could not be loaded!\n", file);
	}
}
 
開發者ID:packetpirate,項目名稱:Generic-Zombie-Shooter-Redux,代碼行數:23,代碼來源:AssetManager.java

示例14: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
	init = true;
	
	if (fbo) {
		fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
	}
	pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
	pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;
	
	if (!fbo && !pbuffer && !pbufferRT) {
		throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
	}
	
	Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:22,代碼來源:GraphicsFactory.java

示例15: init

import org.newdawn.slick.SlickException; //導入依賴的package包/類
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	sound = new Sound(ResourceLoader.getResource("testdata/restart.ogg"));
	charlie = new Sound(ResourceLoader.getResource("testdata/cbrown01.wav"));
	engine = new Sound(ResourceLoader.getResource("testdata/engine.wav"));
	//music = musica = new Music("testdata/SMB-X.XM");
	music = musica = new Music(ResourceLoader.getResource("testdata/restart.ogg"), false);
	musicb = new Music(ResourceLoader.getResource("testdata/kirby.ogg"), false);
	burp = new Sound(ResourceLoader.getResource("testdata/burp.aif"));
}
 
開發者ID:IngSW-unipv,項目名稱:Progetto-C,代碼行數:13,代碼來源:SoundURLTest.java


注:本文中的org.newdawn.slick.SlickException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。