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

Add option "Unlimited" on frame limiter #324

Closed
wants to merge 4 commits into from
Closed
Changes from 2 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: 6 additions & 4 deletions src/itdelatrisu/opsu/options/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,17 @@ public void selectItem(int index, GameContainer container) {

@Override
public String getValueString() {
return String.format((getTargetFPS() == 60) ? "%dfps (vsync)" : "%dfps", getTargetFPS());
return String.format((getTargetFPS() == -1) ? "Unlimited" :
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take (getTargetFPS() == -1) ? "Unlimited" : out of String.format().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted.

(getTargetFPS() == 60) ? "%dfps (vsync)" : "%dfps", getTargetFPS());
}

@Override
public Object[] getItemList() {
if (itemList == null) {
itemList = new String[targetFPS.length];
for (int i = 0; i < targetFPS.length; i++)
itemList[i] = String.format((targetFPS[i] == 60) ? "%dfps (vsync)" : "%dfps", targetFPS[i]);
itemList[i] = String.format((targetFPS[i] == -1) ? "Unlimited" :
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(same as above)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, what?

The shortcut function to "Unlimited" has already been removed. Removing this would result in the option "Unlimited" being not displayed on the option's dropdown list, but available via modifying the configuration file's FrameSync parameter to -1.

(targetFPS[i] == 60) ? "%dfps (vsync)" : "%dfps", targetFPS[i]);
}
return itemList;
}
Expand Down Expand Up @@ -954,7 +956,7 @@ public boolean hasFullscreenDisplayMode() {
private static Skin skin;

/** Frame limiters. */
private static final int[] targetFPS = { 60, 120, 240 };
private static final int[] targetFPS = { 60, 120, 240, -1 };

/** Index in targetFPS[] array. */
private static int targetFPSindex = 0;
Expand Down Expand Up @@ -985,7 +987,7 @@ private Options() {}
* @param container the game container
*/
public static void setNextFPS(GameContainer container) {
int index = (targetFPSindex + 1) % targetFPS.length;
int index = (targetFPSindex + 1) % (targetFPS.length - 1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment:

int index = (targetFPSindex + 1) % (targetFPS.length - 1);  // Skip "Unlimited" option

GameOption.TARGET_FPS.selectItem(index, container);
UI.getNotificationManager().sendBarNotification(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString()));
}
Expand Down