Compare commits
	
		
			2 commits
		
	
	
		
			master
			...
			integer_sc
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| bfe889f00a | |||
| 
							 | 
						fb16c8e6d0 | 
					 7 changed files with 237 additions and 10 deletions
				
			
		| 
						 | 
					@ -203,6 +203,9 @@ DEF_GRA_PROP_B(Fullscreen)
 | 
				
			||||||
DEF_GRA_PROP_B(ShowCursor)
 | 
					DEF_GRA_PROP_B(ShowCursor)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEF_GRA_PROP_B(FixedAspectRatio)
 | 
					DEF_GRA_PROP_B(FixedAspectRatio)
 | 
				
			||||||
 | 
					DEF_GRA_PROP_B(SmoothScaling)
 | 
				
			||||||
 | 
					DEF_GRA_PROP_B(IntegerScaling)
 | 
				
			||||||
 | 
					DEF_GRA_PROP_B(LastMileScaling)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define INIT_GRA_PROP_BIND(PropName, prop_name_s) \
 | 
					#define INIT_GRA_PROP_BIND(PropName, prop_name_s) \
 | 
				
			||||||
{ \
 | 
					{ \
 | 
				
			||||||
| 
						 | 
					@ -225,6 +228,9 @@ void graphicsBindingInit()
 | 
				
			||||||
	INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
 | 
						INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	INIT_GRA_PROP_BIND( FixedAspectRatio, "fixed_aspect_ratio" );
 | 
						INIT_GRA_PROP_BIND( FixedAspectRatio, "fixed_aspect_ratio" );
 | 
				
			||||||
 | 
						INIT_GRA_PROP_BIND( SmoothScaling, "smooth_scaling" );
 | 
				
			||||||
 | 
						INIT_GRA_PROP_BIND( IntegerScaling, "integer_scaling" );
 | 
				
			||||||
 | 
						INIT_GRA_PROP_BIND( LastMileScaling, "last_mile_scaling" );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (rgssVer >= 2)
 | 
						if (rgssVer >= 2)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,6 +150,30 @@
 | 
				
			||||||
# maxTextureSize=0
 | 
					# maxTextureSize=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Scale up the game screen by an integer amount,
 | 
				
			||||||
 | 
					# as large as the current window size allows, before
 | 
				
			||||||
 | 
					# doing any last additional scalings to fill part or
 | 
				
			||||||
 | 
					# all of the remaining window space (or none at all
 | 
				
			||||||
 | 
					# if lastMileScaling is disabled).
 | 
				
			||||||
 | 
					# If fixedAspectRatio is disabled, the integer scale
 | 
				
			||||||
 | 
					# factors in horizontal and vertical direction can differ
 | 
				
			||||||
 | 
					# depending on how much space is available, otherwise
 | 
				
			||||||
 | 
					# they are forced to the smaller of the two.
 | 
				
			||||||
 | 
					# (default: disabled)
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# integerScaling.active = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# When integer scaling is enabled, this option controls
 | 
				
			||||||
 | 
					# whether the scaled game screen is further scaled
 | 
				
			||||||
 | 
					# (with linear interpolation when smoothScaling is enabled)
 | 
				
			||||||
 | 
					# to fill the rest of the game window.
 | 
				
			||||||
 | 
					# Note that this option still respects fixedAspectRatio.
 | 
				
			||||||
 | 
					# (default: enabled)
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# integerScaling.lastMileScaling = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set the base path of the game to '/path/to/game'
 | 
					# Set the base path of the game to '/path/to/game'
 | 
				
			||||||
# (default: executable directory)
 | 
					# (default: executable directory)
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -170,6 +170,8 @@ void Config::read(int argc, char *argv[])
 | 
				
			||||||
	PO_DESC(subImageFix, bool, false) \
 | 
						PO_DESC(subImageFix, bool, false) \
 | 
				
			||||||
	PO_DESC(enableBlitting, bool, true) \
 | 
						PO_DESC(enableBlitting, bool, true) \
 | 
				
			||||||
	PO_DESC(maxTextureSize, int, 0) \
 | 
						PO_DESC(maxTextureSize, int, 0) \
 | 
				
			||||||
 | 
						PO_DESC(integerScaling.active, bool, false) \
 | 
				
			||||||
 | 
						PO_DESC(integerScaling.lastMileScaling, bool, true) \
 | 
				
			||||||
	PO_DESC(gameFolder, std::string, ".") \
 | 
						PO_DESC(gameFolder, std::string, ".") \
 | 
				
			||||||
	PO_DESC(anyAltToggleFS, bool, false) \
 | 
						PO_DESC(anyAltToggleFS, bool, false) \
 | 
				
			||||||
	PO_DESC(enableReset, bool, true) \
 | 
						PO_DESC(enableReset, bool, true) \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,6 +59,12 @@ struct Config
 | 
				
			||||||
	bool enableBlitting;
 | 
						bool enableBlitting;
 | 
				
			||||||
	int maxTextureSize;
 | 
						int maxTextureSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							bool active;
 | 
				
			||||||
 | 
							bool lastMileScaling;
 | 
				
			||||||
 | 
						} integerScaling;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::string gameFolder;
 | 
						std::string gameFolder;
 | 
				
			||||||
	bool anyAltToggleFS;
 | 
						bool anyAltToggleFS;
 | 
				
			||||||
	bool enableReset;
 | 
						bool enableReset;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										190
									
								
								src/graphics.cpp
									
										
									
									
									
								
							
							
						
						
									
										190
									
								
								src/graphics.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -477,6 +477,11 @@ struct GraphicsPrivate
 | 
				
			||||||
	TEXFBO frozenScene;
 | 
						TEXFBO frozenScene;
 | 
				
			||||||
	Quad screenQuad;
 | 
						Quad screenQuad;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Vec2i integerScaleFactor;
 | 
				
			||||||
 | 
						TEXFBO integerScaleBuffer;
 | 
				
			||||||
 | 
						bool integerScaleActive;
 | 
				
			||||||
 | 
						bool integerLastMileScaling;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Global list of all live Disposables
 | 
						/* Global list of all live Disposables
 | 
				
			||||||
	 * (disposed on reset) */
 | 
						 * (disposed on reset) */
 | 
				
			||||||
	IntruList<Disposable> dispList;
 | 
						IntruList<Disposable> dispList;
 | 
				
			||||||
| 
						 | 
					@ -492,9 +497,18 @@ struct GraphicsPrivate
 | 
				
			||||||
	      frameCount(0),
 | 
						      frameCount(0),
 | 
				
			||||||
	      brightness(255),
 | 
						      brightness(255),
 | 
				
			||||||
	      fpsLimiter(frameRate),
 | 
						      fpsLimiter(frameRate),
 | 
				
			||||||
	      frozen(false)
 | 
						      frozen(false),
 | 
				
			||||||
 | 
						      integerScaleFactor(0, 0),
 | 
				
			||||||
 | 
						      integerScaleActive(rtData->config.integerScaling.active),
 | 
				
			||||||
 | 
						      integerLastMileScaling(rtData->config.integerScaling.lastMileScaling)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		recalculateScreenSize(rtData);
 | 
							if (integerScaleActive)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								integerScaleFactor = Vec2i(1, 1);
 | 
				
			||||||
 | 
								rebuildIntegerScaleBuffer();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							recalculateScreenSize(rtData->config.fixedAspectRatio);
 | 
				
			||||||
		updateScreenResoRatio(rtData);
 | 
							updateScreenResoRatio(rtData);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		TEXFBO::init(frozenScene);
 | 
							TEXFBO::init(frozenScene);
 | 
				
			||||||
| 
						 | 
					@ -510,6 +524,7 @@ struct GraphicsPrivate
 | 
				
			||||||
	~GraphicsPrivate()
 | 
						~GraphicsPrivate()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		TEXFBO::fini(frozenScene);
 | 
							TEXFBO::fini(frozenScene);
 | 
				
			||||||
 | 
							TEXFBO::fini(integerScaleBuffer);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void updateScreenResoRatio(RGSSThreadData *rtData)
 | 
						void updateScreenResoRatio(RGSSThreadData *rtData)
 | 
				
			||||||
| 
						 | 
					@ -522,16 +537,28 @@ struct GraphicsPrivate
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Enforces fixed aspect ratio, if desired */
 | 
						/* Enforces fixed aspect ratio, if desired */
 | 
				
			||||||
	void recalculateScreenSize(RGSSThreadData *rtData)
 | 
						void recalculateScreenSize(bool fixedAspectRatio)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		scSize = winSize;
 | 
							scSize = winSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!rtData->config.fixedAspectRatio)
 | 
							if (!fixedAspectRatio && integerLastMileScaling)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			scOffset = Vec2i(0, 0);
 | 
								scOffset = Vec2i(0, 0);
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/* Last mile scaling disabled: just center the integer scale buffer
 | 
				
			||||||
 | 
							 * inside the window space */
 | 
				
			||||||
 | 
							if (integerScaleActive && !integerLastMileScaling)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								scOffset.x = (winSize.x - scRes.x * integerScaleFactor.x) / 2;
 | 
				
			||||||
 | 
								scOffset.y = (winSize.y - scRes.y * integerScaleFactor.y) / 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								scSize = Vec2i(scRes.x * integerScaleFactor.x, scRes.y * integerScaleFactor.y);
 | 
				
			||||||
 | 
								Debug() << scOffset.x << scOffset.y << winSize.x << winSize.y << integerScaleFactor.x << integerScaleFactor.y;
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		float resRatio = (float) scRes.x / scRes.y;
 | 
							float resRatio = (float) scRes.x / scRes.y;
 | 
				
			||||||
		float winRatio = (float) winSize.x / winSize.y;
 | 
							float winRatio = (float) winSize.x / winSize.y;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -544,10 +571,70 @@ struct GraphicsPrivate
 | 
				
			||||||
		scOffset.y = (winSize.y - scSize.y) / 2.f;
 | 
							scOffset.y = (winSize.y - scSize.y) / 2.f;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						static int findHighestFittingScale(int base, int target)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							int scale = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							while (base * scale <= target)
 | 
				
			||||||
 | 
								scale += 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							Debug() << base << target << scale - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return scale - 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Returns whether a new scale was found */
 | 
				
			||||||
 | 
						bool findHighestIntegerScale()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							Vec2i newScale(findHighestFittingScale(scRes.x, winSize.x),
 | 
				
			||||||
 | 
							               findHighestFittingScale(scRes.y, winSize.y));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (threadData->config.fixedAspectRatio)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								/* Limit both factors to the smaller of the two */
 | 
				
			||||||
 | 
								newScale.x = newScale.y = std::min(newScale.x, newScale.y);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (newScale == integerScaleFactor)
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							integerScaleFactor = newScale;
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void rebuildIntegerScaleBuffer()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							TEXFBO::fini(integerScaleBuffer);
 | 
				
			||||||
 | 
							TEXFBO::init(integerScaleBuffer);
 | 
				
			||||||
 | 
							TEXFBO::allocEmpty(integerScaleBuffer, scRes.x * integerScaleFactor.x,
 | 
				
			||||||
 | 
							                                       scRes.y * integerScaleFactor.y);
 | 
				
			||||||
 | 
							TEXFBO::linkFBO(integerScaleBuffer);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						bool integerScaleStepApplicable() const
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							if (!integerScaleActive)
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (integerScaleFactor.x < 1 || integerScaleFactor.y < 1) // XXX should be < 2, this is for testing only
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return true;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void checkResize()
 | 
						void checkResize()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (threadData->windowSizeMsg.poll(winSize))
 | 
							if (threadData->windowSizeMsg.poll(winSize))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								/* Query the acutal size in pixels, not units */
 | 
				
			||||||
 | 
								SDL_GL_GetDrawableSize(threadData->window, &winSize.x, &winSize.y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								/* Make sure integer buffers are rebuilt before screen offsets are
 | 
				
			||||||
 | 
								 * calculated so we have the final allocated buffer size ready */
 | 
				
			||||||
 | 
								if (integerScaleActive)
 | 
				
			||||||
 | 
									if (findHighestIntegerScale())
 | 
				
			||||||
 | 
										rebuildIntegerScaleBuffer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/* some GL drivers change the viewport on window resize */
 | 
								/* some GL drivers change the viewport on window resize */
 | 
				
			||||||
			glState.viewport.refresh();
 | 
								glState.viewport.refresh();
 | 
				
			||||||
			recalculateScreenSize(threadData);
 | 
								recalculateScreenSize(threadData);
 | 
				
			||||||
| 
						 | 
					@ -600,20 +687,64 @@ struct GraphicsPrivate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void metaBlitBufferFlippedScaled()
 | 
						void metaBlitBufferFlippedScaled()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		GLMeta::blitRectangle(IntRect(0, 0, scRes.x, scRes.y),
 | 
							metaBlitBufferFlippedScaled(scRes);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void metaBlitBufferFlippedScaled(const Vec2i &sourceSize, bool forceNearestNeighbour = false)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							GLMeta::blitRectangle(IntRect(0, 0, sourceSize.x, sourceSize.y),
 | 
				
			||||||
		                      IntRect(scOffset.x, scSize.y+scOffset.y, scSize.x, -scSize.y),
 | 
							                      IntRect(scOffset.x, scSize.y+scOffset.y, scSize.x, -scSize.y),
 | 
				
			||||||
		                      threadData->config.smoothScaling);
 | 
							                      !forceNearestNeighbour && threadData->config.smoothScaling);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void redrawScreen()
 | 
						void redrawScreen()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		screen.composite();
 | 
							screen.composite();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// maybe unspaghetti this later
 | 
				
			||||||
 | 
							if (integerScaleStepApplicable() && !integerLastMileScaling)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								GLMeta::blitBeginScreen(winSize);
 | 
				
			||||||
 | 
								GLMeta::blitSource(screen.getPP().frontBuffer());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								FBO::clear();
 | 
				
			||||||
 | 
								metaBlitBufferFlippedScaled(scRes, true);
 | 
				
			||||||
 | 
								GLMeta::blitEnd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								swapGLBuffer();
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (integerScaleStepApplicable())
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								assert(integerScaleBuffer.tex != TEX::ID(0));
 | 
				
			||||||
 | 
								GLMeta::blitBegin(integerScaleBuffer);
 | 
				
			||||||
 | 
								GLMeta::blitSource(screen.getPP().frontBuffer());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								GLMeta::blitRectangle(IntRect(0, 0, scRes.x, scRes.y),
 | 
				
			||||||
 | 
								                      IntRect(0, 0, integerScaleBuffer.width, integerScaleBuffer.height),
 | 
				
			||||||
 | 
								                      false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								GLMeta::blitEnd();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		GLMeta::blitBeginScreen(winSize);
 | 
							GLMeta::blitBeginScreen(winSize);
 | 
				
			||||||
		GLMeta::blitSource(screen.getPP().frontBuffer());
 | 
					
 | 
				
			||||||
 | 
							Vec2i sourceSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (integerScaleActive)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								GLMeta::blitSource(integerScaleBuffer);
 | 
				
			||||||
 | 
								sourceSize = Vec2i(integerScaleBuffer.width, integerScaleBuffer.height);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								GLMeta::blitSource(screen.getPP().frontBuffer());
 | 
				
			||||||
 | 
								sourceSize = scRes;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		FBO::clear();
 | 
							FBO::clear();
 | 
				
			||||||
		metaBlitBufferFlippedScaled();
 | 
							metaBlitBufferFlippedScaled(sourceSize);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		GLMeta::blitEnd();
 | 
							GLMeta::blitEnd();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1026,7 +1157,48 @@ bool Graphics::getFixedAspectRatio() const
 | 
				
			||||||
void Graphics::setFixedAspectRatio(bool value)
 | 
					void Graphics::setFixedAspectRatio(bool value)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	shState->config().fixedAspectRatio = value;
 | 
						shState->config().fixedAspectRatio = value;
 | 
				
			||||||
	p->recalculateScreenSize(p->threadData);
 | 
						p->findHighestIntegerScale();
 | 
				
			||||||
 | 
						p->recalculateScreenSize(p->threadData->config.fixedAspectRatio);
 | 
				
			||||||
 | 
						p->updateScreenResoRatio(p->threadData);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool Graphics::getSmoothScaling() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						// Same deal as with fixed aspect ratio
 | 
				
			||||||
 | 
						return shState->config().smoothScaling;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Graphics::setSmoothScaling(bool value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						shState->config().smoothScaling = value;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool Graphics::getIntegerScaling() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return p->integerScaleActive;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Graphics::setIntegerScaling(bool value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						p->integerScaleActive = value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p->findHighestIntegerScale();
 | 
				
			||||||
 | 
						p->rebuildIntegerScaleBuffer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p->recalculateScreenSize(p->threadData->config.fixedAspectRatio);
 | 
				
			||||||
 | 
						p->updateScreenResoRatio(p->threadData);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool Graphics::getLastMileScaling() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return p->integerLastMileScaling;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void Graphics::setLastMileScaling(bool value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						p->integerLastMileScaling = value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p->recalculateScreenSize(p->threadData->config.fixedAspectRatio);
 | 
				
			||||||
	p->updateScreenResoRatio(p->threadData);
 | 
						p->updateScreenResoRatio(p->threadData);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,6 +63,9 @@ public:
 | 
				
			||||||
	DECL_ATTR( ShowCursor, bool )
 | 
						DECL_ATTR( ShowCursor, bool )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DECL_ATTR( FixedAspectRatio, bool )
 | 
						DECL_ATTR( FixedAspectRatio, bool )
 | 
				
			||||||
 | 
						DECL_ATTR( SmoothScaling, bool )
 | 
				
			||||||
 | 
						DECL_ATTR( IntegerScaling, bool )
 | 
				
			||||||
 | 
						DECL_ATTR( LastMileScaling, bool )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* <internal> */
 | 
						/* <internal> */
 | 
				
			||||||
	Scene *getScreen() const;
 | 
						Scene *getScreen() const;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								src/main.cpp
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								src/main.cpp
									
										
									
									
									
								
							| 
						 | 
					@ -41,6 +41,10 @@
 | 
				
			||||||
#include "binding.h"
 | 
					#include "binding.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __WINDOWS__
 | 
					#ifdef __WINDOWS__
 | 
				
			||||||
 | 
					#include <windows.h>
 | 
				
			||||||
 | 
					#include <shellscalingapi.h>
 | 
				
			||||||
 | 
					#include <comdef.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "resource.h"
 | 
					#include "resource.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Try to force dedicated GPU
 | 
					// Try to force dedicated GPU
 | 
				
			||||||
| 
						 | 
					@ -204,6 +208,16 @@ int main(int argc, char *argv[])
 | 
				
			||||||
	SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
 | 
						SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
 | 
				
			||||||
//	SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
 | 
					//	SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __WINDOWS__
 | 
				
			||||||
 | 
						SetProcessDPIAware();
 | 
				
			||||||
 | 
					//	HRESULT hr = SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
 | 
				
			||||||
 | 
					//	if (FAILED(hr))
 | 
				
			||||||
 | 
					//	{
 | 
				
			||||||
 | 
					//		_com_error err(hr);
 | 
				
			||||||
 | 
					//		fwprintf(stderr, L"SetProcessDpiAwareness: %s\n", err.ErrorMessage());
 | 
				
			||||||
 | 
					//	}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* initialize SDL first */
 | 
						/* initialize SDL first */
 | 
				
			||||||
	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
 | 
						if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
| 
						 | 
					@ -276,7 +290,7 @@ int main(int argc, char *argv[])
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SDL_Window *win;
 | 
						SDL_Window *win;
 | 
				
			||||||
	Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS;
 | 
						Uint32 winFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_ALLOW_HIGHDPI;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (conf.winResizable)
 | 
						if (conf.winResizable)
 | 
				
			||||||
		winFlags |= SDL_WINDOW_RESIZABLE;
 | 
							winFlags |= SDL_WINDOW_RESIZABLE;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue