Exemplo n.º 1
0
        protected FusionGameState(FusionGame game)
        {
            Game = game;

            _spriteBatch = (SpriteBatch) game.Services.GetService(typeof (SpriteBatch));

            Gui = new GuiManager(Game.Graphics, Game.Input)
            {
                Screen = new Screen(game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height)
            };

            Gui.Screen.Desktop.Bounds = new UniRectangle(
              new UniScalar(0.0F, 25.0F), new UniScalar(0.0F, 25.0F),
              new UniScalar(1.0f, -50.0F), new UniScalar(1.0f, -50.0F)
            );

            Gui.Initialize();

            Gui.Visualizer = FlatGuiVisualizer.FromFile(game.Services, "Content/menu_gui.xml");
            ((FlatGuiVisualizer)Gui.Visualizer).RendererRepository.AddAssembly(typeof(FlatImageButtonControlRenderer).Assembly);
            ((FlatGuiVisualizer)Gui.Visualizer).RendererRepository.AddAssembly(typeof(FlatTiledIconControlRenderer).Assembly);

            Gui.UpdateOrder = 1000;

            Components = new GameComponentCollection { Gui };
        }
Exemplo n.º 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (FusionGame game = new FusionGame())
     {
         game.Run();
     }
 }
Exemplo n.º 3
0
        public CombatGameState(FusionGame game)
            : base(game)
        {
            InitializeComponent();

            _gameState = StateList.Countdown;
            _wave = 1;
            _playerLives = 3;
            _countdownTimer = 5000;

            var graphics = (GraphicsDeviceManager) game.Services.GetService(typeof (IGraphicsDeviceManager));

            _playerShip = new PlayerShip(game.Services);
            _playerShip.Initialize();
            _playerShip.X = graphics.GraphicsDevice.Viewport.TitleSafeArea.Width/2.0F;
            _playerShip.Y = graphics.GraphicsDevice.Viewport.TitleSafeArea.Height - 200;

            Components.Add(_playerShip);

            var input = (InputManager) game.Services.GetService(typeof (IInputService));
            input.GetKeyboard().KeyPressed += KeyPressed;
            input.GetKeyboard().KeyReleased += KeyReleased;

            _combatPlayerDialog.SetPlayerLives(_playerLives);
        }