1 /**
2  * ae.ui.shell.shell
3  *
4  * License:
5  *   This Source Code Form is subject to the terms of
6  *   the Mozilla Public License, v. 2.0. If a copy of
7  *   the MPL was not distributed with this file, You
8  *   can obtain one at http://mozilla.org/MPL/2.0/.
9  *
10  * Authors:
11  *   Vladimir Panteleev <vladimir@thecybershadow.net>
12  */
13 
14 module ae.ui.shell.shell;
15 
16 import ae.ui.video.video;
17 import ae.ui.audio.audio;
18 
19 /// A "shell" handles OS window management, input handling, and various other platform-dependent tasks.
20 class Shell
21 {
22 	abstract void run();
23 
24 	abstract void setCaption(string caption);
25 
26 	void quit()
27 	{
28 		if (!quitting)
29 		{
30 			quitting = true;
31 			prod();
32 		}
33 	}
34 
35 	/// Wake event thread with a no-op event.
36 	abstract void prod();
37 
38 	Video video;
39 	Audio audio;
40 
41 protected:
42 	bool quitting;
43 }
44 
45 /// Specifies the window / screen mode.
46 enum ScreenMode
47 {
48 	windowed,
49 	maximized,
50 	fullscreen,
51 	windowedFullscreen
52 }
53 
54 /// The default / remembered screen settings.
55 struct ShellSettings
56 {
57 	uint fullScreenX = 1024;
58 	uint fullScreenY =  768;
59 	uint windowSizeX =  800;
60 	uint windowSizeY =  600;
61 	int windowPosX   = int.min; // int.min means unset
62 	int windowPosY   = int.min;
63 	ScreenMode screenMode = ScreenMode.windowed;
64 }