Module ncine.gfx_device

The table containing the graphics device related functions

Functions

ncine.gfx_device.set_swap_interval (interval) Sets the number of vertical blanks to occur before a buffer swap.
ncine.gfx_device.is_fullscreen () Returns true if the device renders in full screen
ncine.gfx_device.set_fullscreen (in_fullscreen) Sets the full screen flag of the window
ncine.gfx_device.is_resizable () Returns true if the window is resizable
ncine.gfx_device.get_window_position_x () Returns the window horizontal position
ncine.gfx_device.get_window_position_y () Returns the window vertical position
ncine.gfx_device.get_window_position () Returns the window position as a ncine.vec2
ncine.gfx_device.set_window_position (position) Sets the position of the application window with a ncine.vec2
ncine.gfx_device.set_window_position (position_x, position_y) Sets the position of the application window with two integers
ncine.gfx_device.get_width () Returns the window or video mode width in screen coordinates
ncine.gfx_device.get_height () Returns the window or video mode height in screen coordinates
ncine.gfx_device.get_resolution () Returns the window or video mode resolution in screen coordinates as a ncine.vec2
ncine.gfx_device.get_aspect_ratio () Returns the window or video mode resolution aspect ratio
ncine.gfx_device.set_window_size (size) Sets the window size with a ncine.vec2.
ncine.gfx_device.set_window_size (width, height) Sets the window size with two integers.
ncine.gfx_device.get_drawable_width () Returns the window width in pixels.
ncine.gfx_device.get_drawable_height () Returns the window height in pixels.
ncine.gfx_device.get_drawable_resolution () Returns the window resolution in pixels as a ncine.vec2.
ncine.gfx_device.set_window_title (title) Sets the application window title
ncine.gfx_device.set_window_icon (icon_filename) Sets the application window icon
ncine.gfx_device.flash_window () Highlights the application window to notify the user
ncine.gfx_device.num_monitors () Returns the number of connected monitors
ncine.gfx_device.get_primary_monitor_index () Returns the array index of the primary monitor.
ncine.gfx_device.get_window_monitor_index () Returns the array index of the monitor associated with the window
ncine.gfx_device.get_monitor (index) Returns the specified monitor
ncine.gfx_device.get_current_video_mode () Returns the current video mode for the specified monitor
ncine.gfx_device.set_video_mode (mode_index) Sets the video mode that will be used in full screen by the monitor that hosts the window.
ncine.gfx_device.get_window_scaling_factor () Returns the scaling factor for application window

Tables

video_mode A table representing a video mode supported by a monitor
monitor A table representing a connected monitor


Functions

ncine.gfx_device.set_swap_interval (interval)
Sets the number of vertical blanks to occur before a buffer swap.

An interval of -1 will enable adaptive v-sync if available.

Parameters:

  • interval integer
ncine.gfx_device.is_fullscreen ()
Returns true if the device renders in full screen

Returns:

    boolean
ncine.gfx_device.set_fullscreen (in_fullscreen)
Sets the full screen flag of the window

Parameters:

  • in_fullscreen boolean
ncine.gfx_device.is_resizable ()
Returns true if the window is resizable

Returns:

    boolean
ncine.gfx_device.get_window_position_x ()
Returns the window horizontal position

Returns:

    integer
ncine.gfx_device.get_window_position_y ()
Returns the window vertical position

Returns:

    integer
ncine.gfx_device.get_window_position ()
Returns the window position as a ncine.vec2

Returns:

    ncine.vec2
ncine.gfx_device.set_window_position (position)
Sets the position of the application window with a ncine.vec2

Parameters:

  • position ncine.vec2
ncine.gfx_device.set_window_position (position_x, position_y)
Sets the position of the application window with two integers

Parameters:

  • position_x integer
  • position_y integer
ncine.gfx_device.get_width ()
Returns the window or video mode width in screen coordinates

Returns:

    integer
ncine.gfx_device.get_height ()
Returns the window or video mode height in screen coordinates

Returns:

    integer
ncine.gfx_device.get_resolution ()
Returns the window or video mode resolution in screen coordinates as a ncine.vec2

Returns:

    ncine.vec2
ncine.gfx_device.get_aspect_ratio ()
Returns the window or video mode resolution aspect ratio

Returns:

    number
ncine.gfx_device.set_window_size (size)
Sets the window size with a ncine.vec2.

If the application is in full screen this method will have no effect.

Parameters:

  • size ncine.vec2
ncine.gfx_device.set_window_size (width, height)
Sets the window size with two integers.

If the application is in full screen this method will have no effect.

Parameters:

  • width integer
  • height integer
ncine.gfx_device.get_drawable_width ()
Returns the window width in pixels.

It may differs from width() on HiDPI screens.

Returns:

    integer
ncine.gfx_device.get_drawable_height ()
Returns the window height in pixels.

It may differs from width() on HiDPI screens.

Returns:

    integer
ncine.gfx_device.get_drawable_resolution ()
Returns the window resolution in pixels as a ncine.vec2.

It may differs from width() on HiDPI screens.

Returns:

    ncine.vec2
ncine.gfx_device.set_window_title (title)
Sets the application window title

Parameters:

ncine.gfx_device.set_window_icon (icon_filename)
Sets the application window icon

Parameters:

ncine.gfx_device.flash_window ()
Highlights the application window to notify the user
ncine.gfx_device.num_monitors ()
Returns the number of connected monitors

Returns:

    integer
ncine.gfx_device.get_primary_monitor_index ()
Returns the array index of the primary monitor.

This is usually the monitor where elements like the task bar or global menu bar are located.

Returns:

    integer
ncine.gfx_device.get_window_monitor_index ()
Returns the array index of the monitor associated with the window

Returns:

    integer
ncine.gfx_device.get_monitor (index)
Returns the specified monitor

Parameters:

  • index integer

Returns:

    monitor
ncine.gfx_device.get_current_video_mode ()
Returns the current video mode for the specified monitor

Returns:

    video_mode
ncine.gfx_device.set_video_mode (mode_index)
Sets the video mode that will be used in full screen by the monitor that hosts the window.

Call this method before enabling full screen.

Parameters:

  • mode_index integer
ncine.gfx_device.get_window_scaling_factor ()
Returns the scaling factor for application window

Returns:

    number

Tables

video_mode
A table representing a video mode supported by a monitor

Fields:

  • width integer The video width
  • height integer The video height
  • refresh_rate number The refresh rate in Hz
  • red_bits integer The number of bits for the red channel
  • green_bits integer The number of bits for the green channel
  • blue_bits integer The number of bits for the blue channel
monitor
A table representing a connected monitor

Fields:

  • position (ncine.vec2) The position of the monitor’s viewport on the virtual screen
  • dpi (ncine.vec2) The horizontal and vertical dots per inch
  • scale (ncine.vec2) The content scale factor
  • video_modes (video_mode[]) The array of supported video modes
  • name string The monitor name
  • num_video_modes integer The number of video modes in the array
generated by LDoc 1.5.0 Last updated 2024-12-18 15:08:56