Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
[cocos2d.Jumpy] Migrate sample to unified
Browse files Browse the repository at this point in the history
  • Loading branch information
olegoid committed Jan 19, 2015
1 parent 1bf8bb3 commit 37c9629
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 233 deletions.
42 changes: 18 additions & 24 deletions cocos2d/samples/Jumpy/Jumpy/AppDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Foundation;
using UIKit;
using MonoTouch.Cocos2D;

namespace Jumpy
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;

public UINavigationController NavController { get ; private set; }
CCDirectorDisplayLink director;


CCDirectorDisplayLink director;

/// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
Expand All @@ -48,69 +50,61 @@ public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
var glView = new CCGLView(window.Bounds);
var glView = new CCGLView (window.Bounds);

director = (CCDirectorDisplayLink)CCDirector.SharedDirector;

director.WantsFullScreenLayout = true;

//director.DisplayStats = true;

director.AnimationInterval = 1.0/60;
director.AnimationInterval = 1.0 / 60;

director.View = glView;

director.Projection = CCDirectorProjection.TwoD;

//if (!director.EnableRetinaDisplay(true))
// Console.WriteLine ("Retina Display not supported");

CCTexture2D.DefaultAlphaPixelFormat = CCTexture2DPixelFormat.Rgba8888;

// CCDirector.SharedDirector.ShouldAutorotateToInterfaceOrientation = (orientation) => {
// return orientation == UIInterfaceOrientation.LandscapeLeft || orientation == UIInterfaceOrientation.LandscapeRight;
// };


CCTexture2D.PVRImageHavePremultipliedAlpha = true;

director.Run (GameLayer.Scene);

// Create a Navigation Controller with the Director
NavController = new UINavigationController(director) {NavigationBarHidden=true, WantsFullScreenLayout=true};
NavController = new UINavigationController (director) { NavigationBarHidden = true, WantsFullScreenLayout = true };

// set the Navigation Controller as the root view controller
window.RootViewController = NavController;
window.MakeKeyAndVisible ();

return true;
}

public override void DidEnterBackground (UIApplication application)
{
if (NavController.VisibleViewController == director)
director.StopAnimation ();
}

public override void WillEnterForeground (UIApplication application)
{
if (NavController.VisibleViewController == director)
director.StartAnimation ();
}

public override void WillTerminate (UIApplication application)
{
CCDirector.SharedDirector.End();
CCDirector.SharedDirector.End ();
}

public override void ReceiveMemoryWarning (UIApplication application)
{
CCDirector.SharedDirector.PurgeCachedData ();
}

public override void ApplicationSignificantTimeChange (UIApplication application)
{
CCDirector.SharedDirector.NextDeltaTimeZero=true;
CCDirector.SharedDirector.NextDeltaTimeZero = true;
}
}
}
Expand Down
Loading

0 comments on commit 37c9629

Please sign in to comment.