Window - AlsoGhostglowDev/Ghost-s-Utilities GitHub Wiki
Tools used for the game's application/window manipulation. Use with caution.
local window = require 'ghostutil.window'defaultDimensions = {
width: int = 1280,
height: int = 720
}desktopDimensions = {
-- not a constant, therefore it's defaulted to 0.
width: int = 0,
height: int = 0
}onCreate, else it will only return 0.
setProperty(property: string, value: dynamic, ?allowMaps: boolean, ?allowInstances: boolean): dynamicSets the window's property directly to value.
(uses helper.setProperty)
Parameters:
-
property: The property to set, available properties can be referred here:lime.ui.Window. -
value: The value to set the property to. -
allowMaps(optional): Allows for map access in properties, disabled by default for optimization. -
allowInstances(optional): Allows usage ofinstanceArgfor properties, disabled by default for optimization.
Returns: The passed value.
View Example
-- sets the window's X position to 100.
window.setProperty('x', 100)─────────────────────────
getProperty(property: string, ?allowMaps: boolean): dynamicFetches the window's property directly.
Parameters:
-
property: The property to fetch, available properties can be referred here:lime.ui.Window. -
allowMaps(optional): Allows for map access in properties, disabled by default for optimization.
Returns: The fetched value.
View Example
-- assuming you didn't change the window title,
-- this will return "Friday Night Funkin': Psych Engine"
window.getProperty('title')─────────────────────────
setPosition(x: number, y: number): voidSets the window's position.
Parameters:
-
x: The target X position. -
y: The target Y position.
View Example
-- sets the window's position to (X: 240, Y: 320)
window.setPosition(240, 320)─────────────────────────
screenCenter(?axes: string): voidCenters the current window at the given axis.
Parameters:
-
axes(optional): The axis the window should center at, defaults to'xy'
(can be x, y or xy)
View Example
-- centers the window on the X axis.
window.screenCenter('x')─────────────────────────
resize(width: number, height: number): voidResizes the window to the specified dimensions.
Parameters:
-
width: The new window width. -
height: The new window height.
View Example
-- resizes the window to half it's size
window.resize(
window.getProperty('width') / 2,
window.getProperty('height') / 2
)─────────────────────────
doTweenX(tag: string, value: number, ?duration: number, ?ease: string): voidTweens the window's X position to the given value.
Parameters:
-
tag: The tween's tag. -
value: The target X position. -
duration(optional): Determines how long the tween will take, defaults to1. -
ease(optional): Determines the ease used on the tween. Refer toFlxEase. Defaults to'linear'
View Example
-- tweens the window's X position to 100.
window.doTweenX('coolTween', 100, 2, 'expoInOut')─────────────────────────
doTweenY(tag: string, value: number, ?duration: number, ?ease: string): voidJust like doTweenX, instead this tweens the window's Y position instead.
Parameters:
-
tag: The tween's tag. -
value: The target Y position. -
duration(optional): Determines how long the tween will take, defaults to1. -
ease(optional): Determines the ease used on the tween. Refer toFlxEase. Defaults to'linear'
View Example
-- tweens the window's Y position to 300.
window.doTweenY('coolTween', 300, 2, 'expoInOut')─────────────────────────
doTweenPosition(tag: string, x: number, y: number, ?duration: number, ?ease: string): voidTweens the window's position to the specified values.
Parameters:
-
tag: The tween's tag. -
x: The target X position. -
y: The target Y position. -
duration(optional): Determines how long the tween will take, defaults to1. -
ease(optional): Determines the ease used on the tween. Refer toFlxEase. Defaults to'linear'
─────────────────────────
doTweenSize(tag: string, width: number, height: number, ?duration: number, ?ease: string): voidTweens the window's size to the specified values.
Parameters:
-
tag: The tween's tag. -
width: The target window width. -
height: The target window height. -
duration(optional): Determines how long the tween will take, defaults to1. -
ease(optional): Determines the ease used on the tween. Refer toFlxEase. Defaults to'linear'
View Example
-- tweens the window's width and height to your desktop's dimensions.
window.doTweenSize('coolResize', window.desktopDimensions.width, window.desktopDimensions.height, 2, 'expoInOut')─────────────────────────
tweenToCenter(tag: string, ?axes: string, ?duration: number, ?options: TweenOptions): voidTweens the window to the center of the given axis.
(uses bcompat.startTween)
Parameters:
-
tag: The tween's tag. -
axes(optional): The axis the window should center at, defaults to'xy'
(can be x, y or xy) -
duration(optional): Determines how long the tween will take, defaults to1. -
options(optional): The tween's options; Refer toTweenOptions.
View Example
-- tweens the window to the center.
window.tweenToCenter('tweener', 'xy', 2, {
ease = 'quadIn'
})─────────────────────────
startTween(tag: string, values: directory<string, dynamic>, ?duration: number, ?options: TweenOptions): voidCreates a tween of the window supporting multiple values for each respective fields.
(uses bcompat.startTween)
Parameters:
-
tag: The tween's tag. -
object: The target object to tween. -
values: Directory containing values mapped to their corresponding field. -
duration(optional): Determines how long the tween will take, defaults to1. -
options(optional): The tween's options; Refer toTweenOptions.
This tween is still cancelable through Psych's cancelTween.
View Example
-- tweens the window's width and x to 200 and 100 respectively.
window.startTween('tweener', {x = 100, width = 200}, 2, {
ease = 'quadInOut'
})─────────────────────────
setIcon(image: string): voidSets the window's icon to the specified image.
Parameters:
-
image: The image path. (checks inimages)
View Example
-- assuming you have icon.png in mods/images/..
window.setIcon('icon')─────────────────────────
alert(title: string, message: string): voidSends an alert to the user.
For a more advanced use, check out cpp.makeMessageBox.
Parameters:
-
title: The alert's window title. -
message: The alert's message.
View Example
window.alert('Cool dude spotted', 'YOOO THIS GUY USES GHOSTUTIL!!')─────────────────────────
setTitle(?title: string): voidSets the current window's title.
Parameters:
-
title(optional): The new window title, defaults to"Friday Night Funkin': Psych Engine".
─────────────────────────
createWindow(tag: string, ?attributes: WindowAttributes): voidCreates a new window for the current application.
(This window does not automatically close. Use window.closeWindow to close it.)
Warning
This function is exclusively for Psych Engine versions below 0.7.0.
Parameters:
-
tag: The tag to store to later use with other functions likesetProperty, etc. -
attributes: The window's attributes; Refer toWindowAttributes.
View Example
-- WARNING: this only works in Psych Engine versions below 0.7.0
window.createWindow('coolWindow', {
x = 100,
y = 200,
title = 'Cool Window'
})
-- you can change it's properties with setProperty..
setProperty('coolWindow.title', 'VERY Cool Window')
-- close it once you're done using it!
function onDestroy()
window.closeWindow('coolWindow')
end─────────────────────────
closeWindow(tag: string): voidCloses the custom window that corresponds to the given tag that was created with createWindow.
Parameters:
-
tag: The custom window tag.
─────────────────────────
close(): voidExits the current window.
(Shortcut for os.exit.)
GhostUtil 3.0.0 • Docs 3.0.0, Revision 2
a Lua Library made by GhostglowDev; for Psych Engine
© 2025 GhostglowDev — Ghost's Utilities
Licensed under the MIT License.