Class UiModule
- All Implemented Interfaces:
UiAPI
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionUiModule
(EventManager em, APIv2 api, String name) Create a new module with the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear both the headline and the sub-header messages.void
Clear the content of the headline message.void
Clear the content of the sub-header message.void
collapse_pane
(String name) Collapse the UI pane with the given name.void
disable()
Disable the GUI rendering.void
display_image
(int id, String path, double x, double y, double[] color) Same asUiAPI.display_image(int, String, float, float, float, float, float, float)
but using a double array for the color instead of each component separately.void
display_image
(int id, String path, double x, double y, List<?> color) void
display_image
(int id, String path, float x, float y) Add a new image object at the given coordinates.void
display_image
(int id, String path, float x, float y, float r, float g, float b, float a) Add a new image object at the given coordinates.void
display_message
(int id, String msg, double x, double y, double[] color, double size) Same asUiAPI.display_image(int, String, float, float, float, float, float, float)
but using an array for the color instead of giving each component separately.void
display_message
(int id, String message, double x, double y, List<?> color, double fontSize) void
display_message
(int id, String msg, float x, float y, float r, float g, float b, float a, float size) Add a new one-line message in the screen with the given id and the given coordinates.void
display_message
(int id, String message, float x, float y, float r, float g, float b, float a, int fontSize) void
Display a popup notification on the screen with the given contents for the default duration of 8 seconds.void
display_popup_notification
(String msg, float duration) Display a popup notification on the screen for the given duration.void
display_popup_notification
(String message, Double duration) void
display_text
(int id, String msg, float x, float y, float max_w, float max_h, float r, float g, float b, float a, float size) Add a new multi-line text in the screen with the given id, coordinates and size.void
display_text
(int id, String text, float x, float y, float maxWidth, float maxHeight, float r, float g, float b, float a, int fontSize) void
enable()
Enable the GUI rendering.void
expand_pane
(String name) Expand the UI pane with the given name.int
Return the height of the client area in logical pixels.int
Return the width of the client area in logical pixels.float[]
get_position_and_size
(String name) Return the size and position of the GUI actor that goes by the given name, or null if such element does not exist.float
Get the current scale factor applied to the UI.void
preload_texture
(String path) Preload the given image as a texture for later use.void
preload_textures
(String[] paths) Preload the given image file paths as textures for later use.void
reload()
Forces a re-initialization of the entire user interface of Gaia Sky.void
Remove all objects (messages, texts and images).void
remove_object
(int id) Remove the object with the given id.void
remove_objects
(int[] ids) Remove the items with the given ids.void
remove_objects
(List<?> ids) void
set_closest_crosshair_visibility
(boolean visible) Set the visibility of the closest object crosshair.void
set_crosshair_visibility
(boolean visible) Set the visibility of all crosshairs.void
set_focus_crosshair_visibility
(boolean visible) Set the visibility of the focus object crosshair.void
Set the contents of the headline message.void
set_home_crosshair_visibility
(boolean visible) Set the visibility of the home object crosshair.void
set_minimap_visibility
(boolean visible) Set the visibility of the minimap.void
Set the contents of the sub-header message.
-
Constructor Details
-
UiModule
Create a new module with the given attributes.- Parameters:
api
- Reference to the API class.name
- Name of the module.
-
-
Method Details
-
display_message
public void display_message(int id, String msg, float x, float y, float r, float g, float b, float a, float size) Description copied from interface:UiAPI
Add a new one-line message in the screen with the given id and the given coordinates. If an object already exists with the given id, it is removed. However, if a message object already exists with the same id, its properties are updated. The messages placed with this method will not appear in the screenshots/frames in advanced mode. This is intended for running interactively only.- Specified by:
display_message
in interfaceUiAPI
- Parameters:
id
- A unique identifier, used to identify this message when you want to remove it.msg
- The string message, to be displayed in one line. But explicit newline breaks the line.x
- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y
- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.r
- The red component of the color in [0,1].g
- The green component of the color in [0,1].b
- The blue component of the color in [0,1].a
- The alpha component of the color in [0,1].size
- The size of the font. The system will use the existing font closest to the chosen size and scale it up or down to match the desired size. Scaling can cause artifacts, so to ensure the best font quality, stick to the existing sizes.
-
display_message
Description copied from interface:UiAPI
Same asUiAPI.display_image(int, String, float, float, float, float, float, float)
but using an array for the color instead of giving each component separately.- Specified by:
display_message
in interfaceUiAPI
- Parameters:
id
- A unique identifier, used to identify this message when you want to remove it.msg
- The string message, to be displayed in one line. But explicit newline breaks the line.x
- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y
- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.color
- The color as an array of RGBA (red, green, blue, alpha) values in [0,1].size
- The size of the font. The system will use the existing font closest to the chosen size and scale it up or down to match the desired size. Scaling can cause artifacts, so to ensure the best font quality, stick to the existing sizes.
-
display_message
-
display_message
public void display_message(int id, String message, float x, float y, float r, float g, float b, float a, int fontSize) -
display_text
public void display_text(int id, String msg, float x, float y, float max_w, float max_h, float r, float g, float b, float a, float size) Description copied from interface:UiAPI
Add a new multi-line text in the screen with the given id, coordinates and size. If an object already exists with the given id, it is removed. However, if a text object already exists with the same id, its properties are updated. The texts placed with this method will not appear in the screenshots/frames in advanced mode. This is intended for running interactively only.- Specified by:
display_text
in interfaceUiAPI
- Parameters:
id
- A unique identifier, used to identify this message when you want to remove it.msg
- The string message, to be displayed line-wrapped in the box defined by maxWidth and maxHeight. Explicit newline still breaks the line.x
- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y
- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.max_w
- The maximum width in screen percentage [0,1]. Set to 0 to let the system decide.max_h
- The maximum height in screen percentage [0,1]. Set to 0 to let the system decide.r
- The red component of the color in [0,1].g
- The green component of the color in [0,1].b
- The blue component of the color in [0,1].a
- The alpha component of the color in [0,1].size
- The size of the font. The system will use the existing font closest to the chosen size.
-
display_text
public void display_text(int id, String text, float x, float y, float maxWidth, float maxHeight, float r, float g, float b, float a, int fontSize) -
display_image
public void display_image(int id, String path, float x, float y, float r, float g, float b, float a) Description copied from interface:UiAPI
Add a new image object at the given coordinates. If an object already exists with the given id, it is removed. However, if an image object already exists with the same id, its properties are updated.
Warning: This method will only work in the asynchronous mode. Run the script with the "asynchronous" check box activated!- Specified by:
display_image
in interfaceUiAPI
- Parameters:
id
- A unique identifier, used to identify this message when you want to remove it.path
- The path to the image. It can either be an absolute path (not recommended) or a path relative to the Gaia Sky work directory.x
- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y
- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.r
- The red component of the color in [0,1].g
- The green component of the color in [0,1].b
- The blue component of the color in [0,1].a
- The alpha component of the color in [0,1].
-
display_image
Description copied from interface:UiAPI
Same asUiAPI.display_image(int, String, float, float, float, float, float, float)
but using a double array for the color instead of each component separately.- Specified by:
display_image
in interfaceUiAPI
- Parameters:
id
- A unique identifier, used to identify this message when you want to remove it.path
- The path to the image. It can either be an absolute path (not recommended) or a path relative to the Gaia Sky work directory.x
- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y
- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.color
- The color as an array of RGBA (red, green, blue, alpha) values in [0,1].
-
display_image
-
display_image
Description copied from interface:UiAPI
Add a new image object at the given coordinates. If an object already exists with the given id, it is removed. However, if an image object already exists with the same id, its properties are updated.
The messages placed with this method will not appear in the screenshots/frames in advanced mode. This is intended for running interactively only.- Specified by:
display_image
in interfaceUiAPI
- Parameters:
id
- A unique identifier, used to identify this message when you want to remove it.path
- The path to the image. It can either be an absolute path (not recommended) or a path relative to the Gaia Sky work directory.x
- The x coordinate of the bottom-left corner, in [0,1] from left to right. This is not resolution-dependant.y
- The y coordinate of the bottom-left corner, in [0,1] from bottom to top. This is not resolution-dependant.
-
remove_all_objects
public void remove_all_objects()Description copied from interface:UiAPI
Remove all objects (messages, texts and images).- Specified by:
remove_all_objects
in interfaceUiAPI
-
remove_object
public void remove_object(int id) Description copied from interface:UiAPI
Remove the object with the given id.This object is assumed to have been added with
UiAPI.display_message(int, String, float, float, float, float, float, float, float)
,UiAPI.display_text(int, String, float, float, float, float, float, float, float, float, float)
, orUiAPI.display_image(int, String, float, float)
.- Specified by:
remove_object
in interfaceUiAPI
- Parameters:
id
- Integer with the integer id of the object to remove.
-
remove_objects
public void remove_objects(int[] ids) Description copied from interface:UiAPI
Remove the items with the given ids. They can either be messages, images or whatever else.The objects to remove are assumed to have been added with
UiAPI.display_message(int, String, float, float, float, float, float, float, float)
,UiAPI.display_text(int, String, float, float, float, float, float, float, float, float, float)
, orUiAPI.display_image(int, String, float, float)
.- Specified by:
remove_objects
in interfaceUiAPI
- Parameters:
ids
- Vector with the integer ids of the objects to remove.
-
remove_objects
-
enable
public void enable()Description copied from interface:UiAPI
Enable the GUI rendering. This makes the user interface to be rendered and updated again if it was previously disabled. Otherwise, it has no effect. -
disable
public void disable()Description copied from interface:UiAPI
Disable the GUI rendering. This causes the user interface to no longer be rendered or updated. -
get_client_width
public int get_client_width()Description copied from interface:UiAPI
Return the width of the client area in logical pixels.- Specified by:
get_client_width
in interfaceUiAPI
- Returns:
- The width in logical pixels.
-
get_client_height
public int get_client_height()Description copied from interface:UiAPI
Return the height of the client area in logical pixels.- Specified by:
get_client_height
in interfaceUiAPI
- Returns:
- The height in logical pixels.
-
get_position_and_size
Description copied from interface:UiAPI
Return the size and position of the GUI actor that goes by the given name, or null if such element does not exist.The actor names are given at creation, and are internal to the Gaia Sky source code. You need to dive into the source code if you want to manipulate GUI actors.
Warning: This will only work in asynchronous mode.
- Specified by:
get_position_and_size
in interfaceUiAPI
- Parameters:
name
- The name of the gui element.- Returns:
- A vector of floats with the position (0, 1) of the bottom left corner in pixels from the bottom-left of the screen and the size (2, 3) in pixels of the element.
-
get_ui_scale_factor
public float get_ui_scale_factor()Description copied from interface:UiAPI
Get the current scale factor applied to the UI.- Specified by:
get_ui_scale_factor
in interfaceUiAPI
- Returns:
- The scale factor.
-
expand_pane
Description copied from interface:UiAPI
Expand the UI pane with the given name. Possible names are:- Time
- Camera
- Visibility
- VisualSettings
- Datasets
- Bookmarks
- LocationLog
Please, mind the case!
- Specified by:
expand_pane
in interfaceUiAPI
-
collapse_pane
Description copied from interface:UiAPI
Collapse the UI pane with the given name. Possible names are:- Time
- Camera
- Visibility
- VisualSettings
- Datasets
- Bookmarks
- LocationLog
Please, mind the case!
- Specified by:
collapse_pane
in interfaceUiAPI
-
display_popup_notification
Description copied from interface:UiAPI
Display a popup notification on the screen with the given contents for the default duration of 8 seconds. The notification appears at the top-right of the screen and stays there until the duration time elapses, then it disappears.- Specified by:
display_popup_notification
in interfaceUiAPI
- Parameters:
msg
- The notification text.
-
display_popup_notification
Description copied from interface:UiAPI
Display a popup notification on the screen for the given duration. The notification appears at the top-right of the screen and stays there until the duration time elapses, then it disappears.- Specified by:
display_popup_notification
in interfaceUiAPI
- Parameters:
msg
- The notification text.duration
- The duration, in seconds, until the notification automatically disappears. Set this to a negative number so that the notification never expires. If this is the case, the notification must be manually closed by the user.
-
display_popup_notification
-
set_headline_message
Description copied from interface:UiAPI
Set the contents of the headline message. The headline message appears in the middle of the screen with a big font.- Specified by:
set_headline_message
in interfaceUiAPI
- Parameters:
msg
- The headline text.
-
set_subhead_message
Description copied from interface:UiAPI
Set the contents of the sub-header message. The sub-header message appears just below the headline message, in the middle of the screen, with a somewhat smaller font.- Specified by:
set_subhead_message
in interfaceUiAPI
- Parameters:
msg
- The sub-header text.
-
clear_headline_message
public void clear_headline_message()Description copied from interface:UiAPI
Clear the content of the headline message. After this method is called, the headline message disappears from screen.- Specified by:
clear_headline_message
in interfaceUiAPI
-
clear_subhead_message
public void clear_subhead_message()Description copied from interface:UiAPI
Clear the content of the sub-header message. After this method is called, the sub-header message disappears from screen.- Specified by:
clear_subhead_message
in interfaceUiAPI
-
clear_all_messages
public void clear_all_messages()Description copied from interface:UiAPI
Clear both the headline and the sub-header messages. After this method is called, both the headline and the sub-header messages disappear from screen.- Specified by:
clear_all_messages
in interfaceUiAPI
-
set_crosshair_visibility
public void set_crosshair_visibility(boolean visible) Description copied from interface:UiAPI
Set the visibility of all crosshairs. Affects the visibility of the focus, closest, and home objects' crosshairs.- Specified by:
set_crosshair_visibility
in interfaceUiAPI
- Parameters:
visible
- The visibility state, which applies to all cross-hairs.
-
set_focus_crosshair_visibility
public void set_focus_crosshair_visibility(boolean visible) Description copied from interface:UiAPI
Set the visibility of the focus object crosshair.- Specified by:
set_focus_crosshair_visibility
in interfaceUiAPI
- Parameters:
visible
- The visibility state.
-
set_closest_crosshair_visibility
public void set_closest_crosshair_visibility(boolean visible) Description copied from interface:UiAPI
Set the visibility of the closest object crosshair.- Specified by:
set_closest_crosshair_visibility
in interfaceUiAPI
- Parameters:
visible
- The visibility state.
-
set_home_crosshair_visibility
public void set_home_crosshair_visibility(boolean visible) Description copied from interface:UiAPI
Set the visibility of the home object crosshair.- Specified by:
set_home_crosshair_visibility
in interfaceUiAPI
- Parameters:
visible
- The visibility state.
-
set_minimap_visibility
public void set_minimap_visibility(boolean visible) Description copied from interface:UiAPI
Set the visibility of the minimap.- Specified by:
set_minimap_visibility
in interfaceUiAPI
- Parameters:
visible
- The visibility state.
-
preload_texture
Description copied from interface:UiAPI
Preload the given image as a texture for later use. The texture will be cached for later use.- Specified by:
preload_texture
in interfaceUiAPI
- Parameters:
path
- The path of the image file to preload as a string.
-
preload_textures
Description copied from interface:UiAPI
Preload the given image file paths as textures for later use. They will be cached for the subsequent uses.- Specified by:
preload_textures
in interfaceUiAPI
- Parameters:
paths
- The texture paths as an array of strings.
-
reload
public void reload()Description copied from interface:UiAPI
Forces a re-initialization of the entire user interface of Gaia Sky. This causes all elements in the UI to be disposed and re-created.
-