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 
18 /// A "shell" handles OS window management, input handling, and various other platform-dependent tasks.
19 class Shell
20 {
21 	abstract void run();
22 
23 	abstract void setCaption(string caption);
24 
25 	void quit()
26 	{
27 		if (!quitting)
28 		{
29 			quitting = true;
30 			prod();
31 		}
32 	}
33 
34 	/// Wake event thread with a no-op event.
35 	abstract void prod();
36 
37 	Video video;
38 
39 protected:
40 	bool quitting;
41 }
42 
43 /// Specifies the window / screen mode.
44 enum ScreenMode
45 {
46 	windowed,
47 	maximized,
48 	fullscreen,
49 	windowedFullscreen
50 }
51 
52 /// The default / remembered screen settings.
53 struct ShellSettings
54 {
55 	uint fullScreenX = 1024;
56 	uint fullScreenY =  768;
57 	uint windowSizeX =  800;
58 	uint windowSizeY =  600;
59 	int windowPosX   = int.min; // int.min means unset
60 	int windowPosY   = int.min;
61 	ScreenMode screenMode = ScreenMode.windowed;
62 }