Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GraphicsDeviceFromContentReader()

static GraphicsDevice Microsoft.Xna.Framework.Graphics.GraphicsContentHelper.GraphicsDeviceFromContentReader ( ContentReader contentReader)
inlinestaticpackage

Definition at line 7 of file GraphicsContentHelper.cs.

8 {
9 IGraphicsDeviceService graphicsDeviceService = (IGraphicsDeviceService)contentReader.ContentManager.ServiceProvider.GetService(typeof(IGraphicsDeviceService));
10 if (graphicsDeviceService == null)
11 {
12 throw contentReader.CreateContentLoadException(FrameworkResources.NoGraphicsDeviceContent);
13 }
14 GraphicsDevice graphicsDevice = graphicsDeviceService.GraphicsDevice;
15 if (graphicsDevice == null)
16 {
17 throw contentReader.CreateContentLoadException(FrameworkResources.NoGraphicsDeviceContent);
18 }
19 GraphicsProfile graphicsProfile = graphicsDevice.GraphicsProfile;
20 GraphicsProfile graphicsProfile2 = (GraphicsProfile)contentReader.graphicsProfile;
21 if (!IsProfileCompatible(graphicsProfile, graphicsProfile2))
22 {
23 throw contentReader.CreateContentLoadException(FrameworkResources.BadXnbGraphicsProfile, graphicsProfile2, graphicsProfile);
24 }
25 return graphicsDevice;
26 }
static bool IsProfileCompatible(GraphicsProfile deviceProfile, GraphicsProfile contentProfile)

References Microsoft.Xna.Framework.FrameworkResources.BadXnbGraphicsProfile, Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.GraphicsDevice, Microsoft.Xna.Framework.Graphics.GraphicsDevice.GraphicsProfile, Microsoft.Xna.Framework.Graphics.GraphicsContentHelper.IsProfileCompatible(), and Microsoft.Xna.Framework.FrameworkResources.NoGraphicsDeviceContent.