Manual controls draw

Dec 29, 2012 at 12:04 PM
Edited Dec 29, 2012 at 12:06 PM

I need to draw components manually (GuiManager is not added to game components).
I have added property to GuiManager to retrieve  guiVisualizer and then tried to call guiManager.GuiVisualizer.Draw(screen) but it throws null-pointer exception. Then i realized that I need to call guiManager.Initialize method (because it is no longer called automatically as gameComponent). So my code is:


        GraphicsDeviceManager graphics;

        public static GuiManager gui;
        private Nuclex.Input.InputManager input;

        public GameStateManagementGame()
            //Game thingies
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);
            graphics.IsFullScreen = true;

            TargetElapsedTime = TimeSpan.FromTicks(333333);
            //Nuclex thingies
            input = new Nuclex.Input.InputManager(Services, Window.Handle);
            gui = new GuiManager(Services);
            gui.DrawOrder = 1000;

            var capturer = new Nuclex.UserInterface.Input.DefaultInputCapturer(this.input);
            gui.InputCapturer = capturer;
           // Components.Add(gui);

but i get this error:The GraphicsDevice must not be null when creating new resources.Parameter name: graphicsDevice
at (public static FlatGuiVisualizer FromResource(....)):
return new FlatGuiVisualizer(contentManager, skinStream); 

Thanks for help.
Jan 17, 2013 at 11:09 AM

I think you should call gui initialize after graphics.initialize() method. so you have to move  gui.Initialize(); to Game.LoadResources or Game.Initialize