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

Examples:

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.10 - Last updated: 2024-11-28 03:30:53 UTC