Skip to content

Commit

Permalink
Adds Fullscreen (#2878)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
Added fullscreen as hotkey F11 and on OOC -> Toggle Fullscreen

![image](https://github.com/shiptest-ss13/Shiptest/assets/58084138/3db51657-c491-423a-a4e2-1e70647897b3)

![image](https://github.com/shiptest-ss13/Shiptest/assets/58084138/8136e422-922a-4937-8c59-50993d1a8bc1)


<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Why It's Good For The Game
You can play in fullscreen without annoying borders.
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

## Changelog

:cl:
add: Fullscreen on F11
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
Yata9ar4su authored Apr 11, 2024
1 parent 18498d9 commit b25ec18
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 b25ec18

Please sign in to comment.