Monitors

These functions are declared in the main Allegro header file:

 #include <allegro5/allegro.h>

ALLEGRO_MONITOR_INFO

typedef struct ALLEGRO_MONITOR_INFO

Source Code

Describes a monitor’s size and position relative to other monitors. x1, y1 will be 0, 0 on the primary display. Other monitors can have negative values if they are to the left or above the primary display. x2, y2 are the coordinates one beyond the bottom right pixel, so that x2-x1 gives the width and y2-y1 gives the height of the display.

typedef struct ALLEGRO_MONITOR_INFO
{
   int x1;
   int y1;
   int x2;
   int y2;
} ALLEGRO_MONITOR_INFO;

See also: al_get_monitor_info

al_get_new_display_adapter

int al_get_new_display_adapter(void)

Source Code

Gets the video adapter index where new displays will be created by the calling thread, if previously set with al_set_new_display_adapter. Otherwise returns ALLEGRO_DEFAULT_DISPLAY_ADAPTER.

See also: al_set_new_display_adapter

al_set_new_display_adapter

void al_set_new_display_adapter(int adapter)

Source Code

Sets the adapter to use for new displays created by the calling thread. The adapter has a monitor attached to it. Information about the monitor can be gotten using al_get_num_video_adapters and al_get_monitor_info.

To return to the default behaviour, pass ALLEGRO_DEFAULT_DISPLAY_ADAPTER.

See also: al_get_num_video_adapters, al_get_monitor_info

al_get_monitor_info

bool al_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info)

Source Code

Get information about a monitor’s position on the desktop. adapter is a number from 0 to al_get_num_video_adapters()-1.

On Windows, use al_set_new_display_flags to switch between Direct3D and OpenGL backends, which will often have different adapters available.

Returns true on success, false on failure.

See also: ALLEGRO_MONITOR_INFO, al_get_num_video_adapters

Examples:

al_get_monitor_dpi

int al_get_monitor_dpi(int adapter)

Source Code

Get the dots per inch of a monitor attached to the display adapter.

Since: 5.2.5

See also: al_get_num_video_adapters

Examples:

al_get_num_video_adapters

int al_get_num_video_adapters(void)

Source Code

Get the number of video “adapters” attached to the computer. Each video card attached to the computer counts as one or more adapters. An adapter is thus really a video port that can have a monitor connected to it.

On Windows, use al_set_new_display_flags to switch between Direct3D and OpenGL backends, which will often have different adapters available.

See also: al_get_monitor_info

Examples:

al_get_monitor_refresh_rate

int al_get_monitor_refresh_rate(int adapter)

Source Code

Returns the current refresh rate of a monitor attached to the display adapter.

Since: 5.2.6

Unstable API: This is an experimental feature and currently only works on Windows.

See also: al_get_monitor_info

Allegro version 5.2.8 - Last updated: 2022-06-06 01:17:44 UTC