moving stuff around
This commit is contained in:
parent
e8cac712fc
commit
9c0eaca4ee
|
@ -32,7 +32,6 @@ public class OpsuDance {
|
|||
|
||||
public void start() {
|
||||
try {
|
||||
container.setIcons(new String[] { "icon16.png", "icon32.png" });
|
||||
container.run();
|
||||
} catch (LWJGLException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -24,18 +24,13 @@ import org.lwjgl.openal.AL;
|
|||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.DisplayMode;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.opengl.ImageIOImageData;
|
||||
import org.newdawn.slick.opengl.InternalTextureLoader;
|
||||
import org.newdawn.slick.opengl.LoadableImageData;
|
||||
import org.newdawn.slick.opengl.TGAImageData;
|
||||
import org.newdawn.slick.opengl.renderer.Renderer;
|
||||
import org.newdawn.slick.opengl.renderer.SGL;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import org.newdawn.slick.util.ResourceLoader;
|
||||
import yugecin.opsudance.states.EmptyRedState;
|
||||
import yugecin.opsudance.utils.GLHelper;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -97,6 +92,7 @@ public class DisplayContainer {
|
|||
// temp displaymode to not flash the screen with a 1ms black window
|
||||
Display.setDisplayMode(new DisplayMode(100, 100));
|
||||
Display.create();
|
||||
GLHelper.setIcons(new String[] { "icon16.png", "icon32.png" });
|
||||
setDisplayMode(640, 480, false);
|
||||
} catch (LWJGLException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -181,29 +177,4 @@ public class DisplayContainer {
|
|||
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
|
||||
}
|
||||
|
||||
public void setIcons(String[] refs) {
|
||||
ByteBuffer[] bufs = new ByteBuffer[refs.length];
|
||||
|
||||
for (int i = 0; i < refs.length; i++) {
|
||||
LoadableImageData data;
|
||||
boolean flip = true;
|
||||
|
||||
if (refs[i].endsWith(".tga")) {
|
||||
data = new TGAImageData();
|
||||
} else {
|
||||
flip = false;
|
||||
data = new ImageIOImageData();
|
||||
}
|
||||
|
||||
try {
|
||||
bufs[i] = data.loadImage(ResourceLoader.getResourceAsStream(refs[i]), flip, false, null);
|
||||
} catch (Exception e) {
|
||||
Log.error("failed to set the icon", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Display.setIcon(bufs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,13 @@ package yugecin.opsudance.utils;
|
|||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.DisplayMode;
|
||||
import org.newdawn.slick.opengl.ImageIOImageData;
|
||||
import org.newdawn.slick.opengl.LoadableImageData;
|
||||
import org.newdawn.slick.opengl.TGAImageData;
|
||||
import org.newdawn.slick.util.Log;
|
||||
import org.newdawn.slick.util.ResourceLoader;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class GLHelper {
|
||||
|
||||
|
@ -50,4 +57,32 @@ public class GLHelper {
|
|||
return foundMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* from org.newdawn.slick.AppGameContainer#setDisplayMode
|
||||
*/
|
||||
public static void setIcons(String[] refs) {
|
||||
ByteBuffer[] bufs = new ByteBuffer[refs.length];
|
||||
|
||||
for (int i = 0; i < refs.length; i++) {
|
||||
LoadableImageData data;
|
||||
boolean flip = true;
|
||||
|
||||
if (refs[i].endsWith(".tga")) {
|
||||
data = new TGAImageData();
|
||||
} else {
|
||||
flip = false;
|
||||
data = new ImageIOImageData();
|
||||
}
|
||||
|
||||
try {
|
||||
bufs[i] = data.loadImage(ResourceLoader.getResourceAsStream(refs[i]), flip, false, null);
|
||||
} catch (Exception e) {
|
||||
Log.error("failed to set the icon", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Display.setIcon(bufs);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user