1gfx_mode_select_filter(3)       Allegro manual       gfx_mode_select_filter(3)
2
3
4

NAME

6       gfx_mode_select_filter  -  Even  more  extended version of the graphics
7       mode selection dialog. Allegro game programming library.
8

SYNOPSIS

10       #include <allegro.h>
11
12
13       int gfx_mode_select_filter(int *card, int *w, int *h, int *color_depth,
14       int (*filter)(int, int, int, int));
15

DESCRIPTION

17       Even more extended version of the graphics mode selection dialog, which
18       allows the programmer to customize the contents of the dialog  and  the
19       user  to  select the color depth as well as the resolution and hardware
20       driver.  `filter' will be passed (card, w, h, color_depth)  quadruplets
21       and  must return 0 to let the specified quadruplet be added to the list
22       of displayed modes.
23
24       As with gfx_mode_select, the values stored at the addresses  passed  to
25       the  function will be used as suggestions for the initial selections in
26       the dialog, defaulting to the first entry in each list  if  the  values
27       are  not  found.  Initialize the data stored at the addresses passed to
28       the function to the value of 0 or -1 if you want  to  ensure  that  the
29       initial selection for each list will be the first entry.
30
31       If the dialog is OK'd, it stores the selections at the addresses passed
32       to the function.
33
34       Example usage :
35
36          ret = gfx_mode_select_filter(&card, &w, &h, &color_depth, user_filter);
37          if (ret) {/* User okayed dialog or user_filter removed all modes */
38             if (card == GFX_NONE) {
39                // No modes available
40                *card = 0;/* Make sure not to leave *card == GFX_NONE */
41                return -1;
42             }
43             /* Handle changing to new mode here... */
44
45          } else {/* User cancelled dialog or there was an error (unlikely) */
46             if (card == GFX_NONE) {
47                /* Error, probably out of memory */
48                *card = 0;/* Make sure not to leave *card == GFX_NONE */
49                return -2;
50             }
51             /* Carry on in current graphics mode if that is acceptable */
52          }
53
54

RETURN VALUE

56       Returns zero if the user cancelled the dialog or an error occurred.  In
57       the  case  of  an  error then *card is assigned the value GFX_NONE. The
58       functions return non-zero if the user made a selection OR  if  all  the
59       modes  were  filtered  out. In the case that all of the modes were fil‐
60       tered out, then *card is assigned the value GFX_NONE.  This  means  you
61       should  NOT  initialize the *card to the value of GFX_NONE, as it could
62       interfere with determining the proper return value.
63
64

SEE ALSO

66       gfx_mode_select(3),     gfx_mode_select_ex(3),      set_color_depth(3),
67       set_gfx_mode(3), gui_fg_color(3)
68
69
70
71Allegro                          version 4.4.2       gfx_mode_select_filter(3)
Impressum