Fixed scroll override bug

This commit is contained in:
Willem 2022-02-05 00:21:55 +01:00
parent 1efc29b370
commit bc02b51d7d
4 changed files with 26 additions and 15 deletions

View file

@ -11,7 +11,7 @@ import love.distributedrebirth.gdxapp.Demo4DMain;
import love.distributedrebirth.gdxapp.Demo4DMainAdapter;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
abstract public class ScrollScreenAdapter extends Demo4DMainAdapter {
abstract public class AbstractScrollScreen extends Demo4DMainAdapter {
private static final int LINE_HEIGHT = 16;
private float scrollDeltaTime = 0f;
private String scrollText = "";
@ -19,7 +19,7 @@ abstract public class ScrollScreenAdapter extends Demo4DMainAdapter {
private int scrollLine = LINE_HEIGHT;
private final Texture backgroundImage;
public ScrollScreenAdapter(final Demo4DMain main, String background) {
public AbstractScrollScreen(final Demo4DMain main, String background) {
super(main);
backgroundImage = new Texture(Gdx.files.internal(background));
}
@ -64,19 +64,30 @@ abstract public class ScrollScreenAdapter extends Demo4DMainAdapter {
}
@Override
public void hide() {
public final void show() {
showScroll();
}
protected void showScroll() {
}
@Override
public final void hide() {
scrollText = "";
scrollIndex = 0;
scrollLine = LINE_HEIGHT;
hideScroll();
}
protected void hideScroll() {
}
@Override
public final void dispose() {
backgroundImage.dispose();
disposeScreen(main);
disposeScroll();
}
protected void disposeScreen(Demo4DMain main) {
// override if needed
protected void disposeScroll() {
}
}

View file

@ -7,7 +7,7 @@ import love.distributedrebirth.gdxapp.Demo4DMain;
import love.distributedrebirth.gdxapp.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenCredits extends ScrollScreenAdapter {
public class ScreenCredits extends AbstractScrollScreen {
private final String creditsText = String.join("\n",
"Credits;",
"At-Ohm-Allah-to-the-power-of-Four",
@ -78,12 +78,12 @@ public class ScreenCredits extends ScrollScreenAdapter {
}
@Override
public void show () {
public void showScroll() {
main.music.play(MusicSongType.CREDITS);
}
@Override
public void hide () {
public void hideScroll() {
main.music.play(MusicSongType.BACKGROUND);
}
}

View file

@ -7,7 +7,7 @@ import love.distributedrebirth.gdxapp.Demo4DMain;
import love.distributedrebirth.gdxapp.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenHelp extends ScrollScreenAdapter {
public class ScreenHelp extends AbstractScrollScreen {
private final String creditsText = String.join("\n",
"Genesis 11",
" ",
@ -61,12 +61,12 @@ public class ScreenHelp extends ScrollScreenAdapter {
}
@Override
public void show () {
public void showScroll() {
main.music.play(MusicSongType.INTRO);
}
@Override
public void hide () {
public void hideScroll() {
main.music.play(MusicSongType.BACKGROUND);
}
}

View file

@ -7,7 +7,7 @@ import love.distributedrebirth.gdxapp.Demo4DMain;
import love.distributedrebirth.gdxapp.music.MusicSongType;
@BãßBȍőnAuthorInfoʸᴰ(name = "willemtsade", copyright = "©Δ∞ 仙上主天")
public class ScreenIntroMission extends ScrollScreenAdapter {
public class ScreenIntroMission extends AbstractScrollScreen {
private final String missionText = String.join("\n",
"To a Waterfowl",
" -- by William Cullen Bryant --",
@ -71,7 +71,7 @@ public class ScreenIntroMission extends ScrollScreenAdapter {
}
@Override
public void hide () {
public void hideScroll() {
main.music.play(MusicSongType.BACKGROUND);
}
}