本文整理汇总了C#中CocosSharp.CCApplication类的典型用法代码示例。如果您正苦于以下问题:C# CCApplication类的具体用法?C# CCApplication怎么用?C# CCApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCApplication类属于CocosSharp命名空间,在下文中一共展示了CCApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: ApplicationDidFinishLaunching
/// <summary>
/// Called when app launched.
/// </summary>
/// <param name="application">application object</param>
/// <param name="mainWindow">main window</param>
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
var windowSize = mainWindow.WindowSizeInPixels;
var desiredHeight = 1024.0f;
var 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);
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_paddle");
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_wall");
CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/hit_off");
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
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
GameAppDelegate.mainWindow = mainWindow;
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchPaths.Add ("Entity");
application.ContentSearchPaths.Add ("fonts");
application.ContentSearchPaths.Add ("images");
application.ContentSearchPaths.Add ("Level");
application.ContentSearchPaths.Add ("Sound");
application.ContentSearchPaths.Add ("ViewsImage");
float desiredHeight = 768.0f;
float desiredWidth = 1024.0f;
CCScene.SetDefaultDesignResolution (desiredWidth, desiredHeight, CCSceneResolutionPolicy.ShowAll);
director = new CCDirector ();
mainWindow.AddSceneDirector (director);
var scene = new SplashScene (mainWindow);
director.RunWithScene (scene);
scene.PerformSplash ();
CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic ("SplashBackMusic.wav",false);
CCSimpleAudioEngine.SharedEngine.PreloadEffect ("BallCollideHigh.wav");
CCSimpleAudioEngine.SharedEngine.PreloadEffect ("BallCollideLow.wav");
CCSimpleAudioEngine.SharedEngine.PreloadEffect ("ballCollideBrick.wav");
}
示例5: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
CCLog.Logger = DebugLogging;
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);
}
示例6: FinishedLaunching
public override void FinishedLaunching(UIApplication app)
{
CCApplication application = new CCApplication();
application.ApplicationDelegate = new AppDelegate();
application.StartGame();
}
示例7: ApplicationWillEnterForeground
public override void ApplicationWillEnterForeground(CCApplication application)
{
application.Paused = false;
// if you use SimpleAudioEngine, your background music track must resume here.
CCSimpleAudioEngine.SharedEngine.ResumeBackgroundMusic ();
}
示例8: LoadContent
/** Добавляет в пути поиска ресурсов необходимые папки */
public static void LoadContent(CCApplication application) {
Log.Print("Loading resources");
application.ContentRootDirectory = "Resource";
CCSpriteFontCache.DefaultFont = "kongtext";
application.ContentSearchPaths.Add("Font");
application.ContentSearchPaths.Add("Icon");
application.ContentSearchPaths.Add("Image");
application.ContentSearchPaths.Add("Image\\Boss");
application.ContentSearchPaths.Add("Image\\Class");
application.ContentSearchPaths.Add("Image\\Effects");
application.ContentSearchPaths.Add("Image\\GUI");
application.ContentSearchPaths.Add("Image\\GUI\\Menu");
application.ContentSearchPaths.Add("Image\\Objects");
application.ContentSearchPaths.Add("Image\\Item");
application.ContentSearchPaths.Add("Image\\Projectile");
application.ContentSearchPaths.Add("Image\\Tile");
application.ContentSearchPaths.Add("Image\\Tile\\Cave");
application.ContentSearchPaths.Add("Image\\Tile\\City");
application.ContentSearchPaths.Add("Image\\Tile\\Desert");
application.ContentSearchPaths.Add("Image\\Tile\\Town");
application.ContentSearchPaths.Add("Image\\Enemy");
application.ContentSearchPaths.Add("Music");
application.ContentSearchPaths.Add("Sound");
CCSpriteFontCache.FontScale = 1f;
CCSpriteFontCache.RegisterFont("kongtext", 14, 24);
CCSpriteFontCache.RegisterFont("arial", 24);
}
示例9: FinishedLaunching
public override void FinishedLaunching(MonoMac.Foundation.NSObject notification)
{
CCApplication application = new CCApplication ();
application.ApplicationDelegate = new GameAppDelegate ();
application.StartGame ();
}
示例10: 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);
}
示例11: ApplicationDidFinishLaunching
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow)
{
application.PreferMultiSampling = false;
application.ContentRootDirectory = "Content";
application.ContentSearchPaths.Add ("fonts");
application.ContentSearchPaths.Add ("landscape");
application.ContentSearchPaths.Add ("menu");
application.ContentSearchPaths.Add ("interface");
application.ContentSearchPaths.Add ("particle");
gameContainer = new mapKnightLibrary.Container ();
gameContainer.mainCharacter= new RoboBob();
gameContainer.physicsHandler = new PhysicsHandler ();
runningWindow = mainWindow;
// This tells the application to not use antialiasing which can
// improve the performance of your game.
// Get the resolution of the main window...
var bounds = mainWindow.WindowSizeInPixels;
////definieren der Windowgröße auf 1280x576 p (16:9)
CCScene.SetDefaultDesignResolution (bounds.Width, bounds.Height, CCSceneResolutionPolicy.ShowAll);
//startScene = new StartScene (mainWindow);
gameScene = new GameScene (mainWindow, gameContainer, RunningControlType);
optionScene = new OptionScene (mainWindow);
// startet das erste Fenster
mainWindow.RunWithScene (gameScene);
//startScene.Version = app_version;
//startScene.startGame += startGame;
//if (ApplicationFinishedLaunching != null)
// ApplicationFinishedLaunching (this, EventArgs.Empty);
}
示例12: Main
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
CCApplication application = new CCApplication(false, new CCSize(1024f, 768f));
application.ApplicationDelegate = new AppDelegate();
application.StartGame();
}
示例13: ApplicationDidFinishLaunching
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);
}
示例14: ApplicationDidFinishLaunching
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);
}
示例15: FinishedLaunching
public override void FinishedLaunching (NSObject notification)
{
CCApplication application = new CCApplication(false, new CCSize(1024f, 768f));
application.ApplicationDelegate = new AppDelegate();
application.StartGame();
}