Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullscreen improvements #6850

Merged
merged 4 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/__DEFINES/client_prefs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define TOGGLE_AUTOMATIC_PUNCTUATION (1<<7) // Whether your sentences will automatically be punctuated with a period
#define TOGGLE_COMBAT_CLICKDRAG_OVERRIDE (1<<8) // Whether disarm/harm intents cause clicks to trigger immediately when the mouse button is depressed.
#define TOGGLE_ALTERNATING_DUAL_WIELD (1<<9) // Whether dual-wielding fires both guns at once or swaps between them, OUTDATED, used to update savefiles, now dual_wield_pref
#define TOGGLE_FULLSCREEN (1<<10) // See /client/proc/toggle_fullscreen in client_procs.dm
#define TOGGLE_FULLSCREEN (1<<10) // See /client/proc/update_fullscreen in client_procs.dm
#define TOGGLE_MEMBER_PUBLIC (1<<11) //determines if you get a byond logo by your name in ooc if you're a member or not
#define TOGGLE_OOC_FLAG (1<<12) // determines if your country flag appears by your name in ooc chat
#define TOGGLE_MIDDLE_MOUSE_SWAP_HANDS (1<<13) //Toggle whether middle click swaps your hands
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
//Client
#define COMSIG_KB_CLIENT_GETHELP_DOWN "keybinding_client_gethelp_down"
#define COMSIG_KB_CLIENT_SCREENSHOT_DOWN "keybinding_client_screenshot_down"
#define COMSIG_KB_CLIENT_TOGGLEFULLSCREEN_DOWN "keybinding_client_togglefullscreen_down"
#define COMSIG_KB_CLIENT_MINIMALHUD_DOWN "keybinding_client_minimalhud_down"

//Communication
Expand Down
15 changes: 15 additions & 0 deletions code/datums/keybinding/client.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@
winset(user, null, "command=.screenshot [!user.keys_held["shift"] ? "auto" : ""]")
return TRUE

/datum/keybinding/client/toggle_fullscreen
hotkey_keys = list("F11")
classic_keys = list("F11")
name = "toggle_fullscreen"
full_name = "Toggle Fullscreen"
description = "Toggles whether the game window will be true fullscreen or normal."
keybind_signal = COMSIG_KB_CLIENT_TOGGLEFULLSCREEN_DOWN

/datum/keybinding/client/toggle_fullscreen/down(client/user)
. = ..()
if(.)
return
user.toggle_fullscreen_preference()
return TRUE

/datum/keybinding/client/minimal_hud
hotkey_keys = list("F12")
classic_keys = list("F12")
Expand Down
20 changes: 10 additions & 10 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
if(prefs.lastchangelog != GLOB.changelog_hash) //bolds the changelog button on the interface so we know there are updates.
winset(src, "infowindow.changelog", "background-color=#ED9F9B;font-style=bold")

if(prefs.toggle_prefs & TOGGLE_FULLSCREEN)
toggle_fullscreen(TRUE)
else
toggle_fullscreen(FALSE)

update_fullscreen()

var/file = file2text("config/donators.txt")
var/lines = splittext(file, "\n")
Expand Down Expand Up @@ -733,12 +729,16 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
if(WHISPER_CHANNEL)
winset(src, "srvkeybinds-[REF(key)]", "parent=default;name=[key];command=whisper")

/client/proc/toggle_fullscreen(new_value)
if(new_value)
winset(src, "mainwindow", "is-maximized=false;can-resize=false;titlebar=false;menu=menu")
/client/proc/update_fullscreen()
if(CHECK_BITFIELD(prefs.toggle_prefs, TOGGLE_FULLSCREEN))
Doubleumc marked this conversation as resolved.
Show resolved Hide resolved
winset(src, "mainwindow", "is-fullscreen=true;menu=")
else
winset(src, "mainwindow", "is-maximized=false;can-resize=true;titlebar=true;menu=menu")
winset(src, "mainwindow", "is-maximized=true")
winset(src, "mainwindow", "is-fullscreen=false;menu=menu")

if(prefs.adaptive_zoom)
adaptive_zoom()
else if(prefs.auto_fit_viewport)
fit_viewport()

/// Attempts to make the client orbit the given object, for administrative purposes.
/// If they are not an observer, will try to aghost them.
Expand Down
4 changes: 2 additions & 2 deletions code/modules/client/preferences_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@
set category = "Preferences"
set desc = "Toggles whether the game window will be true fullscreen or normal."

prefs.toggle_prefs ^= TOGGLE_FULLSCREEN
TOGGLE_BITFIELD(prefs.toggle_prefs, TOGGLE_FULLSCREEN)
Doubleumc marked this conversation as resolved.
Show resolved Hide resolved
prefs.save_preferences()
toggle_fullscreen(prefs.toggle_prefs & TOGGLE_FULLSCREEN)
update_fullscreen()

/client/verb/toggle_ambient_occlusion()
set name = "Toggle Ambient Occlusion"
Expand Down
Loading