NuclearWinter.UI

NuclearWinter.UI is a resizable UI framework.

How to use it

  • Your Game class must inherits NuclearGame
  • You might want to declare "using NuclearUI = NuclearWinter.UI;" to avoid too long typenames

Sample GameState using NuclearUI

using NuclearUI = NuclearWinter.UI;

namespace MyGame
{
    public class GameStateMainMenu: NuclearWinter.GameFlow.GameStateFadeTransition<MyGame>
    {
        //----------------------------------------------------------------------
        Screen          mScreen;
        
        //----------------------------------------------------------------------
        public GameStateMainMenu( MyGame _game )
        : base( _game )
        {
        }
        
        //----------------------------------------------------------------------
        public override void Start()
        {
            Game.IsMouseVisible = true;
            
            mScreen = new NuclearUI.Screen( Game, Game.UIStyle, Game.GraphicsDevice.Viewport.Width, Game.GraphicsDevice.Viewport.Height );
            
            //------------------------------------------------------------------
            NuclearUI.Label titleLabel = new NuclearUI.Label( mScreen, "Hello world!" );
            titleLabel.Font = mScreen.Style.BigFont;
            
            mScreen.Root.AddChild( new NuclearUI.FixedWidget( titleLabel, NuclearUI.AnchoredRect.CreateCentered( 500, 100 ) ) );
            
            //------------------------------------------------------------------
            base.Start();
        }
        
        //----------------------------------------------------------------------
        public override void Update( float _fElapsedTime )
        {
            mScreen.Active = Game.IsActive;
            mScreen.HandleInput();
            mScreen.Update();
        }
        
        //----------------------------------------------------------------------
        public override void Draw()
        {
            mScreen.Draw();
        }
    }
}

Last edited Sep 12, 2011 at 12:35 PM by elisee, version 5

Comments

Ghandhi May 13, 2014 at 5:55 PM 
" Screen mScreen; " should be " NuclearUI.Screen mScreen; "