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) { 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"; var windowSize = mainWindow.WindowSizeInPixels; int nativeWidth = application.GraphicsDevice.PresentationParameters.BackBufferWidth; int nativeHeight = application.GraphicsDevice.PresentationParameters.BackBufferHeight; CocosSharpEngine engine = new CocosSharpEngine(application.GraphicsDevice, nativeWidth, nativeHeight); var desiredWidth = 1280.0f; var desiredHeight = 720.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(); var testLayer = new TestLayer(); scene.AddChild(testLayer); scene.AddChild(introLayer); mainWindow.RunWithScene(scene); }