Ejemplo n.º 1
0
        public void Exit()
        {
            RunApplication = false;
            suppressDraw   = true;

            SDL2_FNAPlatform.ExitGame();
        }
Ejemplo n.º 2
0
        static FNAPlatform()
        {
            /* I suspect you may have an urge to put an #if in here for new
             * FNAPlatform implementations.
             *
             * DON'T.
             *
             * Determine this at runtime, or load dynamically.
             * No amount of whining will get me to budge on this.
             * -flibit
             */

            // Environment.GetEnvironmentVariable("FNA_PLATFORM_BACKEND");

            CreateWindow            = SDL2_FNAPlatform.CreateWindow;
            DisposeWindow           = SDL2_FNAPlatform.DisposeWindow;
            ApplyWindowChanges      = SDL2_FNAPlatform.ApplyWindowChanges;
            GetWindowBounds         = SDL2_FNAPlatform.GetWindowBounds;
            GetWindowResizable      = SDL2_FNAPlatform.GetWindowResizable;
            SetWindowResizable      = SDL2_FNAPlatform.SetWindowResizable;
            GetWindowBorderless     = SDL2_FNAPlatform.GetWindowBorderless;
            SetWindowBorderless     = SDL2_FNAPlatform.SetWindowBorderless;
            SetWindowTitle          = SDL2_FNAPlatform.SetWindowTitle;
            RunLoop                 = SDL2_FNAPlatform.RunLoop;
            CreateGLDevice          = SDL2_FNAPlatform.CreateGLDevice;
            CreateALDevice          = SDL2_FNAPlatform.CreateALDevice;
            SetPresentationInterval = SDL2_FNAPlatform.SetPresentationInterval;
            GetGraphicsAdapters     = SDL2_FNAPlatform.GetGraphicsAdapters;
            GetKeyFromScancode      = SDL2_FNAPlatform.GetKeyFromScancode;
            StartTextInput          = SDL2.SDL.SDL_StartTextInput;
            StopTextInput           = SDL2.SDL.SDL_StopTextInput;
            GetMouseState           = SDL2_FNAPlatform.GetMouseState;
            SetMousePosition        = SDL2.SDL.SDL_WarpMouseInWindow;
            OnIsMouseVisibleChanged = SDL2_FNAPlatform.OnIsMouseVisibleChanged;
            GetGamePadCapabilities  = SDL2_FNAPlatform.GetGamePadCapabilities;
            GetGamePadState         = SDL2_FNAPlatform.GetGamePadState;
            SetGamePadVibration     = SDL2_FNAPlatform.SetGamePadVibration;
            GetGamePadGUID          = SDL2_FNAPlatform.GetGamePadGUID;
            SetGamePadLightBar      = SDL2_FNAPlatform.SetGamePadLightBar;
            GetStorageRoot          = SDL2_FNAPlatform.GetStorageRoot;
            IsStoragePathConnected  = SDL2_FNAPlatform.IsStoragePathConnected;
            ShowRuntimeError        = SDL2_FNAPlatform.ShowRuntimeError;
            TextureDataFromStream   = SDL2_FNAPlatform.TextureDataFromStream;
            SavePNG                 = SDL2_FNAPlatform.SavePNG;

            // Static init is a strange beast... -flibit
            if (Game.logStore != null)
            {
                Log = Game.logStore;
            }
            else
            {
                Log = Console.WriteLine;
            }

            AppDomain.CurrentDomain.ProcessExit += SDL2_FNAPlatform.ProgramExit;
            SDL2_FNAPlatform.ProgramInit();
        }
Ejemplo n.º 3
0
        static FNAPlatform()
        {
            /* I suspect you may have an urge to put an #if in here for new
             * FNAPlatform implementations.
             *
             * DON'T.
             *
             * Determine this at runtime, or load dynamically.
             * No amount of whining will get me to budge on this.
             * -flibit
             */

            // Environment.GetEnvironmentVariable("FNA_PLATFORM_BACKEND");

            // Built-in command line arguments
            LaunchParameters args = new LaunchParameters();
            string           arg;

            if (args.TryGetValue("enablehighdpi", out arg) && arg == "1")
            {
                Environment.SetEnvironmentVariable(
                    "FNA_GRAPHICS_ENABLE_HIGHDPI",
                    "1"
                    );
            }
            if (args.TryGetValue("gldevice", out arg))
            {
                Environment.SetEnvironmentVariable(
                    "FNA3D_FORCE_DRIVER",
                    arg
                    );
            }
            if (args.TryGetValue("disablelateswaptear", out arg) && arg == "1")
            {
                Environment.SetEnvironmentVariable(
                    "FNA3D_DISABLE_LATESWAPTEAR",
                    "1"
                    );
            }
            if (args.TryGetValue("mojoshaderprofile", out arg))
            {
                Environment.SetEnvironmentVariable(
                    "FNA3D_MOJOSHADER_PROFILE",
                    arg
                    );
            }
            if (args.TryGetValue("backbufferscalenearest", out arg) && arg == "1")
            {
                Environment.SetEnvironmentVariable(
                    "FNA3D_BACKBUFFER_SCALE_NEAREST",
                    "1"
                    );
            }
            if (args.TryGetValue("usescancodes", out arg) && arg == "1")
            {
                Environment.SetEnvironmentVariable(
                    "FNA_KEYBOARD_USE_SCANCODES",
                    "1"
                    );
            }

            CreateWindow               = SDL2_FNAPlatform.CreateWindow;
            DisposeWindow              = SDL2_FNAPlatform.DisposeWindow;
            ApplyWindowChanges         = SDL2_FNAPlatform.ApplyWindowChanges;
            GetWindowBounds            = SDL2_FNAPlatform.GetWindowBounds;
            GetWindowResizable         = SDL2_FNAPlatform.GetWindowResizable;
            SetWindowResizable         = SDL2_FNAPlatform.SetWindowResizable;
            GetWindowBorderless        = SDL2_FNAPlatform.GetWindowBorderless;
            SetWindowBorderless        = SDL2_FNAPlatform.SetWindowBorderless;
            SetWindowTitle             = SDL2_FNAPlatform.SetWindowTitle;
            RegisterGame               = SDL2_FNAPlatform.RegisterGame;
            UnregisterGame             = SDL2_FNAPlatform.UnregisterGame;
            PollEvents                 = SDL2_FNAPlatform.PollEvents;
            GetGraphicsAdapters        = SDL2_FNAPlatform.GetGraphicsAdapters;
            GetCurrentDisplayMode      = SDL2_FNAPlatform.GetCurrentDisplayMode;
            GetKeyFromScancode         = SDL2_FNAPlatform.GetKeyFromScancode;
            StartTextInput             = SDL2.SDL.SDL_StartTextInput;
            StopTextInput              = SDL2.SDL.SDL_StopTextInput;
            SetTextInputRectangle      = SDL2_FNAPlatform.SetTextInputRectangle;
            GetMouseState              = SDL2_FNAPlatform.GetMouseState;
            SetMousePosition           = SDL2.SDL.SDL_WarpMouseInWindow;
            OnIsMouseVisibleChanged    = SDL2_FNAPlatform.OnIsMouseVisibleChanged;
            GetRelativeMouseMode       = SDL2_FNAPlatform.GetRelativeMouseMode;
            SetRelativeMouseMode       = SDL2_FNAPlatform.SetRelativeMouseMode;
            GetGamePadCapabilities     = SDL2_FNAPlatform.GetGamePadCapabilities;
            GetGamePadState            = SDL2_FNAPlatform.GetGamePadState;
            SetGamePadVibration        = SDL2_FNAPlatform.SetGamePadVibration;
            GetGamePadGUID             = SDL2_FNAPlatform.GetGamePadGUID;
            SetGamePadLightBar         = SDL2_FNAPlatform.SetGamePadLightBar;
            GetStorageRoot             = SDL2_FNAPlatform.GetStorageRoot;
            GetDriveInfo               = SDL2_FNAPlatform.GetDriveInfo;
            ShowRuntimeError           = SDL2_FNAPlatform.ShowRuntimeError;
            GetMicrophones             = SDL2_FNAPlatform.GetMicrophones;
            GetMicrophoneSamples       = SDL2_FNAPlatform.GetMicrophoneSamples;
            GetMicrophoneQueuedBytes   = SDL2_FNAPlatform.GetMicrophoneQueuedBytes;
            StartMicrophone            = SDL2_FNAPlatform.StartMicrophone;
            StopMicrophone             = SDL2_FNAPlatform.StopMicrophone;
            GetTouchCapabilities       = SDL2_FNAPlatform.GetTouchCapabilities;
            UpdateTouchPanelState      = SDL2_FNAPlatform.UpdateTouchPanelState;
            GetNumTouchFingers         = SDL2_FNAPlatform.GetNumTouchFingers;
            SupportsOrientationChanges = SDL2_FNAPlatform.SupportsOrientationChanges;
            NeedsPlatformMainLoop      = SDL2_FNAPlatform.NeedsPlatformMainLoop;
            RunPlatformMainLoop        = SDL2_FNAPlatform.RunPlatformMainLoop;

            FNALoggerEXT.Initialize();

            AppDomain.CurrentDomain.ProcessExit += SDL2_FNAPlatform.ProgramExit;
            TitleLocation = SDL2_FNAPlatform.ProgramInit(args);
        }
Ejemplo n.º 4
0
        static FNAPlatform()
        {
            /* I suspect you may have an urge to put an #if in here for new
             * FNAPlatform implementations.
             *
             * DON'T.
             *
             * Determine this at runtime, or load dynamically.
             * No amount of whining will get me to budge on this.
             * -flibit
             */

            // Environment.GetEnvironmentVariable("FNA_PLATFORM_BACKEND");

            CreateWindow               = SDL2_FNAPlatform.CreateWindow;
            DisposeWindow              = SDL2_FNAPlatform.DisposeWindow;
            ApplyWindowChanges         = SDL2_FNAPlatform.ApplyWindowChanges;
            GetWindowBounds            = SDL2_FNAPlatform.GetWindowBounds;
            GetWindowResizable         = SDL2_FNAPlatform.GetWindowResizable;
            SetWindowResizable         = SDL2_FNAPlatform.SetWindowResizable;
            GetWindowBorderless        = SDL2_FNAPlatform.GetWindowBorderless;
            SetWindowBorderless        = SDL2_FNAPlatform.SetWindowBorderless;
            SetWindowTitle             = SDL2_FNAPlatform.SetWindowTitle;
            RunLoop                    = SDL2_FNAPlatform.RunLoop;
            CreateGLDevice             = SDL2_FNAPlatform.CreateGLDevice;
            SetPresentationInterval    = SDL2_FNAPlatform.SetPresentationInterval;
            GetGraphicsAdapters        = SDL2_FNAPlatform.GetGraphicsAdapters;
            GetCurrentDisplayMode      = SDL2_FNAPlatform.GetCurrentDisplayMode;
            GetKeyFromScancode         = SDL2_FNAPlatform.GetKeyFromScancode;
            StartTextInput             = SDL2.SDL.SDL_StartTextInput;
            StopTextInput              = SDL2.SDL.SDL_StopTextInput;
            SetTextInputRectangle      = SDL2_FNAPlatform.SetTextInputRectangle;
            GetMouseState              = SDL2_FNAPlatform.GetMouseState;
            SetMousePosition           = SDL2.SDL.SDL_WarpMouseInWindow;
            OnIsMouseVisibleChanged    = SDL2_FNAPlatform.OnIsMouseVisibleChanged;
            GetRelativeMouseMode       = SDL2_FNAPlatform.GetRelativeMouseMode;
            SetRelativeMouseMode       = SDL2_FNAPlatform.SetRelativeMouseMode;
            GetGamePadCapabilities     = SDL2_FNAPlatform.GetGamePadCapabilities;
            GetGamePadState            = SDL2_FNAPlatform.GetGamePadState;
            SetGamePadVibration        = SDL2_FNAPlatform.SetGamePadVibration;
            GetGamePadGUID             = SDL2_FNAPlatform.GetGamePadGUID;
            SetGamePadLightBar         = SDL2_FNAPlatform.SetGamePadLightBar;
            GetStorageRoot             = SDL2_FNAPlatform.GetStorageRoot;
            GetDriveInfo               = SDL2_FNAPlatform.GetDriveInfo;
            ShowRuntimeError           = SDL2_FNAPlatform.ShowRuntimeError;
            TextureDataFromStream      = SDL2_FNAPlatform.TextureDataFromStream;
            SavePNG                    = SDL2_FNAPlatform.SavePNG;
            SaveJPG                    = SDL2_FNAPlatform.SaveJPG;
            GetMicrophones             = SDL2_FNAPlatform.GetMicrophones;
            GetMicrophoneSamples       = SDL2_FNAPlatform.GetMicrophoneSamples;
            GetMicrophoneQueuedBytes   = SDL2_FNAPlatform.GetMicrophoneQueuedBytes;
            StartMicrophone            = SDL2_FNAPlatform.StartMicrophone;
            StopMicrophone             = SDL2_FNAPlatform.StopMicrophone;
            GetTouchCapabilities       = SDL2_FNAPlatform.GetTouchCapabilities;
            GetNumTouchFingers         = SDL2_FNAPlatform.GetNumTouchFingers;
            SupportsOrientationChanges = SDL2_FNAPlatform.SupportsOrientationChanges;

            // Don't overwrite application log hooks!
            if (FNALoggerEXT.LogInfo == null)
            {
                FNALoggerEXT.LogInfo = Console.WriteLine;
            }
            if (FNALoggerEXT.LogWarn == null)
            {
                FNALoggerEXT.LogWarn = Console.WriteLine;
            }
            if (FNALoggerEXT.LogError == null)
            {
                FNALoggerEXT.LogError = Console.WriteLine;
            }

            AppDomain.CurrentDomain.ProcessExit += SDL2_FNAPlatform.ProgramExit;
            TitleLocation = SDL2_FNAPlatform.ProgramInit();
        }