stretchedfixedmode: add resizable interface scaling

This commit is contained in:
Lotto
2018-10-21 17:56:22 +02:00
parent 2ba20c1859
commit 7cf3e3401a
13 changed files with 285 additions and 65 deletions

View File

@@ -1103,9 +1103,9 @@ public interface Client extends GameEngine
RenderOverview getRenderOverview();
/**
* Checked whether the client is in stretched mode.
* Checks whether the client is in stretched mode.
*
* @return true if the client is in stretched, false otherwise
* @return true if the client is in stretched mode, false otherwise
*/
boolean isStretchedEnabled();
@@ -1117,16 +1117,16 @@ public interface Client extends GameEngine
void setStretchedEnabled(boolean state);
/**
* Checks whether the client is using fast rendering techniques when
* stretching the client in fixed mode.
* Checks whether the client is using fast
* rendering techniques when stretching the canvas.
*
* @return true if client is fast rendering, false otherwise
* @return true if stretching is fast rendering, false otherwise
*/
boolean isStretchedFast();
/**
* Sets whether to use fast rendering techniques when in stretch
* fixed mode.
* Sets whether to use fast rendering techniques
* when stretching the canvas.
*
* @param state new fast rendering state
*/
@@ -1134,19 +1134,36 @@ public interface Client extends GameEngine
/**
* Sets whether to force integer scale factor by rounding scale
* factors towards {@code zero} when stretching fixed mode.
* factors towards {@code zero} when stretching.
*
* @param state new integer scaling state
*/
void setStretchedIntegerScaling(boolean state);
/**
* Sets whether to keep aspect ratio when stretching fixed mode.
* Sets whether to keep aspect ratio when stretching.
*
* @param state new keep aspect ratio state
*/
void setStretchedKeepAspectRatio(boolean state);
/**
* Sets the scaling factor when scaling resizable mode.
*
* @param factor new scaling factor
*/
void setScalingFactor(int factor);
/**
* Invalidates cached dimensions that are
* used for stretching and scaling.
*
* @param resize true to tell the game to
* resize the canvas on the next frame,
* false otherwise.
*/
void invalidateStretching(boolean resize);
/**
* Gets the current stretched dimensions of the client.
*

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api.events;
/**
* An event posted when the canvas size might have changed.
*/
public class CanvasSizeChanged
{
}

View File

@@ -29,13 +29,13 @@ package net.runelite.api.events;
import lombok.Data;
/**
* An event where the client window has been resized.
* An event where the game has changed from fixed to resizable mode or vice versa.
*/
@Data
public class ResizeableChanged
{
/**
* Whether the window is resized.
* Whether the game is in resizable mode.
*/
private boolean isResized;
}