public Layer3() : base(new ccColor4B (0,0,255,255)) { CGSize s = CCDirector.SharedDirector ().WinSize (); CCMenuItemFont item0 = new CCMenuItemFont("Touch to pushScene (self)", delegate { CCScene newScene = new CCScene(); newScene.AddChild (new Layer3 ()); CCDirector.SharedDirector ().PushScene (new CCTransitionFade (0.5f, newScene, new ccColor3B (0, 255, 255))); }); CCMenuItemFont item1 = new CCMenuItemFont("Touch to popScene", delegate { CCDirector.SharedDirector ().PopScene (); }); CCMenuItemFont item2 = new CCMenuItemFont("Touch to popToRootScene", delegate { CCDirector.SharedDirector ().PopToRootScene (); }); CCMenu menu = new CCMenu(item0, item1, item2); this.AddChild (menu); menu.AlignItemsVertically (); CCSprite sprite = new CCSprite("grossini.png", true); this.AddChild (sprite); sprite.Position = new CCPoint(s.Width / 2, 40); var rotate = new CCRotateBy (2, 360); var repeat = new CCRepeatForever (rotate); sprite.RunAction (repeat); }
public override void FinishedLaunching(NSObject notification) { CCDirector director = CCDirector.SharedDirector (); director.View = glView; director.DisplayStats = true; CCScene scene = new CCScene(); Layer1 l = new Layer1(); scene.AddChild (l); director.RunWithScene (scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { //application.AllowUserResizing = true; application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; sharedWindow = mainWindow; CCSize winSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, 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); mainWindow.DisplayStats = true; mainWindow.StatsScale = 2; // if (mainWindow.WindowSizeInPixels.Height > 320) // { // application.ContentSearchPaths.Insert(0,"HD"); // } CCScene scene = new CCScene(sharedWindow); CCLayer layer = new TestController(); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }
/// <summary> /// there's no 'id' in cpp, so we recommand to return the exactly class pointer /// </summary> public static CCScene Scene() { // 'scene' is an autorelease object CCScene scene = new CCScene(); // 'layer' is an autorelease object var layer = new StartGameScene(); layer.Color = CCColor3B.Black; // add layer as a child to scene scene.AddChild(layer); // return the scene return(scene); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { preferredWidth = application.MainWindow.WindowSizeInPixels.Width; preferredHeight = application.MainWindow.WindowSizeInPixels.Height; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("SD"); CCScene scene = new CCScene(mainWindow); CCLayer layer = new IntroLayer(new CCSize(preferredWidth, preferredHeight)); scene.AddChild(layer); mainWindow.RunWithScene(scene); }
public static CCScene GameScene(CCWindow mainWindow) { var scene = new CCScene(mainWindow); float w_baseline = 640.0f; float h_baseline = 1136.0f; CCSize winSize = mainWindow.WindowSizeInPixels; var layer = new GameLayer(winSize.Width / w_baseline, winSize.Height / h_baseline); scene.AddChild(layer); return(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; sharedWindow = mainWindow; DefaultResolution = new CCSize( application.MainWindow.WindowSizeInPixels.Width, application.MainWindow.WindowSizeInPixels.Height); CCScene scene = new CCScene(sharedWindow); CCLayer layer = new IntroLayer(DefaultResolution); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }
public override void FinishedLaunching(NSObject notification) { CCDirector director = CCDirector.SharedDirector (); director.View = glView; director.DisplayStats = true; CCScene scene = new CCScene(); CCLabelTTF label = new CCLabelTTF("Hello World", "Marker Felt", 64); SizeF size = director.WinSize (); label.Position = new PointF(size.Width/2, size.Height/2); scene.AddChild(label); director.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; sharedWindow = mainWindow; DefaultResolution = new CCSize( application.MainWindow.WindowSizeInPixels.Width, application.MainWindow.WindowSizeInPixels.Height); //mainWindow.SetDesignResolutionSize(960, 640, CCSceneResolutionPolicy.ShowAll); //application.HandleMediaStateAutomatically = false; //mainWindow.DisplayStats = true; CCScene scene = new CCScene(sharedWindow); CCLayer layer = new IntroLayer(DefaultResolution); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }
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 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"); } else { application.ContentSearchPaths.Add("ld"); } CCSprite.DefaultTexelToContentSizeRatio = 1.0f; var scene = new CCScene(mainWindow); var introLayer = new IntroLayer(); mainWindow.DisplayStats = true; #if ANDROID var display = Game.Activity.WindowManager.DefaultDisplay; var metrics = new Android.Util.DisplayMetrics(); display.GetMetrics(metrics); mainWindow.StatsScale = (int)metrics.ScaledDensity; #endif scene.AddChild(introLayer); mainWindow.RunWithScene(scene); }
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("images"); application.ContentSearchPaths.Add("sounds"); CCSize windowSize = mainWindow.WindowSizeInPixels; mainWindow.SetDesignResolutionSize(windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.ShowAll); CCScene scene = new CCScene(mainWindow); GameLayer gameLayer = new GameLayer(); scene.AddChild(gameLayer); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { #if DEBUG // Example of using a custom log action as a Lambda. CCLog.Logger = (format, args) => { System.Diagnostics.Debug.WriteLine("TextField: " + format, args); }; #endif 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 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(); scene.AddChild(introLayer); mainWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { CCLog.Logger = System.Diagnostics.Debug.WriteLine; application.PreferMultiSampling = true; application.ContentRootDirectory = "Content"; CCSize windowSize = mainWindow.WindowSizeInPixels; float desiredWidth = 1024.0f; float desiredHeight = 768.0f; desiredWidth = windowSize.Width; desiredHeight = windowSize.Height; // 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.ExactFit); // 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); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; sharedWindow = mainWindow; DefaultResolution = new CCSize( application.MainWindow.WindowSizeInPixels.Width, application.MainWindow.WindowSizeInPixels.Height); #if NETFX_CORE TouchPanel.EnableMouseTouchPoint = true; TouchPanel.EnableMouseGestures = true; application.Game.IsMouseVisible = true; #endif CCScene scene = new CCScene(sharedWindow); CCLayer layer = new IntroLayer(DefaultResolution); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchPaths.Add("sounds"); application.ContentSearchPaths.Add("particles"); CCSize windowSize = mainWindow.WindowSizeInPixels; mainWindow.SetDesignResolutionSize(windowSize.Width, windowSize.Height, CCSceneResolutionPolicy.ShowAll); CCScene scene = new CCScene(mainWindow); GameLayer gameLayer = new GameLayer(); scene.AddChild(gameLayer); CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/explosion"); CCSimpleAudioEngine.SharedEngine.PreloadEffect("sounds/laser"); mainWindow.RunWithScene(scene); }
public void ChangeScene(CCLayer layer) { if (_isChange) { return; } if (CCAudioEngine.SharedEngine.BackgroundMusicPlaying) { CCAudioEngine.SharedEngine.StopBackgroundMusic(); } _isChange = true; var newScene = new CCScene(GameView); newScene.AddChild(layer); // シーン切り替え時の効果を設定 //CCTransitionScene cCTransitionScene = new CCTransitionScene(0, newScene); this.Director.ReplaceScene(newScene); }
public void onAnimationsTestClicked(object pSender, CCControlEvent pCCControlEvent) { // Load node graph (TestAnimations is a sub class of CCLayer) and retrieve the ccb action manager CCBAnimationManager actionManager = null; /* Create an autorelease CCNodeLoaderLibrary. */ CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary(); ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader <TestHeaderLayer>()); ccNodeLoaderLibrary.RegisterCCNodeLoader("TestAnimationsLayer", new Loader <AnimationsTestLayer>()); /* Create an autorelease CCBReader. */ var ccbReader = new CCBReader(ccNodeLoaderLibrary); /* Read a ccbi file. */ // Load the scene from the ccbi-file, setting this class as // the owner will cause lblTestTitle to be set by the CCBReader. // lblTestTitle is in the TestHeader.ccbi, which is referenced // from each of the test scenes. CCNode animationsTest = ccbReader.ReadNodeGraphFromFile("ccb/ccb/TestAnimations.ccbi", this); ((AnimationsTestLayer)animationsTest).setAnimationManager(ccbReader.AnimationManager); mTestTitleLabelTTF.Text = ("TestAnimations.ccbi"); CCScene scene = new CCScene(Scene); scene.AddChild(animationsTest); /* Push the new scene with a fancy transition. */ CCColor3B transitionColor = new CCColor3B(); transitionColor.R = 0; transitionColor.G = 0; transitionColor.B = 0; Scene.Director.PushScene(new CCTransitionFade(0.5f, scene, transitionColor)); }
public override void ApplicationDidFinishLaunching(CCApplication app, CCWindow window) { app.PreferMultiSampling = false; app.ContentRootDirectory = "Content"; app.ContentSearchPaths.Add("hd"); CCScene scene = new CCScene(window); CCLayerColor layer = new CCLayerColor(); var label = new CCLabel("Tap Screen To Play!", "MarkerFelt-22", 22) { Position = layer.VisibleBoundsWorldspace.Center, Color = CCColor3B.Black, HorizontalAlignment = CCTextAlignment.Center, VerticalAlignment = CCVerticalTextAlignment.Center, AnchorPoint = CCPoint.AnchorLowerLeft, Dimensions = layer.ContentSize }; layer.AddChild(label); scene.AddChild(layer); window.RunWithScene(scene); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override bool ApplicationDidFinishLaunching() { //initialize director CCDirector pDirector = CCDirector.SharedDirector; pDirector.SetOpenGlView(); #if WINDOWS DrawManager.SetDesignResolutionSize(1024, 768, ResolutionPolicy.ExactFit); #else CCDrawManager.SetDesignResolutionSize(800, 480, ResolutionPolicy.ShowAll); //DrawManager.SetDesignResolutionSize(480, 320, ResolutionPolicy.ShowAll); #endif // turn on display FPS pDirector.DisplayStats = true; // pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft); // set FPS. the default value is 1.0/60 if you don't call this pDirector.AnimationInterval = 1.0 / 60; // create a scene. it's an autorelease object CCScene pScene = new CCScene(); CCLayer pLayer = new TestController(); /* * CCScene pScene = CCScene.node(); * var pLayer = Box2DView.viewWithEntryID(0); * pLayer.scale = 10; * pLayer.anchorPoint = new CCPoint(0, 0); * pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4); */ pScene.AddChild(pLayer); pDirector.RunWithScene(pScene); return(true); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { application.ContentRootDirectory = "Content"; // See comment in IntroLayer.cs module when loading a tilemap from a StreamReader application.ContentSearchPaths.Add("tilemaps"); 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); }
public void openTest(string pCCBFileName, string pCCNodeName, CCNodeLoader pCCNodeLoader) { /* Create an autorelease CCNodeLoaderLibrary. */ CCNodeLoaderLibrary ccNodeLoaderLibrary = new CCNodeLoaderLibrary(); ccNodeLoaderLibrary.RegisterCCNodeLoader("TestHeaderLayer", new Loader <TestHeaderLayer>()); if (pCCNodeName != null && pCCNodeLoader != null) { ccNodeLoaderLibrary.RegisterCCNodeLoader(pCCNodeName, pCCNodeLoader); } /* Create an autorelease CCBReader. */ var ccbReader = new CCBReader(ccNodeLoaderLibrary); /* Read a ccbi file. */ // Load the scene from the ccbi-file, setting this class as // the owner will cause lblTestTitle to be set by the CCBReader. // lblTestTitle is in the TestHeader.ccbi, which is referenced // from each of the test scenes. CCNode node = ccbReader.ReadNodeGraphFromFile(pCCBFileName, this); mTestTitleLabelTTF.Text = (pCCBFileName); CCScene scene = new CCScene(Scene); scene.AddChild(node); /* Push the new scene with a fancy transition. */ CCColor3B transitionColor = new CCColor3B(); transitionColor.R = 0; transitionColor.G = 0; transitionColor.B = 0; Scene.Director.PushScene(new CCTransitionFade(0.5f, scene, transitionColor)); }
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 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"); -- Jag tog bort den här mappen, verkar inte behövas CCSprite.DefaultTexelToContentSizeRatio = 2.0f; } else { // application.ContentSearchPaths.Add("ld"); -- Jag tog bort den här mappen, verkar inte behövas CCSprite.DefaultTexelToContentSizeRatio = 1.0f; } var scene = new CCScene(mainWindow); eventLayer = new StoryEventLayer(); CreateGameData(); scene.AddChild(eventLayer); mainWindow.RunWithScene(scene); }
public override void showCurrentTest() { CCLayer pLayer = null; switch (m_nCurCase) { case 0: pLayer = new TouchesPerformTest1(true, PerformanceTouchesTest.TEST_COUNT, m_nCurCase); break; case 1: pLayer = new TouchesPerformTest2(true, PerformanceTouchesTest.TEST_COUNT, m_nCurCase); break; } PerformanceTouchesTest.s_nTouchCurCase = m_nCurCase; if (pLayer != null) { CCScene pScene = new CCScene(); pScene.AddChild(pLayer); CCDirector.SharedDirector.ReplaceScene(pScene); } }
public void menuCallback(object pSender) { CCMenuItemFont pItem = (CCMenuItemFont)pSender; int nIndex = pItem.ZOrder - BugsTestScene.kItemTagBasic; CCScene pScene = new CCScene(); CCLayer pLayer = null; switch (nIndex) { case 0: pLayer = new Bug350Layer(); pLayer.Init(); break; case 1: pLayer = new Bug422Layer(); pLayer.Init(); break; case 2: pLayer = new Bug458Layer(); pLayer.Init(); break; case 3: pLayer = new Bug624Layer(); pLayer.Init(); break; case 4: pLayer = new Bug886Layer(); pLayer.Init(); break; case 5: pLayer = new Bug899Layer(); pLayer.Init(); break; case 6: pLayer = new Bug914Layer(); pLayer.Init(); break; case 7: pLayer = new Bug1159Layer(); pLayer.Init(); break; case 8: pLayer = new Bug1174Layer(); pLayer.Init(); break; default: break; } pScene.AddChild(pLayer); CCDirector.SharedDirector.ReplaceScene(pScene); }
void cb(NSObject sender) { CCScene scene = new CCScene(); scene.AddChild(new Layer3()); CCDirector.SharedDirector().ReplaceScene(scene); }
void NewScene() { CCScene s = new CCScene (); var child = new TextLayer (); s.AddChild (child); CCDirector.SharedDirector ().ReplaceScene (s); }
void OnPushSceneTran(NSObject CCSenderCallback) { CCScene scene = new CCScene(); scene.AddChild (new Layer2 (), 0); CCDirector.SharedDirector ().PushScene (new CCTransitionSlideInT (1, scene)); }
void OnPushScene(NSObject CCSenderCallback) { CCScene scene = new CCScene(); scene.AddChild (new Layer2 (), 0); CCDirector.SharedDirector ().PushScene (scene); }
public MenuTest() { CCDirector director = CCDirector.SharedDirector (); SizeF size = director.WinSize (); CCMenu menu = null; CCSprite spriteNormal = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 2, 115, 23)); CCSprite spriteSelected = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 1, 115, 23)); CCSprite spriteDisabled = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 0, 115, 23)); CCMenuItemSprite item1 = new CCMenuItemSprite (spriteNormal, spriteSelected, spriteDisabled, delegate (NSObject sender) { CCScene scene1 = new CCScene (); scene1.AddChild (Layer2.Node()); CCDirector.SharedDirector ().ReplaceScene (scene1); }); CCMenuItemImage item2 = new CCMenuItemImage ("SendScoreButton.png", "SendScoreButtonPressed.png", null, cb); CCLabelAtlas labelAtlas = new CCLabelAtlas ("0123456789", "fps_images.png", 12, 32, '.'); CCMenuItemLabel item3 = new CCMenuItemLabel(labelAtlas, delegate (NSObject sender) { CCDirector.SharedDirector ().EventDispatcher.AddMouseDelegate (this, -128-1); this.Schedule (new MonoMac.ObjCRuntime.Selector ("allowTouches"), 5.0f); }); item3.DisabledColor = new ccColor3B (32, 32, 64); item3.Color = new ccColor3B (200, 200, 255); disabledItem = item3; CCMenuItemFont item4 = new CCMenuItemFont ("I toggle enabled items", delegate { disabledItem.Enabled = !disabledItem.Enabled; } ); item4.FontSize = 20; item4.FontName = "Marker Felt"; CCLabelBMFont label = new CCLabelBMFont ("configuration", "bitmapFontTest3.fnt"); CCMenuItemLabel item5 = new CCMenuItemLabel (label, delegate { CCScene scene = new CCScene (); scene.AddChild (new Layer4 ()); CCDirector.SharedDirector ().ReplaceScene (scene); }); item5.Scale = 0.8f; CCMenuItemFont.DefaultFontName = "Marker Felt"; CCMenuItemFont item6 = new CCMenuItemFont ("Priority Test", delegate (NSObject sender) { CCScene scene = new CCScene(); scene.AddChild (new LayerPriorityTest()); CCDirector.SharedDirector ().PushScene (scene); }); CCMenuItemFont.DefaultFontName = "Courier New"; CCMenuItemFont.DefaultFontSize = 30; CCMenuItemFont item7 = new CCMenuItemFont ("Quit", delegate { director.View.Window.Close (); }); CCTintBy color_action = new CCTintBy(0.5f, 0, -255, -255); var color_back = color_action.Reverse (); var seq = new CCSequence (color_action, color_back); item7.RunAction (new CCRepeatForever (seq)); menu = new CCMenu (item1, item2, item3, item4, item5, item6, item7); menu.AlignItemsVertically (); for (uint i = 0; i < menu.Children.Count(); i++) { CCNode child = (CCNode)menu.Children.ObjectAtIndex(i); PointF dstPoint = child.Position; int offset = (int)(size.Width/2) + 50; if (i % 2 == 0) offset = -offset; child.Position = new PointF(dstPoint.X + offset, dstPoint.Y); child.RunAction(new CCEaseElasticOut( new CCMoveBy(2, new PointF(dstPoint.X - offset, 0)), 0.35f)); } menu.Position = new PointF(size.Width/2, size.Height/2); this.AddChild(menu); }
/** Returns the current control scene. */ public CCScene currentControlScene() { var scene = new CCScene(); switch (m_nCurrentControlSceneId) { case kS9BatchNodeBasic: scene.AddChild(new S9BatchNodeBasic()); break; case kS9FrameNameSpriteSheet: scene.AddChild(new S9FrameNameSpriteSheet()); break; case kS9FrameNameSpriteSheetRotated: scene.AddChild(new S9FrameNameSpriteSheetRotated()); break; case kS9BatchNodeScaledNoInsets: scene.AddChild(new S9BatchNodeScaledNoInsets()); break; case kS9FrameNameSpriteSheetScaledNoInsets: scene.AddChild(new S9FrameNameSpriteSheetScaledNoInsets()); break; case kS9FrameNameSpriteSheetRotatedScaledNoInsets: scene.AddChild(new S9FrameNameSpriteSheetRotatedScaledNoInsets()); break; case kS9BatchNodeScaleWithCapInsets: scene.AddChild(new S9BatchNodeScaleWithCapInsets()); break; case kS9FrameNameSpriteSheetInsets: scene.AddChild(new S9FrameNameSpriteSheetInsets()); break; case kS9FrameNameSpriteSheetInsetsScaled: scene.AddChild(new S9FrameNameSpriteSheetInsetsScaled()); break; case kS9FrameNameSpriteSheetRotatedInsets: scene.AddChild(new S9FrameNameSpriteSheetRotatedInsets()); break; case kS9_TexturePacker: scene.AddChild(new S9_TexturePacker()); break; case kS9FrameNameSpriteSheetRotatedInsetsScaled: scene.AddChild(new S9FrameNameSpriteSheetRotatedInsetsScaled()); break; case kS9FrameNameSpriteSheetRotatedSetCapInsetLater: scene.AddChild(new S9FrameNameSpriteSheetRotatedSetCapInsetLater()); break; case kS9CascadeOpacityAndColor: scene.AddChild(new S9CascadeOpacityAndColor()); break; } return(scene); }
public static CCScene Scene() { CCScene scene = new CCScene (); MenuTest mt = new MenuTest(); scene.AddChild (mt); return scene; }
void backCallback(NSObject sender) { CCScene scene = new CCScene(); scene.AddChild (MenuTest.Scene ()); CCDirector.SharedDirector ().ReplaceScene (scene); }
void OnReplaceScene(NSObject CCSenderCallback) { CCScene scene = new CCScene(); scene.AddChild (new Layer3 (), 0); CCDirector.SharedDirector ().ReplaceScene (scene); }
void OnReplaceSceneTran(NSObject CCSenderCallback) { CCScene scene = new CCScene(); scene.AddChild (new Layer3 (), 0); CCDirector.SharedDirector ().ReplaceScene (new CCTransitionFlipX (2, scene)); }
/// <summary> /// Implement CCDirector and CCScene init code here. /// </summary> /// <returns> /// true Initialize success, app continue. /// false Initialize failed, app terminate. /// </returns> public override bool ApplicationDidFinishLaunching() { //initialize director CCDirector pDirector = CCDirector.SharedDirector; pDirector.SetOpenGlView(); 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); 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); // turn on display FPS pDirector.DisplayStats = true; // set FPS. the default value is 1.0/60 if you don't call this pDirector.AnimationInterval = 1.0 / 60; CCSize designSize = new CCSize(480, 320); if (CCDrawManager.FrameSize.Height > 320) { CCSize resourceSize = new CCSize(960, 640); CCContentManager.SharedContentManager.SearchPaths.Add("hd"); /* * CCContentManager.SharedContentManager.SearchPaths.Add("hd/extensions"); * CCContentManager.SharedContentManager.SearchPaths.Add("extensions"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/animations"); * CCContentManager.SharedContentManager.SearchPaths.Add("animations"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/TileMaps"); * CCContentManager.SharedContentManager.SearchPaths.Add("TileMaps"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/ccb"); * CCContentManager.SharedContentManager.SearchPaths.Add("ccb"); * CCContentManager.SharedContentManager.SearchPaths.Add("hd/Images"); * CCContentManager.SharedContentManager.SearchPaths.Add("Particles"); * CCContentManager.SharedContentManager.SearchPaths.Add("Sounds"); * CCContentManager.SharedContentManager.SearchPaths.Add("TileMaps"); */ pDirector.ContentScaleFactor = resourceSize.Height / designSize.Height; } CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll); /* #if WINDOWS || WINDOWSGL * CCDrawManager.SetDesignResolutionSize(1280, 768, CCResolutionPolicy.ExactFit); #else * CCDrawManager.SetDesignResolutionSize(800, 480, CCResolutionPolicy.ShowAll); * //CCDrawManager.SetDesignResolutionSize(480, 320, CCResolutionPolicy.ShowAll); #endif */ // create a scene. it's an autorelease object CCScene pScene = new CCScene(); CCLayer pLayer = new TestController(); /* * CCScene pScene = CCScene.node(); * var pLayer = Box2DView.viewWithEntryID(0); * pLayer.scale = 10; * pLayer.anchorPoint = new CCPoint(0, 0); * pLayer.position = new CCPoint(CCDirector.sharedDirector().getWinSize().width / 2, CCDirector.sharedDirector().getWinSize().height / 4); */ pScene.AddChild(pLayer); pDirector.RunWithScene(pScene); return(true); }