Exemple #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            ui = new UserInterface(GraphicsDevice);

            Player = new InputActor(1, new MouseDevice(), new KeyboardDevice(PlayerIndex.One, Window.Handle));
            //Kernel.Bind<InputActor>().ToConstant(player);
            Components.Add(Player);
            ui.Actors.Add(Player);

            var statLog = new StatisticTextLog(ui.Root, Content.Load <SpriteFont>("Consolas"), true);

            statLog.SetPoint(Points.TopLeft, 10, 10);

            frameTime = Statistic.Get("Misc.Time", "{0:00.00}ms");
            fps       = new FrequencyTracker("Misc.FPS");

            var console = new CommandConsole(this, Content.Load <SpriteFont>("Consolas"), ui.Root);

            Kernel.Bind <CommandConsole>().ToConstant(console);

            screens = new ScreenManager();
            screens.Push(Kernel.Get <MainMenu>());

            base.Initialize();
        }
Exemple #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _ui = new UserInterface(GraphicsDevice);

            Player = new InputActor(1, new MouseDevice(), new KeyboardDevice(PlayerIndex.One, Window.Handle));
            //Kernel.Bind<InputActor>().ToConstant(player);
            Components.Add(Player);
            _ui.Actors.Add(Player);

            var statLog = new StatisticTextLog(_ui.Root, Content.Load<SpriteFont>("Consolas"), true);
            statLog.SetPoint(Points.TopLeft, 10, 10);

            _frameTime = Statistic.Create("Misc.Time", "{0:00.00}ms");
            _fps = new FrequencyTracker("Misc.FPS");

            var console = new CommandConsole(this, Content.Load<SpriteFont>("Consolas"), _ui.Root);
            Kernel.Bind<CommandConsole>().ToConstant(console);

            _screens = new ScreenManager();
            _screens.Push(Kernel.Get<MainMenu>());

            base.Initialize();
        }
Exemple #3
0
 public StatisticText(StatisticTextLog log, Statistic statistic, TimeSpan accessInterval, SpriteFont font)
     : base(statistic, accessInterval)
 {
     _label = new Label(log, font)
     {
         Text = statistic.Name + ": " + string.Format(statistic.Format, statistic.Value)
     };
 }