Skip to content

Commit

Permalink
added fullscreen
Browse files Browse the repository at this point in the history
Added fullscreen as hotkey f11 and in ooc
  • Loading branch information
Yata9ar4su committed Apr 5, 2024
1 parent 868c6ad commit 285e97d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define COMSIG_KB_CLIENT_GETHELP_DOWN "keybinding_client_gethelp_down"
#define COMSIG_KB_CLIENT_SCREENSHOT_DOWN "keybinding_client_screenshot_down"
#define COMSIG_KB_CLIENT_MINIMALHUD_DOWN "keybinding_client_minimalhud_down"
#define COMSIG_KB_CLIENT_FULLSCREEN_DOWN "keybinding_client_fullscreen_down"

//Communication
#define COMSIG_KB_CLIENT_OOC_DOWN "keybinding_client_ooc_down"
Expand Down
36 changes: 36 additions & 0 deletions code/datums/keybinding/client.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,39 @@
return
user.mob.button_pressed_F12()
return TRUE

/client
var/fullscreen = FALSE
/datum/keybinding/client/t_fullscreen
hotkey_keys = list("F11")
name = "change_fullscreen"
full_name = "Toggle Fullscreen"
description = "Change window to Fullscreen or back"
keybind_signal = COMSIG_KB_CLIENT_FULLSCREEN_DOWN

/datum/keybinding/client/t_fullscreen/down(client/C)
. = ..()
C.toggle_fullscreen()


/client/verb/toggle_fullscreen()
set name = "Toggle Fullscreen"
set category = "OOC"

fullscreen = !fullscreen

if (fullscreen)
winset(usr, "mainwindow", "on-size=")
winset(usr, "mainwindow", "titlebar=false")
winset(usr, "mainwindow", "can-resize=false")
winset(usr, "mainwindow", "menu=")
winset(usr, "mainwindow", "is-maximized=false")
winset(usr, "mainwindow", "is-maximized=true")
else
winset(usr, "mainwindow", "titlebar=true")
winset(usr, "mainwindow", "can-resize=true")
winset(usr, "mainwindow", "menu=menu")
winset(usr, "mainwindow", "is-maximized=false")
winset(usr, "mainwindow", "on-size=fitviewport")

fit_viewport()

0 comments on commit 285e97d

Please sign in to comment.