-
Notifications
You must be signed in to change notification settings - Fork 279
/
ex_monitorinfo.c
47 lines (34 loc) · 1.05 KB
/
ex_monitorinfo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "allegro5/allegro.h"
#include <stdio.h>
#include "common.c"
int main(int argc, char **argv)
{
ALLEGRO_MONITOR_INFO info;
int num_adapters;
int i, j;
(void)argc;
(void)argv;
if (!al_init()) {
abort_example("Could not init Allegro.\n");
}
open_log();
num_adapters = al_get_num_video_adapters();
log_printf("%d adapters found...\n", num_adapters);
for (i = 0; i < num_adapters; i++) {
al_get_monitor_info(i, &info);
log_printf("Adapter %d: ", i);
int dpi = al_get_monitor_dpi(i);
log_printf("(%d, %d) - (%d, %d) - dpi: %d\n", info.x1, info.y1, info.x2, info.y2, dpi);
al_set_new_display_adapter(i);
log_printf(" Available fullscreen display modes:\n");
for (j = 0; j < al_get_num_display_modes(); j++) {
ALLEGRO_DISPLAY_MODE mode;
al_get_display_mode(j, &mode);
log_printf(" Mode %3d: %4d x %4d, %d Hz\n",
j, mode.width, mode.height, mode.refresh_rate);
}
}
close_log(true);
return 0;
}
/* vim: set sts=3 sw=3 et: */