本文整理汇总了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()));
}
示例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);
}
示例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");
}
示例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("");
}
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
}
示例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();
}
}
}
}
示例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);
}
示例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);
}
}
示例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");
}
示例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);
}
}
示例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);
}
示例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"));
}