void LoadGame(object sender, System.EventArgs e) { CCGameView gameView = sender as CCGameView; if (gameView != null) { CCSpriteFontCache sharedCache = gameView.SpriteFontCache; sharedCache.RegisterFont("arial", 12, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 38, 50, 64); sharedCache.RegisterFont("MarkerFelt", 16, 18, 22, 32); sharedCache.RegisterFont("MarkerFelt-Thin", 12, 18); sharedCache.RegisterFont("Paint Boy", 26); sharedCache.RegisterFont("Schwarzwald Regular", 26); sharedCache.RegisterFont("Scissor Cuts", 26); sharedCache.RegisterFont("A Damn Mess", 26); sharedCache.RegisterFont("Abberancy", 26); sharedCache.RegisterFont("Abduction", 26); gameView.ContentManager.SearchPaths = new List <string>() { "", "images", "fonts" }; gameView.DesignResolution = new CCSizeI(1024, 768); gameView.Stats.Enabled = true; gameView.ResolutionPolicy = CCViewResolutionPolicy.ShowAll; CCScene gameScene = new CCScene(gameView); gameScene.AddLayer(new TestController()); gameView.RunWithScene(gameScene); } }
public override bool ApplicationDidFinishLaunching() { ContentRootDirectory = "Content"; CCSpriteFontCache.FontScale = 0.6f; CCSpriteFontCache.RegisterFont("MarkerFelt", 22); CCDirector director = CCDirector.SharedDirector; director.DisplayStats = true; director.AnimationInterval = 1.0 / 60; CCSize designSize = new CCSize(480, 320); if (CCDrawManager.FrameSize.Height > 320) { CCSize resourceSize = new CCSize(960, 640); ContentSearchPaths.Add("hd"); director.ContentScaleFactor = resourceSize.Height / designSize.Height; } CCDrawManager.SetDesignResolutionSize(designSize.Width, designSize.Height, CCResolutionPolicy.ShowAll); CCScene scene = new CCScene(); var label = TestClass.PCLLabel(AppDelegate.PlatformMessage()); scene.AddChild(label); director.RunWithScene(scene); return(true); }
/// <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.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"); 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); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { //application.AllowUserResizing = true; application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; application.ContentSearchResolutionOrder = new List <string>() { "images", "fonts" }; sharedWindow = mainWindow; CCSize winSize = mainWindow.WindowSizeInPixels; CCScene.SetDefaultDesignResolution(winSize.Width, winSize.Height, CCSceneResolutionPolicy.ShowAll); //CCScene.SetDefaultDesignResolution(winSize.Width/2, winSize.Height/2, 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"); // } //CCApplication.DefaultTexelToContentSizeRatio = 2f; CCScene scene = new CCScene(sharedWindow); CCLayer layer = new TestController(); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }
public override void ApplicationDidFinishLaunching(CCApplication application, CCWindow mainWindow) { //application.SupportedOrientations = CCDisplayOrientation.LandscapeRight | CCDisplayOrientation.LandscapeLeft; //application.AllowUserResizing = true; //application.PreferMultiSampling = false; application.ContentRootDirectory = "Content"; sharedWindow = mainWindow; 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); CCLayer layer = new TestController(); scene.AddChild(layer); sharedWindow.RunWithScene(scene); }