本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}