CocosSharp is an easy to use library for simple games using C# and F#. It is a .NET port of the popular Cocos2D engine, derived from the Cocos2D-X engine via Cocos2D-XNA.
This library is MIT licensed.
Xamarin is hosting forums for CocosSharp here:
To learn more, see the https://github.com/mono/CocosSharp/wiki
This project is open source, freely available, and free of royalties or encumberance. The software is released under the highly permissive MIT License.
When you first check out, run
git clone --recursive email@example.com:xamarin/CocosSharp
so you will have all the submodules checked out for you.
With existing checkouts, run
git submodule update --init --recursive
to make sure you get the latest changes in the submodules. Repos that were checked out recursively will do this automatically, but it doesn't hurt to run this manually.
To pull external changes into a submodule
cd <submodule> git pull origin <branch> cd <top-level>; git add <submodule> git commit
To make changes in a submodule
- By default, submodules are detached because they point to a specific commit. Use git-checkout to put yourself back on a branch.
git checkout <branch>
work as normal, the submodule is a normal repo
git commit/push new changes to the repo (submodule) cd <top-level>; git add <submodule> # this will record the new commits to CocosSharp MonoGame submodule git commit
To switch the repo of a submodule
edit '.gitmodules' to point to the new location
git submodule sync -- <path of the submodule> # updates .git/config
- I think this will checkout from the new location, internally. It may take a while for big repos.
git submodule update --recursive git checkout <desired new hash> # This changes the pointer of the submodule
The desired output diff is a change in .gitmodule to reflect the change in the remote URL, and a change in / where you see the desired change in the commit hash
You now have everything you need to start start developing with CocosSharp
Solutions & Projects - MonoGame
After clone you will need to generate the MonoGame projects.
The solution and project files are generated by Protobuild when you double-click
Protobuild.exe on Windows from or run
mono Protobuild.exe under Mac OS or Linux.
Note: that the previous needs to be done in the MonoGame directory.
To modify the projects you must edit the .definition file in the
Build/Projects/ folder and re-execute Protobuild.
For more information and advanced usage, please refer to the Protobuild wiki.
We have created solutions for all the supported platforms that serves as our TestBed for each platform.
You can find those in the tests directory
CocosSharp.Tests.Android.sln CocosSharp.Tests.Windows.sln CocosSharp.Tests.Windows8.sln CocosSharp.Tests.WindowsDX.sln CocosSharp.Tests.WindowsGL.sln CocosSharp.Tests.WindowsPhone.sln CocosSharp.Tests.WindowsPhone7.sln CocosSharp.Tests.iOS.sln CocosSharp.Tests.MacOS.sln
As the saying goes "A picture is worth a thousand words" well sample code can be just as effective.
So to get started we have placed a number of samples here: Samples
There is a special case for Xamarin iOS MonoTouch running on the simulator where they aggressively call garbage collection themselves. This should not affect the devices though. On the Simulator the GC label will always be 0 (zero)
This project is a fork of the Cocos2D-XNA project, which is a port of the C++-based Cocos2D-X API, which in turn is a cross-platform port of the cocos2d-iphone project.
The focus of this fork is to create a library that is idiomatically correct for C# and remove many of the historical warts inherited from the straight ports from C++ and Objective-C.