internal static GameContext NewDefaultGameContext() { // Default context is Desktop AppContextType type = AppContextType.Desktop; #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP || SILICONSTUDIO_PLATFORM_UNIX #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGL #if SILICONSTUDIO_XENKO_UI_SDL type = AppContextType.DesktopSDL; #elif SILICONSTUDIO_XENKO_UI_OPENTK type = AppContextType.DesktopOpenTK; #endif #elif SILICONSTUDIO_XENKO_GRAPHICS_API_VULKAN #if SILICONSTUDIO_XENKO_UI_SDL && !SILICONSTUDIO_XENKO_UI_WINFORMS && !SILICONSTUDIO_XENKO_UI_WPF type = AppContextType.DesktopSDL; #endif #else type = AppContextType.Desktop; #endif #elif SILICONSTUDIO_PLATFORM_UWP type = AppContextType.UWPXaml; // Can change later to CoreWindow #elif SILICONSTUDIO_PLATFORM_ANDROID type = AppContextType.Android; #elif SILICONSTUDIO_PLATFORM_IOS type = AppContextType.iOS; #endif return(NewGameContext(type)); }
internal static GameContext NewDefaultGameContext(int requestedWidth = 0, int requestedHeight = 0, bool isUserManagingRun = false) { // Default context is Desktop AppContextType type = AppContextType.Desktop; #if STRIDE_PLATFORM_DESKTOP #if STRIDE_GRAPHICS_API_OPENGL #if STRIDE_UI_SDL type = AppContextType.DesktopSDL; #elif STRIDE_UI_OPENTK type = AppContextType.DesktopOpenTK; #endif #elif STRIDE_GRAPHICS_API_VULKAN #if STRIDE_UI_SDL && !STRIDE_UI_WINFORMS && !STRIDE_UI_WPF type = AppContextType.DesktopSDL; #endif #else type = AppContextType.Desktop; #endif #elif STRIDE_PLATFORM_UWP type = AppContextType.UWPXaml; // Can change later to CoreWindow #elif STRIDE_PLATFORM_ANDROID type = AppContextType.Android; #elif STRIDE_PLATFORM_IOS type = AppContextType.iOS; #endif return(NewGameContext(type, requestedWidth, requestedHeight, isUserManagingRun)); }
/// <summary> /// Given a <paramref name="type"/> create the appropriate game Context for the current executing platform. /// </summary> /// <returns></returns> public static GameContext NewGameContext(AppContextType type) { GameContext res = null; switch (type) { case AppContextType.Android: res = NewGameContextAndroid(); break; case AppContextType.Desktop: res = NewGameContextDesktop(); break; case AppContextType.DesktopOpenTK: res = NewGameContextOpenTk(); break; case AppContextType.DesktopSDL: res = NewGameContextSdl(); break; case AppContextType.DesktopWpf: res = NewGameContextWpf(); break; case AppContextType.WindowsRuntime: res = NewGameContextWindowsRuntime(); break; case AppContextType.iOS: res = NewGameContextiOS(); break; } if (res == null) { throw new InvalidOperationException("Requested type and current platform are incompatible."); } return res; }
internal static GameContext NewDefaultGameContext() { // Default context is Desktop AppContextType type = AppContextType.Desktop; #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP || SILICONSTUDIO_PLATFORM_LINUX #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGL #if SILICONSTUDIO_XENKO_UI_SDL type = AppContextType.DesktopSDL; #elif SILICONSTUDIO_XENKO_UI_OPENTK type = AppContextType.DesktopOpenTK; #endif #elif SILICONSTUDIO_XENKO_GRAPHICS_API_VULKAN #if SILICONSTUDIO_XENKO_UI_SDL && !SILICONSTUDIO_XENKO_UI_WINFORMS && !SILICONSTUDIO_XENKO_UI_WPF type = AppContextType.DesktopSDL; #endif #else type = AppContextType.Desktop; #endif #elif SILICONSTUDIO_PLATFORM_WINDOWS_RUNTIME type = AppContextType.WindowsRuntime; #elif SILICONSTUDIO_PLATFORM_ANDROID type = AppContextType.Android; #elif SILICONSTUDIO_PLATFORM_IOS type = AppContextType.iOS; #endif return(NewGameContext(type)); }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { switch (type) { #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGL case AppContextType.DesktopOpenTK: return new GameWindowOpenTK(); #endif #if SILICONSTUDIO_XENKO_UI_SDL case AppContextType.DesktopSDL: return new GameWindowSdl(); #endif case AppContextType.Desktop: #if SILICONSTUDIO_XENKO_GRAPHICS_API_DIRECT3D && SILICONSTUDIO_XENKO_UI_WINFORMS return new GameWindowWinforms(); #elif SILICONSTUDIO_XENKO_UI_SDL return new GameWindowSdl(); #else return null; #endif #if SILICONSTUDIO_XENKO_UI_WPF case AppContextType.DesktopWpf: // WPF is not supported yet. return null; #endif default: return null; } }
public void RenderToWindow(AppContextType contextType) { PerformTest(game => { var context = GameContextFactory.NewGameContext(contextType, isUserManagingRun: true); var windowRenderer = new GameWindowRenderer(game.Services, context) { PreferredBackBufferWidth = 640, PreferredBackBufferHeight = 480, }; windowRenderer.Initialize(); ((IContentable)windowRenderer).LoadContent(); var messageLoop = windowRenderer.Window.CreateUserManagedMessageLoop(); messageLoop.NextFrame(); windowRenderer.BeginDraw(); game.GraphicsContext.CommandList.Clear(windowRenderer.Presenter.BackBuffer, Color.Blue); windowRenderer.EndDraw(); game.SaveImage(windowRenderer.Presenter.BackBuffer, "Clear"); windowRenderer.Dispose(); }); }
internal static GameContext NewDefaultGameContext(int width = 1280, int height = 720, bool fullscreen = false) { // Default context is Desktop AppContextType type = AppContextType.Desktop; #if XENKO_PLATFORM_WINDOWS_DESKTOP || XENKO_PLATFORM_UNIX #if XENKO_GRAPHICS_API_OPENGL #if XENKO_UI_SDL type = AppContextType.DesktopSDL; #elif XENKO_UI_OPENTK type = AppContextType.DesktopOpenTK; #endif #elif XENKO_GRAPHICS_API_VULKAN #if XENKO_UI_SDL && !XENKO_UI_WINFORMS && !XENKO_UI_WPF type = AppContextType.DesktopSDL; #endif #else type = AppContextType.Desktop; #endif #elif XENKO_PLATFORM_UWP type = AppContextType.UWPXaml; // Can change later to CoreWindow #elif XENKO_PLATFORM_ANDROID type = AppContextType.Android; #elif XENKO_PLATFORM_IOS type = AppContextType.iOS; #endif return(NewGameContext(type, width, height, fullscreen)); }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { switch (type) { #if STRIDE_GRAPHICS_API_OPENGL && STRIDE_UI_OPENTK case AppContextType.DesktopOpenTK: return(new GameWindowOpenTK()); #endif #if STRIDE_UI_SDL case AppContextType.DesktopSDL: return(new GameWindowSDL()); #endif case AppContextType.Desktop: #if (STRIDE_GRAPHICS_API_DIRECT3D || STRIDE_GRAPHICS_API_VULKAN) && STRIDE_UI_WINFORMS return(new GameWindowWinforms()); #elif STRIDE_UI_SDL return(new GameWindowSDL()); #else return(null); #endif #if STRIDE_UI_WPF case AppContextType.DesktopWpf: // WPF is not supported yet. return(null); #endif default: return(null); } }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { if (type == AppContextType.Android) { return new GameWindowAndroid(); } else { return null; } }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { if (type == AppContextType.UWPCoreWindow || type == AppContextType.UWPXaml) { return(new GameWindowUWP()); } else { return(null); } }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { if (type == AppContextType.Android) { return(new GameWindowAndroid()); } else { return(null); } }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { if (type == AppContextType.WindowsRuntime) { return(new GameWindowWindowsRuntimeSwapChainPanel()); } else { return(null); } }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { if (type == AppContextType.UWP) { return new GameWindowUWPSwapChainPanel(); } else { return null; } }
/// <summary> /// Creates the appropriate <see cref="GameContext"/> for the current executing platform and <see cref="AppContextType"/>. /// </summary> /// <returns>The created <see cref="GameContext"/>.</returns> public static GameContext NewGameContext(AppContextType type, int requestedWidth = 0, int requestedHeight = 0, bool isUserManagingRun = false) { switch (type) { case AppContextType.Desktop: return(NewGameContextDesktop(requestedWidth, requestedHeight, isUserManagingRun)); case AppContextType.DesktopWpf: return(NewGameContextWpf(requestedWidth, requestedHeight, isUserManagingRun)); default: throw new InvalidOperationException("Requested type and current platform are incompatible."); } }
/// <summary> /// Given a <paramref name="type"/> create the appropriate game Context for the current executing platform. /// </summary> /// <returns></returns> public static GameContext NewGameContext(AppContextType type, int requestedWidth = 0, int requestedHeight = 0, bool isUserManagingRun = false) { GameContext res = null; switch (type) { case AppContextType.Android: res = NewGameContextAndroid(); break; case AppContextType.Desktop: res = NewGameContextDesktop(requestedWidth, requestedHeight, isUserManagingRun); break; case AppContextType.DesktopOpenTK: res = NewGameContextOpenTK(requestedWidth, requestedHeight, isUserManagingRun); break; case AppContextType.DesktopSDL: res = NewGameContextSDL(requestedWidth, requestedHeight, isUserManagingRun); break; case AppContextType.DesktopWpf: res = NewGameContextWpf(requestedWidth, requestedHeight, isUserManagingRun); break; case AppContextType.UWPXaml: res = NewGameContextUWPXaml(requestedWidth, requestedHeight); break; case AppContextType.UWPCoreWindow: res = NewGameContextUWPCoreWindow(requestedWidth, requestedHeight); break; case AppContextType.iOS: res = NewGameContextiOS(); break; } if (res == null) { throw new InvalidOperationException("Requested type and current platform are incompatible."); } return(res); }
/// <summary> /// Given a <paramref name="type"/> create the appropriate game Context for the current executing platform. /// </summary> /// <returns></returns> public static GameContext NewGameContext(AppContextType type) { GameContext res = null; switch (type) { case AppContextType.Android: res = NewGameContextAndroid(); break; case AppContextType.Desktop: res = NewGameContextDesktop(); break; case AppContextType.DesktopOpenTK: res = NewGameContextOpenTK(); break; case AppContextType.DesktopSDL: res = NewGameContextSDL(); break; case AppContextType.DesktopWpf: res = NewGameContextWpf(); break; case AppContextType.UWPXaml: res = NewGameContextUWPXaml(); break; case AppContextType.UWPCoreWindow: res = NewGameContextUWPCoreWindow(); break; case AppContextType.iOS: res = NewGameContextiOS(); break; } if (res == null) { throw new InvalidOperationException("Requested type and current platform are incompatible."); } return(res); }
internal override GameWindow GetSupportedGameWindow(AppContextType type) { switch (type) { case AppContextType.Desktop: #if STRIDE_GRAPHICS_API_DIRECT3D && STRIDE_UI_WINFORMS return(new GameWindowWinforms()); #else return(null); #endif #if STRIDE_UI_WPF case AppContextType.DesktopWpf: // WPF is not supported yet return(null); #endif default: return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="WindowHandle"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="nativeWindow">The native window instance (Winforms, SDLWindow, ...).</param> /// <param name="handle">The associated handle of <paramref name="nativeWindow"/>.</param> public WindowHandle(AppContextType context, object nativeWindow, IntPtr handle) { Context = context; NativeWindow = nativeWindow; Handle = handle; }
internal abstract GameWindow GetSupportedGameWindow(AppContextType type);
/// <summary> /// Initializes a new instance of the <see cref="WindowHandle"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="nativeHandle">The native handle.</param> public WindowHandle(AppContextType context, object nativeHandle) { Context = context; NativeHandle = nativeHandle; }
public WindowHandle(AppContextType contextType, object nativeWindow, IntPtr handle) { ContextType = contextType; NativeWindow = nativeWindow; Handle = handle; }
public AppContextAttribute(AppContextType type) { ContextType = type; }