本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.PresentationParameters类的典型用法代码示例。如果您正苦于以下问题:C# PresentationParameters类的具体用法?C# PresentationParameters怎么用?C# PresentationParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PresentationParameters类属于Microsoft.Xna.Framework.Graphics命名空间,在下文中一共展示了PresentationParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateDevice
private void CreateDevice(IntPtr windowHandle, int width, int height)
{
try
{
parameters = new PresentationParameters();
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.BackBufferFormat = SurfaceFormat.Color;
parameters.DepthStencilFormat = DepthFormat.Depth24;
parameters.DeviceWindowHandle = windowHandle;
parameters.PresentationInterval = PresentInterval.Immediate;
parameters.IsFullScreen = false;
graphicsDevice = new GraphicsDevice(
GraphicsAdapter.DefaultAdapter,
GraphicsProfile.Reach,
parameters);
if (DeviceCreated != null)
DeviceCreated(this, EventArgs.Empty);
}
catch (Exception ex)
{
throw new ApplicationException("Failed to initialize GraphicsDeviceService. See inner exception for details.", ex);
}
}
开发者ID:liquidradio,项目名称:Terraria-Map-Editor,代码行数:28,代码来源:GraphicsDeviceService.cs
示例2: GraphicsDeviceService
public GraphicsDeviceService(IntPtr windowHandle)
{
var screenBounds = System.Windows.Forms.Screen.FromHandle(windowHandle).Bounds;
_parameters = new PresentationParameters
{
BackBufferWidth = screenBounds.Width,
BackBufferHeight = screenBounds.Height,
BackBufferFormat = SurfaceFormat.Color,
DepthStencilFormat = DepthFormat.Depth24,
DeviceWindowHandle = windowHandle,
IsFullScreen = false,
PresentationInterval = PresentInterval.Immediate,
};
var profilingAdapter = GraphicsAdapter.Adapters.FirstOrDefault(a => a.Description.Contains("PerfHUD"));
var useAdapter = profilingAdapter ?? GraphicsAdapter.DefaultAdapter;
if (profilingAdapter != null) GraphicsAdapter.UseReferenceDevice = true;
if (!useAdapter.IsProfileSupported(GraphicsProfile.Reach))
GraphicsAdapter.UseReferenceDevice = !GraphicsAdapter.UseReferenceDevice;
if (!useAdapter.IsProfileSupported(GraphicsProfile.Reach))
throw new NotSupportedException("No suitable graphics adapter found");
try
{
GraphicsDevice = new GraphicsDevice(useAdapter, GraphicsProfile.Reach, _parameters);
}
catch (InvalidOperationException)
{
// With VMware, GraphicsDevice.ctor may throw InvalidOperationException when using reference device.
GraphicsAdapter.UseReferenceDevice = false;
GraphicsDevice = new GraphicsDevice(useAdapter, GraphicsProfile.Reach, _parameters);
}
if (DeviceCreated != null) DeviceCreated(this, EventArgs.Empty);
}
开发者ID:vvnurmi,项目名称:assaultwing,代码行数:34,代码来源:GraphicsDeviceService.cs
示例3: XNAGraphicsDeviceService
private XNAGraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
parameters = new PresentationParameters();
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.BackBufferFormat = SurfaceFormat.Color;
parameters.DepthStencilFormat = DepthFormat.Depth16;
parameters.DeviceWindowHandle = windowHandle;
parameters.PresentationInterval = PresentInterval.Immediate;
parameters.IsFullScreen = false;
if (GraphicsAdapter.DefaultAdapter.IsProfileSupported(GraphicsProfile.HiDef))
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
GraphicsProfile.HiDef,
parameters);
else
{
MessageBox.Show(
"WARNING: Your graphics device does not support the HiDef Profile, switching to the Reach profile.",
"Rose");
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
GraphicsProfile.Reach,
parameters);
}
XnaResourceManager.Instance.DeviceCreate(graphicsDevice);
}
开发者ID:sgrzeda,项目名称:rose,代码行数:27,代码来源:XNAGraphicsDeviceService.cs
示例4: InitializeMainScrn
private void InitializeMainScrn()
{
mainScreen = new MainScreen();
PresentationParameters pp = new PresentationParameters();
pp.BackBufferCount = 1;
pp.IsFullScreen = false;
pp.SwapEffect = SwapEffect.Discard;
pp.BackBufferWidth = mainScreen.canvas.Width;
pp.BackBufferHeight = mainScreen.canvas.Height;
pp.AutoDepthStencilFormat = DepthFormat.Depth24Stencil8;
pp.EnableAutoDepthStencil = true;
pp.PresentationInterval = PresentInterval.Default;
pp.BackBufferFormat = SurfaceFormat.Unknown;
pp.MultiSampleType = MultiSampleType.None;
mainDevice = new GraphicsDevice( GraphicsAdapter.DefaultAdapter,
DeviceType.Hardware, this.mainScreen.canvas.Handle,
pp );
mainScreen.canvas.SizeChanged += new EventHandler( mainScreen_canvas_SizeChanged );
mainScreen.canvas.Paint += new EventHandler( mainScreen_canvas_Paint );
mainDevice.Reset();
mainScreen.Show( dockPanel, DockState.Document );
mainScrnBatch = new SpriteBatch( mainDevice );
//BasicGraphics.Initial( mainDevice );
}
开发者ID:ingex0,项目名称:smarttank,代码行数:32,代码来源:MapEditer.cs
示例5: GraphicsDeviceService
/// <summary>
/// Constructor is private, because this is a singleton class:
/// client controls should use the public AddRef method instead.
/// </summary>
GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
parameters = new PresentationParameters();
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.BackBufferFormat = SurfaceFormat.Color;
parameters.DepthStencilFormat = DepthFormat.Depth24;
parameters.DeviceWindowHandle = windowHandle;
parameters.RenderTargetUsage = RenderTargetUsage.DiscardContents;
parameters.IsFullScreen = false;
/*PORT XNA 4
parameters.EnableAutoDepthStencil = true;
parameters.AutoDepthStencilFormat = DepthFormat.Depth24;
*/
if(GraphicsAdapter.DefaultAdapter.IsProfileSupported(GraphicsProfile.HiDef))
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, parameters);
else if (GraphicsAdapter.DefaultAdapter.IsProfileSupported(GraphicsProfile.Reach))
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, parameters);
else
{
System.Windows.Forms.MessageBox.Show("Default graphics adapter does not support XNA");
throw new System.InvalidOperationException("Default graphics adapter does not support XNA");
}
}
开发者ID:abordt,项目名称:Viking,代码行数:33,代码来源:GraphicsDeviceService.cs
示例6: Renderer
public Renderer( PresentationParameters p_PresentationParameters )
{
m_GraphicsAdapter = GraphicsAdapter.DefaultAdapter;
m_PresentationParameters = p_PresentationParameters;
#if XBOX360
m_PresentationParameters.BackBufferWidth =
m_GraphicsAdapter.CurrentDisplayMode.Width;
m_PresentationParameters.BackBufferHeight =
m_GraphicsAdapter.CurrentDisplayMode.Height;
m_PresentationParameters.IsFullScreen = true;
#endif
m_GraphicsDeviceService = GraphicsDeviceService.AddReference(
m_PresentationParameters );
m_ServiceContainer.AddService< IGraphicsDeviceService >(
m_GraphicsDeviceService );
m_ClearColour = new Color( 1.0f, 1.0f, 1.0f );
m_Width = m_PresentationParameters.BackBufferWidth;
m_Height = m_PresentationParameters.BackBufferHeight;
if( GamerServicesDispatcher.IsInitialized == false )
{
GamerServicesDispatcher.WindowHandle =
m_GraphicsDeviceService.GraphicsDevice.
PresentationParameters.DeviceWindowHandle;
GamerServicesDispatcher.Initialize( m_ServiceContainer );
GamerServicesDispatcher.Update( );
}
}
开发者ID:RedRingRico,项目名称:BloodBullet,代码行数:35,代码来源:Renderer.cs
示例7: GraphicsDeviceInformation
public GraphicsDeviceInformation()
{
deviceType = DeviceType.Hardware;
adapter = GraphicsAdapter.DefaultAdapter;
presentationParameters = new PresentationParameters();
presentationParameters.Clear();
}
开发者ID:sergios1234,项目名称:monoxna,代码行数:7,代码来源:GraphicsDeviceInformation.cs
示例8: GraphicsDeviceService
/// <summary>
/// Constructor is private, because this is a singleton class:
/// client controls should use the public AddRef method instead.
/// </summary>
GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
parameters = new PresentationParameters();
// Basic settings.
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.BackBufferFormat = SurfaceFormat.Color;
parameters.DepthStencilFormat = DepthFormat.Depth24;
parameters.DeviceWindowHandle = windowHandle;
parameters.PresentationInterval = PresentInterval.Immediate;
parameters.IsFullScreen = false;
// High-quality settings.
parameters.MultiSampleCount = 4;
// Try for high-quality graphics, otherwise drop down to basic settings.
try
{
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
GraphicsProfile.HiDef,
parameters);
}
catch
{
parameters.MultiSampleCount = 0;
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
GraphicsProfile.Reach,
parameters);
}
}
开发者ID:tuannsofta,项目名称:kinect4bag,代码行数:36,代码来源:GraphicsDeviceService.cs
示例9: SelectTeleportationForm
public SelectTeleportationForm(Map map, System.Drawing.Point premier, int layer, Map firstMap, SpriteBatch Mapbatch)
{
InitializeComponent();
utils = new XNAUtils();
this.map = map;
this.premier = premier;
this.layer = layer;
this.firstMap = firstMap;
this.batch = Mapbatch;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Size = Screen.PrimaryScreen.Bounds.Size;
this.StartPosition = FormStartPosition.Manual;
this.Location = new System.Drawing.Point(0, 0);
PN_Map.Size = Screen.PrimaryScreen.Bounds.Size;
PresentationParameters pp = new PresentationParameters()
{
BackBufferHeight = PN_Map.Height,
BackBufferWidth = PN_Map.Width,
DeviceWindowHandle = PN_Map.Handle,
IsFullScreen = false
};
XNADevices.graphicsdevice.Reset(pp);
}
开发者ID:rykdesjardins,项目名称:pixel-lion,代码行数:25,代码来源:SelectTeleportationForm.cs
示例10: Reset
public static unsafe void Reset(GraphicsDevice graphicsDevice, PresentationParameters parameters)
{
var fi = typeof(GraphicsDevice).GetField("pComPtr", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
var ptr = fi.GetValue(graphicsDevice);
var pComPtr = new IntPtr(System.Reflection.Pointer.Unbox(ptr));
if (g_mdxAssembly == null) throw new ApplicationException("GraphicsDevice.Reset failed. Please install Managed DirectX from the Assault Wing web site.");
var mdxDeviceType = g_mdxAssembly.GetType("Microsoft.DirectX.Direct3D.Device");
var mdxPresentParametersType = g_mdxAssembly.GetType("Microsoft.DirectX.Direct3D.PresentParameters");
var dev = Activator.CreateInstance(mdxDeviceType, pComPtr);
dynamic dxParameters = new MDXPresentParameters(Activator.CreateInstance(mdxPresentParametersType));
dxParameters.AutoDepthStencilFormat = parameters.DepthStencilFormat.ToD3D();
dxParameters.BackBufferCount = 1;
dxParameters.BackBufferFormat = parameters.BackBufferFormat.ToD3D();
dxParameters.BackBufferHeight = parameters.BackBufferHeight;
dxParameters.BackBufferWidth = parameters.BackBufferWidth;
dxParameters.DeviceWindow = null;
dxParameters.DeviceWindowHandle = parameters.DeviceWindowHandle;
dxParameters.EnableAutoDepthStencil = false; // ???
dxParameters.ForceNoMultiThreadedFlag = false; // ???
dxParameters.FullScreenRefreshRateInHz = 0; // ??? should be 0 for windowed mode; in fullscreen mode take value from DisplayModeCollection
dxParameters.MultiSample = GetMDXEnumValue("MultiSampleType", "None");
dxParameters.MultiSampleQuality = 0;
dxParameters.PresentationInterval = parameters.PresentationInterval.ToD3D();
dxParameters.PresentFlag = GetMDXEnumValue("PresentFlag", "None"); // ???
dxParameters.SwapEffect = GetMDXEnumValue("SwapEffect", "Flip"); // ??? see _parameters.RenderTargetUsage
dxParameters.Windowed = !parameters.IsFullScreen;
var resetMethod = mdxDeviceType.GetMethod("Reset");
var mdxPresentParametersArray = Array.CreateInstance(mdxPresentParametersType, 1);
mdxPresentParametersArray.SetValue(((MDXPresentParameters)dxParameters).WrappedValue, 0);
resetMethod.Invoke(dev, new[] { mdxPresentParametersArray });
}
开发者ID:vvnurmi,项目名称:assaultwing,代码行数:31,代码来源:Direct3D.cs
示例11: GraphicsDeviceService
/// <summary>
/// Constructor is private, because this is a singleton class:
/// client controls should use the public AddRef method instead.
/// </summary>
GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
//parameters = new PresentationParameters();
//parameters.BackBufferWidth = Math.Max(width, 1);
//parameters.BackBufferHeight = Math.Max(height, 1);
//parameters.BackBufferFormat = SurfaceFormat.Color;
//parameters.EnableAutoDepthStencil = true;
//parameters.AutoDepthStencilFormat = DepthFormat.Depth24;
this.Parameters = new PresentationParameters()
{
BackBufferWidth = Math.Max(width, 1),
BackBufferHeight = Math.Max(height, 1),
BackBufferFormat = SurfaceFormat.Color,
DepthStencilFormat = DepthFormat.Depth24,
DeviceWindowHandle = windowHandle,
PresentationInterval = PresentInterval.Immediate,
IsFullScreen = false,
MultiSampleCount = 4
};
//graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter,
// DeviceType.Hardware,
// windowHandle,
// parameters);
this.graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.Reach, this.Parameters);
if (this.DeviceCreated != null)
{
this.DeviceCreated(this, EventArgs.Empty);
}
}
开发者ID:rzellertownson,项目名称:neurorighter,代码行数:39,代码来源:GraphicsDeviceService.cs
示例12: GraphicsDevice
public GraphicsDevice()
{
BitmapCacheEnabled = true;
RenderAtScale = 1;
RenderState = new RenderState();
PresentationParameters = new PresentationParameters();
PresentationParameters.BackBufferFormat = SurfaceFormat.Canvas;
}
开发者ID:liwq-net,项目名称:SilverSprite,代码行数:8,代码来源:GraphicsDevice.cs
示例13: EqualsTest
public void EqualsTest()
{
PresentationParameters b = new PresentationParameters();
Assert.IsFalse(b == a, "#1");
Assert.IsTrue(b != a, "#2");
Assert.IsFalse(b == null, "#3");
Assert.IsTrue(b.Equals(b), "#4");
}
开发者ID:sergios1234,项目名称:monoxna,代码行数:8,代码来源:PresentationParametersTests.cs
示例14: GraphicsDeviceService
GraphicsDeviceService(
PresentationParameters p_PresentationParameters)
{
m_PresentationParameters = p_PresentationParameters;
m_GraphicsDevice = new GraphicsDevice(
GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef,
m_PresentationParameters );
}
开发者ID:RedRingRico,项目名称:BloodBullet,代码行数:9,代码来源:GraphicsDeviceService.cs
示例15: GraphicsDeviceService
private GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
this.parameters = new PresentationParameters();
this.parameters.BackBufferWidth = Math.Max(width, 1);
this.parameters.BackBufferHeight = Math.Max(height, 1);
this.parameters.BackBufferFormat = SurfaceFormat.Color;
this.parameters.EnableAutoDepthStencil = true;
this.parameters.AutoDepthStencilFormat = DepthFormat.Depth24;
this.graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.Hardware, windowHandle, this.parameters);
}
开发者ID:Jiwan,项目名称:ROSE-Content-Importer,代码行数:10,代码来源:GraphicsDeviceService.cs
示例16: CreateDevice
public void CreateDevice()
{
PresentationParameters pp = new PresentationParameters();
pp.IsFullScreen = false;
pp.BackBufferHeight = this.m_renderControl.Height;
pp.BackBufferWidth = this.m_renderControl.Width;
pp.DeviceWindowHandle = this.m_renderControl.Handle;
this.m_graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, pp);
}
开发者ID:cryogen,项目名称:VM86CS,代码行数:10,代码来源:GraphicsDeviceService.cs
示例17: AddReference
public static GraphicsDeviceService AddReference(
PresentationParameters p_PresentationParameters)
{
if( Interlocked.Increment( ref m_ReferenceCount ) == 1 )
{
Instance = new GraphicsDeviceService(
p_PresentationParameters );
}
return Instance;
}
开发者ID:RedRingRico,项目名称:BloodBullet,代码行数:11,代码来源:GraphicsDeviceService.cs
示例18: setupGraphicsDevice
private static GraphicsDevice setupGraphicsDevice()
{
PresentationParameters windowParams = new PresentationParameters();
windowParams.DeviceWindowHandle = new IntPtr(1);
GraphicsAdapter.UseNullDevice = true;
GraphicsDevice device = new GraphicsDevice(
GraphicsAdapter.DefaultAdapter,
GraphicsProfile.Reach,
windowParams);
return device;
}
开发者ID:RavenNevermore,项目名称:Omnom-III,代码行数:11,代码来源:DanceSceneTest.cs
示例19: GraphicsDeviceService
/// <summary>
/// Constructor is private, because this is a singleton class:
/// client controls should use the public AddRef method instead.
/// </summary>
GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
GraphicsAdapter adapter = GraphicsAdapter.DefaultAdapter;
GraphicsProfile profile = GraphicsProfile.Reach;
PresentationParameters pp = new PresentationParameters()
{
DeviceWindowHandle = windowHandle,
BackBufferWidth = Math.Max(width, 1),
BackBufferHeight = Math.Max(height, 1),
};
graphicsDevice = new GraphicsDevice(adapter, profile, pp);
}
开发者ID:BoyuanZhang,项目名称:monogame_tile_solution,代码行数:16,代码来源:GraphicsDeviceService.cs
示例20: GraphicsDeviceService
GraphicsDeviceService(IntPtr windowHandle, int width, int height)
{
parameters = new PresentationParameters();
parameters.BackBufferWidth = Math.Max(width, 1);
parameters.BackBufferHeight = Math.Max(height, 1);
parameters.DepthStencilFormat = DepthFormat.Depth24;
parameters.DeviceWindowHandle = windowHandle;
parameters.PresentationInterval = PresentInterval.Immediate;
parameters.IsFullScreen = false;
graphicsDevice = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, GraphicsProfile.HiDef, parameters);
}
开发者ID:999eagle,项目名称:XNATextureViewer,代码行数:12,代码来源:GraphicsDeviceService.cs
注:本文中的Microsoft.Xna.Framework.Graphics.PresentationParameters类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论