1 module allegro5.display;
2 
3 import allegro5.bitmap;
4 import allegro5.color;
5 import allegro5.events;
6 import allegro5.internal.da5;
7 
8 nothrow @nogc extern (C)
9 {
10 	enum
11 	{
12 		ALLEGRO_WINDOWED                    = 1 << 0,
13 		ALLEGRO_FULLSCREEN                  = 1 << 1,
14 		ALLEGRO_OPENGL                      = 1 << 2,
15 		ALLEGRO_DIRECT3D_INTERNAL           = 1 << 3,
16 		ALLEGRO_RESIZABLE                   = 1 << 4,
17 		ALLEGRO_FRAMELESS                   = 1 << 5,
18 		ALLEGRO_NOFRAME                     = ALLEGRO_FRAMELESS, /* older synonym */
19 		ALLEGRO_GENERATE_EXPOSE_EVENTS      = 1 << 6,
20 		ALLEGRO_OPENGL_3_0                  = 1 << 7,
21 		ALLEGRO_OPENGL_FORWARD_COMPATIBLE   = 1 << 8,
22 		ALLEGRO_FULLSCREEN_WINDOW           = 1 << 9,
23 		ALLEGRO_MINIMIZED                   = 1 << 10,
24 		ALLEGRO_PROGRAMMABLE_PIPELINE       = 1 << 11,
25 		ALLEGRO_GTK_TOPLEVEL_INTERNAL       = 1 << 12,
26 		ALLEGRO_MAXIMIZED                   = 1 << 13,
27 		ALLEGRO_OPENGL_ES_PROFILE           = 1 << 14,
28 	}
29 
30 	enum ALLEGRO_DISPLAY_OPTIONS
31 	{
32 		ALLEGRO_RED_SIZE = 0,
33 		ALLEGRO_GREEN_SIZE = 1,
34 		ALLEGRO_BLUE_SIZE = 2,
35 		ALLEGRO_ALPHA_SIZE = 3,
36 		ALLEGRO_RED_SHIFT = 4,
37 		ALLEGRO_GREEN_SHIFT = 5,
38 		ALLEGRO_BLUE_SHIFT = 6,
39 		ALLEGRO_ALPHA_SHIFT = 7,
40 		ALLEGRO_ACC_RED_SIZE = 8,
41 		ALLEGRO_ACC_GREEN_SIZE = 9,
42 		ALLEGRO_ACC_BLUE_SIZE = 10,
43 		ALLEGRO_ACC_ALPHA_SIZE = 11,
44 		ALLEGRO_STEREO = 12,
45 		ALLEGRO_AUX_BUFFERS = 13,
46 		ALLEGRO_COLOR_SIZE = 14,
47 		ALLEGRO_DEPTH_SIZE = 15,
48 		ALLEGRO_STENCIL_SIZE = 16,
49 		ALLEGRO_SAMPLE_BUFFERS = 17,
50 		ALLEGRO_SAMPLES = 18,
51 		ALLEGRO_RENDER_METHOD = 19,
52 		ALLEGRO_FLOAT_COLOR = 20,
53 		ALLEGRO_FLOAT_DEPTH = 21,
54 		ALLEGRO_SINGLE_BUFFER = 22,
55 		ALLEGRO_SWAP_METHOD = 23,
56 		ALLEGRO_COMPATIBLE_DISPLAY = 24,
57 		ALLEGRO_UPDATE_DISPLAY_REGION = 25,
58 		ALLEGRO_VSYNC = 26,
59 		ALLEGRO_MAX_BITMAP_SIZE = 27,
60 		ALLEGRO_SUPPORT_NPOT_BITMAP = 28,
61 		ALLEGRO_CAN_DRAW_INTO_BITMAP = 29,
62 		ALLEGRO_SUPPORT_SEPARATE_ALPHA = 30,
63 		ALLEGRO_AUTO_CONVERT_BITMAPS = 31,
64 		ALLEGRO_SUPPORTED_ORIENTATIONS = 32,
65 		ALLEGRO_OPENGL_MAJOR_VERSION = 33,
66 		ALLEGRO_OPENGL_MINOR_VERSION = 34,
67 		ALLEGRO_DISPLAY_OPTIONS_COUNT
68 	}
69 
70 	enum
71 	{
72 		ALLEGRO_DONTCARE,
73 		ALLEGRO_REQUIRE,
74 		ALLEGRO_SUGGEST
75 	}
76 	
77 	enum ALLEGRO_DISPLAY_ORIENTATION
78 	{
79 		ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN = 0,
80 		ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES = 1,
81 		ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES = 2,
82 		ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES = 4,
83 		ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES = 8,
84 		ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT = 5,
85 		ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE = 10,
86 		ALLEGRO_DISPLAY_ORIENTATION_ALL = 15,
87 		ALLEGRO_DISPLAY_ORIENTATION_FACE_UP = 16,
88 		ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN = 32
89 	}
90 
91 	enum
92 	{
93 		_ALLEGRO_PRIM_MAX_USER_ATTR = 10
94 	}
95 
96 	struct ALLEGRO_DISPLAY {};
97 
98 	enum ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE = 255;
99 
100 	void al_set_new_display_refresh_rate(int refresh_rate);
101 	void al_set_new_display_flags(int flags);
102 	int  al_get_new_display_refresh_rate();
103 	int  al_get_new_display_flags();
104 
105 	void al_set_new_window_title(const(char) *title);
106 	const(char)* al_get_new_window_title();
107 
108 	int al_get_display_width(ALLEGRO_DISPLAY* display);
109 	int al_get_display_height(ALLEGRO_DISPLAY* display);
110 	int al_get_display_format(ALLEGRO_DISPLAY* display);
111 	int al_get_display_refresh_rate(ALLEGRO_DISPLAY* display);
112 	int al_get_display_flags(ALLEGRO_DISPLAY* display);
113 	int al_get_display_orientation(ALLEGRO_DISPLAY* display);
114 	bool al_set_display_flag(ALLEGRO_DISPLAY* display, int flag, bool onoff);
115 
116 	ALLEGRO_DISPLAY* al_create_display(int w, int h);
117 	void al_destroy_display(ALLEGRO_DISPLAY* display);
118 	ALLEGRO_DISPLAY* al_get_current_display();
119 	void al_set_target_bitmap(ALLEGRO_BITMAP* bitmap);
120 	void al_set_target_backbuffer(ALLEGRO_DISPLAY* display);
121 	ALLEGRO_BITMAP* al_get_backbuffer(ALLEGRO_DISPLAY* display);
122 	ALLEGRO_BITMAP* al_get_target_bitmap();
123 
124 	bool al_acknowledge_resize(ALLEGRO_DISPLAY* display);
125 	bool al_resize_display(ALLEGRO_DISPLAY* display, int width, int height);
126 	void al_flip_display();
127 	void al_update_display_region(int x, int y, int width, int height);
128 	bool al_is_compatible_bitmap(ALLEGRO_BITMAP* bitmap);
129 
130 	bool al_wait_for_vsync();
131 
132 	ALLEGRO_EVENT_SOURCE* al_get_display_event_source(ALLEGRO_DISPLAY* display);
133 
134 	void al_set_display_icon(ALLEGRO_DISPLAY* display, ALLEGRO_BITMAP* icon);
135 	void al_set_display_icons(ALLEGRO_DISPLAY* display, int num_icons, ALLEGRO_BITMAP** icons);
136 
137 	/* Stuff for multihead/window management */
138 	int al_get_new_display_adapter();
139 	void al_set_new_display_adapter(int adapter);
140 	void al_set_new_window_position(int x, int y);
141 	void al_get_new_window_position(int* x, int* y);
142 	void al_set_window_position(ALLEGRO_DISPLAY* display, int x, int y);
143 	void al_get_window_position(ALLEGRO_DISPLAY* display, int* x, int* y);
144 	bool al_set_window_constraints(ALLEGRO_DISPLAY* display, int min_w, int min_h, int max_w, int max_h);
145 	bool al_get_window_constraints(ALLEGRO_DISPLAY* display, int* min_w, int* min_h, int* max_w, int* max_h);
146 
147 	void al_set_window_title(ALLEGRO_DISPLAY* display, in char* title);
148 
149 	/* Defined in display_settings.c */
150 	void al_set_new_display_option(int option, int value, int importance);
151 	int al_get_new_display_option(int option, int* importance);
152 	void al_reset_new_display_options();
153 	void al_set_display_option(ALLEGRO_DISPLAY* display, int option, int value);
154 	int al_get_display_option(ALLEGRO_DISPLAY* display, int option);
155 	
156 	/*Deferred drawing*/
157 	void al_hold_bitmap_drawing(bool hold);
158 	bool al_is_bitmap_drawing_held();
159 	
160 	void al_acknowledge_drawing_halt(ALLEGRO_DISPLAY* display);
161 	void al_acknowledge_drawing_resume(ALLEGRO_DISPLAY *display);
162 }