Example #1
0
        internal CCWindow(CCApplication application, CCSize screenSizeInPixels, GameWindow xnaWindow, GraphicsDeviceManager deviceManager)
        {
            sceneDirectors = new List <CCDirector>();

            AddSceneDirector(new CCDirector());

            EventDispatcher = new CCEventDispatcher(this);
            Stats           = new CCStats();

            #if !NETFX_CORE
            Accelerometer = new CCAccelerometer(this);
            #endif

            eventAfterDraw            = new CCEventCustom(EVENT_AFTER_DRAW);
            eventAfterDraw.UserData   = this;
            eventAfterVisit           = new CCEventCustom(EVENT_AFTER_VISIT);
            eventAfterVisit.UserData  = this;
            eventAfterUpdate          = new CCEventCustom(EVENT_AFTER_UPDATE);
            eventAfterUpdate.UserData = this;


            IsUseAlphaBlending = true;
            IsUseDepthTesting  = false;

            this.XnaWindow = xnaWindow;
            xnaWindow.OrientationChanged += OnOrientationChanged;
            xnaWindow.ClientSizeChanged  += OnWindowSizeChanged;
            xnaWindow.AllowUserResizing   = true;

            Application = application;

            designResolutionSize   = WindowSizeInPixels;
            DesignResolutionPolicy = CCSceneResolutionPolicy.ExactFit;
            Stats.Initialize();
        }
Example #2
0
        internal CCWindow(CCApplication application, CCSize screenSizeInPixels, GameWindow xnaWindow, GraphicsDeviceManager deviceManager)
        {
            sceneDirectors = new List <CCDirector>();

            AddSceneDirector(new CCDirector());

            EventDispatcher = new CCEventDispatcher(this);
            Stats           = new CCStats();

            #if !NETFX_CORE
            Accelerometer = new CCAccelerometer(this);
            #endif

            eventAfterDraw            = new CCEventCustom(EVENT_AFTER_DRAW);
            eventAfterDraw.UserData   = this;
            eventAfterVisit           = new CCEventCustom(EVENT_AFTER_VISIT);
            eventAfterVisit.UserData  = this;
            eventAfterUpdate          = new CCEventCustom(EVENT_AFTER_UPDATE);
            eventAfterUpdate.UserData = this;


            IsUseAlphaBlending = true;
            IsUseDepthTesting  = false;

            this.XnaWindow = xnaWindow;
            xnaWindow.OrientationChanged += OnOrientationChanged;
            xnaWindow.ClientSizeChanged  += OnWindowSizeChanged;

            DeviceManager = deviceManager;
            // Trying to set user resize when game is full-screen will cause app to crash
            if (!deviceManager.IsFullScreen)
            {
                xnaWindow.AllowUserResizing = true;
            }

            Application = application;

            if (CCScene.DefaultDesignResolutionSize == CCSize.Zero)
            {
                CCScene.DefaultDesignResolutionSize   = screenSizeInPixels;
                CCScene.DefaultDesignResolutionPolicy = CCSceneResolutionPolicy.ExactFit;
            }

            // Make sure we initialize the Cache's so that the correct Scheduler is used.
            // This needs to be looked at further for multiple windows.
            new CCTextureCache(application);
            new CCParticleSystemCache(application);

            Stats.Initialize();

            CCPoint center = screenSizeInPixels.Center;
            defaultViewMatrix = Matrix.CreateLookAt(new CCPoint3(center, 300.0f).XnaVector, new CCPoint3(center, 0.0f).XnaVector, Vector3.Up);
            defaultProjMatrix = Matrix.CreateOrthographic(screenSizeInPixels.Width, screenSizeInPixels.Height, 1024f, -1024);
            defaultViewport   = new Viewport(0, 0, (int)screenSizeInPixels.Width, (int)screenSizeInPixels.Height);
        }
Example #3
0
        void InitialiseMobileInputHandling()
        {
            touchMap               = new Dictionary <int, CCTouch>();
            incomingNewTouches     = new List <CCTouch>();
            incomingMoveTouches    = new List <CCTouch>();
            incomingReleaseTouches = new List <CCTouch>();

            TouchEnabled = true;

            Accelerometer = new CCAccelerometer(this);
        }
Example #4
0
        internal CCWindow(CCApplication application, CCSize screenSizeInPixels, GameWindow xnaWindow, GraphicsDeviceManager deviceManager)
        {
            sceneDirectors = new List <CCDirector>();

            AddSceneDirector(new CCDirector());

            EventDispatcher = new CCEventDispatcher(this);
            Stats           = new CCStats();

            #if !NETFX_CORE
            Accelerometer = new CCAccelerometer(this);
            #endif

            eventAfterDraw            = new CCEventCustom(EVENT_AFTER_DRAW);
            eventAfterDraw.UserData   = this;
            eventAfterVisit           = new CCEventCustom(EVENT_AFTER_VISIT);
            eventAfterVisit.UserData  = this;
            eventAfterUpdate          = new CCEventCustom(EVENT_AFTER_UPDATE);
            eventAfterUpdate.UserData = this;


            IsUseAlphaBlending = true;
            IsUseDepthTesting  = false;

            this.XnaWindow = xnaWindow;
            xnaWindow.OrientationChanged += OnOrientationChanged;
            xnaWindow.ClientSizeChanged  += OnWindowSizeChanged;

            DeviceManager = deviceManager;
            // Trying to set user resize when game is full-screen will cause app to crash
            if (!deviceManager.IsFullScreen)
            {
                xnaWindow.AllowUserResizing = true;
            }

            Application = application;

            if (CCScene.DefaultDesignResolutionSize == CCSize.Zero)
            {
                CCScene.DefaultDesignResolutionSize   = screenSizeInPixels;
                CCScene.DefaultDesignResolutionPolicy = CCSceneResolutionPolicy.ExactFit;
            }

            Stats.Initialize();
        }
Example #5
0
        internal CCWindow(CCApplication application, CCSize screenSizeInPixels, GameWindow xnaWindow, GraphicsDeviceManager deviceManager)
        {
            sceneDirectors = new List<CCDirector>();

            AddSceneDirector(new CCDirector());

            EventDispatcher = new CCEventDispatcher(this);
            //Stats = new CCStats();

            #if !NETFX_CORE
            Accelerometer = new CCAccelerometer(this);
            #endif

            eventAfterDraw = new CCEventCustom(EVENT_AFTER_DRAW);
            eventAfterDraw.UserData = this;
            eventAfterVisit = new CCEventCustom(EVENT_AFTER_VISIT);
            eventAfterVisit.UserData = this;
            eventAfterUpdate = new CCEventCustom(EVENT_AFTER_UPDATE);
            eventAfterUpdate.UserData = this;


            IsUseAlphaBlending = true;
            IsUseDepthTesting = false;

            this.XnaWindow = xnaWindow;
            xnaWindow.OrientationChanged += OnOrientationChanged;
            xnaWindow.ClientSizeChanged += OnWindowSizeChanged;
            xnaWindow.AllowUserResizing = true;

            Application = application;

            designResolutionSize = WindowSizeInPixels;
            DesignResolutionPolicy = CCSceneResolutionPolicy.ExactFit;
            //Stats.Initialize();
        }
Example #6
0
        internal CCWindow(CCApplication application, CCSize screenSizeInPixels, GameWindow xnaWindow, GraphicsDeviceManager deviceManager)
        {
            sceneDirectors = new List<CCDirector>();

            AddSceneDirector(new CCDirector());

            EventDispatcher = new CCEventDispatcher(this);
            Stats = new CCStats();

            #if !NETFX_CORE
            Accelerometer = new CCAccelerometer(this);
            #endif

            eventAfterDraw = new CCEventCustom(EVENT_AFTER_DRAW);
            eventAfterDraw.UserData = this;
            eventAfterVisit = new CCEventCustom(EVENT_AFTER_VISIT);
            eventAfterVisit.UserData = this;
            eventAfterUpdate = new CCEventCustom(EVENT_AFTER_UPDATE);
            eventAfterUpdate.UserData = this;


            IsUseAlphaBlending = true;
            IsUseDepthTesting = false;

            this.XnaWindow = xnaWindow;
            xnaWindow.OrientationChanged += OnOrientationChanged;
            xnaWindow.ClientSizeChanged += OnWindowSizeChanged;
            
            DeviceManager = deviceManager;
            // Trying to set user resize when game is full-screen will cause app to crash 
            if(!deviceManager.IsFullScreen)
                xnaWindow.AllowUserResizing = true;

            Application = application;

            if (CCScene.DefaultDesignResolutionSize == CCSize.Zero)
            {
                CCScene.DefaultDesignResolutionSize = screenSizeInPixels;
                CCScene.DefaultDesignResolutionPolicy = CCSceneResolutionPolicy.ExactFit;
            }

            // Make sure we initialize the Cache's so that the correct Scheduler is used.
            // This needs to be looked at further for multiple windows.
            new CCTextureCache(application);
            new CCParticleSystemCache(application);

            Stats.Initialize();

            CCPoint center = screenSizeInPixels.Center;
            defaultViewMatrix = Matrix.CreateLookAt(new CCPoint3(center, 300.0f).XnaVector, new CCPoint3(center, 0.0f).XnaVector, Vector3.Up);
            defaultProjMatrix = Matrix.CreateOrthographic(screenSizeInPixels.Width, screenSizeInPixels.Height, 1024f, -1024);
            defaultViewport = new Viewport(0, 0, (int)screenSizeInPixels.Width, (int)screenSizeInPixels.Height);
        }
Example #7
0
        internal CCWindow(CCApplication application, CCSize screenSizeInPixels, GameWindow xnaWindow, GraphicsDeviceManager deviceManager)
        {
            sceneDirectors = new List<CCDirector>();

            AddSceneDirector(new CCDirector());

            EventDispatcher = new CCEventDispatcher(this);
            Stats = new CCStats();

            #if !NETFX_CORE
            Accelerometer = new CCAccelerometer(this);
            #endif

            eventAfterDraw = new CCEventCustom(EVENT_AFTER_DRAW);
            eventAfterDraw.UserData = this;
            eventAfterVisit = new CCEventCustom(EVENT_AFTER_VISIT);
            eventAfterVisit.UserData = this;
            eventAfterUpdate = new CCEventCustom(EVENT_AFTER_UPDATE);
            eventAfterUpdate.UserData = this;


            IsUseAlphaBlending = true;
            IsUseDepthTesting = false;

            this.XnaWindow = xnaWindow;
            xnaWindow.OrientationChanged += OnOrientationChanged;
            xnaWindow.ClientSizeChanged += OnWindowSizeChanged;
            
            DeviceManager = deviceManager;
            // Trying to set user resize when game is full-screen will cause app to crash 
            if(!deviceManager.IsFullScreen)
                xnaWindow.AllowUserResizing = true;

            Application = application;

            if (CCScene.DefaultDesignResolutionSize == CCSize.Zero)
            {
                CCScene.DefaultDesignResolutionSize = screenSizeInPixels;
                CCScene.DefaultDesignResolutionPolicy = CCSceneResolutionPolicy.ExactFit;
            }

            Stats.Initialize();
        }