示例#1
0
        protected void Draw(CCGameTime gameTime)
        {
            // Only draw stats if they are enabled.
            if (Stats.IsEnabled)
            {
                Stats.UpdateStart();
            }

            DrawManager.PushMatrix();

            foreach (CCDirector director in sceneDirectors)
            {
                CCScene runningScene = director.RunningScene;

                // draw the scene
                if (runningScene != null)
                {
                    runningScene.Visit();

                    Renderer.VisitRenderQueue();

                    if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_VISIT))
                    {
                        EventDispatcher.DispatchEvent(eventAfterVisit);
                    }
                }

                // draw the notifications node
                if (NotificationNode != null)
                {
                    NotificationNode.Visit();
                }

                if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_DRAW))
                {
                    EventDispatcher.DispatchEvent(eventAfterDraw);
                }
            }

            DrawManager.PopMatrix();

            // Only draw stats if they are enabled.
            if (Stats.IsEnabled)
            {
                Renderer.PushGroup();
                Renderer.PushViewportGroup(ref defaultViewport);
                Renderer.PushLayerGroup(ref defaultViewMatrix, ref defaultProjMatrix);

                DrawManager.UpdateStats();
                Stats.Draw(this);

                Renderer.PopLayerGroup();
                Renderer.PopViewportGroup();
                Renderer.PopGroup();

                Renderer.VisitRenderQueue();
            }
        }
示例#2
0
        internal CCApplication(CCGame game, bool isFullScreen             = true, CCSize?mainWindowSizeInPixels = null,
                               CCDisplayOrientation supportedOrientations = CCDisplayOrientation.Default)
            : base(game)
        {
            GameTime = new CCGameTime();
            xnaGame  = game;

            Scheduler     = new CCScheduler();
            ActionManager = new CCActionManager();
            Scheduler.Schedule(ActionManager, CCSchedulePriority.System, false);

            priorGamePadState = new Dictionary <PlayerIndex, GamePadState>();
            gamePadConnection = new CCEventGamePadConnection();
            gamePadButton     = new CCEventGamePadButton();
            gamePadDPad       = new CCEventGamePadDPad();
            gamePadStick      = new CCEventGamePadStick();
            gamePadTrigger    = new CCEventGamePadTrigger();

            IGraphicsDeviceService service = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService));

            if (service == null)
            {
                service = new GraphicsDeviceManager(game);

                // if we still do not have a service after creating the GraphicsDeviceManager
                // we need to stop somewhere and issue a warning.
                if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null)
                {
                    Game.Services.AddService(typeof(IGraphicsDeviceService), service);
                }
            }

            xnaDeviceManager = (GraphicsDeviceManager)service;

            Content = game.Content;
            HandleMediaStateAutomatically = true;

            game.IsFixedTimeStep = true;

            TouchPanel.EnabledGestures = GestureType.Tap;

            game.Activated   += GameActivated;
            game.Deactivated += GameDeactivated;
            game.Exiting     += GameExiting;
            game.Window.OrientationChanged += OrientationChanged;

            game.Components.Add(this);

            gameWindows = new List <CCWindow>();

            InitializeMainWindow((mainWindowSizeInPixels.HasValue) ? mainWindowSizeInPixels.Value : CCSize.Zero,
                                 isFullScreen, supportedOrientations);
        }
示例#3
0
 public virtual void MainLoop(CCGameTime gameTime)
 {
     foreach (CCDirector director in sceneDirectors)
     {
         if (director.IsPurgeDirectorInNextLoop)
         {
             director.PurgeDirector();
             director.IsPurgeDirectorInNextLoop = false;
         }
         else
         {
             Draw(gameTime);
         }
     }
 }
示例#4
0
        protected void Draw(CCGameTime gameTime)
        {
            Stats.UpdateStart();

            DrawManager.PushMatrix();

            foreach (CCDirector director in sceneDirectors)
            {
                CCScene runningScene = director.RunningScene;

                // draw the scene
                if (runningScene != null)
                {
                    runningScene.Visit();
                    if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_VISIT))
                    {
                        EventDispatcher.DispatchEvent(eventAfterVisit);
                    }
                }

                // draw the notifications node
                if (NotificationNode != null)
                {
                    NotificationNode.Visit();
                }

                if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_DRAW))
                {
                    EventDispatcher.DispatchEvent(eventAfterDraw);
                }
            }

            DrawManager.PopMatrix();

            Stats.Draw(this);
        }
示例#5
0
        protected void Draw(CCGameTime gameTime)
        {
            //Stats.UpdateStart();

            DrawManager.PushMatrix();

            foreach (CCDirector director in sceneDirectors) 
            {
                CCScene runningScene = director.RunningScene;

                // draw the scene
                if (runningScene != null) 
                {
                    runningScene.Visit();
                    if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_VISIT))
                        EventDispatcher.DispatchEvent (eventAfterVisit);
                }

                // draw the notifications node
                if (NotificationNode != null) 
                {
                    NotificationNode.Visit();
                }

                if (EventDispatcher.IsEventListenersFor (EVENT_AFTER_DRAW))
                    EventDispatcher.DispatchEvent (eventAfterDraw);
            }

            DrawManager.PopMatrix();

            //Stats.Draw(this);
        }
示例#6
0
 public virtual void MainLoop(CCGameTime gameTime)
 {
     foreach (CCDirector director in sceneDirectors) 
     {
         if (director.IsPurgeDirectorInNextLoop) 
         {
             director.PurgeDirector();
             director.IsPurgeDirectorInNextLoop = false;
         } 
         else
         {
             Draw(gameTime);
         }
     }
 }
示例#7
0
        internal CCApplication(CCGame game, bool isFullScreen = true, CCSize? mainWindowSizeInPixels = null)
            : base(game)
        {
            GameTime = new CCGameTime();
            xnaGame = game;

            Scheduler = new CCScheduler();
            ActionManager = new CCActionManager();
            Scheduler.Schedule(ActionManager, CCSchedulePriority.System, false);

            priorGamePadState = new Dictionary<PlayerIndex, GamePadState>();
            gamePadConnection = new CCEventGamePadConnection();
            gamePadButton = new CCEventGamePadButton();
            gamePadDPad = new CCEventGamePadDPad();
            gamePadStick = new CCEventGamePadStick();
            gamePadTrigger = new CCEventGamePadTrigger();

            IGraphicsDeviceService service = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService));

            if (service == null)
            {
                service = new GraphicsDeviceManager(game);

                // if we still do not have a service after creating the GraphicsDeviceManager
                // we need to stop somewhere and issue a warning.
                if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null)
                {
                    Game.Services.AddService(typeof(IGraphicsDeviceService), service);
                }
            }

            xnaDeviceManager = (GraphicsDeviceManager)service;

            Content = game.Content;
            HandleMediaStateAutomatically = true;

            game.IsFixedTimeStep = true;

            TouchPanel.EnabledGestures = GestureType.Tap;

            game.Activated += GameActivated;
            game.Deactivated += GameDeactivated;
            game.Exiting += GameExiting;
            game.Window.OrientationChanged += OrientationChanged;

            game.Components.Add(this);

            gameWindows = new List<CCWindow>();

            // Setting up the window correctly requires knowledge of the phone app page which needs to be set first
            #if !WINDOWS_PHONE
            InitializeMainWindow((mainWindowSizeInPixels.HasValue) ? mainWindowSizeInPixels.Value : new CCSize(800,480), isFullScreen);
            #endif
        }
示例#8
0
        protected void Draw(CCGameTime gameTime)
        {
            // Only draw stats if they are enabled.
            if (Stats.IsEnabled)
                Stats.UpdateStart();

            DrawManager.PushMatrix();

            foreach (CCDirector director in sceneDirectors) 
            {
                CCScene runningScene = director.RunningScene;

                // draw the scene
                if (runningScene != null) 
                {
                    runningScene.Visit();

                    Renderer.VisitRenderQueue();

                    if (EventDispatcher.IsEventListenersFor(EVENT_AFTER_VISIT))
                        EventDispatcher.DispatchEvent (eventAfterVisit);
                }

                // draw the notifications node
                if (NotificationNode != null) 
                {
                    NotificationNode.Visit();
                }

                if (EventDispatcher.IsEventListenersFor (EVENT_AFTER_DRAW))
                    EventDispatcher.DispatchEvent (eventAfterDraw);
            }

            DrawManager.PopMatrix();

            // Only draw stats if they are enabled.
            if (Stats.IsEnabled)
            {
                Renderer.PushGroup();
                Renderer.PushViewportGroup(ref defaultViewport);
                Renderer.PushLayerGroup(ref defaultViewMatrix, ref defaultProjMatrix);

                DrawManager.UpdateStats();
                Stats.Draw(this);

                Renderer.PopLayerGroup();
                Renderer.PopViewportGroup();
                Renderer.PopGroup();

                Renderer.VisitRenderQueue();
            } 
        }
示例#9
0
		CCApplication(CCGame game, bool isFullScreen = true, CCSize? mainWindowSizeInPixels = null,
			CCDisplayOrientation supportedOrientations = CCDisplayOrientation.Default)
			: base(game)
		{
			GameTime = new CCGameTime();
			xnaGame = game;

			Scheduler = new CCScheduler();
			ActionManager = new CCActionManager();
			Scheduler.Schedule(ActionManager, CCSchedulePriority.System, false);

			priorGamePadState = new Dictionary<PlayerIndex, GamePadState>();
			gamePadConnection = new CCEventGamePadConnection();
			gamePadButton = new CCEventGamePadButton();
			gamePadDPad = new CCEventGamePadDPad();
			gamePadStick = new CCEventGamePadStick();
			gamePadTrigger = new CCEventGamePadTrigger();

			IGraphicsDeviceService service = (IGraphicsDeviceService)Game.Services.GetService(typeof(IGraphicsDeviceService));

			if (service == null)
			{
				service = new GraphicsDeviceManager(game);

				// if we still do not have a service after creating the GraphicsDeviceManager
				// we need to stop somewhere and issue a warning.
				if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null)
				{
					Game.Services.AddService(typeof(IGraphicsDeviceService), service);
				}
			}

			xnaDeviceManager = (GraphicsDeviceManager)service;

			Content = game.Content;
			HandleMediaStateAutomatically = true;

			game.IsFixedTimeStep = true;

			TouchPanel.EnabledGestures = GestureType.Tap;

			game.Activated += GameActivated;
			game.Deactivated += GameDeactivated;
			game.Exiting += GameExiting;
			game.Window.OrientationChanged += OrientationChanged;

			game.Components.Add(this);

			gameWindows = new List<CCWindow>();

			InitializeMainWindow((mainWindowSizeInPixels.HasValue) ? mainWindowSizeInPixels.Value : CCSize.Zero,
				isFullScreen, supportedOrientations);
		}