コード例 #1
0
ファイル: Game.cs プロジェクト: 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
        }
コード例 #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;
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: craftworkgames/katabasis
        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);
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: 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
        }
コード例 #5
0
ファイル: Game.cs プロジェクト: ReaTsukuda/ReaMG
        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;
            }
        }
コード例 #6
0
ファイル: Game.cs プロジェクト: 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;
        }
コード例 #7
0
ファイル: Game.cs プロジェクト: FakeDomi/FNA-Threaded
        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();
        }
コード例 #8
0
ファイル: Game.cs プロジェクト: ReaTsukuda/ReaMG
        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();
        }
コード例 #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;
        }
コード例 #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
        }
コード例 #11
0
ファイル: Game.cs プロジェクト: craftworkgames/katabasis
 protected virtual void Update(GameTime gameTime)
 {
     FrameworkDispatcher.Update();
 }