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"); 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); }
/// <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 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 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.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.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 void PlayMainTrackLoopOnIntroLayer() { CustomAudioTrack fcMain = new CustomAudioTrack(BackgroundMusic, 90.35f, PlayMainTrackOnMainLayer); IntroLayer.AddToQueue(fcMain); }
public void Load() { // Music testing CodeVariant = 3; if (CodeVariant == 1) { BackgroundMusicIntro = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave Intro.wav"); BackgroundMusic = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave 12.wav"); IntroLayer = Engine.Host.Audio.CreateLayer("Audio/Intro layer", 1); CustomAudioTrack fcIntro = new CustomAudioTrack(BackgroundMusicIntro, 11.29f, PlayMainTrackOnMainLayer); IntroLayer.AddToQueue(fcIntro); MainLayer = Engine.Host.Audio.CreateLayer("Main layer", 1); } else if (CodeVariant == 2) { //BackgroundMusicIntro = Engine.AssetLoader.Get<AudioAsset>("Frozen Cave Intro 2.wav"); //BackgroundMusic = Engine.AssetLoader.Get<AudioAsset>("Frozen Cave 12.wav"); BackgroundMusicIntro = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave Intro 4.wav"); BackgroundMusic = Engine.AssetLoader.Get <AudioAsset>("Audio/Frozen Cave Loop 3.wav"); SecondaryLayer = Engine.Host.Audio.CreateLayer("Secondary layer", 1); SecondaryLayer.AddToQueue(BackgroundMusicIntro); SecondaryLayer.AddToQueue(BackgroundMusic); } // Texture loading should be done before any texture usages // to make sure they are loaded in parallel TextureLoader.Load(LoadedRoom.Textures); // Init the player Player = new Midori(LoadedRoom.Spawn); Units.Add(Player); // Init the camera Engine.Renderer.Camera = new ScalableArtCamera(new Vector3(Player.X, 540, 0), 1f); // Set the TextureArrayLimit to 1 for GPU's that support only zero indexing // Engine.Renderer.TextureArrayLimit = 1; // Create units foreach (ConfigUnit configUnit in LoadedRoom.Units) { Unit unit; switch (configUnit.Type) { case "Shishi": unit = new Shishi(configUnit.Name, configUnit.TextureName, configUnit.Position, configUnit.Size); break; default: throw new Exception("No applicable classes"); } Units.Add(unit); NonPlayerUnits.Add(unit); } // Magic Flows MagicFlow m = new MagicFlow(); m.AddSegment(new Collision.LineSegment(100, 5400, 950, 4600)); m.AddSegment(new Collision.LineSegment(950, 4600, 1450, 4800)); m.AddSegment(new Collision.LineSegment(1450, 4800, 2000, 4200)); MagicFlows.Add(m); m = new MagicFlow(); m.AddSegment(new Collision.LineSegment(1450, 5400, 1750, 5300)); m.AddSegment(new Collision.LineSegment(1750, 5300, 1950, 5200)); m.AddSegment(new Collision.LineSegment(1950, 5200, 2050, 5100)); m.AddSegment(new Collision.LineSegment(2050, 5100, 2100, 5000)); m.AddSegment(new Collision.LineSegment(2100, 5000, 2100, 4900)); m.AddSegment(new Collision.LineSegment(2100, 4900, 2050, 4800)); m.AddSegment(new Collision.LineSegment(2050, 4800, 1950, 4700)); m.AddSegment(new Collision.LineSegment(1950, 4700, 1750, 4600)); MagicFlows.Add(m); // Create platforms for (int i = 0; i < LoadedRoom.CollisionPlatforms.Count; i++) { ConfigCollisionPlatform configPlatform = LoadedRoom.CollisionPlatforms[i]; Collision.LineSegment realPlatform = new Collision.LineSegment(configPlatform.PointA, configPlatform.PointB); if (realPlatform.IsSloped) { SlopedCollisionPlatforms.Add(realPlatform); } else { AxisAlignedCollisionPlatforms.Add(realPlatform); } CollisionPlatforms.Add(realPlatform); } // Create decorations // Backgrounds for (int i = 0; i < LoadedRoom.Backgrounds.Count; i++) { ConfigDecoration configDecor = LoadedRoom.Backgrounds[i]; Backgrounds.Add( new Decoration( configDecor.Name, configDecor.TextureName, configDecor.Size, configDecor.Position, configDecor.DisplaySize, configDecor.TextureArea, configDecor.FlipX, configDecor.BlurIntensity, configDecor.ShadowReverseIntensity ) ); } // Background Decorations for (int i = 0; i < LoadedRoom.BackgroundDecorations.Count; i++) { ConfigDecoration configDecor = LoadedRoom.BackgroundDecorations[i]; BackgroundDecorations.Add( new Decoration( configDecor.Name, configDecor.TextureName, configDecor.Size, configDecor.Position, configDecor.DisplaySize, configDecor.TextureArea, configDecor.FlipX, configDecor.BlurIntensity, configDecor.ShadowReverseIntensity ) ); } // Foreground Decorations for (int i = 0; i < LoadedRoom.ForegroundDecorations.Count; i++) { ConfigDecoration configDecor = LoadedRoom.ForegroundDecorations[i]; ForegroundDecorations.Add( new Decoration( configDecor.Name, configDecor.TextureName, configDecor.Size, configDecor.Position, configDecor.DisplaySize, configDecor.TextureArea, configDecor.FlipX, configDecor.BlurIntensity, configDecor.ShadowReverseIntensity ) ); } for (int i = 0; i < LoadedRoom.SceneChangers.Count; i++) { SceneChanger sceneChanger = LoadedRoom.SceneChangers[i]; SceneChangers.Add(sceneChanger); } }
/// <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 IntroLayer(); /* * 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); }