rename ResolutionChanged event to ResolutionOrSkinChanged

This commit is contained in:
yugecin 2017-01-21 15:30:07 +01:00
parent a489ee24d6
commit 7f1abb085f
7 changed files with 23 additions and 32 deletions

View File

@ -47,7 +47,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.openal.SoundStore;
@ -64,7 +63,7 @@ import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.errorhandling.ErrorHandler;
import yugecin.opsudance.core.events.EventBus;
import yugecin.opsudance.events.BubbleNotificationEvent;
import yugecin.opsudance.events.ResolutionChangedEvent;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
import yugecin.opsudance.movers.factories.ExgonMoverFactory;
import yugecin.opsudance.movers.factories.QuadraticBezierMoverFactory;
import yugecin.opsudance.movers.slidermovers.DefaultSliderMoverController;
@ -1873,7 +1872,7 @@ public class Options {
public static void reloadSkin() {
loadSkin();
SoundController.init();
EventBus.instance.post(new ResolutionChangedEvent(DisplayContainer.instance.width, DisplayContainer.instance.height));
EventBus.instance.post(new ResolutionOrSkinChangedEvent());
}
/**

View File

@ -48,7 +48,7 @@ import yugecin.opsudance.core.state.specialstates.BubbleNotificationState;
import yugecin.opsudance.core.state.specialstates.FpsRenderState;
import yugecin.opsudance.core.state.transitions.*;
import yugecin.opsudance.events.BubbleNotificationEvent;
import yugecin.opsudance.events.ResolutionChangedEvent;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
import yugecin.opsudance.utils.GLHelper;
import java.io.StringWriter;
@ -142,9 +142,9 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
}
};
eventBus.subscribe(ResolutionChangedEvent.class, new EventListener<ResolutionChangedEvent>() {
eventBus.subscribe(ResolutionOrSkinChangedEvent.class, new EventListener<ResolutionOrSkinChangedEvent>() {
@Override
public void onEvent(ResolutionChangedEvent event) {
public void onEvent(ResolutionOrSkinChangedEvent event) {
destroyImages();
}
});
@ -349,7 +349,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
GameImage.init(width, height);
Fonts.init();
eventBus.post(new ResolutionChangedEvent(this.width, this.height));
eventBus.post(new ResolutionOrSkinChangedEvent());
}
public void resetCursor() {

View File

@ -24,11 +24,11 @@ import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.events.EventListener;
import yugecin.opsudance.events.ResolutionChangedEvent;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
import java.io.StringWriter;
public abstract class BaseOpsuState implements OpsuState, EventListener<ResolutionChangedEvent> {
public abstract class BaseOpsuState implements OpsuState, EventListener<ResolutionOrSkinChangedEvent> {
protected final DisplayContainer displayContainer;
@ -40,7 +40,7 @@ public abstract class BaseOpsuState implements OpsuState, EventListener<Resoluti
public BaseOpsuState(DisplayContainer displayContainer) {
this.displayContainer = displayContainer;
displayContainer.eventBus.subscribe(ResolutionChangedEvent.class, this);
displayContainer.eventBus.subscribe(ResolutionOrSkinChangedEvent.class, this);
}
protected void revalidate() {
@ -59,7 +59,7 @@ public abstract class BaseOpsuState implements OpsuState, EventListener<Resoluti
}
@Override
public void onEvent(ResolutionChangedEvent event) {
public void onEvent(ResolutionOrSkinChangedEvent event) {
if (isCurrentState) {
revalidate();
return;

View File

@ -25,7 +25,7 @@ import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.events.EventBus;
import yugecin.opsudance.core.events.EventListener;
import yugecin.opsudance.events.BarNotificationEvent;
import yugecin.opsudance.events.ResolutionChangedEvent;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
import java.util.List;
@ -55,9 +55,9 @@ public class BarNotificationState implements EventListener<BarNotificationEvent>
this.textCol = new Color(Color.white);
this.timeShown = TOTAL_TIME;
eventBus.subscribe(BarNotificationEvent.class, this);
eventBus.subscribe(ResolutionChangedEvent.class, new EventListener<ResolutionChangedEvent>() {
eventBus.subscribe(ResolutionOrSkinChangedEvent.class, new EventListener<ResolutionOrSkinChangedEvent>() {
@Override
public void onEvent(ResolutionChangedEvent event) {
public void onEvent(ResolutionOrSkinChangedEvent event) {
if (timeShown >= TOTAL_TIME) {
return;
}

View File

@ -25,7 +25,7 @@ import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.events.EventBus;
import yugecin.opsudance.core.events.EventListener;
import yugecin.opsudance.events.BubbleNotificationEvent;
import yugecin.opsudance.events.ResolutionChangedEvent;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
import java.util.LinkedList;
import java.util.List;
@ -49,9 +49,9 @@ public class BubbleNotificationState implements EventListener<BubbleNotification
this.bubbles = new LinkedList<>();
this.addAnimationTime = IN_TIME;
eventBus.subscribe(BubbleNotificationEvent.class, this);
eventBus.subscribe(ResolutionChangedEvent.class, new EventListener<ResolutionChangedEvent>() {
eventBus.subscribe(ResolutionOrSkinChangedEvent.class, new EventListener<ResolutionOrSkinChangedEvent>() {
@Override
public void onEvent(ResolutionChangedEvent event) {
public void onEvent(ResolutionOrSkinChangedEvent event) {
calculatePositions();
}
});

View File

@ -22,9 +22,9 @@ import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.core.events.EventListener;
import yugecin.opsudance.events.ResolutionChangedEvent;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
public class FpsRenderState implements EventListener<ResolutionChangedEvent> {
public class FpsRenderState implements EventListener<ResolutionOrSkinChangedEvent> {
private final DisplayContainer displayContainer;
@ -38,7 +38,7 @@ public class FpsRenderState implements EventListener<ResolutionChangedEvent> {
public FpsRenderState(DisplayContainer displayContainer) {
this.displayContainer = displayContainer;
displayContainer.eventBus.subscribe(ResolutionChangedEvent.class, this);
displayContainer.eventBus.subscribe(ResolutionOrSkinChangedEvent.class, this);
}
public void render(Graphics g) {
@ -70,10 +70,10 @@ public class FpsRenderState implements EventListener<ResolutionChangedEvent> {
}
@Override
public void onEvent(ResolutionChangedEvent event) {
public void onEvent(ResolutionOrSkinChangedEvent event) {
singleHeight = Fonts.SMALL.getLineHeight();
x = event.width - 3;
y = event.height - 3 - singleHeight - 10;
x = displayContainer.width - 3;
y = displayContainer.height - 3 - singleHeight - 10;
}
}

View File

@ -17,14 +17,6 @@
*/
package yugecin.opsudance.events;
public class ResolutionChangedEvent {
public final int width;
public final int height;
public ResolutionChangedEvent(int width, int height) {
this.width = width;
this.height = height;
}
public class ResolutionOrSkinChangedEvent {
}