public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";

            try
            {
                CCSimpleAudioEngine.SharedEngine.PreloadEffect("Sounds/SplatEffect");
                CCSimpleAudioEngine.SharedEngine.PreloadEffect("Sounds/pew-pew-lei");
                CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic("Sounds/backgroundSound", true);
                CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = 0.9f;
                CCSimpleAudioEngine.SharedEngine.EffectsVolume = 0.7f;
            }
            catch(Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }

            var winSize = mainWindow.WindowSizeInPixels;
            mainWindow.SetDesignResolutionSize(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit);
            //			CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit);

            // TODO: Set this up when we have a Game Layer
            CCScene scene = GameStartLayer.GameStartLayerScene(mainWindow);
            mainWindow.RunWithScene (scene);
        }
Example #2
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.ContentRootDirectory = "Content";
            var windowSize = mainWindow.WindowSizeInPixels;

            var desiredWidth = 1024.0f;
            var desiredHeight = 768.0f;
            
            // This will set the world bounds to be (0,0, w, h)
            // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved
            mainWindow.SetDesignResolutionSize(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
            
            // Determine whether to use the high or low def versions of our images
            // Make sure the default texel to content size ratio is set correctly
            // Of course you're free to have a finer set of image resolutions e.g (ld, hd, super-hd)
            if (desiredWidth < windowSize.Width)
            {
                application.ContentSearchPaths.Add("hd");
                CCSprite.DefaultTexelToContentSizeRatio = 2.0f;
            }
            else
            {
                application.ContentSearchPaths.Add("ld");
                CCSprite.DefaultTexelToContentSizeRatio = 1.0f;
            }
            
            var scene = new CCScene(mainWindow);
            var introLayer = new IntroLayer();

            scene.AddChild(introLayer);

            mainWindow.RunWithScene(scene);
        }
Example #3
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            //application.SupportedOrientations = CCDisplayOrientation.LandscapeRight | CCDisplayOrientation.LandscapeLeft;
            //application.AllowUserResizing = true;
            //application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";


            CCRect boundsRect = new CCRect(0.0f, 0.0f, 960, 640);

			sharedViewport = new CCViewport(new CCRect (0.0f, 0.0f, 1.0f, 1.0f));

            sharedWindow = mainWindow;
            sharedCamera = new CCCamera(boundsRect.Size, new CCPoint3(boundsRect.Center, 100.0f), new CCPoint3(boundsRect.Center, 0.0f));

            mainWindow.SetDesignResolutionSize(960, 640, CCSceneResolutionPolicy.ShowAll);

            #if WINDOWS || WINDOWSGL || WINDOWSDX 
			//application.PreferredBackBufferWidth = 1024;
			//application.PreferredBackBufferHeight = 768;
            #elif MACOS
            //application.PreferredBackBufferWidth = 960;
            //application.PreferredBackBufferHeight = 640;
            #endif

            #if WINDOWS_PHONE8
            application.HandleMediaStateAutomatically = false; // Bug in MonoGame - https://github.com/Cocos2DXNA/cocos2d-xna/issues/325
            #endif

            CCSpriteFontCache.FontScale = 0.6f;
            CCSpriteFontCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64);
            CCSpriteFontCache.RegisterFont("MarkerFelt", 16, 18, 22, 32);
            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);

            //sharedDirector = new CCDirector();
            //director.DisplayStats = true;
            //director.AnimationInterval = 1.0 / 60;


//            if (sharedWindow.WindowSizeInPixels.Height > 320)
//            {
//                application.ContentSearchPaths.Insert(0,"HD");
//            }

            //sharedWindow.AddSceneDirector(sharedDirector);

            CCScene scene = new CCScene(sharedWindow);
			scene.Camera = sharedCamera;

            CCLayer layer = new TestController();

            scene.AddChild(layer);
            sharedWindow.RunWithScene(scene);
        }
Example #4
0
        /// <summary>
        ///     Метод вызывается после загрузки приложения
        /// </summary>
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) {
            base.ApplicationDidFinishLaunching(application, mainWindow);
            sharedWindow = mainWindow;

            mainWindow.SetDesignResolutionSize(Settings.ScreenWidth, Settings.ScreenHeight,
                CCSceneResolutionPolicy.ShowAll);

            Resources.LoadContent(application);
            mainWindow.DisplayStats = true;
            mainWindow.AllowUserResizing = false;


            _startScene = new MenuScene(mainWindow);
            mainWindow.RunWithScene(_startScene);
        }
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            Window = mainWindow;

            //application.AllowUserResizing = true;
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";
            application.ContentSearchPaths.Add ("animations");
            application.ContentSearchPaths.Add ("fonts");
            application.ContentSearchPaths.Add ("images");
            application.ContentSearchPaths.Add ("sounds");

            CCSize windowSize = mainWindow.WindowSizeInPixels;
            mainWindow.SetDesignResolutionSize (windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.ShowAll);

            CCScene scene = StartLevelLayer.Scene;

            mainWindow.RunWithScene (scene);
        }
Example #6
0
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";

            mainWindow.SupportedDisplayOrientations = CCDisplayOrientation.Portrait;
            mainWindow.SetDesignResolutionSize(320, 480, CCSceneResolutionPolicy.ShowAll);

            if (ContentScaleFactor > 1)
            {
                application.ContentSearchPaths.Add("hd");
            }
            else
            {
                application.ContentSearchPaths.Add("ld");
            }

            CCScene scene = TestLayer1.Scene(mainWindow);
            mainWindow.RunWithScene(scene);
        }
        public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
        {
            //application.AllowUserResizing = true;
            application.PreferMultiSampling = false;
            application.ContentRootDirectory = "Content";
            application.ContentSearchPaths.Add ("animations");
            application.ContentSearchPaths.Add ("fonts");
            application.ContentSearchPaths.Add ("images");
            application.ContentSearchPaths.Add ("sounds");

            CCSize windowSize = new CCSize (600, 320);
            mainWindow.SetDesignResolutionSize (windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.FixedHeight);

            CCScene scene = new CCScene (mainWindow);
            StartLevelLayer gameLayer = new StartLevelLayer ();
            scene.AddChild (gameLayer);

            mainWindow.RunWithScene (scene);
            //Hack to see all objects in right position ¿?
            scene.Position = -windowSize.Center;
        }