Created
July 21, 2011 22:02
-
-
Save alexyork/1098344 to your computer and use it in GitHub Desktop.
Compiler directives v IoC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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