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


C# CocosSharp.CCWindow类代码示例

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


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

示例1: 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");
        }
开发者ID:coroner4817,项目名称:MyBouncingGame,代码行数:32,代码来源:GameAppDelegate.cs

示例2: 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);
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:25,代码来源:GameAppDelegate.cs

示例3: 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);
        }
开发者ID:Nuckal777,项目名称:mapKnight,代码行数:35,代码来源:GameAppDelegate.cs

示例4: 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

示例5: GameScene

		public GameScene(CCWindow mainWindow) : base(mainWindow)
		{
			mainLayer = new CCLayer ();
			AddChild (mainLayer);

			paddleSprite = new CCSprite ("paddle");
			paddleSprite.PositionX = 100;
			paddleSprite.PositionY = 100;
			mainLayer.AddChild (paddleSprite);

			ballSprite = new CCSprite ("ball");
			ballSprite.PositionX = 320;
			ballSprite.PositionY = 600;
			mainLayer.AddChild (ballSprite);

			scoreLabel = new CCLabel ("Score: 0", "arial", 22);
			scoreLabel.PositionX = mainLayer.VisibleBoundsWorldspace.MinX + 20;
			scoreLabel.PositionY = mainLayer.VisibleBoundsWorldspace.MaxY - 20;
			scoreLabel.AnchorPoint = CCPoint.AnchorUpperLeft;

			mainLayer.AddChild (scoreLabel);

			Schedule (RunGameLogic);

			touchListener = new CCEventListenerTouchAllAtOnce ();
			touchListener.OnTouchesMoved = HandleTouchesMoved;
			AddEventListener (touchListener, this);
		}
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:28,代码来源:GameScene.cs

示例6: MainGameScene

        /// <summary>
        /// Constructs a new main game scene.
        /// </summary>
        /// <param name="window">window to use</param>
        public MainGameScene(CCWindow window)
            : base(window)
        {
            this.gameLayer = new MainGameLayer();

            this.AddChild(this.gameLayer);
        }
开发者ID:vividos,项目名称:CocosSharp,代码行数:11,代码来源:MainGameScene.cs

示例7: 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);
		}
开发者ID:geekish-interlude,项目名称:mobile-samples,代码行数:28,代码来源:GameAppDelegate.cs

示例8: 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 = 512.0f;
            float desiredWidth = 384.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;
            }

            CCScene scene = new CCScene (mainWindow);
            GameLayer gameLayer = new GameLayer ();

            scene.AddChild (gameLayer);

            mainWindow.RunWithScene (scene);
        }
开发者ID:jonathanzuniga,项目名称:BouncingGame,代码行数:35,代码来源:GameAppDelegate.cs

示例9: StartScene

        public StartScene(CCWindow mainWindow)
            : base(mainWindow)
        {
            mainLayer = new CCLayer ();
            AddChild (mainLayer);

            PlayButton = new CCSprite ("logo");

            NameLabel = new CCLabel ("Map Knight - Alpha", "arial", 22);
            CreatorLabel = new CCLabel ("Created by tipfom and Exo", "arial", 22);
            VersionLabel = new CCLabel ("Version unspecified", "arial", 22);
            InfoLabel = new CCLabel ("Click to play", "arial", 22);

            PlayButton.ScaleX = mainWindow.WindowSizeInPixels.Width / PlayButton.ContentSize.Width;
            PlayButton.ScaleY = mainWindow.WindowSizeInPixels.Height / PlayButton.ContentSize.Height;
            PlayButton.Position = new CCPoint (PlayButton.ScaledContentSize.Width / 2, PlayButton.ScaledContentSize.Height / 2);

            NameLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, mainWindow.WindowSizeInPixels.Height / 2 - NameLabel.ContentSize.Height);
            CreatorLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, NameLabel.PositionY - CreatorLabel.ContentSize.Height - 30);
            VersionLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, CreatorLabel.PositionY - VersionLabel.ContentSize.Height - 30);
            InfoLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, VersionLabel.PositionY - InfoLabel.ContentSize.Height - 30);

            mainLayer.AddChild (PlayButton);
            mainLayer.AddChild (NameLabel);
            mainLayer.AddChild (CreatorLabel);
            mainLayer.AddChild (VersionLabel);
            mainLayer.AddChild (InfoLabel);

            touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesEnded = HandleTouchesEnded;
            AddEventListener (touchListener, this);
        }
开发者ID:Nuckal777,项目名称:mapKnight,代码行数:32,代码来源:StartScene.cs

示例10: 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);
		}
开发者ID:460189852,项目名称:cocos-sharp-samples,代码行数:35,代码来源:AppDelegate.cs

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

示例12: 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

示例13: 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

示例14: MergedLayer

        public MergedLayer(CCWindow mainWindow, Container mainContainer)
        {
            screenSize = mainWindow.WindowSizeInPixels;
            gameContainer = mainContainer;

            mapVersion = "unspecified";
            mapCreator = "unspecified";
            mapName = "unspecified";
        }
开发者ID:Nuckal777,项目名称:mapKnight,代码行数:9,代码来源:MergedLayer.cs

示例15: GameStartScene

        public GameStartScene(CCWindow mainWindow)
            : base(mainWindow)
        {
            CreateLayer ();

            addBackgroundLabel ();

            CreateButton ();
        }
开发者ID:coroner4817,项目名称:MyBouncingGame,代码行数:9,代码来源:GameStartScene.cs


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