本文整理汇总了Java中org.newdawn.slick.loading.LoadingList类的典型用法代码示例。如果您正苦于以下问题:Java LoadingList类的具体用法?Java LoadingList怎么用?Java LoadingList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoadingList类属于org.newdawn.slick.loading包,在下文中一共展示了LoadingList类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.newdawn.slick.loading.LoadingList; //导入依赖的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");
}
示例2: render
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) {
if (nextResource != null) {
g.drawString("Loading: "+nextResource.getDescription(), 100, 100);
}
int total = LoadingList.get().getTotalResources();
int loaded = LoadingList.get().getTotalResources() - LoadingList.get().getRemainingResources();
float bar = loaded / (float) total;
g.fillRect(100,150,loaded*40,20);
g.drawRect(100,150,total*40,20);
if (started) {
image.draw(100,200);
font.drawString(100,500,"LOADING COMPLETE");
}
}
示例3: init
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
ConfigsManager.getInstance().applicateConfigs();
LoadingList.setDeferredLoading(true);
DatasManager.getInstance().addFile("LivingEntity.name", new TrueTypeFont(new Font("Verdana", Font.BOLD, 12), true));
DatasManager.getInstance().addFile("TextEffect.damages", new TrueTypeFont(new Font("Verdana", Font.BOLD, 12), true));
DatasManager.getInstance().addFile("TextEffect.status", new TrueTypeFont(new Font("Verdana", Font.BOLD, 14), true));
DatasManager.getInstance().addFile("MouseCursor.default", new Image("res/images/cursors/default.png"));
DatasManager.getInstance().addMap("test.tmx");
try {
ResourcesManager.getInstance().loadResources();
} catch (Exception e) {
throw new SlickException(e.getMessage());
}
super.init(container, game);
}
示例4: update
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
super.update(container, game, delta);
if (mResource != null) {
try {
mResource.load();
} catch (IOException e) {
throw new SlickException("Failed to load: " + mResource.getDescription(), e);
}
mResource = null;
}
mRemaining = LoadingList.get().getRemainingResources();
mTotal = LoadingList.get().getTotalResources();
if (LoadingList.get().getRemainingResources() > 0) {
mResource = LoadingList.get().getNext();
} else {
((Music)DatasManager.getInstance().getFile("Music.menu")).loop();
game.enterState(1, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
}
示例5: DeferredTexture
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
/**
* Create a new deferred texture
*
* @param in The input stream from which to read the texture
* @param resourceName The name to give the resource
* @param flipped True if the image should be flipped
* @param filter The filter to apply
* @param trans The colour to defined as transparent
*/
public DeferredTexture(InputStream in, String resourceName, boolean flipped, int filter, int[] trans) {
this.in = in;
this.resourceName = resourceName;
this.flipped = flipped;
this.filter = filter;
this.trans = trans;
LoadingList.get().add(this);
}
示例6: checkTarget
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
/**
* Check if the target has been obtained already
*/
private void checkTarget() {
if (target == null) {
try {
load();
LoadingList.get().remove(this);
return;
} catch (IOException e) {
throw new RuntimeException("Attempt to use deferred texture before loading and resource not found: "+resourceName);
}
}
}
示例7: DeferredSound
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
/**
* Create a new sound on request to load
*
* @param ref The location of the sound to load
* @param type The type of sound to load
* @param in The input stream to load from
*/
public DeferredSound(String ref, InputStream in, int type) {
this.ref = ref;
this.type = type;
// nasty hack to detect when we're loading from a stream
if (ref.equals(in.toString())) {
this.in = in;
}
LoadingList.get().add(this);
}
示例8: DeferredTexture
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
/**
* Create a new deferred texture
*
* @param in The input stream from which to read the texture
* @param resourceName The name to give the resource
* @param flipped True if the image should be flipped
* @param filter The filter to apply
* @param trans The colour to defined as transparent
*/
public DeferredTexture(InputStream in, String resourceName, boolean flipped, int filter, @Nullable int[] trans) {
this.in = in;
this.resourceName = resourceName;
this.flipped = flipped;
this.filter = filter;
this.trans = trans;
LoadingList.get().add(this);
}
示例9: checkTarget
import org.newdawn.slick.loading.LoadingList; //导入依赖的package包/类
/**
* Check if the target has been obtained already
*/
private void checkTarget() {
if (target == null) {
try {
load();
LoadingList.get().remove(this);
} catch (IOException e) {
throw new RuntimeException("Attempt to use deferred texture before loading and resource not found: "+resourceName);
}
}
}