I managed to add the module. Dropping the right file into the renpy directory did indeed work. (finding the right file was a lot more difficult for someone unfamiliar with python, though... *g*)
So far for the good news. The bad news: The scaling still doesn't work. Even if I choose a smaller scaling factor, the fullscreen mode switches to the large resolution... and displays a downscaled game surrounded by black.
So I went back to my original approach: Dynamically setting the game size and scaling the images. After some more annoying problems (my system is really good in providing awkward display modes... *sigh*), it finally seems to work with only one problem left:
I'm now displaying a 1280x720 image in the center of a 1280x1024 screen (I need to keep the original aspect ratio of the screen, or renpy will choose a bad fullscreen mode). The text is displayed below the image in the blackness. The problem is, that the text leaves gray traces behind when it changes. Every letter kinda burns into the background.
Do you know what might causing this? And more important: How do I fix this?
For everyone who's interested, here my current size-calculation-function:
Code: Select all
# get_target_resolution(source_x, source_y)
# Function for retrieving scaling data for the images.
#
# Parameters:
# - horizontal size of the source images
# - vertical size of the source images
#
# Returns:
# - horizontal resolution
# - vertical resolution
# - scale factor
# - aspect ratio of the original system resolution
# if the system resolution cannot be found, the ratio of the source
# image is used
def get_target_resolution(source_x, source_y):
# default return values (change nothing)
factor = 1
target_x = source_x
target_y = source_y
screen_factor = float(source_x) / float(source_y)
source_factor = float(source_x) / float(source_y)
# get a list of display modes, sorted by resolution
import pygame
pygame.display.init()
modes = pygame.display.list_modes()
# find the appropriate scaling factor, 1 being the default
factor = 1 #default
for i in range(len(modes)):
aspect_ratio = modes[i][0] / modes[i][1]
# if the aspect ratio is somewhat reasonable (not some multi-screen setup which
# *should* be recognizable by unusal aspect ratios) set the scale factor to
# scale to this resolution => the highest resolution should be chosen
if 1.25 <= aspect_ratio < 1.8:
factor = modes[0][0] / float(source_x)
target_x = modes[0][0]
target_y = int(float(target_x) / source_factor)
break
# the "optimal resolution" that we found above can be awkward on
# some systems (ie: mine). If we can query the current system resolution
# try to use that one instead - if it seems reasonable.
import os
if os.name == 'nt':
from win32api import GetSystemMetrics
if 1.25 <= (float(GetSystemMetrics(0)) / float(GetSystemMetrics(1))) < 1.8:
factor = float(GetSystemMetrics(0)) / float(source_x)
target_x = GetSystemMetrics(0)
target_y = int(float(GetSystemMetrics(0)) / source_factor)
screen_factor = float(GetSystemMetrics(0)) / float(GetSystemMetrics(1))
return target_x, target_y, factor, screen_factor
If you tell me the way to query the system resolution on linux, I can add that too... but I have no way of testing it.