Skip to content
Francisco Dias edited this page Dec 17, 2024 · 2 revisions

Utils

This is a module for managing various aspects of the framework (i.e.: overlay, images, services...).

Functions

The following functions are provided to interact with this module:

Constants

This module exposes the following constants:

Structs

This module offers a collection of structs, which serve as custom data models for organizing and structuring data. Explore the provided structs to better understand the relationships between data elements and simplify your data manipulation tasks.



Back To Top

GOG_Utils_DisableOverlayPopups

This function disables overlay pop-up notifications. It hides overlay pop-up notifications based on the group specified below:

  • "chat_message" - New chat messages received.
  • "friend_invitation" - Friend request received, new user added to the friend list.
  • "game_invitation" - Game invitation sent or received.

Note

For this call to work, the overlay needs to be initialized first. To check whether the overlay is initialized successfully, call GOG_Utils_GetOverlayState.


Syntax:

GOG_Utils_DisableOverlayPopups(popupGroup)
Argument Type Description
popupGroup String The name of the notification pop-up group.



Returns:

N/A


Example:

GOG_Utils_DisableOverlayPopups("chat_message");

The code above provides a simple usage example.




Back To Top

GOG_Utils_GetGogServicesConnectionState

This function returns the current state of the connection to GOG services, see ServicesConnectionState.


Syntax:

GOG_Utils_GetGogServicesConnectionState()



Returns:

ServicesConnectionState


Example:

GOG_Utils_GetGogServicesConnectionState();

The code above provides a simple usage example.




Back To Top

GOG_Utils_GetImageRGBA

This function reads the image of a specified ID into a buffer.

Note

The size of the output buffer will be 4 * height * width (see function GOG_Utils_GetImageSize).

Warning

This function creates a new buffer everytime it is called, unless a buffer is already specified. You need to ensure you correctly delete the buffer when you don't need it anymore using the buffer_delete function. Failing to do so will result in memory leaks.


Syntax:

GOG_Utils_GetImageRGBA(imageID, bufferID=undefined, byteOffset=undefined)
Argument Type Description
imageID Real The ID of the image.
bufferID Buffer OPTIONAL: use an existing buffer instead of allocating a new one
byteOffset Real OPTIONAL: write data to a specific offset in the buffer



Returns:

Buffer


Example:

var _buff = GOG_Utils_GetImageRGBA(imageID);

var _size = buffer_get_size(_buff);
var _L = sqrt(_size / 4);

surf = surface_create(_L, _L);
buffer_set_surface(_buff, _surf, 0);

buffer_delete(_buff);

The code above provides a simple usage example.




Back To Top

GOG_Utils_GetImageSize

This function reads the width and height of the image of a specified ID.


Syntax:

GOG_Utils_GetImageSize(imageID)
Argument Type Description
imageID Real The ID of the image.



Returns:

Size


Example:

var _struct = GOG_Utils_GetImageSize(imageID);
var _width = _struct.width;
var _height = _struct.height;

The code above provides a simple usage example.




Back To Top

GOG_Utils_GetOverlayState

This function returns the current state of the overlay.


Syntax:

GOG_Utils_GetOverlayState()



Returns:

OverlayState


Example:

if(GOG_Utils_GetOverlayState() == GOG_OVERLAY_STATE_INITIALIZED)
{
   //Overlay initialized, do something
}

The code above provides a simple usage example.




Back To Top

GOG_Utils_IsOverlayVisible

This function returns the current visibility of the overlay.


Syntax:

GOG_Utils_IsOverlayVisible()



Returns:

Boolean


Example:

if(GOG_Utils_IsOverlayVisible())
{
   //Overlay visible, do something
}

The code above provides a simple usage example.




Back To Top

GOG_Utils_ShowOverlayWithWebPage

This function shows a web page in the overlay.


Syntax:

GOG_Utils_ShowOverlayWithWebPage(url)
Argument Type Description
url String The URL address of a specified web page with the limit of 2047 bytes.



Returns:

N/A


Example:

GOG_Utils_ShowOverlayWithWebPage("https://gamemaker.io");

The code above provides a simple usage example.




Back To Top

OverlayState

These constants represent the currect overlay state.

These constants are referenced by the following functions:


Member Description
GOG_OVERLAY_STATE_UNDEFINED Overlay state is undefined.
GOG_OVERLAY_STATE_NOT_SUPPORTED Overlay is not supported.
GOG_OVERLAY_STATE_DISABLED Overlay is disabled by the user in the Galaxy Client.
GOG_OVERLAY_STATE_FAILED_TO_INITIALIZE Galaxy Client failed to initialize the overlay or inject it into the game.
GOG_OVERLAY_STATE_INITIALIZED Overlay has been successfully injected into the game.


Back To Top

ServicesConnectionState

These constants represent the current state of the services connection.

These constants are referenced by the following functions:


Member Description
GOG_SERVICES_CONNECTION_STATE_UNDEFINED Connection state is undefined.
GOG_SERVICES_CONNECTION_STATE_CONNECTED Connection to the GOG services has been established.
GOG_SERVICES_CONNECTION_STATE_DISCONNECTED Connection to the GOG services has been lost.
GOG_SERVICES_CONNECTION_STATE_AUTH_LOST Connection to the GOG services has been lost due to lose of peer authentication.


Back To Top

Size

This struct contains an image's size

This struct is referenced by the following functions:


Member Type Description
width Real The width of the image.
height Real The height of the image.