Xamarin.iOS, the garbage collector and me

A lot has been written about the Garbage Collector and Xamarin.iOS. Lately, I’ve been hit by some surprises and I want to share my findings. Let me say that there is not a single bug involved! All the issues I describe are either documented or show standard behavior of the .NET runtime. The fact that Xamarin.iOS lives on top of a reference counted world makes things a bit more difficult.

Many thanks to Rolf Bjarne Kvinge for his patience, Marek Safar for sharing the secrets of Mono compiler with me, Rodrigo Moya for helping me with the Xamarin Profiler, James Clancey for his drawings about native reference cycles :-) and Chris van Wyk for supporting me in these moments of “good god, this cannot be!”

Continue reading

Adding async/await to CocosSharp actions

UPDATE: The CocosSharp team has decided to integrate my ideas directly into their source! :-)

Are you a C# programmer? Using Xamarin? Are you interested in making great games that run…

  • cross platform,
  • from one code base
  • and are powered by Cocos2D and XNA?

If yes, then you should check out CocosSharp!

I used Cocos2D in the past (the “good” old days of ObjectiveC…) and liked it a lot. Seeing all this translated to C# just freaks me out! :-)

However there has been one thing that bugged me: chaining actions and running actions simultaneously.

Say, you want your character to scale, then increase some score counter, afterwards make the character jump and then reset the animation phase to the default frame. You would use something like:

var scale = new CCScaleBy (1f, 1.5f);
var jump = new CCJumpBy (1f, new CCPoint (100, 100), 50, 2);

this.RunActions (scale, new CCCallFunc (() => this.UpdateScore ()), jump, new CCCallFunc(() => this.SpriteFrame = this.defaultFrame));

Works, but with the power of C# we can do better!

Continue reading

Fix too small iOS Simulator on Retina Macs

Recently I received my MacBook Pro. It’s the 13″ model with Retina Display. I run it in the 1680×1050 HiDPI mode to get more content on the screen (I use the nice little tool called QuickRes to conveniently switch resolutions).

Before I had the MacBook Pro I was working on a MacBook Air with significantly lower resolution and when testing my iOS apps in the Simulator, I had to scale the Simulator down to fit on my screen. This can easily be done by pressing CMD+1 (100%), CMD+2 (75%) and CMD+3 (50%) or via the Window -> Scale options.

Now with the MacBook Pro it is the other way round: an iPhone 5 is simply too small even at 100%. See the screenshot below.

Continue reading

Migrating from Parallels Desktop 10 to VMware Fusion 7: Android SDK broken, WP Emulator not working

Recently I switched my Parallels Desktop 10 VM setup to VMware’s Fusion 7. I had various (random) problems with Parallels Desktop 10 and decided to give Fusion a try. The result: Fusion 7 does not support all the fancy DirectX 10 support, but for a virtual Windows 8.1 development machine on my Mac, it is the better choice.

Migrating over was easy: I simply imported the PD10 virtual hard disk. In 30 minutes it was converted over into Fusion’s format and started up just fine. Everything worked pretty well but then I found a view things I had to adjust.

Continue reading

Upgrading my mid 2011 iMac (27″) with an SSD

Back in early 2012 I banned the last PC from my home and bought an iMac:

Bildschirmfoto 2014-11-09 um 19.25.35

It had the fastest processor back then and I upgraded it to a total of 24GB of RAM (it was shipped with 2x2GB – I chose the minimum config because RAM is so much cheaper if you buy it from Amazon). The only thing I did not buy, was an SSD. The price would have been an additional €600 and that would have pushed it towards the €3000 barrier. Too much. So I ended up with a 2TB hard drive, spinning at 7200rpm.

The machine was (and still is!) powerful enough to do al the work I demand from it. But at some point I installed Windows 8 in a Virtual Machine (running Parallels 10 meanwhile) and the HDD became more and more of a bottleneck. If Mac OS wasn’t accessing the disk, Windows surely was. The rumbling sound of an HDD being accessed became my constant company.

So I thought about buying a new Mac – but what for? Just to get an SSD? I mean the new 5K iMac is great but mine is still powerful enough. Too much money. Next, I talked to Gravis about adding a Fusion Drive. They asked for €450; that would include a Samsung 840 Evo SSD with 250GB, installation, configuration, backup and restore of the current system. They also would allow me to keep the Superdrive. The SSD would be an additional device, hidden somewhere inside the iMac. When I saw the price for the SSD alone at Amazon I thought: €120 – can’t I just buy it there and install it myself? I started googling about installation guides and opinions about Fusion Drives vs. pure SSDs. Finally I decided:

  1. It cannot be too hard to install an SSD
  2. I do not want a Fusion Drive but rather put the OS on the SSD and large data (Aperture library e.g.) on the HDD for maximum performance.
  3. I can sacrifice my Superdrive

I want to share my experience because it is actually really easy to install an SSD into the mid 2011 iMac! If you have ever assembled together a PC, you will be able to do it, believe me! The whole procedure took me 40 minutes.

Please be aware that I won’t be responsible for any damage!

Continue reading

Mac OS X is beautiful, but the Terminal UI and UX hurts – let’s fix it!

There are times when one has to drop back to the command line. But the default Terminal window on Mac OS is small, black and white and forces me to think about case sensitivity. Let’s make the Terminal window a bit more beautiful! I want mine to look like this:

  • Ocean Blue Theme
  • Some transparency
  • Not case sensitive
  • Nicely formatted folder listings
Terminal Window

Terminal Window

Continue reading