Skip to content

Commit

Permalink
Another Optimization
Browse files Browse the repository at this point in the history
maybe it's a minor optimization i made, no for loop because textures are contained inside of loaded L2D at Live2DBackgrounds class
  • Loading branch information
WilloIzCitron committed Dec 27, 2024
1 parent a1639b3 commit ac82f85
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/bluearchive/ui/ArchivDBackground.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class ArchivDBackground implements Disposable {
private static float l2dImportProg;
static boolean cancel = false;
static final String version = "v1.5";
static TextureRegion frame= new TextureRegion();
static Image animBG = new Image(new TextureRegion());
static TextureRegion frame = new TextureRegion();
static Image animBG = new Image(frame);

public static void buildL2D(String name) {
// Nullable, can kill every mod with custom MenuRenderer
Expand All @@ -46,14 +46,7 @@ public static void buildL2D(String name) {
render.visible = false;

Events.on(EventType.ClientLoadEvent.class, e -> {
TextureRegion[] frames = new TextureRegion[l2dLoaded.loadedL2ds.size];
for(int i = 0; i < l2dLoaded.loadedL2ds.size; i++){
frames[i] = Core.atlas.addRegion("bluearchive-frame-"+l2dLoaded.name+"-"+(i), new TextureRegion(l2dLoaded.loadedL2ds.get(i)));
}
frame = frames[0];
Events.run(EventType.Trigger.update, () -> {
frame.set(frames[(int) (Time.globalTime / l2dLoaded.frameSpeed) % l2dLoaded.loadedL2ds.size]);
});
Events.run(EventType.Trigger.update, () -> frame.set(l2dLoaded.loadedL2ds.get((int) (Time.globalTime / l2dLoaded.frameSpeed) % l2dLoaded.loadedL2ds.size)));
animBG.setFillParent(true);
group.addChildAt(0, animBG);
Log.infoTag("ArchiveDustry", "Background Loaded!");
Expand Down Expand Up @@ -106,9 +99,6 @@ public static void downloadLive2D() {
});
}, e -> ui.showException(e));
}
private static void setRegion(Image img, TextureRegion reg) {
img.getRegion().set(reg);
}

private static void download(String furl, Fi dest, Floatc progressor, Boolp canceled, Runnable done) {
mainExecutor.submit(() -> {
Expand Down

0 comments on commit ac82f85

Please sign in to comment.