├── .DS_Store
├── Box2DCocos2DExamples.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ ├── YannickL.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ │ └── touchknow.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ ├── YannickL.xcuserdatad
│ └── xcschemes
│ │ ├── Box2DCocos2DExamples.xcscheme
│ │ └── xcschememanagement.plist
│ └── touchknow.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ ├── box2dcocos2dexamples.xcscheme
│ └── xcschememanagement.plist
├── README.md
└── box2dcocos2dexamples
├── .DS_Store
├── Box2DClassesFoundation
├── .DS_Store
├── CCRayCast.h
├── CCRayCast.mm
├── CCTouchJoint.h
├── CCTouchJoint.mm
├── GLES-Render.h
├── GLES-Render.mm
├── QueryCallback.h
└── RaycastCallback.h
├── Classes
├── .DS_Store
├── Box2DExamples.h
├── Box2DSceneManager.h
├── Box2DSceneManager.mm
├── Box2dScene.h
├── Box2dScene.mm
├── TestBuoyancy.h
├── TestBuoyancy.mm
├── TestRagdoll.h
├── TestRagdoll.mm
├── TestSliceBody.h
└── TestSliceBody.mm
├── Prefix.pch
├── ProjectFoundation
├── AppDelegate.h
├── AppDelegate.mm
├── GameConfig.h
├── RootViewController.h
└── RootViewController.m
├── Resources
├── Default.png
├── Icon-72.png
├── Icon-Small-50.png
├── Icon-Small.png
├── Icon-Small@2x.png
├── Icon.png
├── Icon@2x.png
├── Info.plist
├── MenuImages
│ ├── b1-hd.png
│ ├── b1.png
│ ├── b2-hd.png
│ ├── b2.png
│ ├── f1-hd.png
│ ├── f1.png
│ ├── f2-hd.png
│ ├── f2.png
│ ├── r1-hd.png
│ ├── r1.png
│ ├── r2-hd.png
│ └── r2.png
├── blocks.png
├── fps_images.png
└── iTunesArtwork
├── libs
├── .DS_Store
├── Box2D
│ ├── .svn
│ │ ├── all-wcprops
│ │ ├── entries
│ │ └── text-base
│ │ │ ├── Box2D.h.svn-base
│ │ │ ├── Box2DConfig.cmake.svn-base
│ │ │ └── CMakeLists.txt.svn-base
│ ├── Box2D.h
│ ├── Collision
│ │ ├── .svn
│ │ │ ├── all-wcprops
│ │ │ ├── entries
│ │ │ └── text-base
│ │ │ │ ├── b2BroadPhase.cpp.svn-base
│ │ │ │ ├── b2BroadPhase.h.svn-base
│ │ │ │ ├── b2CollideCircle.cpp.svn-base
│ │ │ │ ├── b2CollideEdge.cpp.svn-base
│ │ │ │ ├── b2CollidePolygon.cpp.svn-base
│ │ │ │ ├── b2Collision.cpp.svn-base
│ │ │ │ ├── b2Collision.h.svn-base
│ │ │ │ ├── b2Distance.cpp.svn-base
│ │ │ │ ├── b2Distance.h.svn-base
│ │ │ │ ├── b2DynamicTree.cpp.svn-base
│ │ │ │ ├── b2DynamicTree.h.svn-base
│ │ │ │ ├── b2TimeOfImpact.cpp.svn-base
│ │ │ │ └── b2TimeOfImpact.h.svn-base
│ │ ├── Shapes
│ │ │ ├── .svn
│ │ │ │ ├── all-wcprops
│ │ │ │ ├── entries
│ │ │ │ └── text-base
│ │ │ │ │ ├── b2CircleShape.cpp.svn-base
│ │ │ │ │ ├── b2CircleShape.h.svn-base
│ │ │ │ │ ├── b2EdgeShape.cpp.svn-base
│ │ │ │ │ ├── b2EdgeShape.h.svn-base
│ │ │ │ │ ├── b2LoopShape.cpp.svn-base
│ │ │ │ │ ├── b2LoopShape.h.svn-base
│ │ │ │ │ ├── b2PolygonShape.cpp.svn-base
│ │ │ │ │ ├── b2PolygonShape.h.svn-base
│ │ │ │ │ └── b2Shape.h.svn-base
│ │ │ ├── b2CircleShape.cpp
│ │ │ ├── b2CircleShape.h
│ │ │ ├── b2EdgeShape.cpp
│ │ │ ├── b2EdgeShape.h
│ │ │ ├── b2LoopShape.cpp
│ │ │ ├── b2LoopShape.h
│ │ │ ├── b2PolygonShape.cpp
│ │ │ ├── b2PolygonShape.h
│ │ │ └── b2Shape.h
│ │ ├── b2BroadPhase.cpp
│ │ ├── b2BroadPhase.h
│ │ ├── b2CollideCircle.cpp
│ │ ├── b2CollideEdge.cpp
│ │ ├── b2CollidePolygon.cpp
│ │ ├── b2Collision.cpp
│ │ ├── b2Collision.h
│ │ ├── b2Distance.cpp
│ │ ├── b2Distance.h
│ │ ├── b2DynamicTree.cpp
│ │ ├── b2DynamicTree.h
│ │ ├── b2TimeOfImpact.cpp
│ │ └── b2TimeOfImpact.h
│ ├── Common
│ │ ├── .svn
│ │ │ ├── all-wcprops
│ │ │ ├── entries
│ │ │ └── text-base
│ │ │ │ ├── b2BlockAllocator.cpp.svn-base
│ │ │ │ ├── b2BlockAllocator.h.svn-base
│ │ │ │ ├── b2Draw.cpp.svn-base
│ │ │ │ ├── b2Draw.h.svn-base
│ │ │ │ ├── b2GrowableStack.h.svn-base
│ │ │ │ ├── b2Math.cpp.svn-base
│ │ │ │ ├── b2Math.h.svn-base
│ │ │ │ ├── b2Settings.cpp.svn-base
│ │ │ │ ├── b2Settings.h.svn-base
│ │ │ │ ├── b2StackAllocator.cpp.svn-base
│ │ │ │ ├── b2StackAllocator.h.svn-base
│ │ │ │ ├── b2Timer.cpp.svn-base
│ │ │ │ └── b2Timer.h.svn-base
│ │ ├── b2BlockAllocator.cpp
│ │ ├── b2BlockAllocator.h
│ │ ├── b2Draw.cpp
│ │ ├── b2Draw.h
│ │ ├── b2GrowableStack.h
│ │ ├── b2Math.cpp
│ │ ├── b2Math.h
│ │ ├── b2Settings.cpp
│ │ ├── b2Settings.h
│ │ ├── b2StackAllocator.cpp
│ │ ├── b2StackAllocator.h
│ │ ├── b2Timer.cpp
│ │ └── b2Timer.h
│ ├── Dynamics
│ │ ├── .svn
│ │ │ ├── all-wcprops
│ │ │ ├── entries
│ │ │ └── text-base
│ │ │ │ ├── b2Body.cpp.svn-base
│ │ │ │ ├── b2Body.h.svn-base
│ │ │ │ ├── b2ContactManager.cpp.svn-base
│ │ │ │ ├── b2ContactManager.h.svn-base
│ │ │ │ ├── b2Fixture.cpp.svn-base
│ │ │ │ ├── b2Fixture.h.svn-base
│ │ │ │ ├── b2Island.cpp.svn-base
│ │ │ │ ├── b2Island.h.svn-base
│ │ │ │ ├── b2TimeStep.h.svn-base
│ │ │ │ ├── b2World.cpp.svn-base
│ │ │ │ ├── b2World.h.svn-base
│ │ │ │ ├── b2WorldCallbacks.cpp.svn-base
│ │ │ │ └── b2WorldCallbacks.h.svn-base
│ │ ├── Contacts
│ │ │ ├── .svn
│ │ │ │ ├── all-wcprops
│ │ │ │ ├── entries
│ │ │ │ └── text-base
│ │ │ │ │ ├── b2CircleContact.cpp.svn-base
│ │ │ │ │ ├── b2CircleContact.h.svn-base
│ │ │ │ │ ├── b2Contact.cpp.svn-base
│ │ │ │ │ ├── b2Contact.h.svn-base
│ │ │ │ │ ├── b2ContactSolver.cpp.svn-base
│ │ │ │ │ ├── b2ContactSolver.h.svn-base
│ │ │ │ │ ├── b2EdgeAndCircleContact.cpp.svn-base
│ │ │ │ │ ├── b2EdgeAndCircleContact.h.svn-base
│ │ │ │ │ ├── b2EdgeAndPolygonContact.cpp.svn-base
│ │ │ │ │ ├── b2EdgeAndPolygonContact.h.svn-base
│ │ │ │ │ ├── b2LoopAndCircleContact.cpp.svn-base
│ │ │ │ │ ├── b2LoopAndCircleContact.h.svn-base
│ │ │ │ │ ├── b2LoopAndPolygonContact.cpp.svn-base
│ │ │ │ │ ├── b2LoopAndPolygonContact.h.svn-base
│ │ │ │ │ ├── b2PolygonAndCircleContact.cpp.svn-base
│ │ │ │ │ ├── b2PolygonAndCircleContact.h.svn-base
│ │ │ │ │ ├── b2PolygonContact.cpp.svn-base
│ │ │ │ │ └── b2PolygonContact.h.svn-base
│ │ │ ├── b2CircleContact.cpp
│ │ │ ├── b2CircleContact.h
│ │ │ ├── b2Contact.cpp
│ │ │ ├── b2Contact.h
│ │ │ ├── b2ContactSolver.cpp
│ │ │ ├── b2ContactSolver.h
│ │ │ ├── b2EdgeAndCircleContact.cpp
│ │ │ ├── b2EdgeAndCircleContact.h
│ │ │ ├── b2EdgeAndPolygonContact.cpp
│ │ │ ├── b2EdgeAndPolygonContact.h
│ │ │ ├── b2LoopAndCircleContact.cpp
│ │ │ ├── b2LoopAndCircleContact.h
│ │ │ ├── b2LoopAndPolygonContact.cpp
│ │ │ ├── b2LoopAndPolygonContact.h
│ │ │ ├── b2PolygonAndCircleContact.cpp
│ │ │ ├── b2PolygonAndCircleContact.h
│ │ │ ├── b2PolygonContact.cpp
│ │ │ └── b2PolygonContact.h
│ │ ├── Controllers
│ │ │ ├── b2BuoyancyController.cpp
│ │ │ ├── b2BuoyancyController.h
│ │ │ ├── b2Controller.cpp
│ │ │ └── b2Controller.h
│ │ ├── Joints
│ │ │ ├── .svn
│ │ │ │ ├── all-wcprops
│ │ │ │ ├── entries
│ │ │ │ └── text-base
│ │ │ │ │ ├── b2DistanceJoint.cpp.svn-base
│ │ │ │ │ ├── b2DistanceJoint.h.svn-base
│ │ │ │ │ ├── b2FrictionJoint.cpp.svn-base
│ │ │ │ │ ├── b2FrictionJoint.h.svn-base
│ │ │ │ │ ├── b2GearJoint.cpp.svn-base
│ │ │ │ │ ├── b2GearJoint.h.svn-base
│ │ │ │ │ ├── b2Joint.cpp.svn-base
│ │ │ │ │ ├── b2Joint.h.svn-base
│ │ │ │ │ ├── b2MouseJoint.cpp.svn-base
│ │ │ │ │ ├── b2MouseJoint.h.svn-base
│ │ │ │ │ ├── b2PrismaticJoint.cpp.svn-base
│ │ │ │ │ ├── b2PrismaticJoint.h.svn-base
│ │ │ │ │ ├── b2PulleyJoint.cpp.svn-base
│ │ │ │ │ ├── b2PulleyJoint.h.svn-base
│ │ │ │ │ ├── b2RevoluteJoint.cpp.svn-base
│ │ │ │ │ ├── b2RevoluteJoint.h.svn-base
│ │ │ │ │ ├── b2RopeJoint.cpp.svn-base
│ │ │ │ │ ├── b2RopeJoint.h.svn-base
│ │ │ │ │ ├── b2WeldJoint.cpp.svn-base
│ │ │ │ │ ├── b2WeldJoint.h.svn-base
│ │ │ │ │ ├── b2WheelJoint.cpp.svn-base
│ │ │ │ │ └── b2WheelJoint.h.svn-base
│ │ │ ├── b2DistanceJoint.cpp
│ │ │ ├── b2DistanceJoint.h
│ │ │ ├── b2FrictionJoint.cpp
│ │ │ ├── b2FrictionJoint.h
│ │ │ ├── b2GearJoint.cpp
│ │ │ ├── b2GearJoint.h
│ │ │ ├── b2Joint.cpp
│ │ │ ├── b2Joint.h
│ │ │ ├── b2MouseJoint.cpp
│ │ │ ├── b2MouseJoint.h
│ │ │ ├── b2PrismaticJoint.cpp
│ │ │ ├── b2PrismaticJoint.h
│ │ │ ├── b2PulleyJoint.cpp
│ │ │ ├── b2PulleyJoint.h
│ │ │ ├── b2RevoluteJoint.cpp
│ │ │ ├── b2RevoluteJoint.h
│ │ │ ├── b2RopeJoint.cpp
│ │ │ ├── b2RopeJoint.h
│ │ │ ├── b2WeldJoint.cpp
│ │ │ ├── b2WeldJoint.h
│ │ │ ├── b2WheelJoint.cpp
│ │ │ └── b2WheelJoint.h
│ │ ├── b2Body.cpp
│ │ ├── b2Body.h
│ │ ├── b2ContactManager.cpp
│ │ ├── b2ContactManager.h
│ │ ├── b2Fixture.cpp
│ │ ├── b2Fixture.h
│ │ ├── b2Island.cpp
│ │ ├── b2Island.h
│ │ ├── b2TimeStep.h
│ │ ├── b2World.cpp
│ │ ├── b2World.h
│ │ ├── b2WorldCallbacks.cpp
│ │ └── b2WorldCallbacks.h
│ └── Rope
│ │ ├── .svn
│ │ ├── all-wcprops
│ │ ├── entries
│ │ └── text-base
│ │ │ ├── b2Rope.cpp.svn-base
│ │ │ └── b2Rope.h.svn-base
│ │ ├── b2Rope.cpp
│ │ └── b2Rope.h
├── CocosDenshion
│ ├── CDAudioManager.h
│ ├── CDAudioManager.m
│ ├── CDConfig.h
│ ├── CDOpenALSupport.h
│ ├── CDOpenALSupport.m
│ ├── CocosDenshion.h
│ ├── CocosDenshion.m
│ ├── SimpleAudioEngine.h
│ └── SimpleAudioEngine.m
├── FontLabel
│ ├── FontLabel.h
│ ├── FontLabel.m
│ ├── FontLabelStringDrawing.h
│ ├── FontLabelStringDrawing.m
│ ├── FontManager.h
│ ├── FontManager.m
│ ├── ZAttributedString.h
│ ├── ZAttributedString.m
│ ├── ZAttributedStringPrivate.h
│ ├── ZFont.h
│ └── ZFont.m
├── LICENSE_Box2D.txt
├── LICENSE_CocosDenshion.txt
├── LICENSE_FontLabel.txt
├── LICENSE_TouchJSON.txt
├── LICENSE_cocos2d.txt
├── TouchJSON
│ ├── CDataScanner.h
│ ├── CDataScanner.m
│ ├── Extensions
│ │ ├── CDataScanner_Extensions.h
│ │ ├── CDataScanner_Extensions.m
│ │ ├── NSDictionary_JSONExtensions.h
│ │ └── NSDictionary_JSONExtensions.m
│ └── JSON
│ │ ├── CJSONDeserializer.h
│ │ ├── CJSONDeserializer.m
│ │ ├── CJSONScanner.h
│ │ ├── CJSONScanner.m
│ │ ├── CJSONSerializer.h
│ │ ├── CJSONSerializer.m
│ │ └── JSONRepresentation.h
├── cocos2d
│ ├── CCAction.h
│ ├── CCAction.m
│ ├── CCActionCamera.h
│ ├── CCActionCamera.m
│ ├── CCActionEase.h
│ ├── CCActionEase.m
│ ├── CCActionGrid.h
│ ├── CCActionGrid.m
│ ├── CCActionGrid3D.h
│ ├── CCActionGrid3D.m
│ ├── CCActionInstant.h
│ ├── CCActionInstant.m
│ ├── CCActionInterval.h
│ ├── CCActionInterval.m
│ ├── CCActionManager.h
│ ├── CCActionManager.m
│ ├── CCActionPageTurn3D.h
│ ├── CCActionPageTurn3D.m
│ ├── CCActionProgressTimer.h
│ ├── CCActionProgressTimer.m
│ ├── CCActionTiledGrid.h
│ ├── CCActionTiledGrid.m
│ ├── CCActionTween.h
│ ├── CCActionTween.m
│ ├── CCAnimation.h
│ ├── CCAnimation.m
│ ├── CCAnimationCache.h
│ ├── CCAnimationCache.m
│ ├── CCAtlasNode.h
│ ├── CCAtlasNode.m
│ ├── CCBlockSupport.h
│ ├── CCBlockSupport.m
│ ├── CCCamera.h
│ ├── CCCamera.m
│ ├── CCConfiguration.h
│ ├── CCConfiguration.m
│ ├── CCDirector.h
│ ├── CCDirector.m
│ ├── CCDrawingPrimitives.h
│ ├── CCDrawingPrimitives.m
│ ├── CCGrabber.h
│ ├── CCGrabber.m
│ ├── CCGrid.h
│ ├── CCGrid.m
│ ├── CCLabelAtlas.h
│ ├── CCLabelAtlas.m
│ ├── CCLabelBMFont.h
│ ├── CCLabelBMFont.m
│ ├── CCLabelTTF.h
│ ├── CCLabelTTF.m
│ ├── CCLayer.h
│ ├── CCLayer.m
│ ├── CCMenu.h
│ ├── CCMenu.m
│ ├── CCMenuItem.h
│ ├── CCMenuItem.m
│ ├── CCMotionStreak.h
│ ├── CCMotionStreak.m
│ ├── CCNode.h
│ ├── CCNode.m
│ ├── CCParallaxNode.h
│ ├── CCParallaxNode.m
│ ├── CCParticleExamples.h
│ ├── CCParticleExamples.m
│ ├── CCParticleSystem.h
│ ├── CCParticleSystem.m
│ ├── CCParticleSystemPoint.h
│ ├── CCParticleSystemPoint.m
│ ├── CCParticleSystemQuad.h
│ ├── CCParticleSystemQuad.m
│ ├── CCProgressTimer.h
│ ├── CCProgressTimer.m
│ ├── CCProtocols.h
│ ├── CCRenderTexture.h
│ ├── CCRenderTexture.m
│ ├── CCRibbon.h
│ ├── CCRibbon.m
│ ├── CCScene.h
│ ├── CCScene.m
│ ├── CCScheduler.h
│ ├── CCScheduler.m
│ ├── CCSprite.h
│ ├── CCSprite.m
│ ├── CCSpriteBatchNode.h
│ ├── CCSpriteBatchNode.m
│ ├── CCSpriteFrame.h
│ ├── CCSpriteFrame.m
│ ├── CCSpriteFrameCache.h
│ ├── CCSpriteFrameCache.m
│ ├── CCTMXLayer.h
│ ├── CCTMXLayer.m
│ ├── CCTMXObjectGroup.h
│ ├── CCTMXObjectGroup.m
│ ├── CCTMXTiledMap.h
│ ├── CCTMXTiledMap.m
│ ├── CCTMXXMLParser.h
│ ├── CCTMXXMLParser.m
│ ├── CCTexture2D.h
│ ├── CCTexture2D.m
│ ├── CCTextureAtlas.h
│ ├── CCTextureAtlas.m
│ ├── CCTextureCache.h
│ ├── CCTextureCache.m
│ ├── CCTexturePVR.h
│ ├── CCTexturePVR.m
│ ├── CCTileMapAtlas.h
│ ├── CCTileMapAtlas.m
│ ├── CCTransition.h
│ ├── CCTransition.m
│ ├── CCTransitionPageTurn.h
│ ├── CCTransitionPageTurn.m
│ ├── CCTransitionRadial.h
│ ├── CCTransitionRadial.m
│ ├── Platforms
│ │ ├── CCGL.h
│ │ ├── CCNS.h
│ │ ├── Mac
│ │ │ ├── CCDirectorMac.h
│ │ │ ├── CCDirectorMac.m
│ │ │ ├── CCEventDispatcher.h
│ │ │ ├── CCEventDispatcher.m
│ │ │ ├── MacGLView.h
│ │ │ ├── MacGLView.m
│ │ │ ├── MacWindow.h
│ │ │ └── MacWindow.m
│ │ └── iOS
│ │ │ ├── CCDirectorIOS.h
│ │ │ ├── CCDirectorIOS.m
│ │ │ ├── CCTouchDelegateProtocol.h
│ │ │ ├── CCTouchDispatcher.h
│ │ │ ├── CCTouchDispatcher.m
│ │ │ ├── CCTouchHandler.h
│ │ │ ├── CCTouchHandler.m
│ │ │ ├── EAGLView.h
│ │ │ ├── EAGLView.m
│ │ │ ├── ES1Renderer.h
│ │ │ ├── ES1Renderer.m
│ │ │ ├── ESRenderer.h
│ │ │ ├── glu.c
│ │ │ └── glu.h
│ ├── Support
│ │ ├── CCArray.h
│ │ ├── CCArray.m
│ │ ├── CCFileUtils.h
│ │ ├── CCFileUtils.m
│ │ ├── CCProfiling.h
│ │ ├── CCProfiling.m
│ │ ├── CGPointExtension.h
│ │ ├── CGPointExtension.m
│ │ ├── OpenGL_Internal.h
│ │ ├── TGAlib.h
│ │ ├── TGAlib.m
│ │ ├── TransformUtils.h
│ │ ├── TransformUtils.m
│ │ ├── ZipUtils.h
│ │ ├── ZipUtils.m
│ │ ├── base64.c
│ │ ├── base64.h
│ │ ├── ccCArray.h
│ │ ├── ccUtils.c
│ │ ├── ccUtils.h
│ │ ├── uthash.h
│ │ └── utlist.h
│ ├── ccConfig.h
│ ├── ccMacros.h
│ ├── ccTypes.h
│ ├── cocos2d.h
│ └── cocos2d.m
└── cocoslive
│ ├── CLScoreServerPost.h
│ ├── CLScoreServerPost.m
│ ├── CLScoreServerRequest.h
│ ├── CLScoreServerRequest.m
│ ├── cocoslive.h
│ └── cocoslive.m
└── main.m
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/.DS_Store
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/project.xcworkspace/xcuserdata/YannickL.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/Box2DCocos2DExamples.xcodeproj/project.xcworkspace/xcuserdata/YannickL.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/project.xcworkspace/xcuserdata/touchknow.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/Box2DCocos2DExamples.xcodeproj/project.xcworkspace/xcuserdata/touchknow.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/project.xcworkspace/xcuserdata/touchknow.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/xcuserdata/YannickL.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Box2DCocos2DExamples.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | C2801EB1138708D5001502FC
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/xcuserdata/touchknow.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Box2DCocos2DExamples.xcodeproj/xcuserdata/touchknow.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | box2dcocos2dexamples.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | C2801EB1138708D5001502FC
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Box2D-Example
2 | =====================
3 |
4 | What is this?
5 | -------------
6 |
7 | This project brings together some examples I made (or converted) with Box2D for cocos2d.
8 | The examples use the multi-touch and the accelerometer to allow users to enhance its user experience.
9 |
10 | Available examples list:
11 | --------------
12 | * Ragdoll
13 | * Buoyancy
14 | * Slice/Cut/Split body
15 |
16 | You can see a demo on youtube here: http://youtu.be/K_HnNQrk8O0
17 |
18 | How to get the source?
19 | ----------------
20 | ```
21 | git clone git@github.com:YannickL/Box2D-Examples.git
22 |
23 | # to get latest stable source from master branch, use this command:
24 | git checkout -t origin/master
25 | ```
--------------------------------------------------------------------------------
/box2dcocos2dexamples/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/.DS_Store
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Box2DClassesFoundation/.DS_Store
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/CCRayCast.h:
--------------------------------------------------------------------------------
1 | //
2 | // CCRayCast.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick Loriot on 08/01/12.
6 | // Copyright (c) 2012 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import
11 |
12 | @interface CCRayCast : NSObject
13 | {
14 | @public
15 | CGPoint startPoint;
16 | CGPoint endPoint;
17 | }
18 | @property CGPoint startPoint;
19 | @property CGPoint endPoint;
20 |
21 | #pragma mark Constructors - Initializers
22 |
23 | #pragma mark Public Methods
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/CCRayCast.mm:
--------------------------------------------------------------------------------
1 | //
2 | // CCRayCast.m
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick Loriot on 08/01/12.
6 | // Copyright (c) 2012 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "CCRayCast.h"
11 |
12 | @interface CCRayCast ()
13 | @end
14 |
15 | @implementation CCRayCast
16 | @synthesize startPoint, endPoint;
17 |
18 | - (void)dealloc
19 | {
20 | [super dealloc];
21 | }
22 |
23 | - (id)init
24 | {
25 | if ((self = [super init]))
26 | {
27 | self.startPoint = CGPointZero;
28 | self.endPoint = CGPointZero;
29 | }
30 | return self;
31 | }
32 |
33 | #pragma mark -
34 | #pragma mark CCRayCast Public Methods
35 |
36 | #pragma mark CCRayCast Private Methods
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/CCTouchJoint.h:
--------------------------------------------------------------------------------
1 | //
2 | // CCTouchJoint.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 12/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | //
8 |
9 | #import "Box2D.h"
10 |
11 | @interface CCTouchJoint : NSObject
12 | {
13 | @public
14 | b2MouseJoint *mouseJoint;
15 | UITouch *touch;
16 | }
17 | @property (assign) b2MouseJoint *mouseJoint;
18 | @property (nonatomic, retain) UITouch *touch;
19 |
20 | - (id)initLocal:(UITouch *)touch withMouseJoint:(b2MouseJoint *)mouseJoint;
21 | + (id)touch:(UITouch *)touch withMouseJoint:(b2MouseJoint *)mouseJoint;
22 |
23 | // Public methods
24 |
25 | /**
26 | * Destroy the touch joint in the Box2d world.
27 | */
28 | - (void)destroyTouchJoint;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/CCTouchJoint.mm:
--------------------------------------------------------------------------------
1 | //
2 | // CCTouchJoint.m
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 12/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | //
8 |
9 | #import "CCTouchJoint.h"
10 |
11 | @implementation CCTouchJoint
12 | @synthesize mouseJoint;
13 | @synthesize touch;
14 |
15 | - (void)dealloc
16 | {
17 | [touch release];
18 | [super dealloc];
19 | }
20 |
21 | - (id)initLocal:(UITouch *)_touch withMouseJoint:(b2MouseJoint *)_mouseJoint
22 | {
23 | if ((self = [super init]))
24 | {
25 | self.touch = _touch;
26 | mouseJoint = _mouseJoint;
27 | }
28 | return self;
29 | }
30 |
31 | + (id)touch:(UITouch *)_touch withMouseJoint:(b2MouseJoint *)_mouseJoint
32 | {
33 | return [[self alloc] initLocal:_touch withMouseJoint:_mouseJoint];
34 | }
35 |
36 | #pragma mark -
37 | #pragma mark CCTouchJoint Public Methods
38 |
39 | - (void)destroyTouchJoint
40 | {
41 | if (mouseJoint != NULL)
42 | {
43 | mouseJoint->GetBodyA()->GetWorld()->DestroyJoint(mouseJoint);
44 | }
45 | }
46 |
47 | #pragma mark CCTouchJoint Private Methods
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/GLES-Render.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
3 | *
4 | * iPhone port by Simon Oliver - http://www.simonoliver.com - http://www.handcircus.com
5 | *
6 | * This software is provided 'as-is', without any express or implied
7 | * warranty. In no event will the authors be held liable for any damages
8 | * arising from the use of this software.
9 | * Permission is granted to anyone to use this software for any purpose,
10 | * including commercial applications, and to alter it and redistribute it
11 | * freely, subject to the following restrictions:
12 | * 1. The origin of this software must not be misrepresented; you must not
13 | * claim that you wrote the original software. If you use this software
14 | * in a product, an acknowledgment in the product documentation would be
15 | * appreciated but is not required.
16 | * 2. Altered source versions must be plainly marked as such, and must not be
17 | * misrepresented as being the original software.
18 | * 3. This notice may not be removed or altered from any source distribution.
19 | */
20 |
21 | //
22 | // File modified for cocos2d integration
23 | // http://www.cocos2d-iphone.org
24 | //
25 |
26 | #ifndef GLES_RENDER_H
27 | #define GLES_RENDER_H
28 |
29 | #import
30 |
31 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
32 | #import
33 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
34 | #import
35 | #endif
36 |
37 | #include "Box2D.h"
38 |
39 | struct b2AABB;
40 |
41 | // This class implements debug drawing callbacks that are invoked
42 | // inside b2World::Step.
43 | class GLESDebugDraw : public b2Draw
44 | {
45 | float32 mRatio;
46 | public:
47 | GLESDebugDraw();
48 |
49 | GLESDebugDraw( float32 ratio );
50 |
51 | void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color);
52 |
53 | void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color);
54 |
55 | void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color);
56 |
57 | void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color);
58 |
59 | void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color);
60 |
61 | void DrawTransform(const b2Transform& xf);
62 |
63 | void DrawPoint(const b2Vec2& p, float32 size, const b2Color& color);
64 |
65 | void DrawString(int x, int y, const char* string, ...);
66 |
67 | void DrawAABB(b2AABB* aabb, const b2Color& color);
68 | };
69 |
70 |
71 | #endif // GLES_RENDER_H
72 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Box2DClassesFoundation/QueryCallback.h:
--------------------------------------------------------------------------------
1 | //
2 | // QueryCallback.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 21/05/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | //
8 |
9 | #import "Box2D.h"
10 |
11 | class QueryCallback : public b2QueryCallback
12 | {
13 | public:
14 | QueryCallback (const b2Vec2& point)
15 | {
16 | m_point = point;
17 | m_fixture = NULL;
18 | }
19 |
20 | bool ReportFixture (b2Fixture* fixture)
21 | {
22 | b2Body *body = fixture->GetBody();
23 | if (body->GetType() != b2_staticBody)
24 | {
25 | bool inside = fixture->TestPoint(m_point);
26 | if (inside)
27 | {
28 | m_fixture = fixture;
29 |
30 | // We are done, terminate the query.
31 | return false;
32 | }
33 | }
34 |
35 | // Continue the query.
36 | return true;
37 | }
38 |
39 | b2Vec2 m_point;
40 | b2Fixture* m_fixture;
41 | };
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Classes/.DS_Store
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/Box2DExamples.h:
--------------------------------------------------------------------------------
1 | //
2 | // Box2DExamples.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 21/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | //
8 |
9 | #ifndef __H_BOX2D_EXAMPLES__
10 | #define __H_BOX2D_EXAMPLES__
11 |
12 | // Pixel to metres ratio. Box2D uses metres as the unit for measurement.
13 | // This ratio defines how many pixels correspond to 1 Box2D "metre"
14 | // Box2D is optimized for objects of 1x1 metre therefore it makes sense
15 | // to define the ratio so that your most common object type is 1x1 metre.
16 | #define PTM_RATIO 32
17 |
18 | // World gravity.
19 | #define WORLDGRAVITY 20.0f
20 |
21 | /** Convert the given position into the box2d world. */
22 | static inline float ptm(float d)
23 | {
24 | return d / PTM_RATIO;
25 | }
26 |
27 | /** Convert the given position into the cocos2d world. */
28 | static inline float mtp(float d)
29 | {
30 | return d * PTM_RATIO;
31 | }
32 |
33 | #endif /** !__H_BOX2D_EXAMPLES__ guard */
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/Box2DSceneManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // Box2DSceneManager.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 29/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "cocos2d.h"
11 |
12 | @interface Box2DSceneManager : NSObject
13 | {
14 | @private
15 | NSInteger currentBox2DSceneId;
16 | NSArray *box2DScenes;
17 | }
18 |
19 | #pragma mark Constructors - Initializers
20 |
21 | /** Returns the singleton box2d scene manager. */
22 | + (Box2DSceneManager *)sharedBox2DSceneManager;
23 |
24 | #pragma mark Public Methods
25 |
26 | /** Returns the next box2d scene. */
27 | - (CCScene *)nextBox2DScene;
28 |
29 | /** Returns the previous box2d scene. */
30 | - (CCScene *)previousBox2DScene;
31 |
32 | /** Returns the current box2d scene. */
33 | - (CCScene *)currentBox2DScene;
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/Box2DSceneManager.mm:
--------------------------------------------------------------------------------
1 | //
2 | // Box2DSceneManager.m
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 29/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "Box2DSceneManager.h"
11 |
12 | #import "Box2dScene.h"
13 |
14 | @interface Box2DSceneManager ()
15 | /** Box2d scene id. */
16 | @property (nonatomic, assign) NSInteger currentBox2DSceneId;
17 | /** List of box2d scene's names. */
18 | @property (nonatomic, retain) NSArray *box2DScenes;
19 |
20 | @end
21 |
22 | @implementation Box2DSceneManager
23 | @synthesize currentBox2DSceneId, box2DScenes;
24 |
25 | static Box2DSceneManager *box2DSceneManager = nil;
26 |
27 | - (void)dealloc
28 | {
29 | [box2DScenes release], box2DScenes = nil;
30 |
31 | if (box2DSceneManager)
32 | {
33 | [box2DSceneManager release];
34 | }
35 |
36 | [super dealloc];
37 | }
38 |
39 | - (id)init
40 | {
41 | if ((self = [super init]))
42 | {
43 | currentBox2DSceneId = 0;
44 |
45 | box2DScenes = [[NSArray alloc] initWithObjects:
46 | @"TestRagdoll",
47 | @"TestBuoyancy",
48 | @"TestSliceBody",
49 | nil];
50 | }
51 | return self;
52 | }
53 |
54 | + (Box2DSceneManager *)sharedBox2DSceneManager
55 | {
56 | @synchronized (self)
57 | {
58 | if (box2DSceneManager == nil)
59 | {
60 | box2DSceneManager = [[Box2DSceneManager alloc] init];
61 | }
62 | return box2DSceneManager;
63 | }
64 | }
65 |
66 | #pragma mark -
67 | #pragma mark Box2DSceneManager Public Methods
68 |
69 | - (CCScene *)nextBox2DScene
70 | {
71 | currentBox2DSceneId = (currentBox2DSceneId + 1) % [box2DScenes count];
72 |
73 | return [self currentBox2DScene];
74 | }
75 |
76 | - (CCScene *)previousBox2DScene
77 | {
78 | currentBox2DSceneId = currentBox2DSceneId - 1;
79 | if (currentBox2DSceneId < 0)
80 | {
81 | currentBox2DSceneId = [box2DScenes count] - 1;
82 | }
83 |
84 | return [self currentBox2DScene];
85 | }
86 |
87 | - (CCScene *)currentBox2DScene
88 | {
89 | NSString *box2DSceneName = [box2DScenes objectAtIndex:currentBox2DSceneId];
90 |
91 | Class nextBox2DScene = NSClassFromString(box2DSceneName);
92 | return [nextBox2DScene sceneWithTitle:box2DSceneName];
93 | }
94 |
95 | #pragma mark Box2DSceneManager Private Methods
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/Box2dScene.h:
--------------------------------------------------------------------------------
1 | //
2 | // Box2dScene.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 12/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "cocos2d.h"
11 |
12 | #import "Box2D.h"
13 | #import "GLES-Render.h"
14 |
15 | /**
16 | * Box2D scene.
17 | * Contains the box2D world with the management mutli-touch
18 | * and accelerometer.
19 | */
20 | @interface Box2dScene : CCLayer
21 | {
22 | @public
23 | CCLabelTTF *sceneTitleLabel;
24 |
25 | b2World *world;
26 | GLESDebugDraw *m_debugDraw;
27 |
28 | @private
29 | // Vector of actual mouse position
30 | b2Vec2 m_mouseWorld;
31 |
32 | // Body to hold one side of joint
33 | b2Body *holdJoint;
34 |
35 | NSMutableArray *touchJointList;
36 | }
37 | /** Title label of the scene. */
38 | @property (nonatomic, retain) CCLabelTTF *sceneTitleLabel;
39 | /** Box2D world. */
40 | @property (readonly) b2World *world;
41 | /** GLES Debug draw. */
42 | @property (readonly) GLESDebugDraw *m_debugDraw;
43 |
44 | #pragma mark Constructors - Initializers
45 |
46 | /**
47 | * Returns a CCScene that contains the Box2dScene layer.
48 | *
49 | * @param title The title of the scene.
50 | */
51 | + (CCScene *)sceneWithTitle:(NSString *)title;
52 |
53 | #pragma mark Public Methods
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/TestBuoyancy.h:
--------------------------------------------------------------------------------
1 | //
2 | // TestBuoyancy.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 29/06/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "Box2dScene.h"
11 |
12 | /**
13 | * Buoyancy example scene.
14 | */
15 | @interface TestBuoyancy : Box2dScene
16 | {
17 | @protected
18 | b2BuoyancyController *bc;
19 | }
20 |
21 | #pragma mark Constructors - Initializers
22 |
23 | #pragma mark Public Methods
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/TestRagdoll.h:
--------------------------------------------------------------------------------
1 | //
2 | // TestRagdoll.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 20/05/11.
6 | // Copyright 2011 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "Box2dScene.h"
11 |
12 | /**
13 | * Ragdoll example scene.
14 | */
15 | @interface TestRagdoll : Box2dScene
16 | {
17 | @public
18 | }
19 |
20 | #pragma mark Constructors - Initializers
21 |
22 | #pragma mark Public Methods
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Classes/TestSliceBody.h:
--------------------------------------------------------------------------------
1 | //
2 | // TestSliceBody.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick Loriot on 08/01/12.
6 | // Copyright (c) 2012 Yannick Loriot. All rights reserved.
7 | // http://yannickloriot.com
8 | //
9 |
10 | #import "Box2dScene.h"
11 |
12 | @class CCRayCast;
13 |
14 | /**
15 | * Slice/Split/Cut body example scene.
16 | * Slicing, splitting and cutting objects with Box2D.
17 | */
18 | @interface TestSliceBody : Box2dScene
19 | {
20 | @public
21 | @protected
22 | // Laser drawn by the user to cut bodies
23 | CCRayCast *laser;
24 | }
25 |
26 | #pragma mark Constructors - Initializers
27 |
28 | #pragma mark Public Methods
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'Test' target in the 'Test' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/ProjectFoundation/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 20/05/11.
6 | // Copyright Yannick Loriot 2011. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class RootViewController;
12 |
13 | @interface AppDelegate : NSObject
14 | {
15 | UIWindow *window;
16 | RootViewController *viewController;
17 | }
18 |
19 | @property (nonatomic, retain) UIWindow *window;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/ProjectFoundation/GameConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // GameConfig.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 20/05/11.
6 | // Copyright Yannick Loriot 2011. All rights reserved.
7 | //
8 |
9 | #ifndef __GAME_CONFIG_H
10 | #define __GAME_CONFIG_H
11 |
12 | //
13 | // Supported Autorotations:
14 | // None,
15 | // UIViewController,
16 | // CCDirector
17 | //
18 | #define kGameAutorotationNone 0
19 | #define kGameAutorotationCCDirector 1
20 | #define kGameAutorotationUIViewController 2
21 |
22 | //
23 | // Define here the type of autorotation that you want for your game
24 | //
25 |
26 | // 3rd generation and newer devices: Rotate using UIViewController. Rotation should be supported on iPad apps.
27 | // TIP:
28 | // To improve the performance, you should set this value to "kGameAutorotationNone" or "kGameAutorotationCCDirector"
29 | #if defined(__ARM_NEON__) || TARGET_IPHONE_SIMULATOR
30 | #define GAME_AUTOROTATION kGameAutorotationNone
31 |
32 | // ARMv6 (1st and 2nd generation devices): Don't rotate. It is very expensive
33 | #elif __arm__
34 | #define GAME_AUTOROTATION kGameAutorotationNone
35 |
36 |
37 | // Ignore this value on Mac
38 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
39 |
40 | #else
41 | #error(unknown architecture)
42 | #endif
43 |
44 | #endif // __GAME_CONFIG_H
45 |
46 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/ProjectFoundation/RootViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // RootViewController.h
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 20/05/11.
6 | // Copyright Yannick Loriot 2011. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 |
12 | @interface RootViewController : UIViewController
13 | {
14 |
15 | }
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Default.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Icon-72.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Icon-Small-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Icon-Small-50.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Icon-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Icon-Small.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Icon-Small@2x.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Icon.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/Icon@2x.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 |
13 | CFBundleIconFiles
14 |
15 | Icon.png
16 | Icon@2x.png
17 | Icon-72.png
18 | Icon-Small-50.png
19 | Icon-Small.png
20 | Icon-Small@2x.png
21 |
22 | CFBundleIdentifier
23 | com.yannickloriot.box2dexample
24 | CFBundleInfoDictionaryVersion
25 | 6.0
26 | CFBundleName
27 | ${PRODUCT_NAME}
28 | CFBundlePackageType
29 | APPL
30 | CFBundleSignature
31 | ????
32 | CFBundleVersion
33 | 1.0
34 | LSRequiresIPhoneOS
35 |
36 | UIApplicationExitsOnSuspend
37 |
38 | UIPrerenderedIcon
39 |
40 | UIRequiredDeviceCapabilities
41 |
42 | accelerometer
43 |
44 | opengles-1
45 |
46 |
47 | UIStatusBarHidden
48 |
49 | UISupportedInterfaceOrientations
50 |
51 | UIInterfaceOrientationLandscapeLeft
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/b1-hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/b1-hd.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/b1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/b1.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/b2-hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/b2-hd.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/b2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/b2.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/f1-hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/f1-hd.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/f1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/f1.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/f2-hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/f2-hd.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/f2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/f2.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/r1-hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/r1-hd.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/r1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/r1.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/r2-hd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/r2-hd.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/MenuImages/r2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/MenuImages/r2.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/blocks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/blocks.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/fps_images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/fps_images.png
--------------------------------------------------------------------------------
/box2dcocos2dexamples/Resources/iTunesArtwork:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/Resources/iTunesArtwork
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yannickl/Box2D-Examples/0051afa6aa8f9fd26acc5c6bb02b41a75b3a87dc/box2dcocos2dexamples/libs/.DS_Store
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 35
4 | /svn/!svn/ver/197/trunk/Box2D/Box2D
5 | END
6 | Box2DConfig.cmake
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 52
10 | /svn/!svn/ver/59/trunk/Box2D/Box2D/Box2DConfig.cmake
11 | END
12 | Box2D.h
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 43
16 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Box2D.h
17 | END
18 | CMakeLists.txt
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 50
22 | /svn/!svn/ver/158/trunk/Box2D/Box2D/CMakeLists.txt
23 | END
24 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 197
5 | http://box2d.googlecode.com/svn/trunk/Box2D/Box2D
6 | http://box2d.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-06-28T05:50:29.985253Z
11 | 197
12 | erincatto@gmail.com
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | cafe418c-1137-0410-84cc-357ec87a5d9b
28 |
29 | Box2DConfig.cmake
30 | file
31 |
32 |
33 |
34 |
35 | 2011-06-29T20:00:05.000000Z
36 | da1a45b32e3b86e95364163a8c423436
37 | 2010-02-28T18:53:10.341684Z
38 | 59
39 | erincatto
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 191
62 |
63 | Box2D.h
64 | file
65 |
66 |
67 |
68 |
69 | 2011-06-29T20:00:05.000000Z
70 | 31aca5a865da3ffc31a9fe7c0fb2cede
71 | 2011-03-24T17:36:44.542193Z
72 | 158
73 | erincatto
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 2496
96 |
97 | Rope
98 | dir
99 |
100 | Dynamics
101 | dir
102 |
103 | Common
104 | dir
105 |
106 | Collision
107 | dir
108 |
109 | CMakeLists.txt
110 | file
111 |
112 |
113 |
114 |
115 | 2011-06-29T20:00:05.000000Z
116 | ef85b66a56cd5067da3d5d12bb1f4190
117 | 2011-03-24T17:36:44.542193Z
118 | 158
119 | erincatto
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 | 5946
142 |
143 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/.svn/text-base/Box2DConfig.cmake.svn-base:
--------------------------------------------------------------------------------
1 | get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
2 | include(${SELF_DIR}/Box2D-targets.cmake)
3 | get_filename_component(Box2D_INCLUDE_DIRS "${SELF_DIR}/../../include" ABSOLUTE)
4 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Collision/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 45
4 | /svn/!svn/ver/195/trunk/Box2D/Box2D/Collision
5 | END
6 | b2Distance.cpp
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 60
10 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/b2Distance.cpp
11 | END
12 | b2Collision.cpp
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 61
16 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/b2Collision.cpp
17 | END
18 | b2BroadPhase.h
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 60
22 | /svn/!svn/ver/167/trunk/Box2D/Box2D/Collision/b2BroadPhase.h
23 | END
24 | b2CollideCircle.cpp
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 65
28 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/b2CollideCircle.cpp
29 | END
30 | b2Distance.h
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 58
34 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/b2Distance.h
35 | END
36 | b2CollideEdge.cpp
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 63
40 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/b2CollideEdge.cpp
41 | END
42 | b2Collision.h
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 59
46 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/b2Collision.h
47 | END
48 | b2TimeOfImpact.cpp
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 64
52 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/b2TimeOfImpact.cpp
53 | END
54 | b2CollidePolygon.cpp
55 | K 25
56 | svn:wc:ra_dav:version-url
57 | V 66
58 | /svn/!svn/ver/195/trunk/Box2D/Box2D/Collision/b2CollidePolygon.cpp
59 | END
60 | b2DynamicTree.cpp
61 | K 25
62 | svn:wc:ra_dav:version-url
63 | V 63
64 | /svn/!svn/ver/195/trunk/Box2D/Box2D/Collision/b2DynamicTree.cpp
65 | END
66 | b2TimeOfImpact.h
67 | K 25
68 | svn:wc:ra_dav:version-url
69 | V 62
70 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/b2TimeOfImpact.h
71 | END
72 | b2BroadPhase.cpp
73 | K 25
74 | svn:wc:ra_dav:version-url
75 | V 62
76 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/b2BroadPhase.cpp
77 | END
78 | b2DynamicTree.h
79 | K 25
80 | svn:wc:ra_dav:version-url
81 | V 61
82 | /svn/!svn/ver/188/trunk/Box2D/Box2D/Collision/b2DynamicTree.h
83 | END
84 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Collision/.svn/text-base/b2TimeOfImpact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_TIME_OF_IMPACT_H
20 | #define B2_TIME_OF_IMPACT_H
21 |
22 | #include
23 | #include
24 |
25 | /// Input parameters for b2TimeOfImpact
26 | struct b2TOIInput
27 | {
28 | b2DistanceProxy proxyA;
29 | b2DistanceProxy proxyB;
30 | b2Sweep sweepA;
31 | b2Sweep sweepB;
32 | float32 tMax; // defines sweep interval [0, tMax]
33 | };
34 |
35 | // Output parameters for b2TimeOfImpact.
36 | struct b2TOIOutput
37 | {
38 | enum State
39 | {
40 | e_unknown,
41 | e_failed,
42 | e_overlapped,
43 | e_touching,
44 | e_separated
45 | };
46 |
47 | State state;
48 | float32 t;
49 | };
50 |
51 | /// Compute the upper bound on time before two shapes penetrate. Time is represented as
52 | /// a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate,
53 | /// non-tunneling collision. If you change the time interval, you should call this function
54 | /// again.
55 | /// Note: use b2Distance to compute the contact point and normal at the time of impact.
56 | void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input);
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Collision/Shapes/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 52
4 | /svn/!svn/ver/192/trunk/Box2D/Box2D/Collision/Shapes
5 | END
6 | b2EdgeShape.h
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 66
10 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/Shapes/b2EdgeShape.h
11 | END
12 | b2LoopShape.cpp
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 68
16 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/Shapes/b2LoopShape.cpp
17 | END
18 | b2PolygonShape.h
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 69
22 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/Shapes/b2PolygonShape.h
23 | END
24 | b2LoopShape.h
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 66
28 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/Shapes/b2LoopShape.h
29 | END
30 | b2CircleShape.cpp
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 70
34 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/Shapes/b2CircleShape.cpp
35 | END
36 | b2EdgeShape.cpp
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 68
40 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Collision/Shapes/b2EdgeShape.cpp
41 | END
42 | b2Shape.h
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 62
46 | /svn/!svn/ver/165/trunk/Box2D/Box2D/Collision/Shapes/b2Shape.h
47 | END
48 | b2CircleShape.h
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 68
52 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Collision/Shapes/b2CircleShape.h
53 | END
54 | b2PolygonShape.cpp
55 | K 25
56 | svn:wc:ra_dav:version-url
57 | V 71
58 | /svn/!svn/ver/192/trunk/Box2D/Box2D/Collision/Shapes/b2PolygonShape.cpp
59 | END
60 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Collision/b2TimeOfImpact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_TIME_OF_IMPACT_H
20 | #define B2_TIME_OF_IMPACT_H
21 |
22 | #include
23 | #include
24 |
25 | /// Input parameters for b2TimeOfImpact
26 | struct b2TOIInput
27 | {
28 | b2DistanceProxy proxyA;
29 | b2DistanceProxy proxyB;
30 | b2Sweep sweepA;
31 | b2Sweep sweepB;
32 | float32 tMax; // defines sweep interval [0, tMax]
33 | };
34 |
35 | // Output parameters for b2TimeOfImpact.
36 | struct b2TOIOutput
37 | {
38 | enum State
39 | {
40 | e_unknown,
41 | e_failed,
42 | e_overlapped,
43 | e_touching,
44 | e_separated
45 | };
46 |
47 | State state;
48 | float32 t;
49 | };
50 |
51 | /// Compute the upper bound on time before two shapes penetrate. Time is represented as
52 | /// a fraction between [0,tMax]. This uses a swept separating axis and may miss some intermediate,
53 | /// non-tunneling collision. If you change the time interval, you should call this function
54 | /// again.
55 | /// Note: use b2Distance to compute the contact point and normal at the time of impact.
56 | void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input);
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 42
4 | /svn/!svn/ver/197/trunk/Box2D/Box2D/Common
5 | END
6 | b2StackAllocator.h
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 61
10 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Common/b2StackAllocator.h
11 | END
12 | b2BlockAllocator.cpp
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 63
16 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Common/b2BlockAllocator.cpp
17 | END
18 | b2GrowableStack.h
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 60
22 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Common/b2GrowableStack.h
23 | END
24 | b2Draw.cpp
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 53
28 | /svn/!svn/ver/149/trunk/Box2D/Box2D/Common/b2Draw.cpp
29 | END
30 | b2Math.h
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 51
34 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Common/b2Math.h
35 | END
36 | b2Timer.cpp
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 54
40 | /svn/!svn/ver/197/trunk/Box2D/Box2D/Common/b2Timer.cpp
41 | END
42 | b2BlockAllocator.h
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 61
46 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Common/b2BlockAllocator.h
47 | END
48 | b2Settings.cpp
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 57
52 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Common/b2Settings.cpp
53 | END
54 | b2Draw.h
55 | K 25
56 | svn:wc:ra_dav:version-url
57 | V 51
58 | /svn/!svn/ver/165/trunk/Box2D/Box2D/Common/b2Draw.h
59 | END
60 | b2Settings.h
61 | K 25
62 | svn:wc:ra_dav:version-url
63 | V 55
64 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Common/b2Settings.h
65 | END
66 | b2Timer.h
67 | K 25
68 | svn:wc:ra_dav:version-url
69 | V 52
70 | /svn/!svn/ver/196/trunk/Box2D/Box2D/Common/b2Timer.h
71 | END
72 | b2StackAllocator.cpp
73 | K 25
74 | svn:wc:ra_dav:version-url
75 | V 63
76 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Common/b2StackAllocator.cpp
77 | END
78 | b2Math.cpp
79 | K 25
80 | svn:wc:ra_dav:version-url
81 | V 53
82 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Common/b2Math.cpp
83 | END
84 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2BlockAllocator.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_BLOCK_ALLOCATOR_H
20 | #define B2_BLOCK_ALLOCATOR_H
21 |
22 | #include
23 |
24 | const int32 b2_chunkSize = 16 * 1024;
25 | const int32 b2_maxBlockSize = 640;
26 | const int32 b2_blockSizes = 14;
27 | const int32 b2_chunkArrayIncrement = 128;
28 |
29 | struct b2Block;
30 | struct b2Chunk;
31 |
32 | /// This is a small object allocator used for allocating small
33 | /// objects that persist for more than one time step.
34 | /// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp
35 | class b2BlockAllocator
36 | {
37 | public:
38 | b2BlockAllocator();
39 | ~b2BlockAllocator();
40 |
41 | /// Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
42 | void* Allocate(int32 size);
43 |
44 | /// Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.
45 | void Free(void* p, int32 size);
46 |
47 | void Clear();
48 |
49 | private:
50 |
51 | b2Chunk* m_chunks;
52 | int32 m_chunkCount;
53 | int32 m_chunkSpace;
54 |
55 | b2Block* m_freeLists[b2_blockSizes];
56 |
57 | static int32 s_blockSizes[b2_blockSizes];
58 | static uint8 s_blockSizeLookup[b2_maxBlockSize + 1];
59 | static bool s_blockSizeLookupInitialized;
60 | };
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2Draw.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Erin Catto http://box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 |
21 | b2Draw::b2Draw()
22 | {
23 | m_drawFlags = 0;
24 | }
25 |
26 | void b2Draw::SetFlags(uint32 flags)
27 | {
28 | m_drawFlags = flags;
29 | }
30 |
31 | uint32 b2Draw::GetFlags() const
32 | {
33 | return m_drawFlags;
34 | }
35 |
36 | void b2Draw::AppendFlags(uint32 flags)
37 | {
38 | m_drawFlags |= flags;
39 | }
40 |
41 | void b2Draw::ClearFlags(uint32 flags)
42 | {
43 | m_drawFlags &= ~flags;
44 | }
45 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2GrowableStack.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_GROWABLE_STACK_H
20 | #define B2_GROWABLE_STACK_H
21 | #include
22 | #include
23 |
24 | /// This is a growable LIFO stack with an initial capacity of N.
25 | /// If the stack size exceeds the initial capacity, the heap is used
26 | /// to increase the size of the stack.
27 | template
28 | class b2GrowableStack
29 | {
30 | public:
31 | b2GrowableStack()
32 | {
33 | m_stack = m_array;
34 | m_count = 0;
35 | m_capacity = N;
36 | }
37 |
38 | ~b2GrowableStack()
39 | {
40 | if (m_stack != m_array)
41 | {
42 | b2Free(m_stack);
43 | m_stack = NULL;
44 | }
45 | }
46 |
47 | void Push(const T& element)
48 | {
49 | if (m_count == m_capacity)
50 | {
51 | T* old = m_stack;
52 | m_capacity *= 2;
53 | m_stack = (T*)b2Alloc(m_capacity * sizeof(T));
54 | std::memcpy(m_stack, old, m_count * sizeof(T));
55 | if (old != m_array)
56 | {
57 | b2Free(old);
58 | }
59 | }
60 |
61 | m_stack[m_count] = element;
62 | ++m_count;
63 | }
64 |
65 | T Pop()
66 | {
67 | b2Assert(m_count > 0);
68 | --m_count;
69 | return m_stack[m_count];
70 | }
71 |
72 | int32 GetCount()
73 | {
74 | return m_count;
75 | }
76 |
77 | private:
78 | T* m_stack;
79 | T m_array[N];
80 | int32 m_count;
81 | int32 m_capacity;
82 | };
83 |
84 |
85 | #endif
86 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2Math.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 |
21 | const b2Vec2 b2Vec2_zero(0.0f, 0.0f);
22 |
23 | /// Solve A * x = b, where b is a column vector. This is more efficient
24 | /// than computing the inverse in one-shot cases.
25 | b2Vec3 b2Mat33::Solve33(const b2Vec3& b) const
26 | {
27 | float32 det = b2Dot(ex, b2Cross(ey, ez));
28 | if (det != 0.0f)
29 | {
30 | det = 1.0f / det;
31 | }
32 | b2Vec3 x;
33 | x.x = det * b2Dot(b, b2Cross(ey, ez));
34 | x.y = det * b2Dot(ex, b2Cross(b, ez));
35 | x.z = det * b2Dot(ex, b2Cross(ey, b));
36 | return x;
37 | }
38 |
39 | /// Solve A * x = b, where b is a column vector. This is more efficient
40 | /// than computing the inverse in one-shot cases.
41 | b2Vec2 b2Mat33::Solve22(const b2Vec2& b) const
42 | {
43 | float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y;
44 | float32 det = a11 * a22 - a12 * a21;
45 | if (det != 0.0f)
46 | {
47 | det = 1.0f / det;
48 | }
49 | b2Vec2 x;
50 | x.x = det * (a22 * b.x - a12 * b.y);
51 | x.y = det * (a11 * b.y - a21 * b.x);
52 | return x;
53 | }
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2Settings.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 |
22 | b2Version b2_version = {2, 2, 0};
23 |
24 | // Memory allocators. Modify these to use your own allocator.
25 | void* b2Alloc(int32 size)
26 | {
27 | return malloc(size);
28 | }
29 |
30 | void b2Free(void* mem)
31 | {
32 | free(mem);
33 | }
34 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2StackAllocator.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 |
22 | b2StackAllocator::b2StackAllocator()
23 | {
24 | m_index = 0;
25 | m_allocation = 0;
26 | m_maxAllocation = 0;
27 | m_entryCount = 0;
28 | }
29 |
30 | b2StackAllocator::~b2StackAllocator()
31 | {
32 | b2Assert(m_index == 0);
33 | b2Assert(m_entryCount == 0);
34 | }
35 |
36 | void* b2StackAllocator::Allocate(int32 size)
37 | {
38 | b2Assert(m_entryCount < b2_maxStackEntries);
39 |
40 | b2StackEntry* entry = m_entries + m_entryCount;
41 | entry->size = size;
42 | if (m_index + size > b2_stackSize)
43 | {
44 | entry->data = (char*)b2Alloc(size);
45 | entry->usedMalloc = true;
46 | }
47 | else
48 | {
49 | entry->data = m_data + m_index;
50 | entry->usedMalloc = false;
51 | m_index += size;
52 | }
53 |
54 | m_allocation += size;
55 | m_maxAllocation = b2Max(m_maxAllocation, m_allocation);
56 | ++m_entryCount;
57 |
58 | return entry->data;
59 | }
60 |
61 | void b2StackAllocator::Free(void* p)
62 | {
63 | b2Assert(m_entryCount > 0);
64 | b2StackEntry* entry = m_entries + m_entryCount - 1;
65 | b2Assert(p == entry->data);
66 | if (entry->usedMalloc)
67 | {
68 | b2Free(p);
69 | }
70 | else
71 | {
72 | m_index -= entry->size;
73 | }
74 | m_allocation -= entry->size;
75 | --m_entryCount;
76 |
77 | p = NULL;
78 | }
79 |
80 | int32 b2StackAllocator::GetMaxAllocation() const
81 | {
82 | return m_maxAllocation;
83 | }
84 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2StackAllocator.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_STACK_ALLOCATOR_H
20 | #define B2_STACK_ALLOCATOR_H
21 |
22 | #include
23 |
24 | const int32 b2_stackSize = 100 * 1024; // 100k
25 | const int32 b2_maxStackEntries = 32;
26 |
27 | struct b2StackEntry
28 | {
29 | char* data;
30 | int32 size;
31 | bool usedMalloc;
32 | };
33 |
34 | // This is a stack allocator used for fast per step allocations.
35 | // You must nest allocate/free pairs. The code will assert
36 | // if you try to interleave multiple allocate/free pairs.
37 | class b2StackAllocator
38 | {
39 | public:
40 | b2StackAllocator();
41 | ~b2StackAllocator();
42 |
43 | void* Allocate(int32 size);
44 | void Free(void* p);
45 |
46 | int32 GetMaxAllocation() const;
47 |
48 | private:
49 |
50 | char m_data[b2_stackSize];
51 | int32 m_index;
52 |
53 | int32 m_allocation;
54 | int32 m_maxAllocation;
55 |
56 | b2StackEntry m_entries[b2_maxStackEntries];
57 | int32 m_entryCount;
58 | };
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/.svn/text-base/b2Timer.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Erin Catto http://box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 |
21 | /// Timer for profiling. This has platform specific code and may
22 | /// not work on every platform.
23 | class b2Timer
24 | {
25 | public:
26 |
27 | /// Constructor
28 | b2Timer();
29 |
30 | /// Reset the timer.
31 | void Reset();
32 |
33 | /// Get the time since construction or the last reset.
34 | float32 GetMilliseconds() const;
35 |
36 | private:
37 |
38 | #if defined(WIN32)
39 | float64 m_start;
40 | static float64 s_invFrequency;
41 | #elif defined(__linux__) || defined (__APPLE__)
42 | unsigned long m_start_sec;
43 | unsigned long m_start_msec;
44 | #endif
45 | };
46 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2BlockAllocator.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_BLOCK_ALLOCATOR_H
20 | #define B2_BLOCK_ALLOCATOR_H
21 |
22 | #include
23 |
24 | const int32 b2_chunkSize = 16 * 1024;
25 | const int32 b2_maxBlockSize = 640;
26 | const int32 b2_blockSizes = 14;
27 | const int32 b2_chunkArrayIncrement = 128;
28 |
29 | struct b2Block;
30 | struct b2Chunk;
31 |
32 | /// This is a small object allocator used for allocating small
33 | /// objects that persist for more than one time step.
34 | /// See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp
35 | class b2BlockAllocator
36 | {
37 | public:
38 | b2BlockAllocator();
39 | ~b2BlockAllocator();
40 |
41 | /// Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
42 | void* Allocate(int32 size);
43 |
44 | /// Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.
45 | void Free(void* p, int32 size);
46 |
47 | void Clear();
48 |
49 | private:
50 |
51 | b2Chunk* m_chunks;
52 | int32 m_chunkCount;
53 | int32 m_chunkSpace;
54 |
55 | b2Block* m_freeLists[b2_blockSizes];
56 |
57 | static int32 s_blockSizes[b2_blockSizes];
58 | static uint8 s_blockSizeLookup[b2_maxBlockSize + 1];
59 | static bool s_blockSizeLookupInitialized;
60 | };
61 |
62 | #endif
63 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2Draw.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Erin Catto http://box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 |
21 | b2Draw::b2Draw()
22 | {
23 | m_drawFlags = 0;
24 | }
25 |
26 | void b2Draw::SetFlags(uint32 flags)
27 | {
28 | m_drawFlags = flags;
29 | }
30 |
31 | uint32 b2Draw::GetFlags() const
32 | {
33 | return m_drawFlags;
34 | }
35 |
36 | void b2Draw::AppendFlags(uint32 flags)
37 | {
38 | m_drawFlags |= flags;
39 | }
40 |
41 | void b2Draw::ClearFlags(uint32 flags)
42 | {
43 | m_drawFlags &= ~flags;
44 | }
45 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2GrowableStack.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_GROWABLE_STACK_H
20 | #define B2_GROWABLE_STACK_H
21 | #include
22 | #include
23 |
24 | /// This is a growable LIFO stack with an initial capacity of N.
25 | /// If the stack size exceeds the initial capacity, the heap is used
26 | /// to increase the size of the stack.
27 | template
28 | class b2GrowableStack
29 | {
30 | public:
31 | b2GrowableStack()
32 | {
33 | m_stack = m_array;
34 | m_count = 0;
35 | m_capacity = N;
36 | }
37 |
38 | ~b2GrowableStack()
39 | {
40 | if (m_stack != m_array)
41 | {
42 | b2Free(m_stack);
43 | m_stack = NULL;
44 | }
45 | }
46 |
47 | void Push(const T& element)
48 | {
49 | if (m_count == m_capacity)
50 | {
51 | T* old = m_stack;
52 | m_capacity *= 2;
53 | m_stack = (T*)b2Alloc(m_capacity * sizeof(T));
54 | std::memcpy(m_stack, old, m_count * sizeof(T));
55 | if (old != m_array)
56 | {
57 | b2Free(old);
58 | }
59 | }
60 |
61 | m_stack[m_count] = element;
62 | ++m_count;
63 | }
64 |
65 | T Pop()
66 | {
67 | b2Assert(m_count > 0);
68 | --m_count;
69 | return m_stack[m_count];
70 | }
71 |
72 | int32 GetCount()
73 | {
74 | return m_count;
75 | }
76 |
77 | private:
78 | T* m_stack;
79 | T m_array[N];
80 | int32 m_count;
81 | int32 m_capacity;
82 | };
83 |
84 |
85 | #endif
86 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2Math.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2007-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 |
21 | const b2Vec2 b2Vec2_zero(0.0f, 0.0f);
22 |
23 | /// Solve A * x = b, where b is a column vector. This is more efficient
24 | /// than computing the inverse in one-shot cases.
25 | b2Vec3 b2Mat33::Solve33(const b2Vec3& b) const
26 | {
27 | float32 det = b2Dot(ex, b2Cross(ey, ez));
28 | if (det != 0.0f)
29 | {
30 | det = 1.0f / det;
31 | }
32 | b2Vec3 x;
33 | x.x = det * b2Dot(b, b2Cross(ey, ez));
34 | x.y = det * b2Dot(ex, b2Cross(b, ez));
35 | x.z = det * b2Dot(ex, b2Cross(ey, b));
36 | return x;
37 | }
38 |
39 | /// Solve A * x = b, where b is a column vector. This is more efficient
40 | /// than computing the inverse in one-shot cases.
41 | b2Vec2 b2Mat33::Solve22(const b2Vec2& b) const
42 | {
43 | float32 a11 = ex.x, a12 = ey.x, a21 = ex.y, a22 = ey.y;
44 | float32 det = a11 * a22 - a12 * a21;
45 | if (det != 0.0f)
46 | {
47 | det = 1.0f / det;
48 | }
49 | b2Vec2 x;
50 | x.x = det * (a22 * b.x - a12 * b.y);
51 | x.y = det * (a11 * b.y - a21 * b.x);
52 | return x;
53 | }
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2Settings.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 |
22 | b2Version b2_version = {2, 2, 0};
23 |
24 | // Memory allocators. Modify these to use your own allocator.
25 | void* b2Alloc(int32 size)
26 | {
27 | return malloc(size);
28 | }
29 |
30 | void b2Free(void* mem)
31 | {
32 | free(mem);
33 | }
34 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2StackAllocator.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 |
22 | b2StackAllocator::b2StackAllocator()
23 | {
24 | m_index = 0;
25 | m_allocation = 0;
26 | m_maxAllocation = 0;
27 | m_entryCount = 0;
28 | }
29 |
30 | b2StackAllocator::~b2StackAllocator()
31 | {
32 | b2Assert(m_index == 0);
33 | b2Assert(m_entryCount == 0);
34 | }
35 |
36 | void* b2StackAllocator::Allocate(int32 size)
37 | {
38 | b2Assert(m_entryCount < b2_maxStackEntries);
39 |
40 | b2StackEntry* entry = m_entries + m_entryCount;
41 | entry->size = size;
42 | if (m_index + size > b2_stackSize)
43 | {
44 | entry->data = (char*)b2Alloc(size);
45 | entry->usedMalloc = true;
46 | }
47 | else
48 | {
49 | entry->data = m_data + m_index;
50 | entry->usedMalloc = false;
51 | m_index += size;
52 | }
53 |
54 | m_allocation += size;
55 | m_maxAllocation = b2Max(m_maxAllocation, m_allocation);
56 | ++m_entryCount;
57 |
58 | return entry->data;
59 | }
60 |
61 | void b2StackAllocator::Free(void* p)
62 | {
63 | b2Assert(m_entryCount > 0);
64 | b2StackEntry* entry = m_entries + m_entryCount - 1;
65 | b2Assert(p == entry->data);
66 | if (entry->usedMalloc)
67 | {
68 | b2Free(p);
69 | }
70 | else
71 | {
72 | m_index -= entry->size;
73 | }
74 | m_allocation -= entry->size;
75 | --m_entryCount;
76 |
77 | p = NULL;
78 | }
79 |
80 | int32 b2StackAllocator::GetMaxAllocation() const
81 | {
82 | return m_maxAllocation;
83 | }
84 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2StackAllocator.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_STACK_ALLOCATOR_H
20 | #define B2_STACK_ALLOCATOR_H
21 |
22 | #include
23 |
24 | const int32 b2_stackSize = 100 * 1024; // 100k
25 | const int32 b2_maxStackEntries = 32;
26 |
27 | struct b2StackEntry
28 | {
29 | char* data;
30 | int32 size;
31 | bool usedMalloc;
32 | };
33 |
34 | // This is a stack allocator used for fast per step allocations.
35 | // You must nest allocate/free pairs. The code will assert
36 | // if you try to interleave multiple allocate/free pairs.
37 | class b2StackAllocator
38 | {
39 | public:
40 | b2StackAllocator();
41 | ~b2StackAllocator();
42 |
43 | void* Allocate(int32 size);
44 | void Free(void* p);
45 |
46 | int32 GetMaxAllocation() const;
47 |
48 | private:
49 |
50 | char m_data[b2_stackSize];
51 | int32 m_index;
52 |
53 | int32 m_allocation;
54 | int32 m_maxAllocation;
55 |
56 | b2StackEntry m_entries[b2_maxStackEntries];
57 | int32 m_entryCount;
58 | };
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Common/b2Timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2011 Erin Catto http://box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 |
21 | /// Timer for profiling. This has platform specific code and may
22 | /// not work on every platform.
23 | class b2Timer
24 | {
25 | public:
26 |
27 | /// Constructor
28 | b2Timer();
29 |
30 | /// Reset the timer.
31 | void Reset();
32 |
33 | /// Get the time since construction or the last reset.
34 | float32 GetMilliseconds() const;
35 |
36 | private:
37 |
38 | #if defined(WIN32)
39 | float64 m_start;
40 | static float64 s_invFrequency;
41 | #elif defined(__linux__) || defined (__APPLE__)
42 | unsigned long m_start_sec;
43 | unsigned long m_start_msec;
44 | #endif
45 | };
46 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 44
4 | /svn/!svn/ver/194/trunk/Box2D/Box2D/Dynamics
5 | END
6 | b2Island.cpp
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 57
10 | /svn/!svn/ver/191/trunk/Box2D/Box2D/Dynamics/b2Island.cpp
11 | END
12 | b2ContactManager.h
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 63
16 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Dynamics/b2ContactManager.h
17 | END
18 | b2Fixture.h
19 | K 25
20 | svn:wc:ra_dav:version-url
21 | V 56
22 | /svn/!svn/ver/164/trunk/Box2D/Box2D/Dynamics/b2Fixture.h
23 | END
24 | b2WorldCallbacks.h
25 | K 25
26 | svn:wc:ra_dav:version-url
27 | V 63
28 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Dynamics/b2WorldCallbacks.h
29 | END
30 | b2World.h
31 | K 25
32 | svn:wc:ra_dav:version-url
33 | V 54
34 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Dynamics/b2World.h
35 | END
36 | b2Body.cpp
37 | K 25
38 | svn:wc:ra_dav:version-url
39 | V 55
40 | /svn/!svn/ver/194/trunk/Box2D/Box2D/Dynamics/b2Body.cpp
41 | END
42 | b2TimeStep.h
43 | K 25
44 | svn:wc:ra_dav:version-url
45 | V 57
46 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Dynamics/b2TimeStep.h
47 | END
48 | b2Island.h
49 | K 25
50 | svn:wc:ra_dav:version-url
51 | V 55
52 | /svn/!svn/ver/186/trunk/Box2D/Box2D/Dynamics/b2Island.h
53 | END
54 | b2Body.h
55 | K 25
56 | svn:wc:ra_dav:version-url
57 | V 53
58 | /svn/!svn/ver/188/trunk/Box2D/Box2D/Dynamics/b2Body.h
59 | END
60 | b2Fixture.cpp
61 | K 25
62 | svn:wc:ra_dav:version-url
63 | V 58
64 | /svn/!svn/ver/193/trunk/Box2D/Box2D/Dynamics/b2Fixture.cpp
65 | END
66 | b2ContactManager.cpp
67 | K 25
68 | svn:wc:ra_dav:version-url
69 | V 65
70 | /svn/!svn/ver/189/trunk/Box2D/Box2D/Dynamics/b2ContactManager.cpp
71 | END
72 | b2WorldCallbacks.cpp
73 | K 25
74 | svn:wc:ra_dav:version-url
75 | V 65
76 | /svn/!svn/ver/158/trunk/Box2D/Box2D/Dynamics/b2WorldCallbacks.cpp
77 | END
78 | b2World.cpp
79 | K 25
80 | svn:wc:ra_dav:version-url
81 | V 56
82 | /svn/!svn/ver/189/trunk/Box2D/Box2D/Dynamics/b2World.cpp
83 | END
84 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/.svn/text-base/b2ContactManager.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_CONTACT_MANAGER_H
20 | #define B2_CONTACT_MANAGER_H
21 |
22 | #include
23 |
24 | class b2Contact;
25 | class b2ContactFilter;
26 | class b2ContactListener;
27 | class b2BlockAllocator;
28 |
29 | // Delegate of b2World.
30 | class b2ContactManager
31 | {
32 | public:
33 | b2ContactManager();
34 |
35 | // Broad-phase callback.
36 | void AddPair(void* proxyUserDataA, void* proxyUserDataB);
37 |
38 | void FindNewContacts();
39 |
40 | void Destroy(b2Contact* c);
41 |
42 | void Collide();
43 |
44 | b2BroadPhase m_broadPhase;
45 | b2Contact* m_contactList;
46 | int32 m_contactCount;
47 | b2ContactFilter* m_contactFilter;
48 | b2ContactListener* m_contactListener;
49 | b2BlockAllocator* m_allocator;
50 | };
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/.svn/text-base/b2TimeStep.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2011 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_TIME_STEP_H
20 | #define B2_TIME_STEP_H
21 |
22 | #include
23 |
24 | /// Profiling data. Times are in milliseconds.
25 | struct b2Profile
26 | {
27 | float32 step;
28 | float32 collide;
29 | float32 solve;
30 | float32 solveInit;
31 | float32 solveVelocity;
32 | float32 solvePosition;
33 | float32 broadphase;
34 | float32 solveTOI;
35 | };
36 |
37 | /// This is an internal structure.
38 | struct b2TimeStep
39 | {
40 | float32 dt; // time step
41 | float32 inv_dt; // inverse time step (0 if dt == 0).
42 | float32 dtRatio; // dt * inv_dt0
43 | int32 velocityIterations;
44 | int32 positionIterations;
45 | bool warmStarting;
46 | };
47 |
48 | /// This is an internal structure.
49 | struct b2Position
50 | {
51 | b2Vec2 c;
52 | float32 a;
53 | };
54 |
55 | /// This is an internal structure.
56 | struct b2Velocity
57 | {
58 | b2Vec2 v;
59 | float32 w;
60 | };
61 |
62 | /// Solver Data
63 | struct b2SolverData
64 | {
65 | b2TimeStep step;
66 | b2Position* positions;
67 | b2Velocity* velocities;
68 | };
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/.svn/text-base/b2WorldCallbacks.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 |
22 | // Return true if contact calculations should be performed between these two shapes.
23 | // If you implement your own collision filter you may want to build from this implementation.
24 | bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB)
25 | {
26 | const b2Filter& filterA = fixtureA->GetFilterData();
27 | const b2Filter& filterB = fixtureB->GetFilterData();
28 |
29 | if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0)
30 | {
31 | return filterA.groupIndex > 0;
32 | }
33 |
34 | bool collide = (filterA.maskBits & filterB.categoryBits) != 0 && (filterA.categoryBits & filterB.maskBits) != 0;
35 | return collide;
36 | }
37 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2CircleContact.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | using namespace std;
28 |
29 | b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
30 | {
31 | void* mem = allocator->Allocate(sizeof(b2CircleContact));
32 | return new (mem) b2CircleContact(fixtureA, fixtureB);
33 | }
34 |
35 | void b2CircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
36 | {
37 | ((b2CircleContact*)contact)->~b2CircleContact();
38 | allocator->Free(contact, sizeof(b2CircleContact));
39 | }
40 |
41 | b2CircleContact::b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
42 | : b2Contact(fixtureA, 0, fixtureB, 0)
43 | {
44 | b2Assert(m_fixtureA->GetType() == b2Shape::e_circle);
45 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
46 | }
47 |
48 | void b2CircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
49 | {
50 | b2CollideCircles(manifold,
51 | (b2CircleShape*)m_fixtureA->GetShape(), xfA,
52 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
53 | }
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2CircleContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_CIRCLE_CONTACT_H
20 | #define B2_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2CircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2CircleContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2EdgeAndCircleContact.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | using namespace std;
25 |
26 | b2Contact* b2EdgeAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
27 | {
28 | void* mem = allocator->Allocate(sizeof(b2EdgeAndCircleContact));
29 | return new (mem) b2EdgeAndCircleContact(fixtureA, fixtureB);
30 | }
31 |
32 | void b2EdgeAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
33 | {
34 | ((b2EdgeAndCircleContact*)contact)->~b2EdgeAndCircleContact();
35 | allocator->Free(contact, sizeof(b2EdgeAndCircleContact));
36 | }
37 |
38 | b2EdgeAndCircleContact::b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
39 | : b2Contact(fixtureA, 0, fixtureB, 0)
40 | {
41 | b2Assert(m_fixtureA->GetType() == b2Shape::e_edge);
42 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
43 | }
44 |
45 | void b2EdgeAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
46 | {
47 | b2CollideEdgeAndCircle( manifold,
48 | (b2EdgeShape*)m_fixtureA->GetShape(), xfA,
49 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
50 | }
51 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2EdgeAndCircleContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_EDGE_AND_CIRCLE_CONTACT_H
20 | #define B2_EDGE_AND_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2EdgeAndCircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2EdgeAndCircleContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2EdgeAndPolygonContact.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | using namespace std;
25 |
26 | b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
27 | {
28 | void* mem = allocator->Allocate(sizeof(b2EdgeAndPolygonContact));
29 | return new (mem) b2EdgeAndPolygonContact(fixtureA, fixtureB);
30 | }
31 |
32 | void b2EdgeAndPolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
33 | {
34 | ((b2EdgeAndPolygonContact*)contact)->~b2EdgeAndPolygonContact();
35 | allocator->Free(contact, sizeof(b2EdgeAndPolygonContact));
36 | }
37 |
38 | b2EdgeAndPolygonContact::b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
39 | : b2Contact(fixtureA, 0, fixtureB, 0)
40 | {
41 | b2Assert(m_fixtureA->GetType() == b2Shape::e_edge);
42 | b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon);
43 | }
44 |
45 | void b2EdgeAndPolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
46 | {
47 | b2CollideEdgeAndPolygon( manifold,
48 | (b2EdgeShape*)m_fixtureA->GetShape(), xfA,
49 | (b2PolygonShape*)m_fixtureB->GetShape(), xfB);
50 | }
51 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2EdgeAndPolygonContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_EDGE_AND_POLYGON_CONTACT_H
20 | #define B2_EDGE_AND_POLYGON_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2EdgeAndPolygonContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2EdgeAndPolygonContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2LoopAndCircleContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_LOOP_AND_CIRCLE_CONTACT_H
20 | #define B2_LOOP_AND_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2LoopAndCircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2LoopAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB);
34 | ~b2LoopAndCircleContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2LoopAndPolygonContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_LOOP_AND_POLYGON_CONTACT_H
20 | #define B2_LOOP_AND_POLYGON_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2LoopAndPolygonContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2LoopAndPolygonContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB);
34 | ~b2LoopAndPolygonContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2PolygonAndCircleContact.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | using namespace std;
25 |
26 | b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
27 | {
28 | void* mem = allocator->Allocate(sizeof(b2PolygonAndCircleContact));
29 | return new (mem) b2PolygonAndCircleContact(fixtureA, fixtureB);
30 | }
31 |
32 | void b2PolygonAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
33 | {
34 | ((b2PolygonAndCircleContact*)contact)->~b2PolygonAndCircleContact();
35 | allocator->Free(contact, sizeof(b2PolygonAndCircleContact));
36 | }
37 |
38 | b2PolygonAndCircleContact::b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
39 | : b2Contact(fixtureA, 0, fixtureB, 0)
40 | {
41 | b2Assert(m_fixtureA->GetType() == b2Shape::e_polygon);
42 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
43 | }
44 |
45 | void b2PolygonAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
46 | {
47 | b2CollidePolygonAndCircle( manifold,
48 | (b2PolygonShape*)m_fixtureA->GetShape(), xfA,
49 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
50 | }
51 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2PolygonAndCircleContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_POLYGON_AND_CIRCLE_CONTACT_H
20 | #define B2_POLYGON_AND_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2PolygonAndCircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
30 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
31 |
32 | b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
33 | ~b2PolygonAndCircleContact() {}
34 |
35 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
36 | };
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2PolygonContact.cpp.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | using namespace std;
28 |
29 | b2Contact* b2PolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
30 | {
31 | void* mem = allocator->Allocate(sizeof(b2PolygonContact));
32 | return new (mem) b2PolygonContact(fixtureA, fixtureB);
33 | }
34 |
35 | void b2PolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
36 | {
37 | ((b2PolygonContact*)contact)->~b2PolygonContact();
38 | allocator->Free(contact, sizeof(b2PolygonContact));
39 | }
40 |
41 | b2PolygonContact::b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
42 | : b2Contact(fixtureA, 0, fixtureB, 0)
43 | {
44 | b2Assert(m_fixtureA->GetType() == b2Shape::e_polygon);
45 | b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon);
46 | }
47 |
48 | void b2PolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
49 | {
50 | b2CollidePolygons( manifold,
51 | (b2PolygonShape*)m_fixtureA->GetShape(), xfA,
52 | (b2PolygonShape*)m_fixtureB->GetShape(), xfB);
53 | }
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/.svn/text-base/b2PolygonContact.h.svn-base:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_POLYGON_CONTACT_H
20 | #define B2_POLYGON_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2PolygonContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2PolygonContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2CircleContact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | using namespace std;
28 |
29 | b2Contact* b2CircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
30 | {
31 | void* mem = allocator->Allocate(sizeof(b2CircleContact));
32 | return new (mem) b2CircleContact(fixtureA, fixtureB);
33 | }
34 |
35 | void b2CircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
36 | {
37 | ((b2CircleContact*)contact)->~b2CircleContact();
38 | allocator->Free(contact, sizeof(b2CircleContact));
39 | }
40 |
41 | b2CircleContact::b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
42 | : b2Contact(fixtureA, 0, fixtureB, 0)
43 | {
44 | b2Assert(m_fixtureA->GetType() == b2Shape::e_circle);
45 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
46 | }
47 |
48 | void b2CircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
49 | {
50 | b2CollideCircles(manifold,
51 | (b2CircleShape*)m_fixtureA->GetShape(), xfA,
52 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
53 | }
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2CircleContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_CIRCLE_CONTACT_H
20 | #define B2_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2CircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2CircleContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | using namespace std;
25 |
26 | b2Contact* b2EdgeAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
27 | {
28 | void* mem = allocator->Allocate(sizeof(b2EdgeAndCircleContact));
29 | return new (mem) b2EdgeAndCircleContact(fixtureA, fixtureB);
30 | }
31 |
32 | void b2EdgeAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
33 | {
34 | ((b2EdgeAndCircleContact*)contact)->~b2EdgeAndCircleContact();
35 | allocator->Free(contact, sizeof(b2EdgeAndCircleContact));
36 | }
37 |
38 | b2EdgeAndCircleContact::b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
39 | : b2Contact(fixtureA, 0, fixtureB, 0)
40 | {
41 | b2Assert(m_fixtureA->GetType() == b2Shape::e_edge);
42 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
43 | }
44 |
45 | void b2EdgeAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
46 | {
47 | b2CollideEdgeAndCircle( manifold,
48 | (b2EdgeShape*)m_fixtureA->GetShape(), xfA,
49 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
50 | }
51 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_EDGE_AND_CIRCLE_CONTACT_H
20 | #define B2_EDGE_AND_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2EdgeAndCircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2EdgeAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2EdgeAndCircleContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | using namespace std;
25 |
26 | b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
27 | {
28 | void* mem = allocator->Allocate(sizeof(b2EdgeAndPolygonContact));
29 | return new (mem) b2EdgeAndPolygonContact(fixtureA, fixtureB);
30 | }
31 |
32 | void b2EdgeAndPolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
33 | {
34 | ((b2EdgeAndPolygonContact*)contact)->~b2EdgeAndPolygonContact();
35 | allocator->Free(contact, sizeof(b2EdgeAndPolygonContact));
36 | }
37 |
38 | b2EdgeAndPolygonContact::b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
39 | : b2Contact(fixtureA, 0, fixtureB, 0)
40 | {
41 | b2Assert(m_fixtureA->GetType() == b2Shape::e_edge);
42 | b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon);
43 | }
44 |
45 | void b2EdgeAndPolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
46 | {
47 | b2CollideEdgeAndPolygon( manifold,
48 | (b2EdgeShape*)m_fixtureA->GetShape(), xfA,
49 | (b2PolygonShape*)m_fixtureB->GetShape(), xfB);
50 | }
51 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_EDGE_AND_POLYGON_CONTACT_H
20 | #define B2_EDGE_AND_POLYGON_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2EdgeAndPolygonContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2EdgeAndPolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2EdgeAndPolygonContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2LoopAndCircleContact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2010 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | #include
26 | using namespace std;
27 |
28 | b2Contact* b2LoopAndCircleContact::Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator)
29 | {
30 | void* mem = allocator->Allocate(sizeof(b2LoopAndCircleContact));
31 | return new (mem) b2LoopAndCircleContact(fixtureA, indexA, fixtureB, indexB);
32 | }
33 |
34 | void b2LoopAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
35 | {
36 | ((b2LoopAndCircleContact*)contact)->~b2LoopAndCircleContact();
37 | allocator->Free(contact, sizeof(b2LoopAndCircleContact));
38 | }
39 |
40 | b2LoopAndCircleContact::b2LoopAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB)
41 | : b2Contact(fixtureA, indexA, fixtureB, indexB)
42 | {
43 | b2Assert(m_fixtureA->GetType() == b2Shape::e_loop);
44 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
45 | }
46 |
47 | void b2LoopAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
48 | {
49 | b2LoopShape* loop = (b2LoopShape*)m_fixtureA->GetShape();
50 | b2EdgeShape edge;
51 | loop->GetChildEdge(&edge, m_indexA);
52 | b2CollideEdgeAndCircle( manifold, &edge, xfA,
53 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
54 | }
55 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2LoopAndCircleContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_LOOP_AND_CIRCLE_CONTACT_H
20 | #define B2_LOOP_AND_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2LoopAndCircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2LoopAndCircleContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB);
34 | ~b2LoopAndCircleContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2LoopAndPolygonContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_LOOP_AND_POLYGON_CONTACT_H
20 | #define B2_LOOP_AND_POLYGON_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2LoopAndPolygonContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2LoopAndPolygonContact(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB);
34 | ~b2LoopAndPolygonContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | using namespace std;
25 |
26 | b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
27 | {
28 | void* mem = allocator->Allocate(sizeof(b2PolygonAndCircleContact));
29 | return new (mem) b2PolygonAndCircleContact(fixtureA, fixtureB);
30 | }
31 |
32 | void b2PolygonAndCircleContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
33 | {
34 | ((b2PolygonAndCircleContact*)contact)->~b2PolygonAndCircleContact();
35 | allocator->Free(contact, sizeof(b2PolygonAndCircleContact));
36 | }
37 |
38 | b2PolygonAndCircleContact::b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
39 | : b2Contact(fixtureA, 0, fixtureB, 0)
40 | {
41 | b2Assert(m_fixtureA->GetType() == b2Shape::e_polygon);
42 | b2Assert(m_fixtureB->GetType() == b2Shape::e_circle);
43 | }
44 |
45 | void b2PolygonAndCircleContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
46 | {
47 | b2CollidePolygonAndCircle( manifold,
48 | (b2PolygonShape*)m_fixtureA->GetShape(), xfA,
49 | (b2CircleShape*)m_fixtureB->GetShape(), xfB);
50 | }
51 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_POLYGON_AND_CIRCLE_CONTACT_H
20 | #define B2_POLYGON_AND_CIRCLE_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2PolygonAndCircleContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create(b2Fixture* fixtureA, int32 indexA, b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
30 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
31 |
32 | b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
33 | ~b2PolygonAndCircleContact() {}
34 |
35 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
36 | };
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2PolygonContact.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | using namespace std;
28 |
29 | b2Contact* b2PolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
30 | {
31 | void* mem = allocator->Allocate(sizeof(b2PolygonContact));
32 | return new (mem) b2PolygonContact(fixtureA, fixtureB);
33 | }
34 |
35 | void b2PolygonContact::Destroy(b2Contact* contact, b2BlockAllocator* allocator)
36 | {
37 | ((b2PolygonContact*)contact)->~b2PolygonContact();
38 | allocator->Free(contact, sizeof(b2PolygonContact));
39 | }
40 |
41 | b2PolygonContact::b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB)
42 | : b2Contact(fixtureA, 0, fixtureB, 0)
43 | {
44 | b2Assert(m_fixtureA->GetType() == b2Shape::e_polygon);
45 | b2Assert(m_fixtureB->GetType() == b2Shape::e_polygon);
46 | }
47 |
48 | void b2PolygonContact::Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB)
49 | {
50 | b2CollidePolygons( manifold,
51 | (b2PolygonShape*)m_fixtureA->GetShape(), xfA,
52 | (b2PolygonShape*)m_fixtureB->GetShape(), xfB);
53 | }
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/Contacts/b2PolygonContact.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_POLYGON_CONTACT_H
20 | #define B2_POLYGON_CONTACT_H
21 |
22 | #include
23 |
24 | class b2BlockAllocator;
25 |
26 | class b2PolygonContact : public b2Contact
27 | {
28 | public:
29 | static b2Contact* Create( b2Fixture* fixtureA, int32 indexA,
30 | b2Fixture* fixtureB, int32 indexB, b2BlockAllocator* allocator);
31 | static void Destroy(b2Contact* contact, b2BlockAllocator* allocator);
32 |
33 | b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB);
34 | ~b2PolygonContact() {}
35 |
36 | void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB);
37 | };
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/b2ContactManager.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_CONTACT_MANAGER_H
20 | #define B2_CONTACT_MANAGER_H
21 |
22 | #include
23 |
24 | class b2Contact;
25 | class b2ContactFilter;
26 | class b2ContactListener;
27 | class b2BlockAllocator;
28 |
29 | // Delegate of b2World.
30 | class b2ContactManager
31 | {
32 | public:
33 | b2ContactManager();
34 |
35 | // Broad-phase callback.
36 | void AddPair(void* proxyUserDataA, void* proxyUserDataB);
37 |
38 | void FindNewContacts();
39 |
40 | void Destroy(b2Contact* c);
41 |
42 | void Collide();
43 |
44 | b2BroadPhase m_broadPhase;
45 | b2Contact* m_contactList;
46 | int32 m_contactCount;
47 | b2ContactFilter* m_contactFilter;
48 | b2ContactListener* m_contactListener;
49 | b2BlockAllocator* m_allocator;
50 | };
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/b2TimeStep.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2011 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #ifndef B2_TIME_STEP_H
20 | #define B2_TIME_STEP_H
21 |
22 | #include
23 |
24 | /// Profiling data. Times are in milliseconds.
25 | struct b2Profile
26 | {
27 | float32 step;
28 | float32 collide;
29 | float32 solve;
30 | float32 solveInit;
31 | float32 solveVelocity;
32 | float32 solvePosition;
33 | float32 broadphase;
34 | float32 solveTOI;
35 | };
36 |
37 | /// This is an internal structure.
38 | struct b2TimeStep
39 | {
40 | float32 dt; // time step
41 | float32 inv_dt; // inverse time step (0 if dt == 0).
42 | float32 dtRatio; // dt * inv_dt0
43 | int32 velocityIterations;
44 | int32 positionIterations;
45 | bool warmStarting;
46 | };
47 |
48 | /// This is an internal structure.
49 | struct b2Position
50 | {
51 | b2Vec2 c;
52 | float32 a;
53 | };
54 |
55 | /// This is an internal structure.
56 | struct b2Velocity
57 | {
58 | b2Vec2 v;
59 | float32 w;
60 | };
61 |
62 | /// Solver Data
63 | struct b2SolverData
64 | {
65 | b2TimeStep step;
66 | b2Position* positions;
67 | b2Velocity* velocities;
68 | };
69 |
70 | #endif
71 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Dynamics/b2WorldCallbacks.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
3 | *
4 | * This software is provided 'as-is', without any express or implied
5 | * warranty. In no event will the authors be held liable for any damages
6 | * arising from the use of this software.
7 | * Permission is granted to anyone to use this software for any purpose,
8 | * including commercial applications, and to alter it and redistribute it
9 | * freely, subject to the following restrictions:
10 | * 1. The origin of this software must not be misrepresented; you must not
11 | * claim that you wrote the original software. If you use this software
12 | * in a product, an acknowledgment in the product documentation would be
13 | * appreciated but is not required.
14 | * 2. Altered source versions must be plainly marked as such, and must not be
15 | * misrepresented as being the original software.
16 | * 3. This notice may not be removed or altered from any source distribution.
17 | */
18 |
19 | #include
20 | #include
21 |
22 | // Return true if contact calculations should be performed between these two shapes.
23 | // If you implement your own collision filter you may want to build from this implementation.
24 | bool b2ContactFilter::ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB)
25 | {
26 | const b2Filter& filterA = fixtureA->GetFilterData();
27 | const b2Filter& filterB = fixtureB->GetFilterData();
28 |
29 | if (filterA.groupIndex == filterB.groupIndex && filterA.groupIndex != 0)
30 | {
31 | return filterA.groupIndex > 0;
32 | }
33 |
34 | bool collide = (filterA.maskBits & filterB.categoryBits) != 0 && (filterA.categoryBits & filterB.maskBits) != 0;
35 | return collide;
36 | }
37 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Rope/.svn/all-wcprops:
--------------------------------------------------------------------------------
1 | K 25
2 | svn:wc:ra_dav:version-url
3 | V 40
4 | /svn/!svn/ver/149/trunk/Box2D/Box2D/Rope
5 | END
6 | b2Rope.h
7 | K 25
8 | svn:wc:ra_dav:version-url
9 | V 49
10 | /svn/!svn/ver/149/trunk/Box2D/Box2D/Rope/b2Rope.h
11 | END
12 | b2Rope.cpp
13 | K 25
14 | svn:wc:ra_dav:version-url
15 | V 51
16 | /svn/!svn/ver/149/trunk/Box2D/Box2D/Rope/b2Rope.cpp
17 | END
18 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/Box2D/Rope/.svn/entries:
--------------------------------------------------------------------------------
1 | 10
2 |
3 | dir
4 | 197
5 | http://box2d.googlecode.com/svn/trunk/Box2D/Box2D/Rope
6 | http://box2d.googlecode.com/svn
7 |
8 |
9 |
10 | 2011-02-22T08:25:20.333661Z
11 | 149
12 | erincatto
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | cafe418c-1137-0410-84cc-357ec87a5d9b
28 |
29 | b2Rope.h
30 | file
31 |
32 |
33 |
34 |
35 | 2011-06-29T20:00:03.000000Z
36 | 6dbc4ea4c1d71111773ebbdc58a79707
37 | 2011-02-22T08:25:20.333661Z
38 | 149
39 | erincatto
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | 2088
62 |
63 | b2Rope.cpp
64 | file
65 |
66 |
67 |
68 |
69 | 2011-06-29T20:00:03.000000Z
70 | c2eb85360941ae9b49d6f06ab386bc44
71 | 2011-02-22T08:25:20.333661Z
72 | 149
73 | erincatto
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | 5163
96 |
97 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/FontLabel/FontLabel.h:
--------------------------------------------------------------------------------
1 | //
2 | // FontLabel.h
3 | // FontLabel
4 | //
5 | // Created by Kevin Ballard on 5/8/09.
6 | // Copyright © 2009 Zynga Game Networks
7 | //
8 | //
9 | // Licensed under the Apache License, Version 2.0 (the "License");
10 | // you may not use this file except in compliance with the License.
11 | // You may obtain a copy of the License at
12 | //
13 | // http://www.apache.org/licenses/LICENSE-2.0
14 | //
15 | // Unless required by applicable law or agreed to in writing, software
16 | // distributed under the License is distributed on an "AS IS" BASIS,
17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | // See the License for the specific language governing permissions and
19 | // limitations under the License.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | @class ZFont;
26 | @class ZAttributedString;
27 |
28 | @interface FontLabel : UILabel {
29 | void *reserved; // works around a bug in UILabel
30 | ZFont *zFont;
31 | ZAttributedString *zAttributedText;
32 | }
33 | @property (nonatomic, setter=setCGFont:) CGFontRef cgFont __AVAILABILITY_INTERNAL_DEPRECATED;
34 | @property (nonatomic, assign) CGFloat pointSize __AVAILABILITY_INTERNAL_DEPRECATED;
35 | @property (nonatomic, retain, setter=setZFont:) ZFont *zFont;
36 | // if attributedText is nil, fall back on using the inherited UILabel properties
37 | // if attributedText is non-nil, the font/text/textColor
38 | // in addition, adjustsFontSizeToFitWidth does not work with attributed text
39 | @property (nonatomic, copy) ZAttributedString *zAttributedText;
40 | // -initWithFrame:fontName:pointSize: uses FontManager to look up the font name
41 | - (id)initWithFrame:(CGRect)frame fontName:(NSString *)fontName pointSize:(CGFloat)pointSize;
42 | - (id)initWithFrame:(CGRect)frame zFont:(ZFont *)font;
43 | - (id)initWithFrame:(CGRect)frame font:(CGFontRef)font pointSize:(CGFloat)pointSize __AVAILABILITY_INTERNAL_DEPRECATED;
44 | @end
45 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/FontLabel/ZAttributedStringPrivate.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZAttributedStringPrivate.h
3 | // FontLabel
4 | //
5 | // Created by Kevin Ballard on 9/23/09.
6 | // Copyright 2009 Zynga Game Networks. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ZAttributedString.h"
11 |
12 | @interface ZAttributeRun : NSObject {
13 | NSUInteger _index;
14 | NSMutableDictionary *_attributes;
15 | }
16 | @property (nonatomic, readonly) NSUInteger index;
17 | @property (nonatomic, readonly) NSMutableDictionary *attributes;
18 | + (id)attributeRunWithIndex:(NSUInteger)idx attributes:(NSDictionary *)attrs;
19 | - (id)initWithIndex:(NSUInteger)idx attributes:(NSDictionary *)attrs;
20 | @end
21 |
22 | @interface ZAttributedString (ZAttributedStringPrivate)
23 | @property (nonatomic, readonly) NSArray *attributes;
24 | @end
25 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/FontLabel/ZFont.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZFont.h
3 | // FontLabel
4 | //
5 | // Created by Kevin Ballard on 7/2/09.
6 | // Copyright © 2009 Zynga Game Networks
7 | //
8 | //
9 | // Licensed under the Apache License, Version 2.0 (the "License");
10 | // you may not use this file except in compliance with the License.
11 | // You may obtain a copy of the License at
12 | //
13 | // http://www.apache.org/licenses/LICENSE-2.0
14 | //
15 | // Unless required by applicable law or agreed to in writing, software
16 | // distributed under the License is distributed on an "AS IS" BASIS,
17 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | // See the License for the specific language governing permissions and
19 | // limitations under the License.
20 | //
21 |
22 | #import
23 | #import
24 |
25 | @interface ZFont : NSObject {
26 | CGFontRef _cgFont;
27 | CGFloat _pointSize;
28 | CGFloat _ratio;
29 | NSString *_familyName;
30 | NSString *_fontName;
31 | NSString *_postScriptName;
32 | }
33 | @property (nonatomic, readonly) CGFontRef cgFont;
34 | @property (nonatomic, readonly) CGFloat pointSize;
35 | @property (nonatomic, readonly) CGFloat ascender;
36 | @property (nonatomic, readonly) CGFloat descender;
37 | @property (nonatomic, readonly) CGFloat leading;
38 | @property (nonatomic, readonly) CGFloat xHeight;
39 | @property (nonatomic, readonly) CGFloat capHeight;
40 | @property (nonatomic, readonly) NSString *familyName;
41 | @property (nonatomic, readonly) NSString *fontName;
42 | @property (nonatomic, readonly) NSString *postScriptName;
43 | + (ZFont *)fontWithCGFont:(CGFontRef)cgFont size:(CGFloat)fontSize;
44 | + (ZFont *)fontWithUIFont:(UIFont *)uiFont;
45 | - (id)initWithCGFont:(CGFontRef)cgFont size:(CGFloat)fontSize;
46 | - (ZFont *)fontWithSize:(CGFloat)fontSize;
47 | @end
48 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/LICENSE_Box2D.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
2 |
3 | This software is provided 'as-is', without any express or implied
4 | warranty. In no event will the authors be held liable for any damages
5 | arising from the use of this software.
6 |
7 | Permission is granted to anyone to use this software for any purpose,
8 | including commercial applications, and to alter it and redistribute it
9 | freely, subject to the following restrictions:
10 |
11 | 1. The origin of this software must not be misrepresented; you must not
12 | claim that you wrote the original software. If you use this software
13 | in a product, an acknowledgment in the product documentation would be
14 | appreciated but is not required.
15 | 2. Altered source versions must be plainly marked as such, and must not be
16 | misrepresented as being the original software.
17 | 3. This notice may not be removed or altered from any source distribution.
18 |
19 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/LICENSE_CocosDenshion.txt:
--------------------------------------------------------------------------------
1 | CocosDenshion Sound Engine
2 |
3 | Copyright (c) 2010 Steve Oldmeadow
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/LICENSE_TouchJSON.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2008 Jonathan Wight
2 |
3 | Permission is hereby granted, free of charge, to any person
4 | obtaining a copy of this software and associated documentation
5 | files (the "Software"), to deal in the Software without
6 | restriction, including without limitation the rights to use,
7 | copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | copies of the Software, and to permit persons to whom the
9 | Software is furnished to do so, subject to the following
10 | conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/LICENSE_cocos2d.txt:
--------------------------------------------------------------------------------
1 | cocos2d for iPhone: http://www.cocos2d-iphone.org
2 |
3 | Copyright (c) 2008-2011 - Ricardo Quesada and contributors
4 | (see each file to see the different copyright owners)
5 |
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in
15 | all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/TouchJSON/Extensions/CDataScanner_Extensions.h:
--------------------------------------------------------------------------------
1 | //
2 | // CDataScanner_Extensions.h
3 | // TouchCode
4 | //
5 | // Created by Jonathan Wight on 12/08/2005.
6 | // Copyright 2005 toxicsoftware.com. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "CDataScanner.h"
31 |
32 | @interface CDataScanner (CDataScanner_Extensions)
33 |
34 | - (BOOL)scanCStyleComment:(NSString **)outComment;
35 | - (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment;
36 |
37 | - (NSUInteger)lineOfScanLocation;
38 | - (NSDictionary *)userInfoForScanLocation;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/TouchJSON/Extensions/NSDictionary_JSONExtensions.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary_JSONExtensions.h
3 | // TouchCode
4 | //
5 | // Created by Jonathan Wight on 04/17/08.
6 | // Copyright 2008 toxicsoftware.com. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 |
32 | @interface NSDictionary (NSDictionary_JSONExtensions)
33 |
34 | + (id)dictionaryWithJSONData:(NSData *)inData error:(NSError **)outError;
35 | + (id)dictionaryWithJSONString:(NSString *)inJSON error:(NSError **)outError;
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/TouchJSON/Extensions/NSDictionary_JSONExtensions.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSDictionary_JSONExtensions.m
3 | // TouchCode
4 | //
5 | // Created by Jonathan Wight on 04/17/08.
6 | // Copyright 2008 toxicsoftware.com. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import "NSDictionary_JSONExtensions.h"
31 |
32 | #import "CJSONDeserializer.h"
33 |
34 | @implementation NSDictionary (NSDictionary_JSONExtensions)
35 |
36 | + (id)dictionaryWithJSONData:(NSData *)inData error:(NSError **)outError
37 | {
38 | return([[CJSONDeserializer deserializer] deserialize:inData error:outError]);
39 | }
40 |
41 | + (id)dictionaryWithJSONString:(NSString *)inJSON error:(NSError **)outError;
42 | {
43 | NSData *theData = [inJSON dataUsingEncoding:NSUTF8StringEncoding];
44 | return([self dictionaryWithJSONData:theData error:outError]);
45 | }
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/TouchJSON/JSON/CJSONSerializer.h:
--------------------------------------------------------------------------------
1 | //
2 | // CJSONSerializer.h
3 | // TouchCode
4 | //
5 | // Created by Jonathan Wight on 12/07/2005.
6 | // Copyright 2005 toxicsoftware.com. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person
9 | // obtaining a copy of this software and associated documentation
10 | // files (the "Software"), to deal in the Software without
11 | // restriction, including without limitation the rights to use,
12 | // copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the
14 | // Software is furnished to do so, subject to the following
15 | // conditions:
16 | //
17 | // The above copyright notice and this permission notice shall be
18 | // included in all copies or substantial portions of the Software.
19 | //
20 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 | // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 | // OTHER DEALINGS IN THE SOFTWARE.
28 | //
29 |
30 | #import
31 |
32 | @interface CJSONSerializer : NSObject {
33 | }
34 |
35 | + (id)serializer;
36 |
37 | - (BOOL)isValidJSONObject:(id)inObject;
38 |
39 | /// Take any JSON compatible object (generally NSNull, NSNumber, NSString, NSArray and NSDictionary) and produce an NSData containing the serialized JSON.
40 | - (NSData *)serializeObject:(id)inObject error:(NSError **)outError;
41 |
42 | - (NSData *)serializeNull:(NSNull *)inNull error:(NSError **)outError;
43 | - (NSData *)serializeNumber:(NSNumber *)inNumber error:(NSError **)outError;
44 | - (NSData *)serializeString:(NSString *)inString error:(NSError **)outError;
45 | - (NSData *)serializeArray:(NSArray *)inArray error:(NSError **)outError;
46 | - (NSData *)serializeDictionary:(NSDictionary *)inDictionary error:(NSError **)outError;
47 |
48 | @end
49 |
50 | typedef enum {
51 | CJSONSerializerErrorCouldNotSerializeDataType = -1,
52 | CJSONSerializerErrorCouldNotSerializeObject = -1
53 | } CJSONSerializerError;
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/TouchJSON/JSON/JSONRepresentation.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONRepresentation.h
3 | // TouchJSON
4 | //
5 | // Created by Jonathan Wight on 10/15/10.
6 | // Copyright 2010 toxicsoftware.com. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol JSONRepresentation
12 |
13 | @optional
14 | - (id)initWithJSONDataRepresentation:(NSData *)inJSONData;
15 |
16 | - (NSData *)JSONDataRepresentation;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCActionPageTurn3D.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2009 Sindesso Pty Ltd http://www.sindesso.com/
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import "CCActionGrid3D.h"
28 |
29 | /**
30 | * This action simulates a page turn from the bottom right hand corner of the screen
31 | * It's not much use by itself but is used by the PageTurnTransition.
32 | *
33 | * Based on an original paper by L Hong et al.
34 | * http://www.parc.com/publication/1638/turning-pages-of-3d-electronic-books.html
35 | *
36 | * @since v0.8.2
37 | */
38 | @interface CCPageTurn3D : CCGrid3DAction
39 | {
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCActionProgressTimer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (C) 2010 Lam Pham
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import
28 | #import "CCProgressTimer.h"
29 | #import "CCActionInterval.h"
30 |
31 | /**
32 | Progress to percentage
33 | @since v0.99.1
34 | */
35 | @interface CCProgressTo : CCActionInterval
36 | {
37 | float to_;
38 | float from_;
39 | }
40 | /** Creates and initializes with a duration and a percent */
41 | +(id) actionWithDuration:(ccTime)duration percent:(float)percent;
42 | /** Initializes with a duration and a percent */
43 | -(id) initWithDuration:(ccTime)duration percent:(float)percent;
44 | @end
45 |
46 | /**
47 | Progress from a percentage to another percentage
48 | @since v0.99.1
49 | */
50 | @interface CCProgressFromTo : CCActionInterval
51 | {
52 | float to_;
53 | float from_;
54 | }
55 | /** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */
56 | +(id) actionWithDuration:(ccTime)duration from:(float)fromPercentage to:(float) toPercentage;
57 | /** Initializes the action with a duration, a "from" percentage and a "to" percentage */
58 | -(id) initWithDuration:(ccTime)duration from:(float)fromPercentage to:(float) toPercentage;
59 | @end
60 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCActionTween.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright 2009 lhunath (Maarten Billemont)
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | #import "CCActionTween.h"
27 |
28 |
29 | @implementation CCActionTween
30 |
31 | + (id)actionWithDuration:(ccTime)aDuration key:(NSString *)aKey from:(float)aFrom to:(float)aTo {
32 |
33 | return [[[[self class] alloc] initWithDuration:aDuration key:aKey from:aFrom to:aTo] autorelease];
34 | }
35 |
36 | - (id)initWithDuration:(ccTime)aDuration key:(NSString *)key from:(float)from to:(float)to {
37 |
38 | if ((self = [super initWithDuration:aDuration])) {
39 |
40 | key_ = [key copy];
41 | to_ = to;
42 | from_ = from;
43 |
44 | }
45 |
46 | return self;
47 | }
48 |
49 | - (void) dealloc
50 | {
51 | [key_ release];
52 | [super dealloc];
53 | }
54 |
55 | - (void)startWithTarget:aTarget
56 | {
57 | [super startWithTarget:aTarget];
58 | delta_ = to_ - from_;
59 | }
60 |
61 | - (void) update:(ccTime) dt
62 | {
63 | [target_ setValue:[NSNumber numberWithFloat:to_ - delta_ * (1 - dt)] forKey:key_];
64 | }
65 |
66 | - (CCActionInterval *) reverse
67 | {
68 | return [[self class] actionWithDuration:duration_ key:key_ from:to_ to:from_];
69 | }
70 |
71 |
72 | @end
73 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCAnimationCache.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | #import
27 |
28 | @class CCAnimation;
29 |
30 | /** Singleton that manages the Animations.
31 | It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
32 |
33 | Before v0.99.5, the recommend way was to save them on the CCSprite. Since v0.99.5, you should use this class instead.
34 |
35 | @since v0.99.5
36 | */
37 | @interface CCAnimationCache : NSObject
38 | {
39 | NSMutableDictionary *animations_;
40 | }
41 |
42 | /** Retruns ths shared instance of the Animation cache */
43 | + (CCAnimationCache *) sharedAnimationCache;
44 |
45 | /** Purges the cache. It releases all the CCAnimation objects and the shared instance.
46 | */
47 | +(void)purgeSharedAnimationCache;
48 |
49 | /** Adds a CCAnimation with a name.
50 | */
51 | -(void) addAnimation:(CCAnimation*)animation name:(NSString*)name;
52 |
53 | /** Deletes a CCAnimation from the cache.
54 | */
55 | -(void) removeAnimationByName:(NSString*)name;
56 |
57 | /** Returns a CCAnimation that was previously added.
58 | If the name is not found it will return nil.
59 | You should retain the returned copy if you are going to use it.
60 | */
61 | -(CCAnimation*) animationByName:(NSString*)name;
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCBlockSupport.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Stuart Carnie
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import
28 |
29 | /** @file
30 | cocos2d blocks support
31 | */
32 |
33 | // To comply with Apple Objective C runtime (this is defined in NSObjCRuntime.h)
34 | #if !defined(NS_BLOCKS_AVAILABLE)
35 | #if __BLOCKS__
36 | #define NS_BLOCKS_AVAILABLE 1
37 | #else
38 | #define NS_BLOCKS_AVAILABLE 0
39 | #endif
40 | #endif
41 |
42 | #if NS_BLOCKS_AVAILABLE
43 |
44 | @interface NSObject(CCBlocksAdditions)
45 |
46 | - (void)ccCallbackBlock;
47 | - (void)ccCallbackBlockWithSender:(id)sender;
48 |
49 | @end
50 |
51 | #endif // NS_BLOCKS_AVAILABLE
52 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCBlockSupport.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Stuart Carnie
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import "CCBlockSupport.h"
28 |
29 | #if NS_BLOCKS_AVAILABLE
30 |
31 | @implementation NSObject(CCBlocksAdditions)
32 |
33 | - (void)ccCallbackBlock {
34 | void (^block)(void) = (id)self;
35 | block();
36 | }
37 |
38 | - (void)ccCallbackBlockWithSender:(id)sender {
39 | void (^block)(id) = (id)self;
40 | block(sender);
41 | }
42 |
43 |
44 | @end
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCGrabber.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2009 On-Core
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import "Platforms/CCGL.h"
28 | #import
29 |
30 | @class CCTexture2D;
31 |
32 | /** FBO class that grabs the the contents of the screen */
33 | @interface CCGrabber : NSObject
34 | {
35 | GLuint fbo;
36 | GLint oldFBO;
37 | }
38 |
39 | -(void)grab:(CCTexture2D*)texture;
40 | -(void)beforeRender:(CCTexture2D*)texture;
41 | -(void)afterRender:(CCTexture2D*)texture;
42 |
43 | @end
44 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCParallaxNode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2009-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | #import "CCNode.h"
27 | #import "Support/ccCArray.h"
28 |
29 | /** CCParallaxNode: A node that simulates a parallax scroller
30 |
31 | The children will be moved faster / slower than the parent according the the parallax ratio.
32 |
33 | */
34 | @interface CCParallaxNode : CCNode
35 | {
36 | ccArray *parallaxArray_;
37 | CGPoint lastPosition;
38 | }
39 |
40 | /** array that holds the offset / ratio of the children */
41 | @property (nonatomic,readwrite) ccArray * parallaxArray;
42 |
43 | /** Adds a child to the container with a z-order, a parallax ratio and a position offset
44 | It returns self, so you can chain several addChilds.
45 | @since v0.8
46 | */
47 | -(void) addChild: (CCNode*)node z:(NSInteger)z parallaxRatio:(CGPoint)c positionOffset:(CGPoint)positionOffset;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCParticleSystemPoint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import
28 | #import "CCParticleSystem.h"
29 |
30 | #define CC_MAX_PARTICLE_SIZE 64
31 |
32 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
33 |
34 | /** CCParticleSystemPoint is a subclass of CCParticleSystem
35 | Attributes of a Particle System:
36 | * All the attributes of Particle System
37 |
38 | Features:
39 | * consumes small memory: uses 1 vertex (x,y) per particle, no need to assign tex coordinates
40 | * size can't be bigger than 64
41 | * the system can't be scaled since the particles are rendered using GL_POINT_SPRITE
42 |
43 | Limitations:
44 | * On 3rd gen iPhone devices and iPads, this node performs MUCH slower than CCParticleSystemQuad.
45 | */
46 | @interface CCParticleSystemPoint : CCParticleSystem
47 | {
48 | // Array of (x,y,size)
49 | ccPointSprite *vertices;
50 | // vertices buffer id
51 | #if CC_USES_VBO
52 | GLuint verticesID;
53 | #endif
54 | }
55 | @end
56 |
57 | #elif __MAC_OS_X_VERSION_MAX_ALLOWED
58 |
59 | #import "CCParticleSystemQuad.h"
60 |
61 | @interface CCParticleSystemPoint : CCParticleSystemQuad
62 | @end
63 |
64 | #endif
65 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCScene.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import "CCNode.h"
28 |
29 | /** CCScene is a subclass of CCNode that is used only as an abstract concept.
30 |
31 | CCScene an CCNode are almost identical with the difference that CCScene has it's
32 | anchor point (by default) at the center of the screen.
33 |
34 | For the moment CCScene has no other logic than that, but in future releases it might have
35 | additional logic.
36 |
37 | It is a good practice to use and CCScene as the parent of all your nodes.
38 | */
39 | @interface CCScene : CCNode
40 | {
41 | }
42 | @end
43 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCScene.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import "CCScene.h"
28 | #import "Support/CGPointExtension.h"
29 | #import "CCDirector.h"
30 |
31 |
32 | @implementation CCScene
33 | -(id) init
34 | {
35 | if( (self=[super init]) ) {
36 | CGSize s = [[CCDirector sharedDirector] winSize];
37 | self.isRelativeAnchorPoint = NO;
38 | anchorPoint_ = ccp(0.5f, 0.5f);
39 | [self setContentSize:s];
40 | }
41 |
42 | return self;
43 | }
44 | @end
45 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCTMXObjectGroup.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Ricardo Quesada
5 | * Copyright (c) 2010 Neophit
6 | *
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy
8 | * of this software and associated documentation files (the "Software"), to deal
9 | * in the Software without restriction, including without limitation the rights
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | * copies of the Software, and to permit persons to whom the Software is
12 | * furnished to do so, subject to the following conditions:
13 | *
14 | * The above copyright notice and this permission notice shall be included in
15 | * all copies or substantial portions of the Software.
16 | *
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 | * THE SOFTWARE.
24 | *
25 | *
26 | * TMX Tiled Map support:
27 | * http://www.mapeditor.org
28 | *
29 | */
30 |
31 | #import "CCNode.h"
32 |
33 |
34 | @class CCTMXObjectGroup;
35 |
36 |
37 | /** CCTMXObjectGroup represents the TMX object group.
38 | @since v0.99.0
39 | */
40 | @interface CCTMXObjectGroup : NSObject
41 | {
42 | NSString *groupName_;
43 | CGPoint positionOffset_;
44 | NSMutableArray *objects_;
45 | NSMutableDictionary *properties_;
46 | }
47 |
48 | /** name of the group */
49 | @property (nonatomic,readwrite,retain) NSString *groupName;
50 | /** offset position of child objects */
51 | @property (nonatomic,readwrite,assign) CGPoint positionOffset;
52 | /** array of the objects */
53 | @property (nonatomic,readwrite,retain) NSMutableArray *objects;
54 | /** list of properties stored in a dictionary */
55 | @property (nonatomic,readwrite,retain) NSMutableDictionary *properties;
56 |
57 | /** return the value for the specific property name */
58 | -(id) propertyNamed:(NSString *)propertyName;
59 |
60 | /** return the dictionary for the specific object name.
61 | It will return the 1st object found on the array for the given name.
62 | */
63 | -(NSMutableDictionary*) objectNamed:(NSString *)objectName;
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/CCTransitionRadial.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2009 Lam Pham
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | #import "CCTransition.h"
27 | #import "CCProgressTimer.h"
28 | #import "CCActionProgressTimer.h"
29 |
30 | /** CCTransitionRadialCCW transition.
31 | A counter colock-wise radial transition to the next scene
32 | */
33 | @interface CCTransitionRadialCCW : CCTransitionScene
34 | @end
35 |
36 | /** CCTransitionRadialCW transition.
37 | A counter colock-wise radial transition to the next scene
38 | */
39 | @interface CCTransitionRadialCW : CCTransitionRadialCCW
40 | @end
41 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Platforms/Mac/MacWindow.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | // Only compile this code on Mac. These files should not be included on your iOS project.
26 | // But in case they are included, it won't be compiled.
27 | #import
28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
29 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
30 |
31 | #import
32 |
33 |
34 | @interface MacWindow : NSWindow
35 | {
36 | }
37 | - (id) initWithFrame:(NSRect)frame fullscreen:(BOOL)fullscreen;
38 |
39 | @end
40 |
41 |
42 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Platforms/Mac/MacWindow.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 | // Only compile this code on Mac. These files should not be included on your iOS project.
26 | // But in case they are included, it won't be compiled.
27 | #import
28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
29 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
30 |
31 | #import "MacWindow.h"
32 |
33 |
34 | @implementation MacWindow
35 |
36 | - (id) initWithFrame:(NSRect)frame fullscreen:(BOOL)fullscreen
37 | {
38 | int styleMask = fullscreen ? NSBackingStoreBuffered : ( NSTitledWindowMask | NSClosableWindowMask );
39 | self = [self initWithContentRect:frame
40 | styleMask:styleMask
41 | backing:NSBackingStoreBuffered
42 | defer:YES];
43 |
44 | if (self != nil)
45 | {
46 | if(fullscreen)
47 | {
48 | [self setLevel:NSMainMenuWindowLevel+1];
49 | [self setHidesOnDeactivate:YES];
50 | [self setHasShadow:NO];
51 | }
52 |
53 | [self setAcceptsMouseMovedEvents:NO];
54 | [self setOpaque:YES];
55 | }
56 | return self;
57 | }
58 |
59 | - (BOOL) canBecomeKeyWindow
60 | {
61 | return YES;
62 | }
63 |
64 | - (BOOL) canBecomeMainWindow
65 | {
66 | return YES;
67 | }
68 | @end
69 |
70 | #endif // __MAC_OS_X_VERSION_MAX_ALLOWED
71 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Platforms/iOS/ES1Renderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | *
25 | * File autogenerated with Xcode. Adapted for cocos2d needs.
26 | */
27 |
28 | // Only compile this code on iOS. These files should NOT be included on your Mac project.
29 | // But in case they are included, it won't be compiled.
30 | #import
31 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
32 |
33 |
34 | #import "ESRenderer.h"
35 |
36 | #import
37 | #import
38 |
39 | @interface ES1Renderer : NSObject
40 | {
41 | // The pixel dimensions of the CAEAGLLayer
42 | GLint backingWidth_;
43 | GLint backingHeight_;
44 |
45 | unsigned int samplesToUse_;
46 | BOOL multiSampling_;
47 |
48 | unsigned int depthFormat_;
49 | unsigned int pixelFormat_;
50 |
51 | // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view
52 | GLuint defaultFramebuffer_;
53 | GLuint colorRenderbuffer_;
54 | GLuint depthBuffer_;
55 |
56 |
57 | //buffers for MSAA
58 | GLuint msaaFramebuffer_;
59 | GLuint msaaColorbuffer_;
60 |
61 | EAGLContext *context_;
62 | }
63 |
64 | /** EAGLContext */
65 | @property (nonatomic,readonly) EAGLContext* context;
66 |
67 | - (BOOL)resizeFromLayer:(CAEAGLLayer *)layer;
68 |
69 | @end
70 |
71 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED
72 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Platforms/iOS/ESRenderer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | *
25 | * File autogenerated with Xcode. Adapted for cocos2d needs.
26 | */
27 |
28 | // Only compile this code on iOS. These files should NOT be included on your Mac project.
29 | // But in case they are included, it won't be compiled.
30 | #import
31 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
32 |
33 | #import
34 |
35 | #import
36 | #import
37 |
38 | @protocol ESRenderer
39 |
40 | - (id) initWithDepthFormat:(unsigned int)depthFormat withPixelFormat:(unsigned int)pixelFormat withSharegroup:(EAGLSharegroup*)sharegroup withMultiSampling:(BOOL) multiSampling withNumberOfSamples:(unsigned int) requestedSamples;
41 |
42 | - (BOOL) resizeFromLayer:(CAEAGLLayer *)layer;
43 |
44 | - (EAGLContext*) context;
45 | - (CGSize) backingSize;
46 |
47 | - (unsigned int) colorRenderBuffer;
48 | - (unsigned int) defaultFrameBuffer;
49 | - (unsigned int) msaaFrameBuffer;
50 | - (unsigned int) msaaColorBuffer;
51 | @end
52 |
53 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Platforms/iOS/glu.h:
--------------------------------------------------------------------------------
1 | //
2 | // cocos2d GLU implementation
3 | //
4 | // implementation of GLU functions
5 | //
6 | #ifndef __COCOS2D_GLU_H
7 | #define __COCOS2D_GLU_H
8 |
9 | // Only compile this code on iOS. These files should NOT be included on your Mac project.
10 | // But in case they are included, it won't be compiled.
11 | #import
12 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
13 |
14 | #import
15 |
16 | /**
17 | @file
18 | cocos2d OpenGL GLU implementation
19 | */
20 |
21 | /** OpenGL gluLookAt implementation */
22 | void gluLookAt(float eyeX, float eyeY, float eyeZ, float lookAtX, float lookAtY, float lookAtZ, float upX, float upY, float upZ);
23 | /** OpenGL gluPerspective implementation */
24 | void gluPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);
25 |
26 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED
27 |
28 | #endif /* __COCOS2D_GLU_H */
29 |
30 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/CCFileUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import
28 |
29 |
30 | /** Helper class to handle file operations */
31 | @interface CCFileUtils : NSObject
32 | {
33 | }
34 |
35 | /** Returns the fullpath of an filename.
36 |
37 | If this method is when Retina Display is enabled, then the
38 | Retina Display suffix will be appended to the file (See ccConfig.h).
39 |
40 | If the Retina Display image doesn't exist, then it will return the "non-Retina Display" image
41 |
42 | */
43 | +(NSString*) fullPathFromRelativePath:(NSString*) relPath;
44 | @end
45 |
46 | /** loads a file into memory.
47 | the caller should release the allocated buffer.
48 |
49 | @returns the size of the allocated buffer
50 | @since v0.99.5
51 | */
52 | NSInteger ccLoadFileIntoMemory(const char *filename, unsigned char **out);
53 |
54 |
55 | /** removes the HD suffix from a path
56 |
57 | @returns NSString * without the HD suffix
58 | @since v0.99.5
59 | */
60 | NSString *ccRemoveHDSuffixFromFile( NSString *path );
61 |
62 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/CCProfiling.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2010 Stuart Carnie
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import
28 | #import
29 |
30 | @class CCProfilingTimer;
31 |
32 | @interface CCProfiler : NSObject {
33 | NSMutableArray* activeTimers;
34 | }
35 |
36 | + (CCProfiler*)sharedProfiler;
37 | + (CCProfilingTimer*)timerWithName:(NSString*)timerName andInstance:(id)instance;
38 | + (void)releaseTimer:(CCProfilingTimer*)timer;
39 | - (void)displayTimers;
40 |
41 | @end
42 |
43 |
44 | @interface CCProfilingTimer : NSObject {
45 | NSString* name;
46 | struct timeval startTime;
47 | double averageTime;
48 | }
49 |
50 | @end
51 |
52 | extern void CCProfilingBeginTimingBlock(CCProfilingTimer* timer);
53 | extern void CCProfilingEndTimingBlock(CCProfilingTimer* timer);
54 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/TGAlib.h:
--------------------------------------------------------------------------------
1 | //
2 | // TGA lib for cocos2d-iphone
3 | //
4 | // sources from: http://www.lighthouse3d.com/opengl/terrain/index.php3?tgasource
5 | //
6 |
7 | //#ifndef TGA_LIB
8 | //#define TGA_LIB
9 |
10 | /**
11 | @file
12 | TGA image support
13 | */
14 |
15 | enum {
16 | TGA_OK,
17 | TGA_ERROR_FILE_OPEN,
18 | TGA_ERROR_READING_FILE,
19 | TGA_ERROR_INDEXED_COLOR,
20 | TGA_ERROR_MEMORY,
21 | TGA_ERROR_COMPRESSED_FILE,
22 | };
23 |
24 | /** TGA format */
25 | typedef struct sImageTGA {
26 | int status;
27 | unsigned char type, pixelDepth;
28 |
29 | /** map width */
30 | short int width;
31 |
32 | /** map height */
33 | short int height;
34 |
35 | /** raw data */
36 | unsigned char *imageData;
37 | int flipped;
38 | } tImageTGA;
39 |
40 | /// load the image header fields. We only keep those that matter!
41 | void tgaLoadHeader(FILE *file, tImageTGA *info);
42 |
43 | /// loads the image pixels. You shouldn't call this function directly
44 | void tgaLoadImageData(FILE *file, tImageTGA *info);
45 |
46 | /// this is the function to call when we want to load an image
47 | tImageTGA * tgaLoad(const char *filename);
48 |
49 | // /converts RGB to greyscale
50 | void tgaRGBtogreyscale(tImageTGA *info);
51 |
52 | /// releases the memory used for the image
53 | void tgaDestroy(tImageTGA *info);
54 |
55 | //#endif // TGA_LIB
56 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/TransformUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2009 Valentin Milea
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 | #import
27 |
28 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
29 | #import
30 | #import
31 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
32 | #import
33 | #import
34 | #endif
35 |
36 | void CGAffineToGL(const CGAffineTransform *t, GLfloat *m);
37 | void GLToCGAffine(const GLfloat *m, CGAffineTransform *t);
38 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/TransformUtils.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2009 Valentin Milea
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import "TransformUtils.h"
28 |
29 | void CGAffineToGL(const CGAffineTransform *t, GLfloat *m)
30 | {
31 | // | m[0] m[4] m[8] m[12] | | m11 m21 m31 m41 | | a c 0 tx |
32 | // | m[1] m[5] m[9] m[13] | | m12 m22 m32 m42 | | b d 0 ty |
33 | // | m[2] m[6] m[10] m[14] | <=> | m13 m23 m33 m43 | <=> | 0 0 1 0 |
34 | // | m[3] m[7] m[11] m[15] | | m14 m24 m34 m44 | | 0 0 0 1 |
35 |
36 | m[2] = m[3] = m[6] = m[7] = m[8] = m[9] = m[11] = m[14] = 0.0f;
37 | m[10] = m[15] = 1.0f;
38 | m[0] = t->a; m[4] = t->c; m[12] = t->tx;
39 | m[1] = t->b; m[5] = t->d; m[13] = t->ty;
40 | }
41 |
42 | void GLToCGAffine(const GLfloat *m, CGAffineTransform *t)
43 | {
44 | t->a = m[0]; t->c = m[4]; t->tx = m[12];
45 | t->b = m[1]; t->d = m[5]; t->ty = m[13];
46 | }
47 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/ZipUtils.h:
--------------------------------------------------------------------------------
1 | /* cocos2d for iPhone
2 | *
3 | * http://www.cocos2d-iphone.org
4 | *
5 | *
6 | * inflateMemory_ based on zlib example code
7 | * http://www.zlib.net
8 | *
9 | * Some ideas were taken from:
10 | * http://themanaworld.org/
11 | * from the mapreader.cpp file
12 | *
13 | */
14 |
15 | #ifndef __CC_ZIP_UTILS_H
16 | #define __CC_ZIP_UTILS_H
17 |
18 | #import
19 |
20 | #ifdef __cplusplus
21 | extern "C" {
22 | #endif
23 |
24 | /* XXX: pragma pack ??? */
25 | /** @struct CCZHeader
26 | */
27 | struct CCZHeader {
28 | uint8_t sig[4]; // signature. Should be 'CCZ!' 4 bytes
29 | uint16_t compression_type; // should 0
30 | uint16_t version; // should be 2 (although version type==1 is also supported)
31 | uint32_t reserved; // Reserverd for users.
32 | uint32_t len; // size of the uncompressed file
33 | };
34 |
35 | enum {
36 | CCZ_COMPRESSION_ZLIB, // zlib format.
37 | CCZ_COMPRESSION_BZIP2, // bzip2 format (not supported yet)
38 | CCZ_COMPRESSION_GZIP, // gzip format (not supported yet)
39 | CCZ_COMPRESSION_NONE, // plain (not supported yet)
40 | };
41 |
42 | /** @file
43 | * Zip helper functions
44 | */
45 |
46 | /**
47 | * Inflates either zlib or gzip deflated memory. The inflated memory is
48 | * expected to be freed by the caller.
49 | *
50 | * @returns the length of the deflated buffer
51 | *
52 | @since v0.8.1
53 | */
54 | int ccInflateMemory(unsigned char *in, unsigned int inLength, unsigned char **out);
55 |
56 |
57 | /** inflates a GZip file into memory
58 | *
59 | * @returns the length of the deflated buffer
60 | *
61 | * @since v0.99.5
62 | */
63 | int ccInflateGZipFile(const char *filename, unsigned char **out);
64 |
65 | /** inflates a CCZ file into memory
66 | *
67 | * @returns the length of the deflated buffer
68 | *
69 | * @since v0.99.5
70 | */
71 | int ccInflateCCZFile(const char *filename, unsigned char **out);
72 |
73 |
74 | #ifdef __cplusplus
75 | }
76 | #endif
77 |
78 | #endif // __CC_ZIP_UTILS_H
79 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/base64.c:
--------------------------------------------------------------------------------
1 | /*
2 | public domain BASE64 code
3 |
4 | modified for cocos2d-iphone: http://www.cocos2d-iphone.org
5 | */
6 |
7 | #include
8 | #include
9 |
10 | unsigned char alphabet[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
11 |
12 | int _base64Decode( unsigned char *input, unsigned int input_len, unsigned char *output, unsigned int *output_len )
13 | {
14 | static char inalphabet[256], decoder[256];
15 | int i, bits, c, char_count, errors = 0;
16 | unsigned int input_idx = 0;
17 | unsigned int output_idx = 0;
18 |
19 | for (i = (sizeof alphabet) - 1; i >= 0 ; i--) {
20 | inalphabet[alphabet[i]] = 1;
21 | decoder[alphabet[i]] = i;
22 | }
23 |
24 | char_count = 0;
25 | bits = 0;
26 | for( input_idx=0; input_idx < input_len ; input_idx++ ) {
27 | c = input[ input_idx ];
28 | if (c == '=')
29 | break;
30 | if (c > 255 || ! inalphabet[c])
31 | continue;
32 | bits += decoder[c];
33 | char_count++;
34 | if (char_count == 4) {
35 | output[ output_idx++ ] = (bits >> 16);
36 | output[ output_idx++ ] = ((bits >> 8) & 0xff);
37 | output[ output_idx++ ] = ( bits & 0xff);
38 | bits = 0;
39 | char_count = 0;
40 | } else {
41 | bits <<= 6;
42 | }
43 | }
44 |
45 | if( c == '=' ) {
46 | switch (char_count) {
47 | case 1:
48 | fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing");
49 | errors++;
50 | break;
51 | case 2:
52 | output[ output_idx++ ] = ( bits >> 10 );
53 | break;
54 | case 3:
55 | output[ output_idx++ ] = ( bits >> 16 );
56 | output[ output_idx++ ] = (( bits >> 8 ) & 0xff);
57 | break;
58 | }
59 | } else if ( input_idx < input_len ) {
60 | if (char_count) {
61 | fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated",
62 | ((4 - char_count) * 6));
63 | errors++;
64 | }
65 | }
66 |
67 | *output_len = output_idx;
68 | return errors;
69 | }
70 |
71 | int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out)
72 | {
73 | unsigned int outLength = 0;
74 |
75 | //should be enough to store 6-bit buffers in 8-bit buffers
76 | *out = malloc( inLength * 3.0f / 4.0f + 1 );
77 | if( *out ) {
78 | int ret = _base64Decode(in, inLength, *out, &outLength);
79 |
80 | if (ret > 0 )
81 | {
82 | printf("Base64Utils: error decoding");
83 | free(*out);
84 | *out = NULL;
85 | outLength = 0;
86 | }
87 | }
88 | return outLength;
89 | }
90 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/base64.h:
--------------------------------------------------------------------------------
1 | /*
2 | public domain BASE64 code
3 |
4 | modified for cocos2d-iphone: http://www.cocos2d-iphone.org
5 | */
6 |
7 | #ifndef __CC_BASE64_DECODE_H
8 | #define __CC_BASE64_DECODE_H
9 |
10 | #ifdef __cplusplus
11 | extern "C" {
12 | #endif
13 |
14 |
15 | /** @file
16 | base64 helper functions
17 | */
18 |
19 | /**
20 | * Decodes a 64base encoded memory. The decoded memory is
21 | * expected to be freed by the caller.
22 | *
23 | * @returns the length of the out buffer
24 | *
25 | @since v0.8.1
26 | */
27 | int base64Decode(unsigned char *in, unsigned int inLength, unsigned char **out);
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif // __CC_BASE64_DECODE_H
34 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/ccUtils.c:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | */
5 |
6 | /*
7 | ccNextPOT function is licensed under the same license that is used in CCTexture2D.m.
8 | */
9 | #include "ccUtils.h"
10 |
11 | unsigned long ccNextPOT(unsigned long x)
12 | {
13 | x = x - 1;
14 | x = x | (x >> 1);
15 | x = x | (x >> 2);
16 | x = x | (x >> 4);
17 | x = x | (x >> 8);
18 | x = x | (x >>16);
19 | return x + 1;
20 | }
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/Support/ccUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | */
5 |
6 | #ifndef __CC_UTILS_H
7 | #define __CC_UTILS_H
8 |
9 | /** @file ccUtils.h
10 | Misc free functions
11 | */
12 |
13 | /*
14 | ccNextPOT function is licensed under the same license that is used in CCTexture2D.m.
15 | */
16 |
17 | /** returns the Next Power of Two value.
18 |
19 | Examples:
20 | - If "value" is 15, it will return 16.
21 | - If "value" is 16, it will return 16.
22 | - If "value" is 17, it will return 32.
23 |
24 | @since v0.99.5
25 | */
26 |
27 | unsigned long ccNextPOT( unsigned long value );
28 |
29 | #endif // ! __CC_UTILS_H
30 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocos2d/cocos2d.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | */
24 |
25 |
26 | #import
27 |
28 | static NSString *version = @"cocos2d v1.0.0-rc";
29 |
30 | NSString *cocos2dVersion()
31 | {
32 | return version;
33 | }
34 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocoslive/cocoslive.h:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 |
28 | // 0x00 HI ME LO
29 | // 00 00 03 02
30 | #define COCOSLIVE_VERSION 0x00000302
31 |
32 | // to use localserver. DEBUG ONLY
33 | //#define USE_LOCAL_SERVER 1
34 |
35 | // all cocos live include files
36 | //
37 | #import "CLScoreServerPost.h"
38 | #import "CLScoreServerRequest.h"
39 |
40 |
41 | // free functions
42 | NSString * cocos2dVersion(void);
43 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/libs/cocoslive/cocoslive.m:
--------------------------------------------------------------------------------
1 | /*
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org
3 | *
4 | * Copyright (c) 2008-2010 Ricardo Quesada
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | *
24 | */
25 |
26 |
27 | #import
28 |
29 | static NSString *version = @"cocoslive v0.3.2";
30 |
31 | NSString *cocosLiveVersion()
32 | {
33 | return version;
34 | }
35 |
--------------------------------------------------------------------------------
/box2dcocos2dexamples/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // Box2DCocos2DExamples
4 | //
5 | // Created by Yannick LORIOT on 20/05/11.
6 | // Copyright Yannick Loriot 2011. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | int main(int argc, char *argv[])
12 | {
13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
14 | int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
15 | [pool release];
16 | return retVal;
17 | }
18 |
--------------------------------------------------------------------------------