Example #1
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);
        }
Example #2
0
        void Initialise()
        {
            if (viewInitialised)
            {
                return;
            }

            PlatformInitialise();

            ActionManager   = new CCActionManager();
            Director        = new CCDirector();
            EventDispatcher = new CCEventDispatcher(this);
            AudioEngine     = new CCAudioEngine();
            Scheduler       = new CCScheduler();

            // Latest instance of game view should be setting shared resources
            // Ideally, we should move towards removing these singletons altogetehr
            CCAudioEngine.SharedEngine  = AudioEngine;
            CCScheduler.SharedScheduler = Scheduler;

            Stats = new CCStats();

            InitialiseGraphicsDevice();

            InitialiseResourceCaches();

            InitialiseRunLoop();

            InitialiseInputHandling();

            Stats.Initialise();

            viewInitialised = true;

            currentViewInstance = new WeakReference(this);
        }
Example #3
0
 internal CCScheduler(CCActionManager actionManager = null)
 {
     TimeScale          = 1.0f;
     this.actionManager = actionManager;
 }
Example #4
0
        internal CCScheduler(CCActionManager actionManager = null)
		{
			TimeScale = 1.0f;
            this.actionManager = actionManager;
		}
Example #5
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
        }
Example #6
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);
		}