Created
July 15, 2011 23:51
-
-
Save CartBlanche/1085798 to your computer and use it in GitHub Desktop.
Default Pths
This file contains hidden or 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
protected virtual void LoadContent() | |
{ | |
var model = UIDevice.CurrentDevice.Model; | |
string suffix = ""; | |
if ( model.ToLower().Contains("iphone") ) | |
{ | |
suffix = "~iphone"; | |
} | |
else if ( model.ToLower().Contains("ipad") ) | |
{ | |
suffix = "~ipad"; | |
} | |
string DefaultPath = string.Format("Default{0}.png", suffix); | |
bool filefound = false; | |
if (File.Exists(DefaultPath)) | |
{ | |
filefound = true; | |
} | |
else if (File.Exists("Default.png")) | |
{ | |
DefaultPath = "Default.png"; | |
filefound = true; | |
} | |
if (filefound) | |
{ | |
// Store the RootDir for later | |
string backup = Content.RootDirectory; | |
try | |
{ | |
// Clear the RootDirectory for this operation | |
Content.RootDirectory = string.Empty; | |
spriteBatch = new SpriteBatch(GraphicsDevice); | |
splashScreen = Content.Load<Texture2D>(DefaultPath); | |
} | |
finally | |
{ | |
// Reset RootDir | |
Content.RootDirectory = backup; | |
} | |
} | |
else | |
{ | |
spriteBatch = null; | |
splashScreen = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment