protected virtual bool InitWithDuration(float t, CCScene scene)
        {
            Debug.Assert(scene != null, "Argument scene must be non-nil");

            if (base.Init())
            {
                m_fDuration = t;

                // retain
                m_pInScene = scene;
                m_pOutScene = CCDirector.SharedDirector.RunningScene;
                if (m_pOutScene == null)
                {
                    // Creating an empty scene.
                    m_pOutScene = new CCScene();
                    m_pOutScene.Init();
                }

                Debug.Assert(m_pInScene != m_pOutScene, "Incoming scene must be different from the outgoing scene");

                // disable events while transitions
                CCDirector pDirector = CCDirector.SharedDirector;
                pDirector.TouchDispatcher.IsDispatchEvents = false;
                SceneOrder();

                return true;
            }
            return false;
        }
        public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader)
        {
            /* Create an autorelease CCNodeLoaderLibrary. */
            CCNodeLoaderLibrary ccNodeLoaderLibrary = CCNodeLoaderLibrary.NewDefaultCCNodeLoaderLibrary();

            ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader<TestHeaderLayer>());
            if (pCCNodeName != null && pCCNodeLoader != null)
            {
                ccNodeLoaderLibrary.RegisterCCNodeLoader(pCCNodeName, pCCNodeLoader);
            }

            /* Create an autorelease CCBReader. */
            var ccbReader = new CCBReader(ccNodeLoaderLibrary);

            /* Read a ccbi file. */
            // Load the scene from the ccbi-file, setting this class as
            // the owner will cause lblTestTitle to be set by the CCBReader.
            // lblTestTitle is in the TestHeader.ccbi, which is referenced
            // from each of the test scenes.
            CCNode node = ccbReader.ReadNodeGraphFromFile(pCCBFileName, this);

            mTestTitleLabelTTF.Label = (pCCBFileName);

            CCScene scene = new CCScene();
            scene.AddChild(node);

            /* Push the new scene with a fancy transition. */
            CCColor3B transitionColor;
            transitionColor.R = 0;
            transitionColor.G = 0;
            transitionColor.B = 0;

            CCDirector.SharedDirector.PushScene(new CCTransitionFade(0.5f, scene, transitionColor));
        }
Exemple #3
0
        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            //initialize director
            CCDirector pDirector = CCDirector.SharedDirector;
            pDirector.SetOpenGlView();
#if WINDOWS
            CCDrawManager.SetDesignResolutionSize(320, 480, CCResolutionPolicy.ExactFit);
#else
            CCDrawManager.SetDesignResolutionSize(800, 480, ResolutionPolicy.ShowAll);
            //CCDrawManager.SetDesignResolutionSize(480, 320, ResolutionPolicy.ShowAll);
#endif
            // turn on display FPS
            pDirector.DisplayStats = true;

            // set FPS. the default value is 1.0/60 if you don't call this
            pDirector.AnimationInterval = 1.0 / 60;

            // create a scene. it's an autorelease object
            CCScene pScene = new CCScene();
            CCLayer pLayer = new GameLayer();

            pScene.AddChild(pLayer);
            pDirector.RunWithScene(pScene);

            return true;
        }
		public static void runTableViewTest()
		{
			var pScene = new CCScene();
			var pLayer = new TableViewTestLayer();
			pLayer.Init();
			pScene.AddChild(pLayer);
			CCDirector.SharedDirector.ReplaceScene(pScene);
		}
Exemple #5
0
        public void switchLayer(float dt)
        {
            //unschedule(schedule_selector(Bug624Layer::switchLayer));

            CCScene scene = new CCScene();
            scene.AddChild(new Bug624Layer(), 0);
            CCDirector.SharedDirector.ReplaceScene(new CCTransitionFade(2.0f, scene, new CCColor3B { R = 255, G = 0, B = 0 }));
        }
Exemple #6
0
        public static CCScene scene()
        {
            CCScene pScene = new CCScene();
            //Bug1159Layer layer = Bug1159Layer.node();
            //pScene.addChild(layer);

            return pScene;
        }
 /// <summary>
 /// initializes the transition with a duration and with an RGB color 
 /// </summary>
 protected virtual bool InitWithDuration(float duration, CCScene scene, CCColor3B color)
 {
     if (base.InitWithDuration(duration, scene))
     {
         m_tColor = new CCColor4B {R = color.R, G = color.G, B = color.B, A = 0};
     }
     return true;
 }
Exemple #8
0
        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            //initialize director
            CCDirector pDirector = CCDirector.SharedDirector;
            pDirector.SetOpenGlView();

            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22);
            CCSpriteFontCache.RegisterFont("MarkerFelt-Thin", 12, 18);
            CCSpriteFontCache.RegisterFont("Paint Boy", 26);
            CCSpriteFontCache.RegisterFont("Schwarzwald Regular", 26);
            CCSpriteFontCache.RegisterFont("Scissor Cuts", 26);
            CCSpriteFontCache.RegisterFont("A Damn Mess", 26);
            CCSpriteFontCache.RegisterFont("Abberancy", 26);
            CCSpriteFontCache.RegisterFont("Abduction", 26);

            // turn on display FPS
            pDirector.DisplayStats = true;
            // set FPS. the default value is 1.0/60 if you don't call this
            pDirector.AnimationInterval = 1.0 / 60;

            CCSize designSize = new CCSize(480, 320);

            if (CCDrawManager.FrameSize.Height > 320)
            {
                CCSize resourceSize = new CCSize(960, 640);
                CCContentManager.SharedContentManager.SearchPaths.Add("hd");
                pDirector.ContentScaleFactor = resourceSize.Height / designSize.Height;
            }

            CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll);

/*
#if WINDOWS || WINDOWSGL
            CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit);
#else
            CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll);
            //CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll);
#endif
*/

            // create a scene. it's an autorelease object
            CCScene pScene = new CCScene();
            CCLayer pLayer = new TestController();
            
            /*           
            CCScene pScene = CCScene.node();
            var pLayer = Box2DView.viewWithEntryID(0);
            pLayer.scale = 10;
            pLayer.anchorPoint = new CCPoint(0, 0);
            pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4);
            */

            pScene.AddChild(pLayer);
            pDirector.RunWithScene(pScene);

            return true;
        }
        public static CCScene SceneWithScore(int score, int remoteScore)
        {
            var scene = new CCScene ();
            var layer = new GameOverLayer (score, remoteScore);

            scene.AddChild (layer);

            return scene;
        }
		public new static CCScene sceneWithTitle(string title)
		{
			var pScene = new CCScene();
			var controlLayer = new CCControlButtonTest_HelloVariableSize();
		    controlLayer.Init();
    		controlLayer.getSceneTitleLabel().Text = (title);
			pScene.AddChild(controlLayer);
			return pScene;
		}
        public static void runTouchesTest()
        {
            s_nTouchCurCase = 0;
            CCScene pScene = new CCScene();
            CCLayer pLayer = new TouchesPerformTest1(true, TEST_COUNT, s_nTouchCurCase);

            pScene.AddChild(pLayer);

            CCDirector.SharedDirector.ReplaceScene(pScene);
        }
 public new static CCScene sceneWithTitle(string title)
 {
     CCScene pScene = new CCScene();
     var controlLayer = new CCControlSwitchTest();
     if (controlLayer != null && controlLayer.Init())
     {
         controlLayer.getSceneTitleLabel().Text = (title);
         pScene.AddChild(controlLayer);
     }
     return pScene;
 }
 public new static CCScene sceneWithTitle(string title)
 {
     var pScene = new CCScene();
     var controlLayer = new CCControlStepperTest();
     if (controlLayer != null)
     {
         controlLayer.getSceneTitleLabel().Text = (title);
         pScene.AddChild(controlLayer);
     }
     return pScene;
 }
        public void menuCallback(object pSender)
        {
            CCMenuItemFont pItem = (CCMenuItemFont)pSender;
            int nIndex = pItem.ZOrder - BugsTestScene.kItemTagBasic;

            CCScene pScene = new CCScene();
            CCLayer pLayer = null;

            switch (nIndex)
            {
                case 0:
                    pLayer = new Bug350Layer();
                    pLayer.Init();
                    break;
                case 1:
                    pLayer = new Bug422Layer();
                    pLayer.Init();
                    break;
                case 2:
                    pLayer = new Bug458Layer();
                    pLayer.Init();
                    break;
                case 3:
                    pLayer = new Bug624Layer();
                    pLayer.Init();
                    break;
                case 4:
                    pLayer = new Bug886Layer();
                    pLayer.Init();
                    break;
                case 5:
                    pLayer = new Bug899Layer();
                    pLayer.Init();
                    break;
                case 6:
                    pLayer = new Bug914Layer();
                    pLayer.Init();
                    break;
                case 7:
                    pLayer = new Bug1159Layer();
                    pLayer.Init();
                    break;
                case 8:
                    pLayer = new Bug1174Layer();
                    pLayer.Init();
                    break;
                default:
                    break;
            }
            pScene.AddChild(pLayer);
            CCDirector.SharedDirector.ReplaceScene(pScene);
        }
        public static CCScene scene()
        {
            // 'scene' is an autorelease object.
            CCScene pScene = new CCScene();
            // 'layer' is an autorelease object.
            //Bug914Layer layer = Bug914Layer.node();

            // add layer as a child to scene
            //pScene.addChild(layer);

            // return the scene
            return pScene;
        }
        public override void showCurrentTest()
        {
            CCLayer pLayer = null;
            switch (m_nCurCase)
            {
                case 0:
                    pLayer = new TouchesPerformTest1(true, PerformanceTouchesTest.TEST_COUNT, m_nCurCase);
                    break;
                case 1:
                    pLayer = new TouchesPerformTest2(true, PerformanceTouchesTest.TEST_COUNT, m_nCurCase);
                    break;
            }
            PerformanceTouchesTest.s_nTouchCurCase = m_nCurCase;

            if (pLayer != null)
            {
                CCScene pScene = new CCScene();
                pScene.AddChild(pLayer);

                CCDirector.SharedDirector.ReplaceScene(pScene);
            }
        }
Exemple #17
0
        /// <summary>
        ///  Implement CCDirector and CCScene init code here.
        /// </summary>
        /// <returns>
        ///  true  Initialize success, app continue.
        ///  false Initialize failed, app terminate.
        /// </returns>
        public override bool ApplicationDidFinishLaunching()
        {
            //initialize director
            CCDirector pDirector = CCDirector.SharedDirector;
            pDirector.SetOpenGlView();
#if WINDOWS || WINDOWSGL
            CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit);
#else
            CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll);
            //CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll);
#endif
            // turn on display FPS
            pDirector.DisplayStats = true;

            // pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);

            // set FPS. the default value is 1.0/60 if you don't call this
            pDirector.AnimationInterval = 1.0 / 60;

            // create a scene. it's an autorelease object
            CCScene pScene = new CCScene();
            CCLayer pLayer = new TestController();
            
            /*           
            CCScene pScene = CCScene.node();
            var pLayer = Box2DView.viewWithEntryID(0);
            pLayer.scale = 10;
            pLayer.anchorPoint = new CCPoint(0, 0);
            pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4);
            */

            pScene.AddChild(pLayer);
            pDirector.RunWithScene(pScene);

            return true;
        }
Exemple #18
0
        public void PopScene(float t, CCTransitionScene s)
        {
            Debug.Assert(m_pRunningScene != null, "m_pRunningScene cannot be null");

            if (m_pobScenesStack.Count > 0)
            {
                // CCScene s = m_pobScenesStack[m_pobScenesStack.Count - 1];
                m_pobScenesStack.RemoveAt(m_pobScenesStack.Count - 1);
            }
            int c = m_pobScenesStack.Count;

            if (c == 0)
            {
                End(); // This should not happen here b/c we need to capture the current state and just deactivate the game (for Android).
            }
            else
            {
                m_bSendCleanupToScene = true;
                m_pNextScene = m_pobScenesStack[c - 1];
                if (s != null)
                {
                    m_pNextScene.Visible = true;
                    s.Reset(t, m_pNextScene);
                    m_pobScenesStack.Add(s);
                    m_pNextScene = s;
                }
            }
        }
Exemple #19
0
        /// <summary>
        /// Replaces the current scene at the top of the stack with the given scene.
        /// </summary>
        /// <param name="pScene"></param>
        public void ReplaceScene(CCScene pScene)
        {
            Debug.Assert(m_pRunningScene != null, "Use runWithScene: instead to start the director");
            Debug.Assert(pScene != null, "the scene should not be null");

            int index = m_pobScenesStack.Count;

            m_bSendCleanupToScene = true;
            if (index == 0)
            {
                m_pobScenesStack.Add(pScene);
            }
            else
            {
            m_pobScenesStack[index - 1] = pScene;
            }
            m_pNextScene = pScene;
        }
Exemple #20
0
        /// <summary>
        /// Push the given scene to the top of the scene stack.
        /// </summary>
        /// <param name="pScene"></param>
        public void PushScene(CCScene pScene)
        {
            Debug.Assert(pScene != null, "the scene should not null");

            m_bSendCleanupToScene = false;

            m_pobScenesStack.Add(pScene);
            m_pNextScene = pScene;
        }
Exemple #21
0
        public void ResetSceneStack()
        {
            CCLog.Log("CCDirector(): ResetSceneStack, clearing out {0} scenes.", m_pobScenesStack.Count);

            m_pRunningScene = null;
            m_pobScenesStack.Clear();
            m_pNextScene = null;
        }
Exemple #22
0
        public void RunWithScene(CCScene pScene)
        {
            Debug.Assert(pScene != null, "the scene should not be null");
            Debug.Assert(m_pRunningScene == null, "Use runWithScene: instead to start the director");

            PushScene(pScene);
            StartAnimation();
        }
Exemple #23
0
        public virtual bool Init()
        {
            SetDefaultValues();

            // scenes
            m_pRunningScene = null;
            m_pNextScene = null;

            m_pNotificationNode = null;

            m_dOldAnimationInterval = m_dAnimationInterval = 1.0 / kDefaultFPS;

            // Set default projection (3D)
            m_eProjection = CCDirectorProjection.Default;

            // projection delegate if "Custom" projection is used
            m_pProjectionDelegate = null;

            // FPS
            m_fAccumDt = 0.0f;
            m_pFPSLabel = null;
            m_pUpdateTimeLabel = null;
            m_pDrawTimeLabel = null;
            m_pDrawsLabel = null;
            m_bDisplayStats = false;
            m_uTotalFrames = 0;

            m_pStopwatch = new Stopwatch();

            // paused ?
            m_bPaused = false;

            // purge ?
            m_bPurgeDirecotorInNextLoop = false;

            m_obWinSizeInPoints = CCSize.Zero;

            //m_pobOpenGLView = null;

            m_fContentScaleFactor = 1.0f;

            // scheduler
            m_pScheduler = new CCScheduler();
            // action manager
            m_pActionManager = new CCActionManager();
            m_pScheduler.ScheduleUpdateForTarget(m_pActionManager, CCScheduler.kCCPrioritySystem, false);
            // touchDispatcher
            m_pTouchDispatcher = new CCTouchDispatcher();
            m_pTouchDispatcher.Init();

            // KeypadDispatcher
            m_pKeypadDispatcher = new CCKeypadDispatcher();

			// KeyboardDispatcher
			m_pKeyboardDispatcher = new CCKeyboardDispatcher();

			// Accelerometer
#if !PSM &&!NETFX_CORE
            m_pAccelerometer = new CCAccelerometer();
#endif
            // create autorelease pool
            //CCPoolManager::sharedPoolManager()->push();

            m_NeedsInit = false;
            return true;
        }
Exemple #24
0
        protected void PurgeDirector()
        {
            // cleanup scheduler
            Scheduler.UnscheduleAll();

            // don't release the event handlers
            // They are needed in case the director is run again
            m_pTouchDispatcher.RemoveAllDelegates();

            if (m_pRunningScene != null)
            {
                m_pRunningScene.OnExitTransitionDidStart();
                m_pRunningScene.OnExit();
                m_pRunningScene.Cleanup();
            }

            m_pRunningScene = null;
            m_pNextScene = null;

            // remove all objects, but don't release it.
            // runWithScene might be executed after 'end'.
            m_pobScenesStack.Clear();

            StopAnimation();

            // purge bitmap cache
            CCLabelBMFont.PurgeCachedData();

            // purge all managed caches
            CCAnimationCache.PurgeSharedAnimationCache();
            CCSpriteFrameCache.PurgeSharedSpriteFrameCache();
            CCTextureCache.PurgeSharedTextureCache();
            //CCFileUtils.purgeFileUtils();
            //CCConfiguration.purgeConfiguration();

            // cocos2d-x specific data structures
            //CCUserDefault.purgeSharedUserDefault();
            //CCNotificationCenter.purgeNotificationCenter();

            CCDrawManager.PurgeDrawManager();

            m_NeedsInit = true;
        }
Exemple #25
0
        /** Pops out all scenes from the queue until it reaches `level`.
         *   If level is 0, it will end the director.
         *   If level is 1, it will pop all scenes until it reaches to root scene.
         *   If level is <= than the current stack level, it won't do anything.
         */
        public void PopToSceneStackLevel(int level)
        {
            Debug.Assert(m_pRunningScene != null, "A running Scene is needed");
            int c = m_pobScenesStack.Count;

            // level 0? -> end
            if (level == 0)
            {
                End();
                return;
            }
            
            // current level or lower -> nothing
            if (level >= c)
                return;
            
            // pop stack until reaching desired level
            while (c > level)
            {
                var current = m_pobScenesStack[m_pobScenesStack.Count - 1];
                
                if (current.IsRunning)
                {
                    current.OnExitTransitionDidStart();
                    current.OnExit();
                }
                
                current.Cleanup();
                m_pobScenesStack.RemoveAt(m_pobScenesStack.Count - 1);
                c--;
            }
            
            m_pNextScene = m_pobScenesStack[m_pobScenesStack.Count - 1];
            m_bSendCleanupToScene = false;
        }
Exemple #26
0
        protected void SetNextScene()
        {
            bool runningIsTransition = m_pRunningScene != null && m_pRunningScene.IsTransition;// is CCTransitionScene;

            // If it is not a transition, call onExit/cleanup
            if (!m_pNextScene.IsTransition)
            {
                if (m_pRunningScene != null)
                {
                    m_pRunningScene.OnExitTransitionDidStart(); 
                    m_pRunningScene.OnExit();

                    // issue #709. the root node (scene) should receive the cleanup message too
                    // otherwise it might be leaked.
                    if (m_bSendCleanupToScene)
                    {
                        m_pRunningScene.Cleanup();

                        GC.Collect();
                    }
                }
            }

            m_pRunningScene = m_pNextScene;
            m_pNextScene = null;

            if (!runningIsTransition && m_pRunningScene != null)
            {
                m_pRunningScene.OnEnter();
                m_pRunningScene.OnEnterTransitionDidFinish();
            }
        }
Exemple #27
0
        public bool DeserializeState()
        {
            try
            {
                // open up isolated storage
                using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    // see if our saved state directory exists
                    if (storage.DirectoryExists(m_sStorageDirName))
                    {
                        string saveFile = System.IO.Path.Combine(m_sStorageDirName, m_sSaveFileName);
                        try
                        {
                            CCLog.Log("Loading director data file: {0}", saveFile);
                            // see if we have a screen list
                            if (storage.FileExists(saveFile))
                            {
                                // load the list of screen types
                                using (IsolatedStorageFileStream stream = storage.OpenFile(saveFile, FileMode.Open, FileAccess.Read))
                                {
                                    using (StreamReader reader = new StreamReader(stream))
                                    {
                                        CCLog.Log("Director save file contains {0} bytes.", reader.BaseStream.Length);
                                        try
                                        {
                                            while (true)
                                            {
                                                // read a line from our file
                                                string line = reader.ReadLine();
                                                if (line == null)
                                                {
                                                    break;
                                                }
                                                CCLog.Log("Restoring: {0}", line);

                                                // if it isn't blank, we can create a screen from it
                                                if (!string.IsNullOrEmpty(line))
                                                {
                                                    if (line.StartsWith("[*]"))
                                                    {
                                                        // Reading my state
                                                        string s   = line.Substring(3);
                                                        int    idx = s.IndexOf('=');
                                                        if (idx > -1)
                                                        {
                                                            string name = s.Substring(0, idx);
                                                            string v    = s.Substring(idx + 1);
                                                            CCLog.Log("Restoring: {0} = {1}", name, v);
                                                            DeserializeMyState(name, v);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        Type    screenType = Type.GetType(line);
                                                        CCScene scene      = Activator.CreateInstance(screenType) as CCScene;
                                                        PushScene(scene);
                                                        //                                                    m_pobScenesStack.Add(scene);
                                                    }
                                                }
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            // EndOfStreamException
                                            // this is OK here.
                                        }
                                    }
                                }
                                // Now we deserialize our own state.
                            }
                            else
                            {
                                CCLog.Log("save file does not exist.");
                            }

                            // next we give each screen a chance to deserialize from the disk
                            for (int i = 0; i < m_pobScenesStack.Count; i++)
                            {
                                string filename = System.IO.Path.Combine(m_sStorageDirName, string.Format(m_sSceneSaveFileName, i));
                                if (storage.FileExists(filename))
                                {
                                    using (IsolatedStorageFileStream stream = storage.OpenFile(filename, FileMode.Open, FileAccess.Read))
                                    {
                                        CCLog.Log("Restoring state for scene {0}", filename);
                                        m_pobScenesStack[i].Deserialize(stream);
                                    }
                                }
                            }
                            if (m_pobScenesStack.Count > 0)
                            {
                                CCLog.Log("Director is running with scene..");

                                RunWithScene(m_pobScenesStack[m_pobScenesStack.Count - 1]); // always at the top of the stack
                            }
                            return(m_pobScenesStack.Count > 0 && m_pRunningScene != null);
                        }
                        catch (Exception ex)
                        {
                            // if an exception was thrown while reading, odds are we cannot recover
                            // from the saved state, so we will delete it so the game can correctly
                            // launch.
                            DeleteState(storage);
                            CCLog.Log("Failed to deserialize the director state, removing old storage file.");
                            CCLog.Log(ex.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CCLog.Log("Failed to deserialize director state.");
                CCLog.Log(ex.ToString());
            }

            return(false);
        }
 public CCTransitionFlipX(float t, CCScene s, CCTransitionOrientation o) : base(t, s, o)
 {
 }
 public PageTransitionBackward (float t, CCScene s) : base (t, s, true)
 {
     CCDirector.SharedDirector.SetDepthTest(true);
 }
Exemple #30
0
        public CCScene CreateSceneWithNodeGraphFromFile(string fileName, object owner, CCSize parentSize)
        {
            CCNode pNode = ReadNodeGraphFromFile(fileName, owner, parentSize);
            CCScene pScene = new CCScene();
            pScene.AddChild(pNode);

            return pScene;
        }
Exemple #31
0
        public virtual bool Init()
        {
            SetDefaultValues();

            // scenes
            m_pRunningScene = null;
            m_pNextScene    = null;

            m_pNotificationNode = null;

            m_dOldAnimationInterval = m_dAnimationInterval = 1.0 / kDefaultFPS;

            // Set default projection (3D)
            m_eProjection = CCDirectorProjection.Default;

            // projection delegate if "Custom" projection is used
            m_pProjectionDelegate = null;

            // FPS
            m_fAccumDt         = 0.0f;
            m_pFPSLabel        = null;
            m_pUpdateTimeLabel = null;
            m_pDrawTimeLabel   = null;
            m_pDrawsLabel      = null;
            m_bDisplayStats    = false;
            m_uTotalFrames     = 0;

            m_pStopwatch = new Stopwatch();

            // paused ?
            m_bPaused = false;

            // purge ?
            m_bPurgeDirecotorInNextLoop = false;

            m_obWinSizeInPoints = CCSize.Zero;

            //m_pobOpenGLView = null;

            m_fContentScaleFactor = 1.0f;

            // scheduler
            m_pScheduler = new CCScheduler();
            // action manager
            m_pActionManager = new CCActionManager();
            m_pScheduler.ScheduleUpdateForTarget(m_pActionManager, CCScheduler.kCCPrioritySystem, false);
            // touchDispatcher
            m_pTouchDispatcher = new CCTouchDispatcher();
            m_pTouchDispatcher.Init();

            // KeypadDispatcher
            m_pKeypadDispatcher = new CCKeypadDispatcher();

            // Accelerometer
#if !PSM && !NETFX_CORE
            m_pAccelerometer = new CCAccelerometer();
#endif
            // create autorelease pool
            //CCPoolManager::sharedPoolManager()->push();

            m_NeedsInit = false;
            return(true);
        }
Exemple #32
0
 public FlipXLeftOver(float t, CCScene s)
     : base(t, s, CCTransitionOrientation.LeftOver)
 {
 }
 protected override bool InitWithDuration(float t, CCScene scene)
 {
     InitWithDuration(t, scene, new CCColor3B(Color.Black));
     return true;
 }