Example #1
0
        public void ChangeSize(SizeF newSize)
        {
            var oldSize = ClientSize;

            ClientSize = newSize;
            ClientSizeChanged?.Invoke(this, new SizeChangedEventArg(oldSize, newSize));
        }
Example #2
0
        public void EnsureFrame(Rectangle frame)
        {
            if (frame == _frame)
            {
                return;
            }

            _frame = frame;

            RemoveAndDispose(ref _gameFramebuffer);
            RemoveAndDispose(ref _gameColorTarget);

            var width  = (uint)_frame.Width;
            var height = (uint)_frame.Height;

            _gameColorTarget = AddDisposable(_graphicsDevice.ResourceFactory.CreateTexture(
                                                 TextureDescription.Texture2D(
                                                     width,
                                                     height,
                                                     1,
                                                     1,
                                                     PixelFormat.B8_G8_R8_A8_UNorm,
                                                     TextureUsage.RenderTarget | TextureUsage.Sampled)));

            _gameFramebuffer = AddDisposable(_graphicsDevice.ResourceFactory.CreateFramebuffer(
                                                 new FramebufferDescription(null, _gameColorTarget)));

            ClientSizeChanged?.Invoke(this, EventArgs.Empty);
            FramebufferChanged?.Invoke(this, EventArgs.Empty);
        }
Example #3
0
 protected internal virtual void OnClientSizeChanged(EventArgs e)
 {
     ClientSizeChanged?.Invoke(this, e);
 }
Example #4
0
 protected void OnClientSizeChanged()
 {
     ClientSizeChanged?.Invoke(this, EventArgs.Empty);
 }
Example #5
0
 protected virtual void OnClientSizeChanged(object sender, Vector2i e)
 {
     ClientSizeChanged?.Invoke(sender, e);
 }
Example #6
0
 private void RaiseClientSizeChanged()
 {
     ClientSizeChanged?.Invoke(this, EventArgs.Empty);
 }