diff --git a/vmf/scripts/mods/vmf/modules/gui/ui_scaling.lua b/vmf/scripts/mods/vmf/modules/gui/ui_scaling.lua index 857e596..c986b8a 100644 --- a/vmf/scripts/mods/vmf/modules/gui/ui_scaling.lua +++ b/vmf/scripts/mods/vmf/modules/gui/ui_scaling.lua @@ -1,46 +1,19 @@ --- If enabled, scale UI for resolutions greater than 1080p when necessary. --- Reports to a global when active, so that existing scaling can be disabled. local vmf = get_mod("VMF") local _ui_scaling_enabled --- #################################################################################################################### --- ##### Hooks ######################################################################################################## --- #################################################################################################################### - -vmf:hook("UIResolutionScale", function (func, ...) - - local width, height = UIResolution() - - if (width > UIResolutionWidthFragments() and height > UIResolutionHeightFragments() and _ui_scaling_enabled) then - - local max_scaling_factor = 4 - - -- Changed to allow scaling up to quadruple the original max scale (1 -> 4) - local width_scale = math.min(width / UIResolutionWidthFragments(), max_scaling_factor) - local height_scale = math.min(height / UIResolutionHeightFragments(), max_scaling_factor) - - return math.min(width_scale, height_scale) - else - return func(...) - end -end) - -- #################################################################################################################### -- ##### VMF internal functions and variables ######################################################################### -- #################################################################################################################### -vmf.load_ui_scaling_settings = function () - _ui_scaling_enabled = vmf:get("ui_scaling") +vmf.check_if_ui_scaling_was_used_before = function() + _ui_scaling_enabled = _ui_scaling_enabled or vmf:get("ui_scaling") if _ui_scaling_enabled then - RESOLUTION_LOOKUP.ui_scaling = true - else - RESOLUTION_LOOKUP.ui_scaling = false + vmf:set("ui_scaling", nil) + if UIResolutionScale() > 1 then + vmf:warning("UI SCALING WAS STRIPPED FROM THE VMF AND HAS BEEN RELEASED AS A SEPARATE MOD. " .. + "YOU CAN FIND THE DOWNLOAD LINK IN THE VMF WORKSHOP DESCRIPTION. " .. + "This message will be shown to you only during this game session.") + end end end - --- #################################################################################################################### --- ##### Script ####################################################################################################### --- #################################################################################################################### - -vmf.load_ui_scaling_settings() diff --git a/vmf/scripts/mods/vmf/modules/vmf_options.lua b/vmf/scripts/mods/vmf/modules/vmf_options.lua index d82aa4c..fd77bbc 100644 --- a/vmf/scripts/mods/vmf/modules/vmf_options.lua +++ b/vmf/scripts/mods/vmf/modules/vmf_options.lua @@ -19,11 +19,6 @@ vmf_mod_data.options = { range = {1, 1000}, unit_text = "percent" }, - { - setting_id = "ui_scaling", - type = "checkbox", - default_value = true - }, { setting_id = "developer_mode", type = "checkbox", @@ -192,10 +187,6 @@ vmf.on_setting_changed = function (setting_id) vmf.load_custom_textures_settings() - elseif setting_id == "ui_scaling" then - - vmf.load_ui_scaling_settings() - elseif setting_id == "logging_mode" or setting_id == "output_mode_echo" or setting_id == "output_mode_error" @@ -239,7 +230,6 @@ if not vmf:get("vmf_initialized") then vmf.load_custom_textures_settings() vmf.load_dev_console_settings() vmf.load_chat_history_settings() - vmf.load_ui_scaling_settings() --vmf.load_vmf_options_view_settings() vmf:set("vmf_initialized", true) diff --git a/vmf/scripts/mods/vmf/vmf_loader.lua b/vmf/scripts/mods/vmf/vmf_loader.lua index 6445de1..b9880dd 100644 --- a/vmf/scripts/mods/vmf/vmf_loader.lua +++ b/vmf/scripts/mods/vmf/vmf_loader.lua @@ -107,6 +107,7 @@ function vmf_mod_object:on_game_state_changed(status, state) if status == "enter" and state == "StateIngame" then vmf.create_keybinds_input_service() + vmf.check_if_ui_scaling_was_used_before() -- @TODO: strip it in a few months end end