Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GraphicsContentHelper.cs
Go to the documentation of this file.
1
using
Microsoft.Xna.Framework.Content;
2
3
namespace
Microsoft.Xna.Framework.Graphics
;
4
5
internal
static
class
GraphicsContentHelper
6
{
7
internal
static
GraphicsDevice
GraphicsDeviceFromContentReader
(ContentReader contentReader)
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
}
27
28
private
static
bool
IsProfileCompatible
(
GraphicsProfile
deviceProfile,
GraphicsProfile
contentProfile)
29
{
30
switch
(deviceProfile)
31
{
32
case
GraphicsProfile
.Reach:
33
return
contentProfile ==
GraphicsProfile
.Reach;
34
case
GraphicsProfile
.HiDef:
35
if
(contentProfile != 0)
36
{
37
return
contentProfile ==
GraphicsProfile
.HiDef;
38
}
39
return
true
;
40
default
:
41
return
false
;
42
}
43
}
44
}
Microsoft.Xna.Framework.FrameworkResources.NoGraphicsDeviceContent
static string NoGraphicsDeviceContent
Definition
FrameworkResources.cs:379
Microsoft.Xna.Framework.FrameworkResources.BadXnbGraphicsProfile
static string BadXnbGraphicsProfile
Definition
FrameworkResources.cs:59
Microsoft.Xna.Framework.FrameworkResources
Definition
FrameworkResources.cs:15
Microsoft.Xna.Framework.Graphics.GraphicsContentHelper.IsProfileCompatible
static bool IsProfileCompatible(GraphicsProfile deviceProfile, GraphicsProfile contentProfile)
Definition
GraphicsContentHelper.cs:28
Microsoft.Xna.Framework.Graphics.GraphicsContentHelper.GraphicsDeviceFromContentReader
static GraphicsDevice GraphicsDeviceFromContentReader(ContentReader contentReader)
Definition
GraphicsContentHelper.cs:7
Microsoft.Xna.Framework.Graphics.GraphicsContentHelper
Definition
GraphicsContentHelper.cs:6
Microsoft.Xna.Framework.Graphics.GraphicsDevice.GraphicsProfile
GraphicsProfile GraphicsProfile
Definition
GraphicsDevice.cs:363
Microsoft.Xna.Framework.Graphics.GraphicsDevice
Definition
GraphicsDevice.cs:13
Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService.GraphicsDevice
GraphicsDevice GraphicsDevice
Definition
IGraphicsDeviceService.cs:8
Microsoft.Xna.Framework.Graphics.IGraphicsDeviceService
Definition
IGraphicsDeviceService.cs:7
Microsoft.Xna.Framework.Graphics.GraphicsProfile
GraphicsProfile
Definition
GraphicsProfile.cs:4
Microsoft.Xna.Framework.Graphics
Definition
AlphaTestEffect.cs:1
source
Microsoft.Xna.Framework.Graphics
GraphicsContentHelper.cs
Generated by
1.10.0