Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove suspended power state #134

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/main/java/dynamic_fps/impl/DynamicFPSMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ private static boolean isDisabledInternal() {
return isDisabled || FREX.isFlawlessFramesActive();
}

private static boolean isPauseScreenOpened() {
return minecraft.screen instanceof PauseScreen;
}

private static boolean isLevelCoveredByScreen() {
return minecraft.screen != null && minecraft.screen.dynamic_fps$rendersBackground();
}
Expand Down Expand Up @@ -183,11 +179,7 @@ private static void checkForStateChanges() {
} else if (isForcingLowFPS) {
current = PowerState.UNFOCUSED;
} else if (window.isFocused()) {
if (!isPauseScreenOpened()) {
current = PowerState.FOCUSED;
} else {
current = PowerState.SUSPENDED;
}
current = PowerState.FOCUSED;
} else if (window.isHovered()) {
current = PowerState.HOVERED;
} else if (!window.isIconified()) {
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/dynamic_fps/impl/PowerState.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@ public enum PowerState {
/*
* Window minimized or otherwise hidden.
*/
INVISIBLE(true),

/*
* User is currently on the pause screen.
*/
SUSPENDED(false);
INVISIBLE(true);

public final boolean configurable;

Expand Down
1 change: 0 additions & 1 deletion src/main/java/dynamic_fps/impl/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public final class Config {
).apply(instance, Config::new));

public static final Config ACTIVE = new Config(-1, 1.0f, GraphicsState.DEFAULT, true, false);
public static final Config SUSPENDED = new Config(60, 1.0f, GraphicsState.DEFAULT, true, false);

public Config(int frameRateTarget, float volumeMultiplier, GraphicsState graphicsState, boolean showToasts, boolean runGarbageCollector) {
this.frameRateTarget = frameRateTarget;
Expand Down
14 changes: 4 additions & 10 deletions src/main/java/dynamic_fps/impl/config/DynamicFPSConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,10 @@ private DynamicFPSConfig(Map<PowerState, Config> configs) {
}

public Config get(PowerState state) {
switch (state) {
case FOCUSED: {
return Config.ACTIVE;
}
case SUSPENDED: {
return Config.SUSPENDED;
}
default: {
return configs.get(state);
}
if (state == PowerState.FOCUSED) {
return Config.ACTIVE;
} else {
return configs.get(state);
}
}

Expand Down