Stretched Fixed Mode Plugin: Add Integer Scaling option (#2863)
Forces integer scale factor by rounding stretched dimensions towards zero.
This commit is contained in:
committed by
Tomas Slusny
parent
108f441f23
commit
d2871d925c
@@ -329,6 +329,8 @@ public interface Client extends GameEngine
|
||||
|
||||
void setStretchedFast(boolean state);
|
||||
|
||||
void setStretchedIntegerScaling(boolean state);
|
||||
|
||||
void setStretchedKeepAspectRatio(boolean state);
|
||||
|
||||
Dimension getStretchedDimensions();
|
||||
|
||||
@@ -55,4 +55,14 @@ public interface StretchedFixedModeConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "integerScaling",
|
||||
name = "Integer Scaling",
|
||||
description = "Forces use of a whole number scale factor"
|
||||
)
|
||||
default boolean integerScaling()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public class StretchedFixedModePlugin extends Plugin
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
client.setStretchedIntegerScaling(config.integerScaling());
|
||||
client.setStretchedKeepAspectRatio(config.keepAspectRatio());
|
||||
client.setStretchedFast(config.increasedPerformance());
|
||||
}
|
||||
|
||||
@@ -40,6 +40,9 @@ public abstract class StretchedFixedModeMixin implements RSClient
|
||||
@Inject
|
||||
private static boolean stretchedFast;
|
||||
|
||||
@Inject
|
||||
private static boolean stretchedIntegerScaling;
|
||||
|
||||
@Inject
|
||||
private static boolean stretchedKeepAspectRatio;
|
||||
|
||||
@@ -77,6 +80,14 @@ public abstract class StretchedFixedModeMixin implements RSClient
|
||||
stretchedFast = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setStretchedIntegerScaling(boolean state)
|
||||
{
|
||||
stretchedIntegerScaling = state;
|
||||
cachedStretchedDimensions = null;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setStretchedKeepAspectRatio(boolean state)
|
||||
@@ -122,6 +133,18 @@ public abstract class StretchedFixedModeMixin implements RSClient
|
||||
}
|
||||
}
|
||||
|
||||
if (stretchedIntegerScaling)
|
||||
{
|
||||
if (width > Constants.GAME_FIXED_WIDTH)
|
||||
{
|
||||
width = width - (width % Constants.GAME_FIXED_WIDTH);
|
||||
}
|
||||
if (height > Constants.GAME_FIXED_HEIGHT)
|
||||
{
|
||||
height = height - (height % Constants.GAME_FIXED_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
cachedStretchedDimensions = new Dimension(width, height);
|
||||
lastCanvasDimensions = new Dimension(width, height);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user