forked from mono/monotouch-bindings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cocos2d/samples: Jumpy, a port of TweeJump
A port of TweeJump, a platform jump code for iphone originally written in cocos2d. I used this port to find out the missing pieces of the bindings. But as a playable game, it's worth looking at it for educational purposes.
- Loading branch information
1 parent
e925294
commit 799f395
Showing
25 changed files
with
948 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual Studio 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jumpy", "Jumpy\Jumpy.csproj", "{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|iPhoneSimulator = Debug|iPhoneSimulator | ||
Release|iPhoneSimulator = Release|iPhoneSimulator | ||
Debug|iPhone = Debug|iPhone | ||
Release|iPhone = Release|iPhone | ||
Ad-Hoc|iPhone = Ad-Hoc|iPhone | ||
AppStore|iPhone = AppStore|iPhone | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.AppStore|iPhone.ActiveCfg = AppStore|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.AppStore|iPhone.Build.0 = AppStore|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Debug|iPhone.ActiveCfg = Debug|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Debug|iPhone.Build.0 = Debug|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Release|iPhone.ActiveCfg = Release|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Release|iPhone.Build.0 = Release|iPhone | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator | ||
{F7F2973E-A67D-4719-8B9F-7A16BAE62FA4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator | ||
EndGlobalSection | ||
GlobalSection(MonoDevelopProperties) = preSolution | ||
StartupItem = Jumpy\Jumpy.csproj | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
// AppDelegate.cs | ||
// | ||
// Author(s) | ||
// Stephane Delcroix <[email protected]> | ||
// | ||
// Copyright (C) 2012 s. Delcroix | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software | ||
// and associated documentation files (the "Software"), to deal in the Software without restriction, | ||
// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all copies or | ||
// substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using MonoTouch.Foundation; | ||
using MonoTouch.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 | ||
// application events from iOS. | ||
[Register ("AppDelegate")] | ||
public partial class AppDelegate : UIApplicationDelegate | ||
{ | ||
// class-level declarations | ||
UIWindow window; | ||
public UINavigationController NavController { get ; private set; } | ||
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. | ||
// You have 17 seconds to return from this method, or iOS will terminate your application. | ||
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 = CCGLView.View(window.Bounds); | ||
|
||
director = (CCDirectorDisplayLink)CCDirector.SharedDirector; | ||
|
||
director.WantsFullScreenLayout = true; | ||
|
||
//director.DisplayStats = true; | ||
|
||
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}; | ||
|
||
// 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(); | ||
} | ||
|
||
public override void ReceiveMemoryWarning (UIApplication application) | ||
{ | ||
CCDirector.SharedDirector.PurgeCachedData (); | ||
} | ||
|
||
public override void ApplicationSignificantTimeChange (UIApplication application) | ||
{ | ||
CCDirector.SharedDirector.NextDeltaTimeZero=true; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.