Files
Bubberstation/code/modules/client/preferences/tgui.dm
harry 2691b9a721 makes various uis more compatible with high dpi monitors, adds a preference for smaller windows (#90418)
## About The Pull Request
various uis (tgui-say, vv, player panel, anything using
`/datum/browser`) would not correct for dpi. they now do

we also have a preference to allow you to have smaller windows that are
zoomed out, instead of larger windows that are not zoomed

#### of note, this does require a small change to the usage of css
viewport units, like `vh` and `vw`. they need to be fed through the
`vp(100vw)` function first. there was only one such unit in the codebase

on 4k monitor with 200% scaling:

fixed (pref on default)

![BiygmRan0QqxOMqL@2x](https://github.com/user-attachments/assets/1bdbc93c-1cd4-4a17-bf18-6cca7a5df032)

pref disabled

![DUWSVJNXt3xuQJEy@2x](https://github.com/user-attachments/assets/1b87ed9e-0498-44c4-ab1b-2c0321e70ce0)


## Why It's Good For The Game
516 fucked with uis again and this unfucks them a bit

## Changelog
🆑
qol: there's a new UI preference called UI scale which allows people
that use windows scaling to have their UIs original size with the
contents zoomed out, instead of the default, which is the UIs being
larger with the contents "normal" size
fix: various UIs did not respect windows scaling, they now do
/🆑

---------

Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
2025-04-06 21:54:57 +02:00

98 lines
3.3 KiB
Plaintext

/datum/preference/toggle/tgui_fancy
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_fancy"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/toggle/tgui_fancy/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.update_static_data(client.mob)
// Determines if input boxes are in tgui or old fashioned
/datum/preference/toggle/tgui_input
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_input"
savefile_identifier = PREFERENCE_PLAYER
/// Large button preference. Error text is in tooltip.
/datum/preference/toggle/tgui_input_large
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_input_large"
savefile_identifier = PREFERENCE_PLAYER
default_value = FALSE
/datum/preference/toggle/tgui_input_large/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.send_full_update(client.mob)
/// Swapped button state - sets buttons to SS13 traditional SUBMIT/CANCEL
/datum/preference/toggle/tgui_input_swapped
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_input_swapped"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/toggle/tgui_input_swapped/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.send_full_update(client.mob)
/// Changes layout in some UI's, like Vending, Smartfridge etc. Making it list or grid
/datum/preference/choiced/tgui_layout
savefile_key = "tgui_layout"
savefile_identifier = PREFERENCE_PLAYER
/datum/preference/choiced/tgui_layout/init_possible_values()
return list(
TGUI_LAYOUT_GRID,
TGUI_LAYOUT_LIST,
)
/datum/preference/choiced/tgui_layout/create_default_value()
return TGUI_LAYOUT_LIST
/datum/preference/choiced/tgui_layout/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.update_static_data(client.mob)
/datum/preference/choiced/tgui_layout/smartfridge
savefile_key = "tgui_layout_smartfridge"
/datum/preference/choiced/tgui_layout/create_default_value()
return TGUI_LAYOUT_GRID
/datum/preference/toggle/tgui_lock
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_lock"
savefile_identifier = PREFERENCE_PLAYER
default_value = FALSE
/datum/preference/toggle/tgui_lock/apply_to_client(client/client, value)
for (var/datum/tgui/tgui as anything in client.mob?.tgui_open_uis)
// Force it to reload either way
tgui.update_static_data(client.mob)
/// Light mode for tgui say
/datum/preference/toggle/tgui_say_light_mode
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "tgui_say_light_mode"
savefile_identifier = PREFERENCE_PLAYER
default_value = FALSE
/datum/preference/toggle/tgui_say_light_mode/apply_to_client(client/client)
client.tgui_say?.load()
/datum/preference/toggle/ui_scale
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "ui_scale"
savefile_identifier = PREFERENCE_PLAYER
default_value = TRUE
/datum/preference/toggle/ui_scale/apply_to_client(client/client, value)
if(!istype(client))
return
INVOKE_ASYNC(client, TYPE_VERB_REF(/client, refresh_tgui))
client.tgui_say?.load()