1 module pixelperfectengine.system.systemutility;
2 /*
3  * Copyright (C) 2015-2017, by Laszlo Szeremi under the Boost license.
4  *
5  * Pixel Perfect Engine, system.systemUtility module
6  */
7 
8 public immutable dstring engineVer = "0.10.0";	///Defines engine version
9 public immutable dstring sdlVer = "2.0.5";		///Defines SDL version
10 version(X86){
11 	public immutable dstring sysInfo = "x86";	///Defines what CPU architecture the software is being built for.
12 }else version(X86_64){
13 	public immutable dstring sysInfo = "AMD86";
14 }else version(ARM){
15 	public immutable dstring sysInfo = "ARMv8";
16 }else version(AArch64){
17 	public immutable dstring sysInfo = "AArch64";
18 }else{
19 	public immutable dstring sysInfo = "UNDEFINED";	//Contact me or make a pull request if something needs to be added.
20 }
21 version(Windows){
22 	public immutable dstring osInfo = "Windows";	///Defines target OS
23 }else version(linux){
24 	public immutable dstring osInfo = "Linux";
25 }else version(OSX){
26 	public immutable dstring osInfo = "OSX";
27 }else version(Posix){
28 	public immutable dstring osInfo = "Posix";
29 }else{
30 	public immutable dstring osInfo = "UNDEFINED";
31 }
32 version(X86){
33 	version(NO_SSE2){
34 		public immutable dstring renderInfo = "CPUBLiT/MMX";
35 	}else{
36 		public immutable dstring renderInfo = "CPUBLiT/SSE2";	///Renderer information.
37 	}
38 }else version(X86_64){
39 	version(USE_AVX){
40 		public immutable dstring renderInfo = "CPUBLiT/AVX";
41 	}else{
42 		public immutable dstring renderInfo = "CPUBLiT/SSE2";
43 	}
44 }else version(ARM){
45 	version(NEON){
46 		public immutable dstring renderInfo = "CPUBLiT/NEON";
47 	}else{
48 		public immutable dstring renderInfo = "Slow";
49 	}
50 }else version(AArch64){
51 	version(NEON){
52 		public immutable dstring renderInfo = "CPUBLiT/NEON";
53 	}else{
54 		public immutable dstring renderInfo = "Slow";
55 	}
56 }else{
57 	public immutable dstring renderInfo = "Slow";
58 }
59 
60 
61 	import pixelperfectengine.concrete.window;
62 	import pixelperfectengine.system.file;
63 	//import pixelperfectengine.extbmp.extbmp;
64 /**
65  * Loads the defaults for Concrete.
66  */
67 public void INIT_CONCRETE() {
68 	import pixelperfectengine.concrete.window;
69 	import pixelperfectengine.system.file;
70 	//import pixelperfectengine.extbmp.extbmp;
71 	import pixelperfectengine.graphics.fontsets;
72 	import pixelperfectengine.graphics.bitmap;
73 	import std.stdio;
74 	Fontset!Bitmap8Bit defaultFont = new Fontset!Bitmap8Bit(File("../system/OpenSans-reg-14.fnt"), "../system/");
75 	Fontset!Bitmap8Bit fixedWidthFont = new Fontset!Bitmap8Bit(File("../system/scp-14-reg.fnt"), "../system/");
76 	alias ChrFormat = CharacterFormattingInfo!Bitmap8Bit;
77 	Bitmap8Bit[] ssOrigin = loadBitmapSheetFromFile!Bitmap8Bit("../system/concreteGUIE0.tga", 16, 16);
78 	StyleSheet ss = new StyleSheet();
79 	ss.setImage(ssOrigin[0],"closeButtonA");
80 	ss.setImage(ssOrigin[1],"closeButtonB");
81 	ss.setImage(ssOrigin[0],"checkBoxA");
82 	ss.setImage(ssOrigin[1],"checkBoxB");
83 	ss.setImage(ssOrigin[2],"radioButtonA");
84 	ss.setImage(ssOrigin[3],"radioButtonB");
85 	ss.setImage(ssOrigin[4],"upArrowA");
86 	ss.setImage(ssOrigin[5],"upArrowB");
87 	ss.setImage(ssOrigin[6],"downArrowA");
88 	ss.setImage(ssOrigin[7],"downArrowB");
89 	ss.setImage(ssOrigin[8],"plusA");
90 	ss.setImage(ssOrigin[9],"plusB");
91 	ss.setImage(ssOrigin[10],"minusA");
92 	ss.setImage(ssOrigin[11],"minusB");
93 	ss.setImage(ssOrigin[12],"leftArrowA");
94 	ss.setImage(ssOrigin[13],"leftArrowB");
95 	ss.setImage(ssOrigin[14],"rightArrowA");
96 	ss.setImage(ssOrigin[15],"rightArrowB");
97 	ss.setImage(loadBitmapFromFile!Bitmap8Bit("../system/concreteGUIDisable.tga"), "ElementDisabledPtrn");
98 	ss.addFontset(defaultFont, "default");
99 	ss.addFontset(fixedWidthFont, "fixedWidth");
100 	ss.addChrFormatting(new ChrFormat(defaultFont, 0x1f, FormattingFlags.leftJustify, 0, 0, 2),"default");
101 	ss.duplicateChrFormatting("default", "windowHeader");
102 	ss.addChrFormatting(new ChrFormat(defaultFont, 0x17, FormattingFlags.leftJustify, 0, 0, 2),"windowHeaderInactive");
103 	ss.addChrFormatting(new ChrFormat(defaultFont, 0x1f, FormattingFlags.centerJustify, 0, 0, 2),"defaultCJ");
104 	ss.duplicateChrFormatting("defaultCJ", "button");
105 	ss.duplicateChrFormatting("default", "textBox");
106 	ss.duplicateChrFormatting("default", "label");
107 	ss.duplicateChrFormatting("default", "checkBox");
108 	ss.duplicateChrFormatting("default", "ListViewHeader");
109 	ss.duplicateChrFormatting("default", "ListViewItem");
110 	ss.duplicateChrFormatting("default", "radioButton");
111 	ss.duplicateChrFormatting("defaultCJ", "menuBar");
112 	ss.duplicateChrFormatting("default", "popUpMenu");
113 	ss.duplicateChrFormatting("default", "panel");
114 
115 	ss.addChrFormatting(new ChrFormat(defaultFont, 0x14, FormattingFlags.rightJustify, 0, 0, 2),"popUpMenuSecondary");
116 	ss.addChrFormatting(new ChrFormat(defaultFont, 0x1f, FormattingFlags.rightJustify, 0, 0, 2),"defaultRJ");
117 	/+wh.defaultStyle = ss;
118 	Window.defaultStyle = ss;
119 	WindowElement.styleSheet = ss;
120 	PopUpElement.styleSheet = ss;+/
121 	globalDefaultStyle = ss;
122 }