当前位置: 首页>>代码示例>>C#>>正文


C# CCWindow.SetDesignResolutionSize方法代码示例

本文整理汇总了C#中CocosSharp.CCWindow.SetDesignResolutionSize方法的典型用法代码示例。如果您正苦于以下问题:C# CCWindow.SetDesignResolutionSize方法的具体用法?C# CCWindow.SetDesignResolutionSize怎么用?C# CCWindow.SetDesignResolutionSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CocosSharp.CCWindow的用法示例。


在下文中一共展示了CCWindow.SetDesignResolutionSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplicationDidFinishLaunching

        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);
        }
开发者ID:jonathanzuniga,项目名称:MonsterSmashing,代码行数:26,代码来源:MonsterSmashingAppDelegate.cs

示例2: ApplicationDidFinishLaunching

        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);
        }
开发者ID:AnimaRobotics,项目名称:CocosSharp,代码行数:33,代码来源:AppDelegate.cs

示例3: ApplicationDidFinishLaunching

        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);
        }
开发者ID:netonjm,项目名称:CocosSharp,代码行数:60,代码来源:AppDelegate.cs

示例4: ApplicationDidFinishLaunching

        /// <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);
        }
开发者ID:Insality,项目名称:essence-of-shadows,代码行数:18,代码来源:Client.cs

示例5: ApplicationDidFinishLaunching

        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);
        }
开发者ID:netonjm,项目名称:CSExtensionKit,代码行数:19,代码来源:GameAppDelegate.cs

示例6: ApplicationDidFinishLaunching

        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;
        }
开发者ID:netonjm,项目名称:CSExtensionKit,代码行数:21,代码来源:GameAppDelegate.cs


注:本文中的CocosSharp.CCWindow.SetDesignResolutionSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。