mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-28 02:02:04 +00:00
Got tired of the issues here when working on something else. Ported several PRs from /tg/station to fix DPI scaling issues. This was not a problem before 516, however 516 now respects Window's DPI setting, causing misalignment in several of our UI elements. This PR implements these ~~four~~ ~~five~~ six PRs: https://github.com/tgstation/tgstation/pull/65686 https://github.com/tgstation/tgstation/pull/89994 https://github.com/tgstation/tgstation/pull/90416 https://github.com/tgstation/tgstation/pull/90418 https://github.com/tgstation/tgstation/pull/90796 https://github.com/cmss13-devs/cmss13/pull/8734 ~~Does not include fixes with TGUI-Say. /tg/station refactored TGUI-Say after their port to React before they fixed DPI scaling, and this would be pain to deconstruct to port over to Inferno. Since porting to React is "inevitable", I considered it not worth my time to fix this.~~ Thanks to the assistance of harry, TGUI-Say fixes now included.
45 lines
1.8 KiB
Plaintext
45 lines
1.8 KiB
Plaintext
/// Green eye; fully interactive
|
|
#define UI_INTERACTIVE 2
|
|
/// Orange eye; updates but is not interactive
|
|
#define UI_UPDATE 1
|
|
/// Red eye; disabled, does not update
|
|
#define UI_DISABLED 0
|
|
/// UI Should close
|
|
#define UI_CLOSE -1
|
|
|
|
/// Maximum number of windows that can be suspended/reused
|
|
#define TGUI_WINDOW_SOFT_LIMIT 5
|
|
/// Maximum number of open windows
|
|
#define TGUI_WINDOW_HARD_LIMIT 9
|
|
|
|
/// Maximum ping timeout allowed to detect zombie windows
|
|
#define TGUI_PING_TIMEOUT (4 SECONDS)
|
|
/// Used for rate-limiting to prevent DoS by excessively refreshing a TGUI window
|
|
#define TGUI_REFRESH_FULL_UPDATE_COOLDOWN (1 SECONDS)
|
|
|
|
/// Window does not exist
|
|
#define TGUI_WINDOW_CLOSED 0
|
|
/// Window was just opened, but is still not ready to be sent data
|
|
#define TGUI_WINDOW_LOADING 1
|
|
/// Window is free and ready to receive data
|
|
#define TGUI_WINDOW_READY 2
|
|
|
|
/// Get a window id based on the provided pool index
|
|
#define TGUI_WINDOW_ID(index) "tgui-window-[index]"
|
|
/// Get a pool index of the provided window id
|
|
#define TGUI_WINDOW_INDEX(window_id) text2num(copytext(window_id, 13))
|
|
|
|
/// Creates a message packet for sending via output()
|
|
// This is {"type":type,"payload":payload}, but pre-encoded. This is much faster
|
|
// than doing it the normal way.
|
|
// To ensure this is correct, this is unit tested in tgui_create_message.
|
|
#define TGUI_CREATE_MESSAGE(type, payload) ( \
|
|
"%7b%22type%22%3a%22[type]%22%2c%22payload%22%3a[url_encode(json_encode(payload))]%7d" \
|
|
)
|
|
|
|
/// Creates a message packet for sending via output() specifically for opening tgsay using an embedded winget
|
|
// This is {"type":"open","payload":{"channel":channel,"mapfocus":[[map.focus]]}}, but pre-encoded.
|
|
#define TGUI_CREATE_OPEN_MESSAGE(channel) ( \
|
|
"%7b%22type%22%3a%22open%22%2c%22payload%22%3a%7B%22channel%22%3a%22[channel]%22%2c%22mapfocus%22%3a\[\[map.focus\]\]%7d%7d" \
|
|
)
|