Forums

Using Empty Keys in Xenko 2.0
Last Post 23 May 2017 06:06 PM by Filip Dušek. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Levi GrahamUser is Offline
New Member
New Member
Posts:2


--
23 May 2017 02:46 AM
    I have spent some time getting all the project solutions setup properly but now I'm running into problems. I can't get anything to render. The commented out code either causes crashes or some of the namespaces in xenko have changed. It believe it is updating properly besides it locks up the mouse when I right click.

    var scene = SceneSystem.SceneInstance.Scene;
    var compositor = ((SceneGraphicsCompositorLayers)scene.Settings.GraphicsCompositor);
    compositor.Master.Renderers.Add(new SceneDelegateRenderer(Render));

    compositor.Master.Renderers doesn't exist anymore it has been moved or changed


    <Code>

    public class MainMenu : AsyncScript
    {
    EmptyKeys.UserInterface.Generated.MainMenu uiRoot;
    private DebugViewModel debug;

    public override async Task Execute()
    {
    SpriteFont font = await Content.LoadAsync<SpriteFont>("Segoe_UI_10_Regular");
    FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);

    XenkoRenderer.GraphicsContext = Game.GraphicsContext;

    uiRoot = new EmptyKeys.UserInterface.Generated.MainMenu();
    debug = new DebugViewModel(uiRoot);
    // uiRoot.DataContext = new BasicUIViewModel();

    //FontManager.Instance.LoadFonts(Content);
    //SoundManager.Instance.LoadSounds(Content);
    //ImageManager.Instance.LoadImages(Content);
    //EffectManager.Instance.LoadEffects(EffectSystem);

    //var scene = SceneSystem.SceneInstance.RootScene;
    //SceneSystem.GraphicsCompositor.RenderSystem.Add(new DelegateSceneRenderer(Render));

    while (Game.IsRunning)
    {
    await Script.NextFrame();
    debug.Update();
    uiRoot.UpdateInput(Game.UpdateTime.Elapsed.TotalMilliseconds);
    uiRoot.UpdateLayout(Game.UpdateTime.Elapsed.TotalMilliseconds);
    }
    }
    private void Render(RenderDrawContext arg1/*, RenderFrame arg2*/)
    {
    uiRoot.Draw(Game.UpdateTime.Elapsed.TotalMilliseconds);
    debug.Draw();
    }
    }
    <Code/>
    Filip DušekUser is Offline
    Advanced Member
    Advanced Member
    Posts:672


    --
    23 May 2017 06:06 PM
    Yup, there are changes in latest Xenko. You can get new Xenko engine library here - http://github.com/EmptyKeys/UI_Engines

    You can replace render delegate code with this

                // Add Graphics Layer         
                var compositor = ((SceneRendererCollection)((SceneCameraRenderer)SceneSystem.GraphicsCompositor.Game).Child);            
                var uiRenderDelegate = new DelegateSceneRenderer(Render);
                compositor.Add(uiRenderDelegate);
    
    You are not authorized to post a reply.