[MonoTouch] GLSprites Sample

Christian Beaumont chris at foundation42.org
Wed Aug 12 05:02:43 EDT 2009


Oh and by the way... MonoTouch Rocks!!!

-chris

On Wed, Aug 12, 2009 at 1:53 AM, Christian Beaumont
<chris at foundation42.org>wrote:

> Hey,
>
> Phew!  I finally got my sprite sample to the point where I can share it.
> Sorry for the delay but I ran into a nasty problem where the application
> would terminate abruptly after just a few seconds.  After hours and hours of
> tedious fiddling I have narrowed it down to what seems like a field layout
> issue or something related in MonoTouch.
>
> Specifically, if you open Main.cs you will see a bunch of member variables
> at the top of the class.  I've set up a preprocessor conditional that lets
> you order them two different ways around.  The default works but if you use
> the other layout the application crashes after a few seconds running (I
> assume at the point of the first garbage collect).   Hopefully the sample is
> of some use in tracking this down.  It could be my fault (the app uses some
> native buffers and unsafe code) but I doubt it because I've been through the
> code with a fine tooth comb.  Also, it works fine on the simulator and in my
> windows version.
>
> Anyway, on to the application - get it here...
>
> http://chrisbe.s3.amazonaws.com/GLSprites.zip
>
> The application spawns a bunch of particles at startup and more when you
> tap or drag your finger over the display.  If you *double-tap the display
> it toggles particle trails on and off*.  The big particles rotate and
> bounce off the floor.  When the big particles die they send off secondary
> "sparks".
>
> I only have access to the iPhone 3G at the moment.  If someone could try it
> on a 3GS that would be super.  I'd love to know how long the startup time is
> and if it seems snappier than on the 3G.
>
> In the code you will find a reusable SpriteManager and ParticleManager that
> I hope people find useful.  It's pretty simple to use and provides something
> like a C API for adding sprites and particles.  If you take a look at the
> code in MyParticleSystem.cs you'll see how new sprites/particles are
> allocated.
>
> Also, you will notice it is a MonoDevelop application and shows setting up
> a startup image "Default.png" and disabling the status bar with an
> Info.plist (Thanks Simon/Hutch for help with that).
>
> If you have any interest in reusing the core sprite/particle code I only
> ask that you leave the license headers in-tact and provide credits since
> I've worked pretty hard on it.  Apart from that, please feel free to use it
> as you wish in commercial or non-commercial projects. I also have the sprite
> animation code and sprite based text rendering code that goes with it but
> I've decided that I'd rather not give that away at the moment.
>
> If this can go in the stock MonoTouch samples at some point I'd be over the
> moon :)
>
> Any feedback, good or bad - send it my way.
>
> cheers and enjoy,
> -chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monotouch/attachments/20090812/209064c2/attachment.html 


More information about the MonoTouch mailing list