Example #1
0
        ///////////////////////////////////////////

        public static PlatformFunctionality Get()
        {
            if (instance == null)
            {
                if (SystemSettings.CurrentPlatform == SystemSettings.Platform.Windows)
                {
#if WINDOWS
                    instance = new WindowsPlatformFunctionality();
#endif
                }
                else if (SystemSettings.CurrentPlatform == SystemSettings.Platform.UWP)
                {
                    Log.Fatal("PlatformFunctionality: Get: Instance must be already initialized.");
                }
                else if (SystemSettings.CurrentPlatform == SystemSettings.Platform.Android)
                {
                    Log.Fatal("PlatformFunctionality: Get: Instance must be already initialized.");
                }
                else if (SystemSettings.CurrentPlatform == SystemSettings.Platform.MacOS)
                {
                    Log.Fatal("MacOSXInputDeviceManager impl.");
                    //instance = new MacOSXPlatformFunctionality();
                }
                else
                {
                    Log.Fatal("PlatformFunctionality: Get: Unknown platform.");
                }
            }
            return(instance);
        }
Example #2
0
 public static void ResetGamma()
 {
     if (gammaChanged != null)
     {
         PlatformFunctionality.Get().SetGamma(1);
         gammaChanged = null;
     }
 }
Example #3
0
 public static void RestoreVideoMode()
 {
     if (videoModeChanged != null)
     {
         PlatformFunctionality.Get().RestoreVideoMode();
         videoModeChanged = null;
     }
 }
Example #4
0
 public static bool ChangeVideoMode(Vector2I mode)
 {
     if (!PlatformFunctionality.Get().ChangeVideoMode(mode))
     {
         return(false);
     }
     videoModeChanged = mode;
     return(true);
 }
Example #5
0
        static void GenerateVideoModes()
        {
            //generate list
            videoModes = PlatformFunctionality.Get().GetVideoModes();

            //safe list
            if (videoModes.Count == 0)
            {
                videoModes.Add(new Vector2I(640, 480));
                videoModes.Add(new Vector2I(800, 600));
                videoModes.Add(new Vector2I(1024, 768));
                videoModes.Add(new Vector2I(1152, 864));
                videoModes.Add(new Vector2I(1280, 1024));
                videoModes.Add(new Vector2I(1600, 1200));
            }

            //sort
            CollectionUtility.SelectionSort(videoModes, delegate(Vector2I mode1, Vector2I mode2)
            {
                if (mode1.X < mode2.X)
                {
                    return(-1);
                }
                if (mode1.X > mode2.X)
                {
                    return(1);
                }
                if (mode1.Y < mode2.Y)
                {
                    return(-1);
                }
                if (mode1.Y > mode2.Y)
                {
                    return(1);
                }
                return(0);
            });
        }
Example #6
0
        ///////////////////////////////////////////

        protected void SetInstance(PlatformFunctionality instance)
        {
            PlatformFunctionality.instance = instance;
        }
Example #7
0
 public static void SetGamma(float value)
 {
     PlatformFunctionality.Get().SetGamma(value);
     gammaChanged = value;
 }