Beispiel #1
0
        protected override void Initialize()
        {
            ScreenManager screenManager = new ScreenManager(this);
            this.Components.Add(screenManager);

            var backgroundscreen = new BackgroundScreen();
            screenManager.AddScreen(backgroundscreen);

            var debugScreen = new DebugScreen(screenManager, false);
            screenManager.Game.Components.Add(debugScreen);
            this.Services.AddService(typeof(IDebugScreen), debugScreen);

            //Recipe[] recipes = new Recipe[1];
            //recipes[0] = new Recipe(StockRecipies.Stable_A);
            PopulationSimulator populationSimulator = new PopulationSimulator(0, 0);

            var swarmEmitterComponent = new SwarmEmitterComponent(populationSimulator);

            var swarmAnalysisComponent = new SwarmAnalysisComponent(this.Services.GetService(typeof(IDebugScreen)) as IDebugScreen);

            SwarmScreen1 swarmScreen = new SwarmScreen1(swarmEmitterComponent, swarmAnalysisComponent, populationSimulator);
            screenManager.AddScreen(swarmScreen);

            #if NETFX_CORE
            ControlClient controlClient = new ControlClient(swarmScreen, this.Services.GetService(typeof(IAudio)) as IAudio);
            #else
            ControlClient controlClient = new ControlClient(swarmScreen));
            #endif
            this.Services.AddService(typeof(IControlClient), controlClient);

            base.Initialize();
            //SoundEngine.Init();
        }
Beispiel #2
0
        protected override void Initialize()
        {
            SetWindowOnSurface();

            ScreenManager screenManager = new ScreenManager(this);
            this.Components.Add(screenManager);

            var backgroundscreen = new BackgroundScreen();
            screenManager.AddScreen(backgroundscreen);

            var debugScreen = new DebugScreen(screenManager,false);
            screenManager.Game.Components.Add(debugScreen);
            this.Services.AddService(typeof(IDebugScreen), debugScreen);

            PopulationSimulator populationSimulator = new PopulationSimulator(0,0);

            var swarmEmitterComponent = new SwarmEmitterComponent(populationSimulator);

            var swarmAnalysisComponent = new SwarmAnalysisComponent(this.Services.GetService(typeof(IDebugScreen)) as IDebugScreen);

            SwarmScreen1 swarmScreen = new SwarmScreen1(swarmEmitterComponent, swarmAnalysisComponent, populationSimulator);
            screenManager.AddScreen(swarmScreen);

            ControlClient controlClient = new ControlClient(swarmScreen, swarmAnalysisComponent);
            this.Services.AddService(typeof(IControlClient), controlClient);

            base.Initialize();
            SoundEngine.Init();
        }
Beispiel #3
0
        public DebugScreen(ScreenManager screenManager, bool visible, IDebugComponent frameRateCounter)
            : base(screenManager.Game)
        {
            this.frameRateCounter = frameRateCounter;
            this.screenManager = screenManager;
            consoleVisible = visible;

            DebugItems = new List<DebugItem>();
        }
Beispiel #4
0
        public Border(ScreenManager screenManager)
        {
            debugScreen = screenManager.Game.Services.GetService(typeof(IDebugScreen)) as IDebugScreen;

            borderWalls = WallFactory.FourBouncy(screenManager.GraphicsDevice.Viewport.Width / 2, screenManager.GraphicsDevice.Viewport.Height / 2, 2);
            borderTexture = screenManager.Content.Load<Texture2D>("Backgrounds/gray");

            rightBound = borderWalls.Where(s => s.GetWallOrientation() == WallOrientationType.Horizontal).First().GetLength();
            bottomBound = borderWalls.Where(s => s.GetWallOrientation() == WallOrientationType.Vertical).First().GetLength();
        }
        public void Draw(GameTime gameTime, ScreenManager screenManager)
        {
            if (isVisible)
            {
                frameCounter++;

                string fps = string.Format(format, "{0} fps", frameRate);

                screenManager.SpriteBatch.Begin();
                screenManager.SpriteBatch.DrawString(screenManager.Fonts.FrameRateCounterFont, fps,
                                                      position, Color.LightBlue);
                screenManager.SpriteBatch.End();
            }
        }
Beispiel #6
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()
        {
            ScreenManager screenManager = new ScreenManager(this);
            this.Components.Add(screenManager);

            var backgroundscreen = new BackgroundScreen();
            screenManager.AddScreen(backgroundscreen);

            var debugScreen = new DebugScreen(screenManager, false);
            screenManager.Game.Components.Add(debugScreen);
            this.Services.AddService(typeof(IDebugScreen), debugScreen);

            SwarmScreen1 swarmScreen = new SwarmScreen1(StockRecipies.Stable_A, false);
            screenManager.AddScreen(swarmScreen);
            base.Initialize();
        }
Beispiel #7
0
 public DebugScreen(ScreenManager screenmanager, bool visible)
     : this(screenmanager, visible, new FrameRateCounter(true))
 {
 }
Beispiel #8
0
        public InputHelper(ScreenManager manager)
        {
            _currentKeyboardState = new KeyboardState();
            _currentGamePadState = new GamePadState();
            _currentMouseState = new MouseState();
            _currentVirtualState = new GamePadState();

            _lastKeyboardState = new KeyboardState();
            _lastGamePadState = new GamePadState();
            _lastMouseState = new MouseState();
            _lastVirtualState = new GamePadState();

            _manager = manager;

            _cursorIsVisible = false;
            _cursorMoved = false;
            #if WINDOWS_PHONE
            _cursorIsValid = false;

            #else
            _cursorIsValid = true;
            #endif
            _cursor = Vector2.Zero;

            _handleVirtualStick = false;
        }
Beispiel #9
0
 public InputHelper(TouchTarget touchtarget, ScreenManager manager)
     : this(manager)
 {
     TouchTarget = touchtarget;
 }