Skip to content

Instantly share code, notes, and snippets.

@alexyork
Created July 21, 2011 22:02
Show Gist options
  • Save alexyork/1098344 to your computer and use it in GitHub Desktop.
Save alexyork/1098344 to your computer and use it in GitHub Desktop.
Compiler directives v IoC
// With compiler directives
public class SpaceInvadersGame
{
private Vector2 screenRes;
public SpaceInvadersGame()
{
#if WINDOWS_PHONE
screenRes = new Vector2(800,480);
#endif
#if MONOTOUCH
screenRes = new Vector2(1280,720);
#endif
}
}
// With IoC
public class SpaceInvadersGame
{
private Vector2 screenRes;
public SpaceInvadersGame(Vector2 screenRes)
{
this.screenRes = screenRes;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment