Пример #1
0
 public static void CreateWindowAndGraphicsDevice(
     WindowCreateInfo windowCI,
     GraphicsDeviceOptions deviceOptions,
     GraphicsBackend preferredBackend,
     out Sdl2Window window,
     out GraphicsDevice gd)
 => CreateWindowAndGraphicsDevice(windowCI, deviceOptions, preferredBackend, false, out window, out gd);
Пример #2
0
 public static void CreateWindowAndGraphicsDevice(
     ref WindowCreateInfo windowCI,
     ref GraphicsDeviceCreateInfo graphicsDeviceCI,
     out Sdl2Window window,
     out GraphicsDevice gd)
 {
     window = CreateWindow(ref windowCI);
     gd     = CreateGraphicsDevice(ref graphicsDeviceCI, window);
 }
Пример #3
0
 public static void CreateWindowAndRenderContext(
     ref WindowCreateInfo windowCI,
     ref RenderContextCreateInfo contextCI,
     out Sdl2Window window,
     out RenderContext rc)
 {
     window = CreateWindow(ref windowCI);
     rc     = CreateRenderContext(ref contextCI, window);
 }
Пример #4
0
 public static void CreateWindowAndGraphicsDevice(
     WindowCreateInfo windowCI,
     out Sdl2Window window,
     out GraphicsDevice gd)
 => CreateWindowAndGraphicsDevice(
     windowCI,
     new GraphicsDeviceOptions(),
     GetPlatformDefaultBackend(),
     out window,
     out gd);
Пример #5
0
 public static void CreateWindowAndGraphicsDevice(
     WindowCreateInfo windowCI,
     GraphicsDeviceOptions deviceOptions,
     GraphicsBackend preferredBackend,
     out Sdl2Window window,
     out GraphicsDevice gd)
 {
     window = CreateWindow(ref windowCI);
     gd     = CreateGraphicsDevice(window, deviceOptions, preferredBackend);
 }
Пример #6
0
        public static Sdl2Window CreateWindow(ref WindowCreateInfo windowCI)
        {
            Sdl2Window window = new Sdl2Window(
                windowCI.WindowTitle,
                windowCI.X,
                windowCI.Y,
                windowCI.WindowWidth,
                windowCI.WindowHeight,
                SDL_WindowFlags.OpenGL | SDL_WindowFlags.Shown | SDL_WindowFlags.Resizable
                | GetWindowFlags(windowCI.WindowInitialState),
                false);

            return(window);
        }
Пример #7
0
        public static void CreateWindowAndGraphicsDevice(
            WindowCreateInfo windowCI,
            GraphicsDeviceOptions deviceOptions,
            GraphicsBackend preferredBackend,
            out Sdl2Window window,
            out GraphicsDevice gd)
        {
            Sdl2Native.SDL_Init(SDLInitFlags.Video);
            if (preferredBackend == GraphicsBackend.OpenGL || preferredBackend == GraphicsBackend.OpenGLES)
            {
                SetSDLGLContextAttributes(deviceOptions, preferredBackend);
            }

            window = CreateWindow(ref windowCI);
            gd     = CreateGraphicsDevice(window, deviceOptions, preferredBackend);
        }
Пример #8
0
        protected override void CreateWindow_Internal()
        {
            TickFunction WindowTick = new TickFunction
            {
                TickFunc = (DeltaTime) => {
                    var Snapshot = Window.PumpEvents();
                    VeldridInputSource.LastInputSnapshot(Snapshot);
                },
                TickPriority = TickFunction.HighPriority,
                CanTick      = true,
            };

            IEngine.Instance.GameThreadTickManager.AddTick(WindowTick);

            Veldrid.StartupUtilities.WindowCreateInfo windowCI = new Veldrid.StartupUtilities.WindowCreateInfo
            {
                X                  = 100,
                Y                  = 100,
                WindowWidth        = (int)ScreenSize.X,
                WindowHeight       = (int)ScreenSize.Y,
                WindowInitialState = Veldrid.WindowState.Normal,
                WindowTitle        = "Intro",
            };

            Window               = VeldridStartup.CreateWindow(ref windowCI);
            Window.KeyDown      += VeldridInputSource.OnWindowKeyEvent;
            Window.KeyUp        += VeldridInputSource.OnWindowKeyEvent;
            Window.MouseDown    += VeldridInputSource.OnWindowMouseEvent;
            Window.MouseUp      += VeldridInputSource.OnWindowMouseEvent;
            Window.Resized      += Window_Resized;
            Window.Closing      += Window_Closing;
            Window.Closed       += Window_Closed;
            Window.LimitPollRate = true;


            Veldrid.GraphicsDeviceOptions options = new Veldrid.GraphicsDeviceOptions()
            {
                PreferStandardClipSpaceYDirection = true,
                Debug = false,
            };

            GraphicsDevice = VeldridStartup.CreateVulkanGraphicsDevice(options, Window);


            ConstructVeldridResources();
        }
Пример #9
0
        public static Sdl2Window CreateWindow(ref WindowCreateInfo windowCI)
        {
            SDL_WindowFlags flags = SDL_WindowFlags.OpenGL | SDL_WindowFlags.Resizable
                                    | GetWindowFlags(windowCI.WindowInitialState);

            if (windowCI.WindowInitialState != WindowState.Hidden)
            {
                flags |= SDL_WindowFlags.Shown;
            }
            Sdl2Window window = new Sdl2Window(
                windowCI.WindowTitle,
                windowCI.X,
                windowCI.Y,
                windowCI.WindowWidth,
                windowCI.WindowHeight,
                flags,
                false);

            return(window);
        }
Пример #10
0
 public static Sdl2Window CreateWindow(WindowCreateInfo windowCI) => CreateWindow(ref windowCI);