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(); }
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); }
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(); }
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); }
internal void ReInitStats() { Stats = new CCStats(); }
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); }
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(); }