public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("sounds"); CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 600.0f; float desiredHeight = 600.0f; // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(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("images/hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { application.ContentSearchPaths.Add("images/ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } mainWindow.RunWithScene(GameLayer.GameScene(mainWindow)); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("sounds"); CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredHeight = 1024.0f; float desiredWidth = 768.0f; // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); CCScene scene = new CCScene(mainWindow); GameLayer gameLayer = new GameLayer(); scene.AddChild(gameLayer); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("config"); application.ContentSearchPaths.Add("resources"); application.ContentSearchPaths.Add("buildings"); // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved var width = application.MainWindow.WindowSizeInPixels.Width; var height = application.MainWindow.WindowSizeInPixels.Height; var defaultWidth = 1080; var defaultHeight = 1920; var scaleFactor = width * height / (defaultWidth * defaultHeight); Font.FontScaleFactor = scaleFactor; CCScene.SetDefaultDesignResolution(width, height, 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) var scene = new MainMenuScene(mainWindow, BuildingDescriptionDatabase, ColorCollectionFile, LanguageSettings); mainWindow.RunWithScene(scene); #if DEBUG mainWindow.DisplayStats = true; mainWindow.StatsScale = 5; #endif }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { GameDelegate.mainWindow = mainWindow; director = mainWindow.DefaultDirector; application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("images"); application.ContentSearchPaths.Add("levels"); application.ContentSearchPaths.Add("sounds"); // Use the SNES resolution: float desiredWidth = 256.0f; float desiredHeight = 224.0f; CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); // TODO: Doesn't work! Fix it //CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic("CoinTimeSong", loop: true); // Make the audio a little quieter: CCSimpleAudioEngine.SharedEngine.EffectsVolume = .3f; var scene = new LevelSelectScene(mainWindow); // Can skip to the GmameScene by using this line instead: //var scene = new GameScene(mainWindow); mainWindow.DisplayStats = true; mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("images"); application.ContentSearchPaths.Add("sounds"); application.ContentSearchPaths.Add("hd"); var windowSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.ExactFit); var scene = GameStartLayer.CreateScene(mainWindow); CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic("sounds/backgroundMusic", true); CCSimpleAudioEngine.SharedEngine.PreloadEffect("pop"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("ring0"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("ring1"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("ring2"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("ring3"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("ring4"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("ring5"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("highscore"); CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = .6f; CCSimpleAudioEngine.SharedEngine.EffectsVolume = .5f; mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { GameAppDelegate.mainWindow = mainWindow; director = new CCDirector(); application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("images"); application.ContentSearchPaths.Add("levels"); application.ContentSearchPaths.Add("sounds"); CCSize windowSize = mainWindow.WindowSizeInPixels; // Use the SNES resolution: float desiredWidth = 256.0f; float desiredHeight = 224.0f; CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); mainWindow.AddSceneDirector(director); var scene = new LevelSelectScene(mainWindow); // Can skip to the GmameScene by using this line instead: //var scene = new GameScene(mainWindow); director.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("sounds"); CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 1024.0f; float desiredHeight = 768.0f; CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); application.ContentSearchPaths.Add("images/hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; CCScene.SetDefaultDesignResolution(384, 240, CCSceneResolutionPolicy.ShowAll); scene = new CCScene(mainWindow); MainLayer mainLayer = new MainLayer(); scene.AddChild(mainLayer); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("sounds"); IGraphicsDeviceService service = (IGraphicsDeviceService)application.Game.Services.GetService(typeof(IGraphicsDeviceService)); var xnaDeviceManager = (GraphicsDeviceManager)service; xnaDeviceManager.SupportedOrientations = DisplayOrientation.LandscapeLeft; xnaDeviceManager.ApplyChanges(); CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 1024.0f; float desiredHeight = 768.0f; CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); application.ContentSearchPaths.Add("images/hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; CCScene.SetDefaultDesignResolution(384, 240, CCSceneResolutionPolicy.ShowAll); scene = new CCScene(mainWindow); MainLayer mainLayer = new MainLayer(); scene.AddChild(mainLayer); //mainWindow.SupportedDisplayOrientations = CCDisplayOrientation.LandscapeLeft; mainWindow.RunWithScene(scene); }
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 CCScene.SetDefaultDesignResolution(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); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; var windowSize = mainWindow.WindowSizeInPixels; //new: mainWindow.DisplayStats = true; mainWindow.StatsScale = 1; // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(600, 400, CCSceneResolutionPolicy.NoBorder); //ShowAll, NoBorder // 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 (600 < windowSize.Width) { application.ContentSearchPaths.Add("hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { application.ContentSearchPaths.Add("ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } var startScene = new StartScene(mainWindow); mainWindow.RunWithScene(startScene); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { preferredWidth = 1024; preferredHeight = 768; application.PreferMultiSampling = true; application.ContentRootDirectory = "Content"; //CCSpriteFontCache.FontScale = 0.5f; //CCSpriteFontCache.RegisterFont("MarkerFelt", 22); //CCSpriteFontCache.RegisterFont("arial", 12, 24); CCSize designSize = new CCSize(480, 320); // if (CCDrawManager.FrameSize.Height > 320) // { // //CCSize resourceSize = new CCSize(960, 640); // CCSize resourceSize = new CCSize(480, 320); // application.ContentSearchPaths.Add("hd"); // director.ContentScaleFactor = resourceSize.Height / designSize.Height; // } CCScene.SetDefaultDesignResolution(designSize.Width, designSize.Height, CCSceneResolutionPolicy.ShowAll); // turn on display FPS mainWindow.DisplayStats = true; //mainWindow.StatsScale = 2; CCScene pScene = GoblinLayer.Scene(mainWindow); mainWindow.RunWithScene(pScene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("Tilemaps"); CCScene.SetDefaultDesignResolution(380, 240, CCSceneResolutionPolicy.ShowAll); mainWindow.RunWithScene(new GamePlayScene(mainWindow)); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { //application.AllowUserResizing = true; application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchResolutionOrder = new List <string>() { "images", "fonts" }; sharedWindow = mainWindow; CCSize winSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll); //CCScene.SetDefaultDesignResolution(winSize.Width/2, winSize.Height/2, 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); mainWindow.DisplayStats = true; mainWindow.StatsScale = 2; // if (mainWindow.WindowSizeInPixels.Height > 320) // { // application.ContentSearchPaths.Insert(0,"HD"); // } //CCApplication.DefaultTexelToContentSizeRatio = 2f; CCScene scene = new CCScene(sharedWindow); CCLayer layer = new TestController(); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; var bounds = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(bounds.Width, bounds.Height, CCSceneResolutionPolicy.ShowAll); // todo: Add our GameScene initialization here }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { var bounds = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(bounds.Width, bounds.Height, CCSceneResolutionPolicy.ShowAll); application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; var gameScene = new GameScene(mainWindow); mainWindow.RunWithScene(gameScene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; var windowSize = mainWindow.WindowSizeInPixels; mainWindow.DisplayStats = true; // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(Constants.COCOS_WORLD_WIDTH, Constants.COCOS_WORLD_HEIGHT, 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; * } */ application.ContentSearchPaths = new List <string>() { "sounds", "hd/graphics", "hd/fonts" }; //CCSprite.DefaultTexelToContentSizeRatio = 1.0f; //CCSprite.DefaultTexelToContentSizeRatio = 0.125f; //CCSprite.DefaultTexelToContentSizeRatio = 0.0625f; var scene = new CCScene(mainWindow); //var playLayer = new PlayLayer(); //var wreckLayer = new WreckageLayer(); //wreckLayer.DEBUG = true; var hangarLayer = new HangarLayer(); FinishedLoading = true; scene.AddChild(hangarLayer.GUILayer); scene.AddChild(hangarLayer, zOrder: int.MinValue); //scene.AddChild(playLayer.GUILayer); //scene.AddChild(playLayer, zOrder:int.MinValue); //scene.AddChild(wreckLayer.GUILayer); //scene.AddChild(wreckLayer, zOrder:int.MinValue); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { SharedApplication = application; SharedWindow = mainWindow; mainWindow.DisplayStats = true; application.ContentRootDirectory = "Content"; application.PreferMultiSampling = true; var windowSize = mainWindow.WindowSizeInPixels; var desiredWidth = 1024.0f; var desiredHeight = 768.0f; CocosSharpEngine engine = new CocosSharpEngine(application.GraphicsDevice, (int)desiredWidth, (int)desiredHeight); // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); mainWindow.AllowUserResizing = true; //mainWindow.AllowUserResizing = false; //// 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; //} // Poll incomming messages SharedApplication.Scheduler.Schedule(GameClient.Instance, 0, false); application.AnimationInterval = 1 / 120.0f; ResourceDictionary.DefaultDictionary = Light.GetThemeDictionary(); SpriteFont font = CCContentManager.SharedContentManager.Load <SpriteFont>("fonts/Segoe_UI_10_Regular"); FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font); FontManager.Instance.LoadFonts(CCContentManager.SharedContentManager, "fonts"); SuperManager.Instance.InitializeManagers(typeof(Manager.ActorManager).Namespace); SceneLoader.Instance.LoadLoginScene(); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; application.PreferMultiSampling = false; CCSize winSize = mainWindow.WindowSizeInPixels; float desiredWidth = 640.0f; float desiredHeight = 960.0f; CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ExactFit); CCScene scene = MenuLayer.GameStartLayerScene(mainWindow); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("sounds"); CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 1024.0f; float desiredHeight = 768.0f; // This will set the world bounds to be (0,0, w, h) // Use CCSceneResolutionPolicy.Custom as we're manually setting our viewports CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.Custom); // 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("images/hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { application.ContentSearchPaths.Add("images/ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } var topViewport = new CCViewport(new CCRect(0.0f, 0.2f, .5f, 0.6f)); var bottomViewport = new CCViewport(new CCRect(0.5f, 0.0f, .5f, 1.0f)); // Each viewport needs its own director var sceneDirector1 = new CCDirector(); var sceneDirector2 = new CCDirector(); var scene1 = new CCScene(mainWindow, topViewport, sceneDirector1); var scene2 = new CCScene(mainWindow, bottomViewport, sceneDirector2); var layer1 = new GameLayer(); var layer2 = new GameLayer(); scene1.AddChild(layer1); scene2.AddChild(layer2); sceneDirector1.RunWithScene(scene1); sceneDirector2.RunWithScene(scene2); }
//-------------------------------------------------------------------------------------------------------------- public static LHScene createWithContentOfFile(string plistLevelFile, CCWindow mainWindow, CCApplication application) { PlistDictionary dict = CCContentManager.SharedContentManager.Load <PlistDocument> (plistLevelFile).Root.AsDictionary; if (null == dict) { Debug.WriteLine("\nERROR: Could not load level file %s. The file does not appear to exist.\n", plistLevelFile); return(null); } var aspect = dict ["aspect"].AsInt; if (aspect == 0) //exact fit { CCSize winSize = CCSize.Parse(dict ["designResolution"].AsString); CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit); } else if (aspect == 1) //no borders { CCSize winSize = CCSize.Parse(dict ["designResolution"].AsString); CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.NoBorder); } else if (aspect == 2) //show all { CCSize winSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll); } PlistArray devsInfo = dict["devices"].AsArray; if (null == devsInfo) { Debug.WriteLine("\nERROR: Level doesn't contain valid devices.\n"); return(null); } foreach (PlistDictionary devInf in devsInfo) { string suffix = dict ["suffix"].AsString; application.ContentSearchPaths.Add(suffix); } application.ContentSearchPaths.Add("hd"); application.ContentSearchPaths.Add("568"); return(new LHScene(dict, plistLevelFile, mainWindow)); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("hd"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("Sounds/tap"); CCSimpleAudioEngine.SharedEngine.PreloadBackgroundMusic("Sounds/backgroundMusic"); CCSize winSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ExactFit); CCScene scene = GameStartLayer.GameStartLayerScene(mainWindow); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; application.ContentSearchPaths = new List <string> { "Sounds", "Images" }; // We use a lower-resolution display to get a pixellated appearance int width = 384; int height = 512; CCScene.SetDefaultDesignResolution(width, height, CCSceneResolutionPolicy.ShowAll); InitializeAudio(); var scene = new TitleScene(mainWindow); mainWindow.RunWithScene(scene); }
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 CCScene.SetDefaultDesignResolution(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"); } else { application.ContentSearchPaths.Add("ld"); } CCSprite.DefaultTexelToContentSizeRatio = 1.0f; var scene = new CCScene(mainWindow); var introLayer = new IntroLayer(); mainWindow.DisplayStats = true; #if ANDROID var display = Game.Activity.WindowManager.DefaultDisplay; var metrics = new Android.Util.DisplayMetrics(); display.GetMetrics(metrics); mainWindow.StatsScale = (int)metrics.ScaledDensity; #endif scene.AddChild(introLayer); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("sounds"); CCSize winSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll); CCScene scene = new CCScene(mainWindow); BouncingGame.GameLayer gameLayer = new BouncingGame.GameLayer(winSize, CCClipMode.None); scene.AddChild(gameLayer); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { CCLog.Logger = System.Diagnostics.Debug.WriteLine; application.PreferMultiSampling = true; application.ContentRootDirectory = "Content"; CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 1024.0f; float desiredHeight = 768.0f; desiredWidth = windowSize.Width; desiredHeight = windowSize.Height; // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ExactFit); // 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("images/hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { application.ContentSearchPaths.Add("images/ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } CCScene scene = new CCScene(mainWindow); GameLayer gameLayer = new GameLayer(); scene.AddChild(gameLayer); mainWindow.RunWithScene(scene); }
public void SetDefaultDesignResolution(CCSceneResolutionPolicy policy = CCSceneResolutionPolicy.ShowAll) { // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(DESIRED_WIDTH, DESIRED_HEIGHT, policy); // 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) application.ContentSearchPaths.Remove("hd"); application.ContentSearchPaths.Remove("ld"); if (DESIRED_WIDTH < Width) { application.ContentSearchPaths.Add("hd"); CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { application.ContentSearchPaths.Add("ld"); CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; var windowSize = mainWindow.WindowSizeInPixels; //desired width and height changed from the original to suit modern resolution Android phones var desiredWidth = 1440.0f; var desiredHeight = 2560.0f; // This will set the world bounds to be (0,0, w, h) // CCSceneResolutionPolicy.ShowAll will ensure that the aspect ratio is preserved CCScene.SetDefaultDesignResolution(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; } //sets up the gameScene in the main window var scene = new GameScene(mainWindow); //adds the titleLayer to the gameScene, meaning the title layer is the first screen the player sees var title = new TitleLayer(); scene.AddChild(title); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { GameAppDelegate.mainWindow = mainWindow; director = new CCDirector(); application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("animations"); application.ContentSearchPaths.Add("fonts"); application.ContentSearchPaths.Add("images"); application.ContentSearchPaths.Add("levels"); application.ContentSearchPaths.Add("sounds"); #if __IOS__ application.ContentSearchPaths.Add("sounds/iOS/"); #else // android application.ContentSearchPaths.Add("sounds/Android/"); #endif CCSize windowSize = mainWindow.WindowSizeInPixels; // Use the SNES resolution: float desiredWidth = 256.0f; float desiredHeight = 224.0f; CCScene.SetDefaultDesignResolution(desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll); mainWindow.AddSceneDirector(director); CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic("CoinTimeSong", loop: true); // Make the audio a little quieter: CCSimpleAudioEngine.SharedEngine.EffectsVolume = .3f; var scene = new LevelSelectScene(mainWindow); // Can skip to the GmameScene by using this line instead: //var scene = new GameScene(mainWindow); director.RunWithScene(scene); }