Skip to content

gui

create_window

Type

function

Parameters

  • string name
  • number width
  • number height

notification

Type

function

Parameters

  • string title
  • string message
  • table buttons

Description

This will create a notification on the bottom right of your main display. Use the on_notification callbacks to interact with the notification. Make sure to use gui:notification_image to set the image of the notification.

Example

Lua
1
2
3
4
-- get gui module
local gui = fantasy.gui( )

gui:notification( "FC2 ROBOT", "Hello World", { "Button1", "Button2" } )

overlay

Type

function

Parameters

  • string title of window to overlay

Description

This will queue the FC2 solution to create an overlay for a target process. This will not work if another overlay is already created.


set_fps

Type

function

Parameters

  • number fps

Description

Sets FPS cap. Set to 0 for unlimited frames.


notification_image

Type

function

Parameters

  • string path/url

Returns

  • table
    • userdata texture
    • number width
    • number height
    • number x
    • number y

Description

This will set the image for gui:notification. You can either pass a file path or a URL as an argument. FC2 will automatically detect that. If the argument is a URL, the image will be downloaded from the page.


set_overlay_padding

Type

function

Parameters

  • number x
  • number y
  • number w
  • number h

Description

This will scale and shift your overlay. This is useful for those with custom themes on Windows that may adjust the rectangle dimensions. This is also extremely useful for Linux users who have very specific and unique desktop customization considering there are a lot of options.


find_window

Type

function

Description

This will iterate through all windows on your system. On Linux, the class_name parameter is always ignored but must still be provided as an argument requirement. The example below will work on both Windows and Linux.

Parameters

  • string class_name
  • string window_title

Returns

  • userdata

Example

Lua
local modules = require( "modules" ) -- lib_modules
local window = modules.gui:find_window( "", "Counter-Strike: Global Offensive - Vulkan" )

get_active_window

Type

function

Description

This will get the currently focused window. You can use this function with find_window to see if a specific window is focused.

Returns

  • userdata

get_windows

Type

function

Description

Returns a table of all windows created by the GUI module (including the overlay). This does not provide a window class instance. You should only use the window class instances provided by callbacks.

Returns

  • table
  • string name
  • userdata address
  • number width
  • number height

hide_window

Type

function

Description

Hides a window based on its name.

Parameters

  • string

Returns

  • boolean

show_window

Type

function

Description

Shows a window based on its name.

Parameters

  • string

Returns

  • boolean

close_window

Type

function

Description

Triggers the event that a window should close next render ticket.

Parameters

  • string

Returns

  • boolean

get_window_size

Type

function

Description

You can get the window userdata from find_window.

Parameters

  • userdata

Returns

  • table
  • number x
  • number y
  • number width
  • number height

play_sound

Type

function

Parameters

  • string path

get_latest

Type

function

Description

This gets the latest rendered window/overlay/notification. This function is very unstable as results aren't consistent due to the GUI module being out of sync with the worker.

Parameters

  • window