using System; using System.Linq; using System.Text; namespace Urho { /// /// Application options, see full description at: /// http://urho3d.github.io/documentation/1.5/_running.html /// public class ApplicationOptions { /// usually it's "Data". Can be null if built-in assets are enough for you public ApplicationOptions(string assetsFolder) { if (assetsFolder != null) { ResourcePaths = new[] { assetsFolder }; } } public ApplicationOptions(string[] assetsFolders) { ResourcePaths = assetsFolders; } /// /// Desktop only /// public int Width { get; set; } = 0; /// /// Desktop only /// public int Height { get; set; } = 0; /// /// Desktop only /// public bool WindowedMode { get; set; } = true; /// /// Desktop only /// public bool ResizableWindow { get; set; } = false; /// /// With limit enabled: 200 fps for Desktop (and always 60 fps for mobile despite of the flag) /// public bool LimitFps { get; set; } = true; #if XFORMS /// /// iOS only /// public OrientationType Orientation { get; set; } = OrientationType.Portrait; #else /// /// iOS only /// public OrientationType Orientation { get; set; } = OrientationType.Landscape; #endif /// /// Resource path(s) to use (default: Data, CoreData) /// public string[] ResourcePaths { get; set; } = null; /// /// Resource package files to use (default: empty) /// public string[] ResourcePackagesPaths { get; set; } = null; /// /// Touch emulation on desktop platform /// public bool TouchEmulation { get; set; } = false; /// /// Add any flag listed here: http://urho3d.github.io/documentation/1.5/_running.html /// public string AdditionalFlags { get; set; } = string.Empty; /// /// Windows: external window handle (WinForms Panel.Handle) to use in order to display Urho game /// You can use it in WPF via WindowsFormsHost (and a WF panel inside it) /// public IntPtr ExternalWindow { get; set; } public enum OrientationType { Landscape, Portrait, LandscapeAndPortrait } public override string ToString() { StringBuilder builder = new StringBuilder(); builder.Append("args");//it will be skipped by Urho; #if !IOS //always use -w on iOS if (WindowedMode) #endif builder.Append(" -w"); if (!LimitFps) builder.Append(" -nolimit"); if (Width > 0) builder.AppendFormat(" -x {0}", Width); if (Height > 0) builder.AppendFormat(" -y {0}", Height); #if !IOS //always use -s on iOS if (ResizableWindow) #endif builder.Append(" -s"); var resourcePathes = new[] {"CoreData"}.Concat(ResourcePaths ?? new string[0]); builder.AppendFormat(" -p \"{0}\"", string.Join(";", resourcePathes.Distinct())); if (ResourcePackagesPaths?.Length > 0) builder.AppendFormat(" -pf \"{0}\"", string.Join(";", ResourcePackagesPaths)); if (TouchEmulation) builder.Append(" -touch"); switch (Orientation) { case OrientationType.Landscape: builder.Append(" -landscape"); break; case OrientationType.Portrait: builder.Append(" -portrait"); break; case OrientationType.LandscapeAndPortrait: builder.Append(" -landscape -portrait"); break; } return builder + " " + AdditionalFlags; } } }