My First Mac-Ported C# App

by Jon Davis 17. May 2008 22:10

Here's a screenie of my little GDI+ (System.Drawing) based game engine ported to the Mac using MonoDevelop. The sandbox "game" instance is just some bouncing balls that collide against the walls, the rectangular blocks, and each other, with fairly realistic physics, emitting dual-light draw drop-shadows, etc. In Windows, DirectSound is also used to create stereo "bump" sound effects that make the bumping balls feel a little more realistic.

Wow, this only took about ten minutes, from "I wonder if .." to "wow, look at that, it's working!" My steps:

  • Add my home Subversion server as a SCM repostitory in MonoDevelop
  • Check out my game engine (called "Level1Engine") to ~/Documents/dev/Level1Engine
  • Watch MonoDevelop puke on the absolute UNC path of one of the project references
    • Manually add the missing .csproj file to the solution
      • MonoDevelop exits unexpectedly
    • Reopen MonoDevelop, reopen solution
    • Create a new project with the same name/directory as the broken project
    • Remove the generated sample .cs file
    • Add the existing .cs files to the project, in-place
  • Comment out the DirectSound references from the game engine class library. (Sadly, that means there's no sound yet.)
  • Let 'er rip

Overall, this blog post took me about twice as long as porting my app!

The result is not flawless, though. Rendering performance is about 1/3 what it is in GDI+ (in Windows), and apparently the 2D matrix transformations (which I had to touch for the drop shadows) are a little buggy in Mono because that text on the top left, which is rendered with System.Drawing, jiggles around erratically by about two pixels.  

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Pet Projects | Software Development | Mac OS X

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading




 

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

Jon Davis (aka "stimpy77") has been a programmer, developer, and consultant for web and Windows software solutions professionally since 1997, with experience ranging from OS and hardware support to DHTML programming to IIS/ASP web apps to Java network programming to Visual Basic applications to C# desktop apps.
 
Software in all forms is also his sole hobby, whether playing PC games or tinkering with programming them. "I was playing Defender on the Commodore 64," he reminisces, "when I decided at the age of 12 or so that I want to be a computer programmer when I grow up."

Jon was previously employed as a senior .NET developer at a very well-known Internet services company whom you're more likely than not to have directly done business with. However, this blog and all of jondavis.net have no affiliation with, and are not representative of, his former employer in any way.

Contact Me 


Tag cloud

Calendar

<<  October 2020  >>
MoTuWeThFrSaSu
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar