rename ResolutionChanged event to ResolutionOrSkinChanged
This commit is contained in:
parent
a489ee24d6
commit
7f1abb085f
|
@ -47,7 +47,6 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
import org.newdawn.slick.GameContainer;
|
|
||||||
import org.newdawn.slick.Input;
|
import org.newdawn.slick.Input;
|
||||||
import org.newdawn.slick.SlickException;
|
import org.newdawn.slick.SlickException;
|
||||||
import org.newdawn.slick.openal.SoundStore;
|
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.errorhandling.ErrorHandler;
|
||||||
import yugecin.opsudance.core.events.EventBus;
|
import yugecin.opsudance.core.events.EventBus;
|
||||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
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.ExgonMoverFactory;
|
||||||
import yugecin.opsudance.movers.factories.QuadraticBezierMoverFactory;
|
import yugecin.opsudance.movers.factories.QuadraticBezierMoverFactory;
|
||||||
import yugecin.opsudance.movers.slidermovers.DefaultSliderMoverController;
|
import yugecin.opsudance.movers.slidermovers.DefaultSliderMoverController;
|
||||||
|
@ -1873,7 +1872,7 @@ public class Options {
|
||||||
public static void reloadSkin() {
|
public static void reloadSkin() {
|
||||||
loadSkin();
|
loadSkin();
|
||||||
SoundController.init();
|
SoundController.init();
|
||||||
EventBus.instance.post(new ResolutionChangedEvent(DisplayContainer.instance.width, DisplayContainer.instance.height));
|
EventBus.instance.post(new ResolutionOrSkinChangedEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,7 +48,7 @@ import yugecin.opsudance.core.state.specialstates.BubbleNotificationState;
|
||||||
import yugecin.opsudance.core.state.specialstates.FpsRenderState;
|
import yugecin.opsudance.core.state.specialstates.FpsRenderState;
|
||||||
import yugecin.opsudance.core.state.transitions.*;
|
import yugecin.opsudance.core.state.transitions.*;
|
||||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||||
import yugecin.opsudance.events.ResolutionChangedEvent;
|
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
|
||||||
import yugecin.opsudance.utils.GLHelper;
|
import yugecin.opsudance.utils.GLHelper;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
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
|
@Override
|
||||||
public void onEvent(ResolutionChangedEvent event) {
|
public void onEvent(ResolutionOrSkinChangedEvent event) {
|
||||||
destroyImages();
|
destroyImages();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -349,7 +349,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
|
||||||
GameImage.init(width, height);
|
GameImage.init(width, height);
|
||||||
Fonts.init();
|
Fonts.init();
|
||||||
|
|
||||||
eventBus.post(new ResolutionChangedEvent(this.width, this.height));
|
eventBus.post(new ResolutionOrSkinChangedEvent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetCursor() {
|
public void resetCursor() {
|
||||||
|
|
|
@ -24,11 +24,11 @@ import org.newdawn.slick.Graphics;
|
||||||
import org.newdawn.slick.Input;
|
import org.newdawn.slick.Input;
|
||||||
import yugecin.opsudance.core.DisplayContainer;
|
import yugecin.opsudance.core.DisplayContainer;
|
||||||
import yugecin.opsudance.core.events.EventListener;
|
import yugecin.opsudance.core.events.EventListener;
|
||||||
import yugecin.opsudance.events.ResolutionChangedEvent;
|
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
public abstract class BaseOpsuState implements OpsuState, EventListener<ResolutionChangedEvent> {
|
public abstract class BaseOpsuState implements OpsuState, EventListener<ResolutionOrSkinChangedEvent> {
|
||||||
|
|
||||||
protected final DisplayContainer displayContainer;
|
protected final DisplayContainer displayContainer;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public abstract class BaseOpsuState implements OpsuState, EventListener<Resoluti
|
||||||
|
|
||||||
public BaseOpsuState(DisplayContainer displayContainer) {
|
public BaseOpsuState(DisplayContainer displayContainer) {
|
||||||
this.displayContainer = displayContainer;
|
this.displayContainer = displayContainer;
|
||||||
displayContainer.eventBus.subscribe(ResolutionChangedEvent.class, this);
|
displayContainer.eventBus.subscribe(ResolutionOrSkinChangedEvent.class, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void revalidate() {
|
protected void revalidate() {
|
||||||
|
@ -59,7 +59,7 @@ public abstract class BaseOpsuState implements OpsuState, EventListener<Resoluti
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(ResolutionChangedEvent event) {
|
public void onEvent(ResolutionOrSkinChangedEvent event) {
|
||||||
if (isCurrentState) {
|
if (isCurrentState) {
|
||||||
revalidate();
|
revalidate();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import yugecin.opsudance.core.DisplayContainer;
|
||||||
import yugecin.opsudance.core.events.EventBus;
|
import yugecin.opsudance.core.events.EventBus;
|
||||||
import yugecin.opsudance.core.events.EventListener;
|
import yugecin.opsudance.core.events.EventListener;
|
||||||
import yugecin.opsudance.events.BarNotificationEvent;
|
import yugecin.opsudance.events.BarNotificationEvent;
|
||||||
import yugecin.opsudance.events.ResolutionChangedEvent;
|
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ public class BarNotificationState implements EventListener<BarNotificationEvent>
|
||||||
this.textCol = new Color(Color.white);
|
this.textCol = new Color(Color.white);
|
||||||
this.timeShown = TOTAL_TIME;
|
this.timeShown = TOTAL_TIME;
|
||||||
eventBus.subscribe(BarNotificationEvent.class, this);
|
eventBus.subscribe(BarNotificationEvent.class, this);
|
||||||
eventBus.subscribe(ResolutionChangedEvent.class, new EventListener<ResolutionChangedEvent>() {
|
eventBus.subscribe(ResolutionOrSkinChangedEvent.class, new EventListener<ResolutionOrSkinChangedEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(ResolutionChangedEvent event) {
|
public void onEvent(ResolutionOrSkinChangedEvent event) {
|
||||||
if (timeShown >= TOTAL_TIME) {
|
if (timeShown >= TOTAL_TIME) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import yugecin.opsudance.core.DisplayContainer;
|
||||||
import yugecin.opsudance.core.events.EventBus;
|
import yugecin.opsudance.core.events.EventBus;
|
||||||
import yugecin.opsudance.core.events.EventListener;
|
import yugecin.opsudance.core.events.EventListener;
|
||||||
import yugecin.opsudance.events.BubbleNotificationEvent;
|
import yugecin.opsudance.events.BubbleNotificationEvent;
|
||||||
import yugecin.opsudance.events.ResolutionChangedEvent;
|
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -49,9 +49,9 @@ public class BubbleNotificationState implements EventListener<BubbleNotification
|
||||||
this.bubbles = new LinkedList<>();
|
this.bubbles = new LinkedList<>();
|
||||||
this.addAnimationTime = IN_TIME;
|
this.addAnimationTime = IN_TIME;
|
||||||
eventBus.subscribe(BubbleNotificationEvent.class, this);
|
eventBus.subscribe(BubbleNotificationEvent.class, this);
|
||||||
eventBus.subscribe(ResolutionChangedEvent.class, new EventListener<ResolutionChangedEvent>() {
|
eventBus.subscribe(ResolutionOrSkinChangedEvent.class, new EventListener<ResolutionOrSkinChangedEvent>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(ResolutionChangedEvent event) {
|
public void onEvent(ResolutionOrSkinChangedEvent event) {
|
||||||
calculatePositions();
|
calculatePositions();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,9 +22,9 @@ import org.newdawn.slick.Color;
|
||||||
import org.newdawn.slick.Graphics;
|
import org.newdawn.slick.Graphics;
|
||||||
import yugecin.opsudance.core.DisplayContainer;
|
import yugecin.opsudance.core.DisplayContainer;
|
||||||
import yugecin.opsudance.core.events.EventListener;
|
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;
|
private final DisplayContainer displayContainer;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class FpsRenderState implements EventListener<ResolutionChangedEvent> {
|
||||||
|
|
||||||
public FpsRenderState(DisplayContainer displayContainer) {
|
public FpsRenderState(DisplayContainer displayContainer) {
|
||||||
this.displayContainer = displayContainer;
|
this.displayContainer = displayContainer;
|
||||||
displayContainer.eventBus.subscribe(ResolutionChangedEvent.class, this);
|
displayContainer.eventBus.subscribe(ResolutionOrSkinChangedEvent.class, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Graphics g) {
|
public void render(Graphics g) {
|
||||||
|
@ -70,10 +70,10 @@ public class FpsRenderState implements EventListener<ResolutionChangedEvent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(ResolutionChangedEvent event) {
|
public void onEvent(ResolutionOrSkinChangedEvent event) {
|
||||||
singleHeight = Fonts.SMALL.getLineHeight();
|
singleHeight = Fonts.SMALL.getLineHeight();
|
||||||
x = event.width - 3;
|
x = displayContainer.width - 3;
|
||||||
y = event.height - 3 - singleHeight - 10;
|
y = displayContainer.height - 3 - singleHeight - 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,6 @@
|
||||||
*/
|
*/
|
||||||
package yugecin.opsudance.events;
|
package yugecin.opsudance.events;
|
||||||
|
|
||||||
public class ResolutionChangedEvent {
|
public class ResolutionOrSkinChangedEvent {
|
||||||
|
|
||||||
public final int width;
|
|
||||||
public final int height;
|
|
||||||
|
|
||||||
public ResolutionChangedEvent(int width, int height) {
|
|
||||||
this.width = width;
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user