Esempio n. 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);
        }
Esempio n. 2
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
        }
Esempio n. 3
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);
		}