def __update_res_opts(self): nx, ny = pf.get_native_resolution() arx, ary = pf.settings_get("pf.video.aspect_ratio") ar = arx / ary native_ar = float(nx) / ny if ar < native_ar: base = (ny * ar, ny) else: base = (nx, nx / ar) assert base[0] <= nx assert base[1] <= ny new_opts = [ base, (base[0]/1.5, base[1]/1.5), (base[0]/2, base[1]/2), ] res = pf.settings_get("pf.video.resolution") int_new_opts = [(int(o[0]), int(o[1])) for o in new_opts] if (int(res[0]), int(res[1])) not in int_new_opts: new_opts += [res] new_opts.sort(reverse=True) self.view.res_opts = new_opts self.view.res_opt_strings = ["{}:{}".format(int(opt[0]), int(opt[1])) for opt in new_opts]
def __init__(self): vresx, vresy = (1920, 1080) super(VideoSettingsWindow, self).__init__( "VideoSettings", ((vresx - VideoSettingsWindow.WIDTH) / 2, (vresy - VideoSettingsWindow.HEIGHT) / 2, VideoSettingsWindow.WIDTH, VideoSettingsWindow.HEIGHT), 0, (vresx, vresy)) self.ar_idx = 0 self.ar_opts = [(4, 3), (16, 9), (21, 9)] self.__ar_opt_strings = ["{}:{}".format(*opt) for opt in self.ar_opts] nx, ny = pf.get_native_resolution() self.res_idx = 0 self.res_opts = [ (nx, ny), (nx * 3 / 4, ny * 3 / 4), (nx / 2, ny / 2), ] self.res_opt_strings = [ "{}:{}".format(int(opt[0]), int(opt[1])) for opt in self.res_opts ] self.mode_idx = 0 self.mode_opts = [ pf.PF_WF_FULLSCREEN, pf.PF_WF_WINDOW, pf.PF_WF_BORDERLESS_WIN, ] self.mode_opt_strings = [ "Fullscreen", "Window", "Borderless Window", ] self.win_on_top_idx = 0 self.win_on_top_opts = [True, False] self.__win_on_top_opt_strings = ["On", "Off"] self.vsync_idx = 0 self.vsync_opts = [True, False] self.__vsync_opt_strings = ["On", "Off"] self.shadows_idx = 0 self.shadows_opts = [True, False] self.__shadows_opt_strings = ["On", "Off"] self.water_reflect_idx = 0 self.water_reflect_opts = [True, False] self.__water_reflect_opt_strings = ["On", "Off"] self.dirty = False