Added "Cursor Size" option.
Also moved "New Cursor" option into the "Input" category. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
81d9421d74
commit
0112a03bd3
|
@ -303,6 +303,20 @@ public class Options {
|
|||
screenshotFormatIndex = i;
|
||||
}
|
||||
},
|
||||
CURSOR_SIZE ("Cursor Size", "CursorSize", "Change the cursor scale.", 100, 50, 200) {
|
||||
@Override
|
||||
public String getValueString() { return String.format("%.2fx", val / 100f); }
|
||||
|
||||
@Override
|
||||
public String write() { return String.format(Locale.US, "%.2f", val / 100f); }
|
||||
|
||||
@Override
|
||||
public void read(String s) {
|
||||
int i = (int) (Float.parseFloat(s) * 100f);
|
||||
if (i >= 50 && i <= 200)
|
||||
val = i;
|
||||
}
|
||||
},
|
||||
NEW_CURSOR ("Enable New Cursor", "NewCursor", "Use the new cursor style (may cause higher CPU usage).", true) {
|
||||
@Override
|
||||
public void click(GameContainer container) {
|
||||
|
@ -832,6 +846,12 @@ public class Options {
|
|||
*/
|
||||
public static int getPort() { return port; }
|
||||
|
||||
/**
|
||||
* Returns the cursor scale.
|
||||
* @return the scale [0.5, 2]
|
||||
*/
|
||||
public static float getCursorScale() { return GameOption.CURSOR_SIZE.getIntegerValue() / 100f; }
|
||||
|
||||
/**
|
||||
* Returns whether or not the new cursor type is enabled.
|
||||
* @return true if enabled
|
||||
|
|
|
@ -57,7 +57,6 @@ public class OptionsMenu extends BasicGameState {
|
|||
GameOption.SHOW_FPS,
|
||||
GameOption.SHOW_UNICODE,
|
||||
GameOption.SCREENSHOT_FORMAT,
|
||||
GameOption.NEW_CURSOR,
|
||||
GameOption.DYNAMIC_BACKGROUND,
|
||||
GameOption.LOAD_HD_IMAGES,
|
||||
GameOption.LOAD_VERBOSE
|
||||
|
@ -85,7 +84,9 @@ public class OptionsMenu extends BasicGameState {
|
|||
GameOption.KEY_LEFT,
|
||||
GameOption.KEY_RIGHT,
|
||||
GameOption.DISABLE_MOUSE_WHEEL,
|
||||
GameOption.DISABLE_MOUSE_BUTTONS
|
||||
GameOption.DISABLE_MOUSE_BUTTONS,
|
||||
GameOption.CURSOR_SIZE,
|
||||
GameOption.NEW_CURSOR
|
||||
}),
|
||||
CUSTOM ("Custom", new GameOption[] {
|
||||
GameOption.FIXED_CS,
|
||||
|
|
|
@ -128,6 +128,17 @@ public class Cursor {
|
|||
int FPSmod = (Options.getTargetFPS() / 60);
|
||||
Skin skin = Options.getSkin();
|
||||
|
||||
// scale cursor
|
||||
float cursorScale = Options.getCursorScale();
|
||||
if (mousePressed && skin.isCursorExpanded())
|
||||
cursorScale *= 1.25f; // increase the cursor size if pressed
|
||||
if (cursorScale != 1f) {
|
||||
cursor = cursor.getScaledCopy(cursorScale);
|
||||
cursorTrail = cursorTrail.getScaledCopy(cursorScale);
|
||||
if (hasMiddle)
|
||||
cursorMiddle = cursorMiddle.getScaledCopy(cursorScale);
|
||||
}
|
||||
|
||||
// TODO: use an image buffer
|
||||
if (newStyle) {
|
||||
// new style: add all points between cursor movements
|
||||
|
@ -174,14 +185,6 @@ public class Cursor {
|
|||
}
|
||||
cursorTrail.drawCentered(mouseX, mouseY);
|
||||
|
||||
// increase the cursor size if pressed
|
||||
if (mousePressed && skin.isCursorExpanded()) {
|
||||
final float scale = 1.25f;
|
||||
cursor = cursor.getScaledCopy(scale);
|
||||
if (hasMiddle)
|
||||
cursorMiddle = cursorMiddle.getScaledCopy(scale);
|
||||
}
|
||||
|
||||
// draw the other components
|
||||
if (newStyle && skin.isCursorRotated())
|
||||
cursor.setRotation(cursorAngle);
|
||||
|
|
Loading…
Reference in New Issue
Block a user