1use crate::bitmap::ALLEGRO_BITMAP;
6use crate::events::ALLEGRO_EVENT_SOURCE;
7
8use allegro_util::c_bool;
9use libc::*;
10
11pub const ALLEGRO_WINDOWED: u32 = 1 << 0;
12pub const ALLEGRO_FULLSCREEN: u32 = 1 << 1;
13pub const ALLEGRO_OPENGL: u32 = 1 << 2;
14pub const ALLEGRO_DIRECT3D_INTERNAL: u32 = 1 << 3;
15pub const ALLEGRO_RESIZABLE: u32 = 1 << 4;
16pub const ALLEGRO_FRAMELESS: u32 = 1 << 5;
17pub const ALLEGRO_NOFRAME: u32 = ALLEGRO_FRAMELESS;
18pub const ALLEGRO_GENERATE_EXPOSE_EVENTS: u32 = 1 << 6;
19pub const ALLEGRO_OPENGL_3_0: u32 = 1 << 7;
20pub const ALLEGRO_OPENGL_FORWARD_COMPATIBLE: u32 = 1 << 8;
21pub const ALLEGRO_FULLSCREEN_WINDOW: u32 = 1 << 9;
22pub const ALLEGRO_MINIMIZED: u32 = 1 << 10;
23pub const ALLEGRO_PROGRAMMABLE_PIPELINE: u32 = 1 << 11;
24pub const ALLEGRO_MAXIMIZED: u32 = 1 << 13;
25pub const ALLEGRO_OPENGL_ES_PROFILE: u32 = 1 << 14;
26
27pub const ALLEGRO_RED_SIZE: u32 = 0;
28pub const ALLEGRO_GREEN_SIZE: u32 = 1;
29pub const ALLEGRO_BLUE_SIZE: u32 = 2;
30pub const ALLEGRO_ALPHA_SIZE: u32 = 3;
31pub const ALLEGRO_RED_SHIFT: u32 = 4;
32pub const ALLEGRO_GREEN_SHIFT: u32 = 5;
33pub const ALLEGRO_BLUE_SHIFT: u32 = 6;
34pub const ALLEGRO_ALPHA_SHIFT: u32 = 7;
35pub const ALLEGRO_ACC_RED_SIZE: u32 = 8;
36pub const ALLEGRO_ACC_GREEN_SIZE: u32 = 9;
37pub const ALLEGRO_ACC_BLUE_SIZE: u32 = 10;
38pub const ALLEGRO_ACC_ALPHA_SIZE: u32 = 11;
39pub const ALLEGRO_STEREO: u32 = 12;
40pub const ALLEGRO_AUX_BUFFERS: u32 = 13;
41pub const ALLEGRO_COLOR_SIZE: u32 = 14;
42pub const ALLEGRO_DEPTH_SIZE: u32 = 15;
43pub const ALLEGRO_STENCIL_SIZE: u32 = 16;
44pub const ALLEGRO_SAMPLE_BUFFERS: u32 = 17;
45pub const ALLEGRO_SAMPLES: u32 = 18;
46pub const ALLEGRO_RENDER_METHOD: u32 = 19;
47pub const ALLEGRO_FLOAT_COLOR: u32 = 20;
48pub const ALLEGRO_FLOAT_DEPTH: u32 = 21;
49pub const ALLEGRO_SINGLE_BUFFER: u32 = 22;
50pub const ALLEGRO_SWAP_METHOD: u32 = 23;
51pub const ALLEGRO_COMPATIBLE_DISPLAY: u32 = 24;
52pub const ALLEGRO_UPDATE_DISPLAY_REGION: u32 = 25;
53pub const ALLEGRO_VSYNC: u32 = 26;
54pub const ALLEGRO_MAX_BITMAP_SIZE: u32 = 27;
55pub const ALLEGRO_SUPPORT_NPOT_BITMAP: u32 = 28;
56pub const ALLEGRO_CAN_DRAW_INTO_BITMAP: u32 = 29;
57pub const ALLEGRO_SUPPORT_SEPARATE_ALPHA: u32 = 30;
58pub const ALLEGRO_DISPLAY_OPTIONS_COUNT: u32 = 31;
59
60pub const ALLEGRO_DONTCARE: u32 = 0;
61pub const ALLEGRO_REQUIRE: u32 = 1;
62pub const ALLEGRO_SUGGEST: u32 = 2;
63
64pub const ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES: u32 = 0;
65pub const ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES: u32 = 1;
66pub const ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES: u32 = 2;
67pub const ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES: u32 = 3;
68pub const ALLEGRO_DISPLAY_ORIENTATION_FACE_UP: u32 = 4;
69pub const ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN: u32 = 5;
70
71allegro_util::opaque!(ALLEGRO_DISPLAY);
72
73unsafe extern "C" {
74 pub fn al_set_new_display_refresh_rate(refresh_rate: c_int);
75 pub fn al_set_new_display_flags(flags: c_int);
76 pub fn al_get_new_display_refresh_rate() -> c_int;
77 pub fn al_get_new_display_flags() -> c_int;
78
79 pub fn al_get_display_width(display: *mut ALLEGRO_DISPLAY) -> c_int;
80 pub fn al_get_display_height(display: *mut ALLEGRO_DISPLAY) -> c_int;
81 pub fn al_get_display_format(display: *mut ALLEGRO_DISPLAY) -> c_int;
82 pub fn al_get_display_refresh_rate(display: *mut ALLEGRO_DISPLAY) -> c_int;
83 pub fn al_get_display_flags(display: *mut ALLEGRO_DISPLAY) -> c_int;
84 pub fn al_set_display_flag(
85 display: *mut ALLEGRO_DISPLAY, flag: c_uint, onoff: c_bool,
86 ) -> c_bool;
87
88 pub fn al_create_display(w: c_int, h: c_int) -> *mut ALLEGRO_DISPLAY;
89 pub fn al_destroy_display(display: *mut ALLEGRO_DISPLAY);
90 pub fn al_get_current_display() -> *mut ALLEGRO_DISPLAY;
91 pub fn al_set_target_bitmap(bitmap: *mut ALLEGRO_BITMAP);
92 pub fn al_set_target_backbuffer(display: *mut ALLEGRO_DISPLAY);
93 pub fn al_get_backbuffer(display: *mut ALLEGRO_DISPLAY) -> *mut ALLEGRO_BITMAP;
94 pub fn al_get_target_bitmap() -> *mut ALLEGRO_BITMAP;
95
96 pub fn al_acknowledge_resize(display: *mut ALLEGRO_DISPLAY) -> c_bool;
97 pub fn al_resize_display(display: *mut ALLEGRO_DISPLAY, width: c_int, height: c_int) -> c_bool;
98 pub fn al_flip_display();
99 pub fn al_update_display_region(x: c_int, y: c_int, width: c_int, height: c_int);
100 pub fn al_is_compatible_bitmap(bitmap: *mut ALLEGRO_BITMAP) -> c_bool;
101
102 pub fn al_wait_for_vsync() -> c_bool;
103
104 pub fn al_get_display_event_source(display: *mut ALLEGRO_DISPLAY) -> *mut ALLEGRO_EVENT_SOURCE;
105
106 pub fn al_set_display_icon(display: *mut ALLEGRO_DISPLAY, icon: *mut ALLEGRO_BITMAP);
107 pub fn al_set_display_icons(
108 display: *mut ALLEGRO_DISPLAY, num_icons: c_int, icons: *mut *mut ALLEGRO_BITMAP,
109 );
110
111 pub fn al_get_new_display_adapter() -> c_int;
112 pub fn al_set_new_display_adapter(adapter: c_int);
113 pub fn al_set_new_window_position(x: c_int, y: c_int);
114 pub fn al_get_new_window_position(x: *mut c_int, y: *mut c_int);
115 pub fn al_set_window_position(display: *mut ALLEGRO_DISPLAY, x: c_int, y: c_int);
116 pub fn al_get_window_position(display: *mut ALLEGRO_DISPLAY, x: *mut c_int, y: *mut c_int);
117
118 pub fn al_set_window_title(display: *mut ALLEGRO_DISPLAY, title: *const c_char);
119
120 pub fn al_set_new_display_option(option: c_int, value: c_int, importance: c_int);
121 pub fn al_get_new_display_option(option: c_int, importance: *mut c_int) -> c_int;
122 pub fn al_reset_new_display_options();
123 pub fn al_get_display_option(display: *mut ALLEGRO_DISPLAY, option: c_int) -> c_int;
124
125 pub fn al_hold_bitmap_drawing(hold: c_bool);
126 pub fn al_is_bitmap_drawing_held() -> c_bool;
127}