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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title>Displays</title>
<style type="text/css">code{white-space: pre;}</style>
<link rel="stylesheet" href="pandoc.css" type="text/css" />
<script type="text/javascript" src="autosuggest.js"></script>
<script type="text/javascript" src="search_index.js"></script>
</head>
<body>
<div class="sidebar">
<div>
<ul>
<li><a href="index.html"><strong>Contents</strong></a></li>
<li><a href="config.html">Configuration files</a></li>
<li><a href="display.html">Display</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="file.html">File I/O</a></li>
<li><a href="fshook.html">Filesystem</a></li>
<li><a href="fixed.html">Fixed point math</a></li>
<li><a href="fullscreen_mode.html">Fullscreen modes</a></li>
<li><a href="graphics.html">Graphics</a></li>
<li><a href="joystick.html">Joystick</a></li>
<li><a href="keyboard.html">Keyboard</a></li>
<li><a href="memory.html">Memory</a></li>
<li><a href="monitor.html">Monitor</a></li>
<li><a href="mouse.html">Mouse</a></li>
<li><a href="path.html">Path</a></li>
<li><a href="state.html">State</a></li>
<li><a href="system.html">System</a></li>
<li><a href="threads.html">Threads</a></li>
<li><a href="time.html">Time</a></li>
<li><a href="timer.html">Timer</a></li>
<li><a href="transformations.html">Transformations</a></li>
<li><a href="utf8.html">UTF-8</a></li>
<li><a href="misc.html">Miscellaneous</a></li>
<li><a href="platform.html">Platform-specific</a></li>
<li><a href="direct3d.html">Direct3D</a></li>
<li><a href="opengl.html">OpenGL</a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>
<div>
<ul>
<li><a href="index.html#addons"><strong>Addons</strong></a></li>
<li><a href="audio.html">Audio addon</a></li>
<li><a href="acodec.html">Audio codecs</a></li>
<li><a href="color.html">Color addon</a></li>
<li><a href="font.html">Font addons</a></li>
<li><a href="image.html">Image I/O addon</a></li>
<li><a href="main.html">Main addon</a></li>
<li><a href="memfile.html">Memfile addon</a></li>
<li><a href="native_dialog.html">Native dialogs addon</a></li>
<li><a href="physfs.html">PhysicsFS addon</a></li>
<li><a href="primitives.html">Primitives addon</a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>
<div>
<ul>
<li><a href="index_all.html"><strong>Index</strong></a></li>
</ul>
<!-- The preceding blank line forces pandoc to terminate the list -->
</div>
<div class="searchbox">
<script type="text/javascript">
function on_search(index, control) {
// Note to self: the less-than sign must NOT converted to an entity!
// SCRIPT elements are special. The HTML validator gives bad advice.
for (i = 0; i < search_index.length; i++) {
if (search_index[i] == control.keywords[index]) {
break;
}
}
location.href = search_urls[i];
}
</script>
Search<br/> <input type="text" name="q" id="q" size="15" autocomplete="off"/><br/>
<script type="text/javascript"> new autosuggest("q", search_index, null, on_search); </script>
</div>
</div>
<div class="content">
<div id="header">
<h1 class="title">Displays</h1>
</div>
<div id="TOC">
<ul>
<li><a href="#display-creation">Display creation</a><ul>
<li><a href="#allegro_display">ALLEGRO_DISPLAY</a></li>
<li><a href="#al_create_display">al_create_display</a></li>
<li><a href="#al_destroy_display">al_destroy_display</a></li>
<li><a href="#al_get_new_display_flags">al_get_new_display_flags</a></li>
<li><a href="#al_set_new_display_flags">al_set_new_display_flags</a></li>
<li><a href="#al_get_new_display_option">al_get_new_display_option</a></li>
<li><a href="#al_set_new_display_option">al_set_new_display_option</a></li>
<li><a href="#al_reset_new_display_options">al_reset_new_display_options</a></li>
<li><a href="#al_get_new_window_position">al_get_new_window_position</a></li>
<li><a href="#al_set_new_window_position">al_set_new_window_position</a></li>
<li><a href="#al_get_new_display_refresh_rate">al_get_new_display_refresh_rate</a></li>
<li><a href="#al_set_new_display_refresh_rate">al_set_new_display_refresh_rate</a></li>
</ul></li>
<li><a href="#display-operations">Display operations</a><ul>
<li><a href="#al_get_display_event_source">al_get_display_event_source</a></li>
<li><a href="#al_get_backbuffer">al_get_backbuffer</a></li>
<li><a href="#al_flip_display">al_flip_display</a></li>
<li><a href="#al_update_display_region">al_update_display_region</a></li>
<li><a href="#al_wait_for_vsync">al_wait_for_vsync</a></li>
</ul></li>
<li><a href="#display-size-and-position">Display size and position</a><ul>
<li><a href="#al_get_display_width">al_get_display_width</a></li>
<li><a href="#al_get_display_height">al_get_display_height</a></li>
<li><a href="#al_resize_display">al_resize_display</a></li>
<li><a href="#al_acknowledge_resize">al_acknowledge_resize</a></li>
<li><a href="#al_get_window_position">al_get_window_position</a></li>
<li><a href="#al_set_window_position">al_set_window_position</a></li>
</ul></li>
<li><a href="#display-settings">Display settings</a><ul>
<li><a href="#al_get_display_flags">al_get_display_flags</a></li>
<li><a href="#al_set_display_flag">al_set_display_flag</a></li>
<li><a href="#al_toggle_display_flag">al_toggle_display_flag</a></li>
<li><a href="#al_get_display_option">al_get_display_option</a></li>
<li><a href="#al_get_display_format">al_get_display_format</a></li>
<li><a href="#al_get_display_refresh_rate">al_get_display_refresh_rate</a></li>
<li><a href="#al_set_window_title">al_set_window_title</a></li>
<li><a href="#al_set_display_icon">al_set_display_icon</a></li>
<li><a href="#al_set_display_icons">al_set_display_icons</a></li>
</ul></li>
<li><a href="#screensaver">Screensaver</a><ul>
<li><a href="#al_inhibit_screensaver">al_inhibit_screensaver</a></li>
</ul></li>
</ul>
</div>
<p>These functions are declared in the main Allegro header file:</p>
<pre><code>#include <allegro5/allegro.h></code></pre>
<h1 id="display-creation"><a href="#display-creation">Display creation</a></h1>
<h2 id="allegro_display"><a href="#allegro_display">ALLEGRO_DISPLAY</a></h2>
<pre><code>typedef struct ALLEGRO_DISPLAY ALLEGRO_DISPLAY;</code></pre>
<p>An opaque type representing an open display or window.</p>
<h2 id="al_create_display"><a href="#al_create_display">al_create_display</a></h2>
<pre><code>ALLEGRO_DISPLAY *al_create_display(int w, int h)</code></pre>
<p>Create a display, or window, with the specified dimensions. The parameters of the display are determined by the last calls to al_set_new_display_*. Default parameters are used if none are set explicitly. Creating a new display will automatically make it the active one, with the backbuffer selected for drawing.</p>
<p>Returns NULL on error.</p>
<p>Each display has a distinct OpenGL rendering context associated with it. See <a href="graphics.html#al_set_target_bitmap">al_set_target_bitmap</a> for the discussion about rendering contexts.</p>
<p>See also: <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a>, <a href="display.html#al_set_new_display_option">al_set_new_display_option</a>, <a href="display.html#al_set_new_display_refresh_rate">al_set_new_display_refresh_rate</a>, <a href="monitor.html#al_set_new_display_adapter">al_set_new_display_adapter</a>, <a href="display.html#al_set_window_position">al_set_window_position</a></p>
<h2 id="al_destroy_display"><a href="#al_destroy_display">al_destroy_display</a></h2>
<pre><code>void al_destroy_display(ALLEGRO_DISPLAY *display)</code></pre>
<p>Destroy a display.</p>
<p>If the target bitmap of the calling thread is tied to the display, then it implies a call to "al_set_target_bitmap(NULL);" before the display is destroyed.</p>
<p>That special case notwithstanding, you should make sure no threads are currently targeting a bitmap which is tied to the display before you destroy it.</p>
<p>See also: <a href="graphics.html#al_set_target_bitmap">al_set_target_bitmap</a></p>
<h2 id="al_get_new_display_flags"><a href="#al_get_new_display_flags">al_get_new_display_flags</a></h2>
<pre><code>int al_get_new_display_flags(void)</code></pre>
<p>Get the display flags to be used when creating new displays on the calling thread.</p>
<p>See also: <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a>, <a href="display.html#al_set_display_flag">al_set_display_flag</a></p>
<h2 id="al_set_new_display_flags"><a href="#al_set_new_display_flags">al_set_new_display_flags</a></h2>
<pre><code>void al_set_new_display_flags(int flags)</code></pre>
<p>Sets various flags to be used when creating new displays on the calling thread. flags is a bitfield containing any reasonable combination of the following:</p>
<dl>
<dt>ALLEGRO_WINDOWED</dt>
<dd><p>Prefer a windowed mode.</p>
<p>Under multi-head X (not XRandR/TwinView), the use of more than one adapter is impossible due to bugs in X and GLX. <a href="display.html#al_create_display">al_create_display</a> will fail if more than one adapter is attempted to be used.</p>
</dd>
<dt>ALLEGRO_FULLSCREEN</dt>
<dd><p>Prefer a fullscreen mode.</p>
<p>Under X the use of more than one FULLSCREEN display when using multi-head X, or true Xinerama is not possible due to bugs in X and GLX, display creation will fail if more than one adapter is attempted to be used.</p>
</dd>
<dt>ALLEGRO_FULLSCREEN_WINDOW</dt>
<dd><p>Make the window span the entire screen. Unlike ALLEGRO_FULLSCREEN this will never attempt to modify the screen resolution. Instead the pixel dimensions of the created display will be the same as the desktop.</p>
<p>The passed width and height are only used if the window is switched out of fullscreen mode later but will be ignored initially.</p>
<p>Under Windows and X11 a fullscreen display created with this flag will behave differently from one created with the ALLEGRO_FULLSCREEN flag - even if the ALLEGRO_FULLSCREEN display is passed the desktop dimensions. The exact difference is platform dependent, but some things which may be different is how alt-tab works, how fast you can toggle between fullscreen/windowed mode or how additional monitors behave while your display is in fullscreen mode.</p>
<p>Additionally under X, the use of more than one adapter in multi-head mode or with true Xinerama enabled is impossible due to bugs in X/GLX, creation will fail if more than one adapter is attempted to be used.</p>
</dd>
<dt>ALLEGRO_RESIZABLE</dt>
<dd><p>The display is resizable (only applicable if combined with ALLEGRO_WINDOWED).</p>
</dd>
<dt>ALLEGRO_OPENGL</dt>
<dd><p>Require the driver to provide an initialized OpenGL context after returning successfully.</p>
</dd>
<dt>ALLEGRO_OPENGL_3_0</dt>
<dd><p>Require the driver to provide an initialized OpenGL context compatible with OpenGL version 3.0.</p>
</dd>
<dt>ALLEGRO_OPENGL_FORWARD_COMPATIBLE</dt>
<dd><p>If this flag is set, the OpenGL context created with ALLEGRO_OPENGL_3_0 will be forward compatible <em>only</em>, meaning that all of the OpenGL API declared deprecated in OpenGL 3.0 will not be supported. Currently, a display created with this flag will <em>not</em> be compatible with Allegro drawing routines; the display option ALLEGRO_COMPATIBLE_DISPLAY will be set to false.</p>
</dd>
<dt>ALLEGRO_DIRECT3D</dt>
<dd><p>Require the driver to do rendering with Direct3D and provide a Direct3D device.</p>
</dd>
<dt>ALLEGRO_FRAMELESS</dt>
<dd><p>Try to create a window without a frame (i.e. no border or titlebar). This usually does nothing for fullscreen modes, and even in windowed modes it depends on the underlying platform whether it is supported or not. Since: 5.0.7, 5.1.2</p>
</dd>
<dt>ALLEGRO_NOFRAME</dt>
<dd><p>Original name for ALLEGRO_FRAMELESS. This works with older versions of Allegro.</p>
</dd>
<dt>ALLEGRO_GENERATE_EXPOSE_EVENTS</dt>
<dd><p>Let the display generate expose events.</p>
</dd>
</dl>
<p>0 can be used for default values.</p>
<p>See also: <a href="display.html#al_set_new_display_option">al_set_new_display_option</a>, <a href="display.html#al_get_display_option">al_get_display_option</a>, [al_change_display_option]</p>
<h2 id="al_get_new_display_option"><a href="#al_get_new_display_option">al_get_new_display_option</a></h2>
<pre><code>int al_get_new_display_option(int option, int *importance)</code></pre>
<p>Retrieve an extra display setting which was previously set with <a href="display.html#al_set_new_display_option">al_set_new_display_option</a>.</p>
<h2 id="al_set_new_display_option"><a href="#al_set_new_display_option">al_set_new_display_option</a></h2>
<pre><code>void al_set_new_display_option(int option, int value, int importance)</code></pre>
<p>Set an extra display option, to be used when creating new displays on the calling thread. Display options differ from display flags, and specify some details of the context to be created within the window itself. These mainly have no effect on Allegro itself, but you may want to specify them, for example if you want to use multisampling.</p>
<p>The 'importance' parameter can be either:</p>
<ul>
<li>ALLEGRO_REQUIRE - The display will not be created if the setting can not be met.</li>
<li>ALLEGRO_SUGGEST - If the setting is not available, the display will be created anyway. FIXME: We need a way to query the settings back from a created display.</li>
<li>ALLEGRO_DONTCARE - If you added a display option with one of the above two settings before, it will be removed again. Else this does nothing.</li>
</ul>
<p>The supported options are:</p>
<dl>
<dt>ALLEGRO_COLOR_SIZE</dt>
<dd><p>This can be used to ask for a specific bit depth. For example to force a 16-bit framebuffer set this to 16.</p>
</dd>
<dt>ALLEGRO_RED_SIZE, ALLEGRO_GREEN_SIZE, ALLEGRO_BLUE_SIZE, ALLEGRO_ALPHA_SIZE</dt>
<dd><p>Individual color component size in bits.</p>
</dd>
<dt>ALLEGRO_RED_SHIFT, ALLEGRO_GREEN_SHIFT, ALLEGRO_BLUE_SHIFT, ALLEGRO_ALPHA_SHIFT</dt>
<dd><p>Together with the previous settings these can be used to specify the exact pixel layout the display should use. Normally there is no reason to use these.</p>
</dd>
<dt>ALLEGRO_ACC_RED_SIZE, ALLEGRO_ACC_GREEN_SIZE, ALLEGRO_ACC_BLUE_SIZE, ALLEGRO_ACC_ALPHA_SIZE</dt>
<dd><p>This can be used to define the required accumulation buffer size.</p>
</dd>
<dt>ALLEGRO_STEREO</dt>
<dd><p>Whether the display is a stereo display.</p>
</dd>
<dt>ALLEGRO_AUX_BUFFERS</dt>
<dd><p>Number of auxiliary buffers the display should have.</p>
</dd>
<dt>ALLEGRO_DEPTH_SIZE</dt>
<dd><p>How many depth buffer (z-buffer) bits to use.</p>
</dd>
<dt>ALLEGRO_STENCIL_SIZE</dt>
<dd><p>How many bits to use for the stencil buffer.</p>
</dd>
<dt>ALLEGRO_SAMPLE_BUFFERS</dt>
<dd><p>Whether to use multisampling (1) or not (0).</p>
</dd>
<dt>ALLEGRO_SAMPLES</dt>
<dd><p>If the above is 1, the number of samples to use per pixel. Else 0.</p>
</dd>
<dt>ALLEGRO_RENDER_METHOD:</dt>
<dd><p>0 if hardware acceleration is not used with this display.</p>
</dd>
<dt>ALLEGRO_FLOAT_COLOR</dt>
<dd><p>Whether to use floating point color components.</p>
</dd>
<dt>ALLEGRO_FLOAT_DEPTH</dt>
<dd><p>Whether to use a floating point depth buffer.</p>
</dd>
<dt>ALLEGRO_SINGLE_BUFFER</dt>
<dd><p>Whether the display uses a single buffer (1) or another update method (0).</p>
</dd>
<dt>ALLEGRO_SWAP_METHOD</dt>
<dd><p>If the above is 0, this is set to 1 to indicate the display is using a copying method to make the next buffer in the flip chain available, or to 2 to indicate a flipping or other method.</p>
</dd>
<dt>ALLEGRO_COMPATIBLE_DISPLAY</dt>
<dd><p>Indicates if Allegro's graphics functions can use this display. If you request a display not useable by Allegro, you can still use for example OpenGL to draw graphics.</p>
</dd>
<dt>ALLEGRO_UPDATE_DISPLAY_REGION</dt>
<dd><p>Set to 1 if the display is capable of updating just a region, and 0 if calling <a href="display.html#al_update_display_region">al_update_display_region</a> is equivalent to <a href="display.html#al_flip_display">al_flip_display</a>.</p>
</dd>
<dt>ALLEGRO_VSYNC</dt>
<dd><p>Set to 1 to tell the driver to wait for vsync in <a href="display.html#al_flip_display">al_flip_display</a>, or to 2 to force vsync off. The default of 0 means that Allegro does not try to modify the vsync behavior so it may be on or off. Note that even in the case of 1 or 2 it is possible to override the vsync behavior in the graphics driver so you should not rely on it.</p>
</dd>
<dt>ALLEGRO_MAX_BITMAP_SIZE</dt>
<dd><p>When queried this returns the maximum size (width as well as height) a bitmap can have for this display. Calls to <a href="graphics.html#al_create_bitmap">al_create_bitmap</a> or <a href="graphics.html#al_load_bitmap">al_load_bitmap</a> for bitmaps larger than this size will fail. It does not apply to memory bitmaps which always can have arbitrary size (but are slow for drawing).</p>
</dd>
<dt>ALLEGRO_SUPPORT_NPOT_BITMAP</dt>
<dd><p>Set to 1 if textures used for bitmaps on this display can have a size which is not a power of two. This is mostly useful if you use Allegro to load textures as otherwise only power-of-two textures will be used internally as bitmap storage.</p>
</dd>
<dt>ALLEGRO_CAN_DRAW_INTO_BITMAP</dt>
<dd><p>Set to 1 if you can use <a href="graphics.html#al_set_target_bitmap">al_set_target_bitmap</a> on bitmaps of this display to draw into them. If this is not the case software emulation will be used when drawing into display bitmaps (which can be very slow).</p>
</dd>
<dt>ALLEGRO_SUPPORT_SEPARATE_ALPHA</dt>
<dd><p>This is set to 1 if the <a href="graphics.html#al_set_separate_blender">al_set_separate_blender</a> function is supported. Otherwise the alpha parameters will be ignored.</p>
</dd>
</dl>
<p>See also: <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a></p>
<h2 id="al_reset_new_display_options"><a href="#al_reset_new_display_options">al_reset_new_display_options</a></h2>
<pre><code>void al_reset_new_display_options(void)</code></pre>
<p>This undoes any previous call to <a href="display.html#al_set_new_display_option">al_set_new_display_option</a> on the calling thread.</p>
<h2 id="al_get_new_window_position"><a href="#al_get_new_window_position">al_get_new_window_position</a></h2>
<pre><code>void al_get_new_window_position(int *x, int *y)</code></pre>
<p>Get the position where new non-fullscreen displays created by the calling thread will be placed.</p>
<p>See also: <a href="display.html#al_set_new_window_position">al_set_new_window_position</a></p>
<h2 id="al_set_new_window_position"><a href="#al_set_new_window_position">al_set_new_window_position</a></h2>
<pre><code>void al_set_new_window_position(int x, int y)</code></pre>
<p>Sets where the top left pixel of the client area of newly created windows (non-fullscreen) will be on screen, for displays created by the calling thread. Negative values allowed on some multihead systems.</p>
<p>To reset to the default behaviour, pass (INT_MAX, INT_MAX).</p>
<p>See also: <a href="display.html#al_get_new_window_position">al_get_new_window_position</a></p>
<h2 id="al_get_new_display_refresh_rate"><a href="#al_get_new_display_refresh_rate">al_get_new_display_refresh_rate</a></h2>
<pre><code>int al_get_new_display_refresh_rate(void)</code></pre>
<p>Get the requested refresh rate to be used when creating new displays on the calling thread.</p>
<p>See also: <a href="display.html#al_set_new_display_refresh_rate">al_set_new_display_refresh_rate</a></p>
<h2 id="al_set_new_display_refresh_rate"><a href="#al_set_new_display_refresh_rate">al_set_new_display_refresh_rate</a></h2>
<pre><code>void al_set_new_display_refresh_rate(int refresh_rate)</code></pre>
<p>Sets the refresh rate to use when creating new displays on the calling thread. If the refresh rate is not available, <a href="display.html#al_create_display">al_create_display</a> will fail. A list of modes with refresh rates can be found with <a href="fullscreen_mode.html#al_get_num_display_modes">al_get_num_display_modes</a> and <a href="fullscreen_mode.html#al_get_display_mode">al_get_display_mode</a>.</p>
<p>The default setting is zero (don't care).</p>
<p>See also: <a href="display.html#al_get_new_display_refresh_rate">al_get_new_display_refresh_rate</a></p>
<h1 id="display-operations"><a href="#display-operations">Display operations</a></h1>
<h2 id="al_get_display_event_source"><a href="#al_get_display_event_source">al_get_display_event_source</a></h2>
<pre><code>ALLEGRO_EVENT_SOURCE *al_get_display_event_source(ALLEGRO_DISPLAY *display)</code></pre>
<p>Retrieve the associated event source.</p>
<h2 id="al_get_backbuffer"><a href="#al_get_backbuffer">al_get_backbuffer</a></h2>
<pre><code>ALLEGRO_BITMAP *al_get_backbuffer(ALLEGRO_DISPLAY *display)</code></pre>
<p>Return a special bitmap representing the back-buffer of the display.</p>
<p>Care should be taken when using the backbuffer bitmap (and its sub-bitmaps) as the source bitmap (e.g as the bitmap argument to <a href="graphics.html#al_draw_bitmap">al_draw_bitmap</a>). Only untransformed operations are hardware accelerated. This consists of <a href="graphics.html#al_draw_bitmap">al_draw_bitmap</a> and <a href="graphics.html#al_draw_bitmap_region">al_draw_bitmap_region</a> when the current transformation is the identity. If the tranformation is not the identity, or some other drawing operation is used, the call will be routed through the memory bitmap routines, which are slow. If you need those operations to be accelerated, then first copy a region of the backbuffer into a temporary bitmap (via the <a href="graphics.html#al_draw_bitmap">al_draw_bitmap</a> and <a href="graphics.html#al_draw_bitmap_region">al_draw_bitmap_region</a>), and then use that temporary bitmap as the source bitmap.</p>
<h2 id="al_flip_display"><a href="#al_flip_display">al_flip_display</a></h2>
<pre><code>void al_flip_display(void)</code></pre>
<p>Copies or updates the front and back buffers so that what has been drawn previously on the currently selected display becomes visible on screen. Pointers to the special back buffer bitmap remain valid and retain their semantics as the back buffer, although the contents may have changed.</p>
<p>Several display options change how this function behaves:</p>
<ul>
<li><p>With ALLEGRO_SINGLE_BUFFER, no flipping is done. You still have to call this function to display graphics, depending on how the used graphics system works.</p></li>
<li><p>The ALLEGRO_SWAP_METHOD option may have additional information about what kind of operation is used internally to flip the front and back buffers.</p></li>
<li><p>If ALLEGRO_VSYNC is 1, this function will force waiting for vsync. If ALLEGRO_VSYNC is 2, this function will not wait for vsync. With many drivers the vsync behavior is controlled by the user and not the application, and ALLEGRO_VSYNC will not be set; in this case <a href="display.html#al_flip_display">al_flip_display</a> will wait for vsync depending on the settings set in the system's graphics preferences.</p></li>
</ul>
<p>See also: <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a>, <a href="display.html#al_set_new_display_option">al_set_new_display_option</a></p>
<h2 id="al_update_display_region"><a href="#al_update_display_region">al_update_display_region</a></h2>
<pre><code>void al_update_display_region(int x, int y, int width, int height)</code></pre>
<p>Does the same as <a href="display.html#al_flip_display">al_flip_display</a>, but tries to update only the specified region. With many drivers this is not possible, but for some it can improve performance.</p>
<p>The ALLEGRO_UPDATE_DISPLAY_REGION option (see <a href="display.html#al_get_display_option">al_get_display_option</a>) will specify the behavior of this function in the display.</p>
<p>See also: <a href="display.html#al_flip_display">al_flip_display</a>, <a href="display.html#al_get_display_option">al_get_display_option</a></p>
<h2 id="al_wait_for_vsync"><a href="#al_wait_for_vsync">al_wait_for_vsync</a></h2>
<pre><code>bool al_wait_for_vsync(void)</code></pre>
<p>Wait for the beginning of a vertical retrace. Some driver/card/monitor combinations may not be capable of this.</p>
<p>Note how <a href="display.html#al_flip_display">al_flip_display</a> usually already waits for the vertical retrace, so unless you are doing something special, there is no reason to call this function.</p>
<p>Returns false if not possible, true if successful.</p>
<p>See also: <a href="display.html#al_flip_display">al_flip_display</a></p>
<h1 id="display-size-and-position"><a href="#display-size-and-position">Display size and position</a></h1>
<h2 id="al_get_display_width"><a href="#al_get_display_width">al_get_display_width</a></h2>
<pre><code>int al_get_display_width(ALLEGRO_DISPLAY *display)</code></pre>
<p>Gets the width of the display. This is like SCREEN_W in Allegro 4.x.</p>
<p>See also: <a href="display.html#al_get_display_height">al_get_display_height</a></p>
<h2 id="al_get_display_height"><a href="#al_get_display_height">al_get_display_height</a></h2>
<pre><code>int al_get_display_height(ALLEGRO_DISPLAY *display)</code></pre>
<p>Gets the height of the display. This is like SCREEN_H in Allegro 4.x.</p>
<p>See also: <a href="display.html#al_get_display_width">al_get_display_width</a></p>
<h2 id="al_resize_display"><a href="#al_resize_display">al_resize_display</a></h2>
<pre><code>bool al_resize_display(ALLEGRO_DISPLAY *display, int width, int height)</code></pre>
<p>Resize the display. Returns true on success, or false on error. This works on both fullscreen and windowed displays, regardless of the ALLEGRO_RESIZABLE flag.</p>
<p>Adjusts the clipping rectangle to the full size of the backbuffer.</p>
<p>See also: <a href="display.html#al_acknowledge_resize">al_acknowledge_resize</a></p>
<h2 id="al_acknowledge_resize"><a href="#al_acknowledge_resize">al_acknowledge_resize</a></h2>
<pre><code>bool al_acknowledge_resize(ALLEGRO_DISPLAY *display)</code></pre>
<p>When the user receives a resize event from a resizable display, if they wish the display to be resized they must call this function to let the graphics driver know that it can now resize the display. Returns true on success.</p>
<p>Adjusts the clipping rectangle to the full size of the backbuffer.</p>
<p>Note that a resize event may be outdated by the time you acknowledge it; there could be further resize events generated in the meantime.</p>
<p>See also: <a href="display.html#al_resize_display">al_resize_display</a>, <a href="events.html#allegro_event">ALLEGRO_EVENT</a></p>
<h2 id="al_get_window_position"><a href="#al_get_window_position">al_get_window_position</a></h2>
<pre><code>void al_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y)</code></pre>
<p>Gets the position of a non-fullscreen display.</p>
<p>See also: <a href="display.html#al_set_window_position">al_set_window_position</a></p>
<h2 id="al_set_window_position"><a href="#al_set_window_position">al_set_window_position</a></h2>
<pre><code>void al_set_window_position(ALLEGRO_DISPLAY *display, int x, int y)</code></pre>
<p>Sets the position on screen of a non-fullscreen display.</p>
<p>See also: <a href="display.html#al_get_window_position">al_get_window_position</a></p>
<h1 id="display-settings"><a href="#display-settings">Display settings</a></h1>
<h2 id="al_get_display_flags"><a href="#al_get_display_flags">al_get_display_flags</a></h2>
<pre><code>int al_get_display_flags(ALLEGRO_DISPLAY *display)</code></pre>
<p>Gets the flags of the display.</p>
<p>In addition to the flags set for the display at creation time with <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a> it can also have the ALLEGRO_MINIMIZED flag set, indicating that the window is currently minimized. This flag is very platform-dependent as even a minimized application may still render a preview version so normally you should not care whether it is minimized or not.</p>
<p>See also: <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a>, <a href="display.html#al_set_display_flag">al_set_display_flag</a></p>
<h2 id="al_set_display_flag"><a href="#al_set_display_flag">al_set_display_flag</a></h2>
<pre><code>bool al_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff)</code></pre>
<p>Enable or disable one of the display flags. The flags are the same as for <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a>. The only flags that can be changed after creation are:</p>
<ul>
<li>ALLEGRO_FULLSCREEN_WINDOW</li>
<li>ALLEGRO_FRAMELESS</li>
</ul>
<p>Returns true if the driver supports toggling the specified flag else false. You can use <a href="display.html#al_get_display_flags">al_get_display_flags</a> to query whether the given display property actually changed.</p>
<p>Since: 5.0.7, 5.1.2</p>
<p>See also: <a href="display.html#al_set_new_display_flags">al_set_new_display_flags</a>, <a href="display.html#al_get_display_flags">al_get_display_flags</a></p>
<h2 id="al_toggle_display_flag"><a href="#al_toggle_display_flag">al_toggle_display_flag</a></h2>
<pre><code>bool al_toggle_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff)</code></pre>
<p>Deprecated synonym for <a href="display.html#al_set_display_flag">al_set_display_flag</a>.</p>
<h2 id="al_get_display_option"><a href="#al_get_display_option">al_get_display_option</a></h2>
<pre><code>int al_get_display_option(ALLEGRO_DISPLAY *display, int option)</code></pre>
<p>Return an extra display setting of the display.</p>
<p>See also: <a href="display.html#al_set_new_display_option">al_set_new_display_option</a></p>
<h2 id="al_get_display_format"><a href="#al_get_display_format">al_get_display_format</a></h2>
<pre><code>int al_get_display_format(ALLEGRO_DISPLAY *display)</code></pre>
<p>Gets the pixel format of the display.</p>
<p>See also: <a href="graphics.html#allegro_pixel_format">ALLEGRO_PIXEL_FORMAT</a></p>
<h2 id="al_get_display_refresh_rate"><a href="#al_get_display_refresh_rate">al_get_display_refresh_rate</a></h2>
<pre><code>int al_get_display_refresh_rate(ALLEGRO_DISPLAY *display)</code></pre>
<p>Gets the refresh rate of the display.</p>
<p>See also: <a href="display.html#al_set_new_display_refresh_rate">al_set_new_display_refresh_rate</a></p>
<h2 id="al_set_window_title"><a href="#al_set_window_title">al_set_window_title</a></h2>
<pre><code>void al_set_window_title(ALLEGRO_DISPLAY *display, const char *title)</code></pre>
<p>Set the title on a display.</p>
<p>See also: <a href="display.html#al_set_display_icon">al_set_display_icon</a>, <a href="display.html#al_set_display_icons">al_set_display_icons</a></p>
<h2 id="al_set_display_icon"><a href="#al_set_display_icon">al_set_display_icon</a></h2>
<pre><code>void al_set_display_icon(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *icon)</code></pre>
<p>Changes the icon associated with the display (window). Same as <a href="display.html#al_set_display_icons">al_set_display_icons</a> with one icon.</p>
<p>See also: <a href="display.html#al_set_display_icons">al_set_display_icons</a>, <a href="display.html#al_set_window_title">al_set_window_title</a></p>
<h2 id="al_set_display_icons"><a href="#al_set_display_icons">al_set_display_icons</a></h2>
<pre><code>void al_set_display_icons(ALLEGRO_DISPLAY *display,
int num_icons, ALLEGRO_BITMAP *icons[])</code></pre>
<p>Changes the icons associated with the display (window). Multiple icons can be provided for use in different contexts, e.g. window frame, taskbar, alt-tab popup. The number of icons must be at least one.</p>
<blockquote>
<p><em>Note:</em> If the underlying OS requires an icon of a size not provided then one of the bitmaps will be scaled up or down to the required size. The choice of bitmap is implementation dependent.</p>
</blockquote>
<p>Since: 5.0.9, 5.1.5</p>
<p>See also: <a href="display.html#al_set_display_icon">al_set_display_icon</a>, <a href="display.html#al_set_window_title">al_set_window_title</a></p>
<h1 id="screensaver"><a href="#screensaver">Screensaver</a></h1>
<h2 id="al_inhibit_screensaver"><a href="#al_inhibit_screensaver">al_inhibit_screensaver</a></h2>
<pre><code>bool al_inhibit_screensaver(bool inhibit)</code></pre>
<p>This function allows the user to stop the system screensaver from starting up if true is passed, or resets the system back to the default state (the state at program start) if false is passed. It returns true if the state was set successfully, otherwise false.</p>
<p class="timestamp">
Allegro version 5.0.10
- Last updated: 2013-06-16 03:32:08 UTC
</p>
</div>
</body>
</html>
|