-
Notifications
You must be signed in to change notification settings - Fork 122
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" : | ||
(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" : | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (same as above) There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
(targetFPS[i] == 60) ? "%dfps (vsync)" : "%dfps", targetFPS[i]); | ||
} | ||
return itemList; | ||
} | ||
|
@@ -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; | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment:
|
||
GameOption.TARGET_FPS.selectItem(index, container); | ||
UI.getNotificationManager().sendBarNotification(String.format("Frame limiter: %s", GameOption.TARGET_FPS.getValueString())); | ||
} | ||
|
There was a problem hiding this comment.
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 ofString.format()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted.