Ejemplo n.º 1
0
        public override void Update()
        {
            UltralightDll.Update();
            UltralightDll.Render();
            IntPtr data;
            int    size;

            UltralightDll.GetViewBitmap(_viewId, out data, out size);
            DataPointer dataPointer = new DataPointer(data, size);

            _texture.SetData(this.Game.GraphicsContext.CommandList, dataPointer);
            _sprite.Texture      = _texture;
            _imageElement.Source = _sprite;
        }
Ejemplo n.º 2
0
        public override void Start()
        {
            base.Start();

            var uiComponent = Entity.Get <UIComponent>();

            _imageElement = uiComponent.Page.RootElement.VisualChildren.FirstOrDefault() as ImageElement;
            _width        = (int)uiComponent.Resolution.X;
            _height       = (int)uiComponent.Resolution.Y;
            _texture      = Texture.New2D(this.GraphicsDevice, _width, _height, Xenko.Graphics.PixelFormat.R8G8B8A8_UNorm, TextureFlags.ShaderResource | TextureFlags.RenderTarget);
            _sprite       = new SpriteFromTexture();
            if (!_rendererInitialized)
            {
                UltralightDll.InitializeApp(this.AssetDirectory);
                _rendererInitialized = true;
            }
            UltralightDll.CreateView(_width, _height, "file:///" + HtmlFile);
        }