change skin on the fly
This commit is contained in:
parent
7261793999
commit
f523328cb3
|
@ -376,6 +376,8 @@ public class Options {
|
||||||
@Override
|
@Override
|
||||||
public void clickListItem(int index) {
|
public void clickListItem(int index) {
|
||||||
skinName = skinDirs[index];
|
skinName = skinDirs[index];
|
||||||
|
loadSkin();
|
||||||
|
EventBus.instance.post(new ResolutionChangedEvent(DisplayContainer.instance.width, DisplayContainer.instance.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,6 +40,7 @@ import org.newdawn.slick.opengl.renderer.SGL;
|
||||||
import org.newdawn.slick.util.Log;
|
import org.newdawn.slick.util.Log;
|
||||||
import yugecin.opsudance.core.events.EventBus;
|
import yugecin.opsudance.core.events.EventBus;
|
||||||
import yugecin.opsudance.core.errorhandling.ErrorDumpable;
|
import yugecin.opsudance.core.errorhandling.ErrorDumpable;
|
||||||
|
import yugecin.opsudance.core.events.EventListener;
|
||||||
import yugecin.opsudance.core.inject.InstanceContainer;
|
import yugecin.opsudance.core.inject.InstanceContainer;
|
||||||
import yugecin.opsudance.core.state.OpsuState;
|
import yugecin.opsudance.core.state.OpsuState;
|
||||||
import yugecin.opsudance.core.state.specialstates.BarNotificationState;
|
import yugecin.opsudance.core.state.specialstates.BarNotificationState;
|
||||||
|
@ -141,6 +142,13 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
eventBus.subscribe(ResolutionChangedEvent.class, new EventListener<ResolutionChangedEvent>() {
|
||||||
|
@Override
|
||||||
|
public void onEvent(ResolutionChangedEvent event) {
|
||||||
|
destroyImages();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.nativeDisplayMode = Display.getDisplayMode();
|
this.nativeDisplayMode = Display.getDisplayMode();
|
||||||
setUPS(1000);
|
setUPS(1000);
|
||||||
setFPS(60);
|
setFPS(60);
|
||||||
|
@ -241,12 +249,16 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teardown() {
|
public void teardown() {
|
||||||
|
destroyImages();
|
||||||
|
CurveRenderState.shutdown();
|
||||||
|
Display.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroyImages() {
|
||||||
InternalTextureLoader.get().clear();
|
InternalTextureLoader.get().clear();
|
||||||
GameImage.destroyImages();
|
GameImage.destroyImages();
|
||||||
GameData.Grade.destroyImages();
|
GameData.Grade.destroyImages();
|
||||||
Beatmap.destroyBackgroundImageCache();
|
Beatmap.destroyBackgroundImageCache();
|
||||||
CurveRenderState.shutdown();
|
|
||||||
Display.destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void teardownAL() {
|
public void teardownAL() {
|
||||||
|
@ -321,11 +333,6 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGL() throws Exception {
|
private void initGL() throws Exception {
|
||||||
InternalTextureLoader.get().clear();
|
|
||||||
GameImage.destroyImages();
|
|
||||||
GameData.Grade.destroyImages();
|
|
||||||
Beatmap.destroyBackgroundImageCache();
|
|
||||||
|
|
||||||
GL.initDisplay(width, height);
|
GL.initDisplay(width, height);
|
||||||
GL.enterOrtho(width, height);
|
GL.enterOrtho(width, height);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user