Esempio n. 1
0
File: Game.cs Progetto: wuchirat/FNA
        protected virtual void Update(GameTime gameTime)
        {
#if BASIC_PROFILER
            updateStart = gameTimer.ElapsedTicks;
#endif
            lock (updateableComponents)
            {
                for (int i = 0; i < updateableComponents.Count; i += 1)
                {
                    currentlyUpdatingComponents.Add(updateableComponents[i]);
                }
            }
            foreach (IUpdateable updateable in currentlyUpdatingComponents)
            {
                if (updateable.Enabled)
                {
                    updateable.Update(gameTime);
                }
            }
            currentlyUpdatingComponents.Clear();

            FrameworkDispatcher.Update();
#if BASIC_PROFILER
            updateTime = gameTimer.ElapsedTicks - updateStart;
#endif
        }
Esempio n. 2
0
        public Game()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            LaunchParameters = new LaunchParameters();
            Components       = new GameComponentCollection();
            Services         = new GameServiceContainer();

            updateableComponents        = new List <IUpdateable>();
            currentlyUpdatingComponents = new List <IUpdateable>();
            drawableComponents          = new List <IDrawable>();
            currentlyDrawingComponents  = new List <IDrawable>();

            IsMouseVisible    = false;
            IsFixedTimeStep   = true;
            TargetElapsedTime = TimeSpan.FromTicks(166667);             // 60fps
            InactiveSleepTime = TimeSpan.FromSeconds(0.02);

            hasInitialized = false;
            suppressDraw   = false;
            isDisposed     = false;

            gameTime = new GameTime();

            Window                  = FNAPlatform.CreateWindow();
            Mouse.WindowHandle      = Window.Handle;
            TouchPanel.WindowHandle = Window.Handle;

            FrameworkDispatcher.Update();

            Content = new AssetManager(this, Services, AssetManager.GameDirectory);

            // Ready to run the loop!
            RunApplication = true;
        }
Esempio n. 3
0
        public Game()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            LaunchParameters = new LaunchParameters();
            Content          = new ContentManager();

            IsMouseVisible    = false;
            IsFixedTimeStep   = true;
            TargetElapsedTime = TimeSpan.FromTicks(166667);             // 60fps
            InactiveSleepTime = TimeSpan.FromSeconds(0.02);

            textInputControlDown   = new bool[FNAPlatform.TextInputCharacters.Length];
            textInputControlRepeat = new int[FNAPlatform.TextInputCharacters.Length];

            hasInitialized = false;
            suppressDraw   = false;
            isDisposed     = false;

            gameTime = new GameTime();

            Window                  = FNAPlatform.CreateWindow();
            Mouse.WindowHandle      = Window.Handle;
            TouchPanel.WindowHandle = Window.Handle;

            FrameworkDispatcher.Update();

            // Ready to run the loop!
            RunApplication = true;

            GraphicsDeviceManager.Instance = new GraphicsDeviceManager(this);
        }
Esempio n. 4
0
File: Game.cs Progetto: BibleUs/FNA
        protected virtual void Update(GameTime gameTime)
        {
#if BASIC_PROFILER
            updateStart = _gameTimer.ElapsedTicks;
#endif
            FrameworkDispatcher.Update();
            _updateables.ForEachFilteredItem(UpdateAction, gameTime);
#if BASIC_PROFILER
            updateTime = _gameTimer.ElapsedTicks - updateStart;
#endif
        }
Esempio n. 5
0
        internal void DoUpdate(GameTime gameTime)
        {
            AssertNotDisposed();
            if (Platform.BeforeUpdate(gameTime))
            {
                FrameworkDispatcher.Update();

                Update(gameTime);

                //The TouchPanel needs to know the time for when touches arrive
                TouchPanelState.CurrentTimestamp = gameTime.TotalGameTime;
            }
        }
Esempio n. 6
0
File: Game.cs Progetto: BibleUs/FNA
        public Game()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            LaunchParameters = new LaunchParameters();
            _services        = new GameServiceContainer();
            _components      = new GameComponentCollection();
            _content         = new ContentManager(_services);

            Window = FNAPlatform.CreateWindow();

            FrameworkDispatcher.Update();

            // Ready to run the loop!
            RunApplication = true;
        }
Esempio n. 7
0
        protected virtual void Update(GameTime gameTime)
        {
            lock (updateableComponents)
            {
                for (int i = 0; i < updateableComponents.Count; i += 1)
                {
                    currentlyUpdatingComponents.Add(updateableComponents[i]);
                }
            }
            foreach (IUpdateable updateable in currentlyUpdatingComponents)
            {
                if (updateable.Enabled)
                {
                    updateable.Update(gameTime);
                }
            }
            currentlyUpdatingComponents.Clear();

            FrameworkDispatcher.Update();
        }
Esempio n. 8
0
        public Game()
        {
            _instance = this;

            LaunchParameters = new LaunchParameters();
            _services        = new GameServiceContainer();
            _components      = new GameComponentCollection();
            _content         = new ContentManager(_services);

            Platform              = GamePlatform.PlatformCreate(this);
            Platform.Activated   += OnActivated;
            Platform.Deactivated += OnDeactivated;
            _services.AddService(typeof(GamePlatform), Platform);

            // Calling Update() for first time initializes some systems
            FrameworkDispatcher.Update();

            // Allow some optional per-platform construction to occur too.
            PlatformConstruct();
        }
Esempio n. 9
0
        public Game()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            LaunchParameters = new LaunchParameters();
            Components       = new GameComponentCollection();
            Services         = new GameServiceContainer();
            Content          = new ContentManager(Services);

            updateableComponents        = new List <IUpdateable>();
            currentlyUpdatingComponents = new List <IUpdateable>();
            drawableComponents          = new List <IDrawable>();
            currentlyDrawingComponents  = new List <IDrawable>();

            IsMouseVisible    = false;
            IsFixedTimeStep   = true;
            TargetElapsedTime = TimeSpan.FromTicks(166667);             // 60fps
            InactiveSleepTime = TimeSpan.FromSeconds(0.02);
            for (int i = 0; i < previousSleepTimes.Length; i += 1)
            {
                previousSleepTimes[i] = TimeSpan.FromMilliseconds(1);
            }

            textInputControlDown   = new bool[FNAPlatform.TextInputCharacters.Length];
            textInputControlRepeat = new int[FNAPlatform.TextInputCharacters.Length];

            hasInitialized = false;
            suppressDraw   = false;
            isDisposed     = false;

            gameTime = new GameTime();

            Window                  = FNAPlatform.CreateWindow();
            Mouse.WindowHandle      = Window.Handle;
            TouchPanel.WindowHandle = Window.Handle;

            FrameworkDispatcher.Update();

            // Ready to run the loop!
            RunApplication = true;
        }
Esempio n. 10
0
        public Game()
        {
            _instance = this;

            LaunchParameters = new LaunchParameters();
            _services        = new GameServiceContainer();
            _components      = new GameComponentCollection();
            _content         = new ContentManager(_services);

            Platform              = GamePlatform.PlatformCreate(this);
            Platform.Activated   += OnActivated;
            Platform.Deactivated += OnDeactivated;
            _services.AddService(typeof(GamePlatform), Platform);

            // Calling Update() for first time initializes some systems
            FrameworkDispatcher.Update();

#if WINDOWS_STOREAPP && !WINDOWS_PHONE81
            Platform.ViewStateChanged += Platform_ApplicationViewChanged;
#endif
        }
Esempio n. 11
0
 protected virtual void Update(GameTime gameTime)
 {
     FrameworkDispatcher.Update();
 }