# Platform-specific functions

## Windows

These functions are declared in the following header file:

~~~~c
 #include <allegro5/allegro_windows.h>
~~~~

### API: al_get_win_window_handle

Returns the handle to the window that the passed display is using.

### API: al_win_add_window_callback

The specified callback function will intercept the window's message
before Allegro processes it. If the callback function consumes the event,
then it should return true. In that case, Allegro will not do anything
with the event.

The `userdata` pointer can be used to supply additional context to the
callback function. 

The callbacks are executed in the same order they were added.

Returns true if the callback was added.

Since: 5.1.2

### API: al_win_remove_window_callback

Removes the callback that was previously registered with 
[al_win_add_window_callback]. The `userdata` pointer must be the same as
what was used during the registration of the callback.

Returns true if the callback was removed.

Since: 5.1.2

## Mac OS X

These functions are declared in the following header file:

~~~~c
 #include <allegro5/allegro_osx.h>
~~~~

### API: al_osx_get_window

Retrieves the NSWindow handle associated with the Allegro display.

Since: 5.0.8, 5.1.3

## iPhone

These functions are declared in the following header file:

~~~~c
 #include <allegro5/allegro_iphone.h>
~~~~

### API: al_iphone_override_screen_scale

Original iPhones and iPod Touches had a screen resolution of 320x480
(in Portrait mode). When the iPhone 4 and iPod Touch 4th generation devices
came out, they were backwards compatible with all old iPhone apps. This
means that they assume a 320x480 screen resolution by default, while they
actually have a 640x960 pixel screen (exactly 2x on each dimension). An
API was added to allow access to the full (or in fact any fraction of the)
resolution of the new devices. This function is normally not needed, as in
the case when you want a scale of 2.0 for "retina display" resolution
(640x960). In that case you would just call al_create_display with the
larger width and height parameters. It is not limited to 2.0 scaling factors
however. You can use 1.5 or 0.5 or other values in between, however if it's
not an exact multiple of the original iPhone resolution, linear filtering
will be applied to the final image.

This function should be called BEFORE calling al_create_display.

### API: al_iphone_set_statusbar_orientation

Sets the orientation of the status bar, which can be one of the following:

-  ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT
-  ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN
-  ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT
-  ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT

Since: 5.1.0

### API: al_iphone_get_last_shake_time

Returns the time as reported by [al_get_time] when the device was last shaken.

Since: 5.1.0

### API: al_iphone_get_battery_level

Returns the level of the charge of the battery as a number between 0.0 (empty)
and 1.0 (full). If the device is currently being charged or connected
to a power supply, this function will also return 1.0 regardless of the real
battery charge level.

Since: 5.1.0

### API: al_iphone_get_screen_scale

Gets the current scaling factor of the screen.

Since: 5.1.0

See also: [al_iphone_override_screen_scale]

### API: al_iphone_get_view

Retrieves the UIView* (EAGLView*) associated with the Allegro display.

Since: 5.1.0

### API: al_iphone_get_window

Retrieves the UIWindow* associated with the Allegro display.

Since: 5.1.0

## Android

These functions are declared in the following header file:

~~~~c
 #include <allegro5/allegro_android.h>
~~~~

### API: al_android_set_apk_file_interface

This function will set up a custom [ALLEGRO_FILE_INTERFACE] that makes all
future calls of [al_fopen] read from the applicatons's APK file.

> *Note:* Currently, access to the APK file after calling this function is read
only.

Since: 5.1.2

### API: al_android_get_os_version

Returns a pointer to a static buffer that contains the version string of the
Android platform that the calling Allegro program is running on.

Since: 5.1.2
