public AnimatedGameWindow(IPlatformWindow window, ISwapChain swapChain, IGraphicsDevice device) { this.Window = window; this.swapChain = swapChain; this.Device = device; this.gameTimer = new GameTimer(); }
public CanvasSwapChainAdapter( IPlatformWindow platformWindow, IGraphicsDeviceAdapter graphicsDeviceAdapter) { this.platformWindow = platformWindow ?? throw new ArgumentNullException(nameof(platformWindow)); this.graphicsDeviceAdapter = graphicsDeviceAdapter ?? throw new ArgumentNullException(nameof(graphicsDeviceAdapter)); }
public override void RenderFrame(FrameBitmapBuffer buffer, IPlatformWindow owner) { var layoutResult = layoutEngine.ProcessLayout(owner.ClientSize, owner.ComponentTree); var info = new SKImageInfo(buffer.Width, buffer.Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul); using (var surface = SKSurface.Create(info, buffer.Pixels, buffer.RowBytes)) { foreach (var component in owner.ComponentTree.GetAllElements()) { if (component is ILayoutBox layoutBox && component is IVisualComponent element) { var frameRenderer = new FrameRenderer(owner.ClientSize, surface); var renderContext = new RenderContext() { FrameRenderer = frameRenderer, ClientSize = owner.ClientSize, LayoutInfo = layoutResult.GetLayoutBoxInformation(layoutBox) }; element.Render(renderContext); } } } }
private static RectangleDouble ScreenToSystemWindow(ScreenRectangle rectOnScreen, SystemWindow containingWindow) { ScreenRectangle screenPosition = new ScreenRectangle() { Left = (int)rectOnScreen.Left, Top = (int)rectOnScreen.Top, Right = (int)rectOnScreen.Right, Bottom = (int)rectOnScreen.Bottom, }; IPlatformWindow mappingWidget = containingWindow.PlatformWindow; screenPosition.Left -= mappingWidget.DesktopPosition.x; screenPosition.Top -= (mappingWidget.DesktopPosition.y + mappingWidget.TitleBarHeight); screenPosition.Left -= mappingWidget.DesktopPosition.x; screenPosition.Bottom -= (mappingWidget.DesktopPosition.y + mappingWidget.TitleBarHeight); screenPosition.Top = (int)containingWindow.Height - screenPosition.Top; screenPosition.Bottom = (int)containingWindow.Height - screenPosition.Bottom; return(new RectangleDouble() { Left = screenPosition.Left, Bottom = screenPosition.Bottom, Right = screenPosition.Right, Top = screenPosition.Top, }); }
/// <summary> /// Makes a new game window. /// </summary> public void CreateNewWindow(VirtualWindow vir) { // - Gets the real window for this reference IPlatformWindow win = Host.Platform.GetWindow(Handlers[MainWindow]); Handlers.Add(vir, win); vir.RealWindow = win; }
public GraphicsDevice( IPlatformWindow window, IGraphicsDeviceAdapter graphicsDeviceAdapter, ISwapChain swapChainAdapter) { this.window = window ?? throw new ArgumentNullException(nameof(window)); this.graphicsDeviceAdapter = graphicsDeviceAdapter ?? throw new ArgumentNullException(nameof(graphicsDeviceAdapter)); this.SwapChain = swapChainAdapter ?? throw new ArgumentNullException(nameof(swapChainAdapter)); }
public GameFrameworkView( IGameWindow gameWindow, ICoreApplicationContext coreApplicationContext, IPlatformWindow platformWindow, IInputManager inputManager) { this.window = gameWindow ?? throw new ArgumentNullException(nameof(gameWindow)); this.coreApplicationContext = coreApplicationContext ?? throw new ArgumentNullException(nameof(coreApplicationContext)); this.platformWindow = platformWindow ?? throw new ArgumentNullException(nameof(platformWindow)); this.inputManager = inputManager ?? throw new ArgumentNullException(nameof(inputManager)); }
private static Point2D SystemWindowToScreen(Point2D pointOnWindow, SystemWindow containingWindow) { Point2D screenPosition = new Point2D(pointOnWindow.x, (int)containingWindow.Height - pointOnWindow.y); IPlatformWindow mappingWidget = containingWindow.PlatformWindow; screenPosition.x += mappingWidget.DesktopPosition.x; screenPosition.y += mappingWidget.DesktopPosition.y + mappingWidget.TitleBarHeight; return(screenPosition); }
public static Point2D ScreenToSystemWindow(Point2D pointOnScreen, SystemWindow containingWindow) { Point2D screenPosition = pointOnScreen; IPlatformWindow mappingWidget = containingWindow.PlatformWindow; screenPosition.x -= mappingWidget.DesktopPosition.x; screenPosition.y -= (mappingWidget.DesktopPosition.y + mappingWidget.TitleBarHeight); screenPosition.y = (int)containingWindow.Height - screenPosition.y; return(screenPosition); }
public GameWindow(IPlatformWindow platformWindow, IGraphicsDevice graphicsDevice, IGame game) { this.GraphicsDevice = graphicsDevice ?? throw new ArgumentNullException(nameof(graphicsDevice)); this.game = game ?? throw new ArgumentNullException(nameof(game)); this.platformWindow = platformWindow ?? throw new ArgumentNullException(nameof(platformWindow)); this.platformWindow.SizeChanged += this.OnSizeChanged; this.platformWindow.Activated += this.OnActivated; this.platformWindow.VisibilityChanged += this.OnVisibilityChanged; this.platformWindow.OrientationChanged += this.OnOrientationChanged; this.platformWindow.DpiChanged += this.OnDpiChanged; this.gameTimer.IsFixedTimeStep = false; }
public GameWindow(int width, int height, int samples, string title, bool fullscreen, bool resizable) { _title = title; _resizable = resizable; _window = Platform.CreateWindow(width, height, samples, title, fullscreen, resizable); _window.Context.VSync = false; _window.OnEvent += OnEvent; _window.OnResize += OnResize; _window.OnFocusGained += OnFocusGained; _window.OnFocusLost += OnFocusLost; _window.OnClose += OnClose; _window.Show(); }
/// <summary> /// Initialize this module. /// </summary> public override void Initialize() { base.Initialize(); // - Make main window MainWindow = new VirtualWindow(); // - Gets the real window for this reference IPlatformWindow win = Host.Platform.GetWindow(); Handlers.Add(MainWindow, win); MainContext = win; MainWindow.RealWindow = win; // - Make the main window win.Make(); }
public static ScreenRectangle SystemWindowToScreen(RectangleDouble rectOnScreen, SystemWindow containingWindow) { ScreenRectangle screenPosition = new ScreenRectangle() { Left = (int)rectOnScreen.Left, Top = (int)rectOnScreen.Top, Right = (int)rectOnScreen.Right, Bottom = (int)rectOnScreen.Bottom, }; screenPosition.Top = (int)containingWindow.Height - screenPosition.Top; screenPosition.Bottom = (int)containingWindow.Height - screenPosition.Bottom; IPlatformWindow mappingWidget = containingWindow.PlatformWindow; screenPosition.Left += mappingWidget.DesktopPosition.x; screenPosition.Top += (mappingWidget.DesktopPosition.y + mappingWidget.TitleBarHeight); screenPosition.Right += mappingWidget.DesktopPosition.x; screenPosition.Bottom += (mappingWidget.DesktopPosition.y + mappingWidget.TitleBarHeight); return(screenPosition); }
public abstract void RenderFrame(FrameBitmapBuffer buffer, IPlatformWindow owner);
public override void Start(IPlatformWindow window) { var formsWindow = (WinFormsWindow)window; System.Windows.Forms.Application.Run(formsWindow.form); }
public CoreWindowKeyboardInputSource(IPlatformWindow window, IKeyboard keyboard) { this.window = window; this.keyboard = keyboard; }
public void Dispose() { if (_window != null) { _window.Dispose(); _window = null; } }
public Window(IGraphicsDevice graphicsDevice, IPlatformWindow platformWindow) { this.graphicsDevice = graphicsDevice ?? throw new ArgumentNullException(nameof(graphicsDevice)); this.platformWindow = platformWindow ?? throw new ArgumentNullException(nameof(platformWindow)); }
public void SetPositionSameAs(IPlatformWindow existingWindow) { WindowsWindow w = (WindowsWindow)existingWindow; NativeAPI.Rectangle rect = new NativeAPI.Rectangle(); NativeAPI.GetWindowRect(w.handle, out rect); NativeAPI.SetWindowPos(handle, IntPtr.Zero, rect.Left, rect.Top, 0, 0, NativeAPI.WindowPosFlags.NoSize); }
public abstract void Start(IPlatformWindow window);