本文整理汇总了C#中Size2.ToVector2方法的典型用法代码示例。如果您正苦于以下问题:C# Size2.ToVector2方法的具体用法?C# Size2.ToVector2怎么用?C# Size2.ToVector2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Size2
的用法示例。
在下文中一共展示了Size2.ToVector2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DepthStencil
public DepthStencil(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats)
: base(parent)
{
try
{
var video = parent.FindParentOrSelfWithException<Video>();
Size = new Size2(width, height);
SizeF = Size.ToVector2();
int depthBit = 16, stencilBit = 0;
switch (depthStencilFormats)
{
case DepthStencilFormats.Defualt:
depthBit = 24;
stencilBit = 0;
break;
case DepthStencilFormats.Depth24Stencil8:
depthBit = 24;
stencilBit = 8;
break;
case DepthStencilFormats.Depth16:
depthBit = 16;
stencilBit = 0;
break;
case DepthStencilFormats.Depth24:
depthBit = 24;
stencilBit = 0;
break;
case DepthStencilFormats.Depth32:
depthBit = 32;
stencilBit = 0;
break;
default:
Debug.ThrowError("Video", "Unsuported DepthStencilFormat type");
break;
}
com = new DepthStencilCom();
var error = com.Init(video.com, width, height, depthBit, stencilBit);
switch (error)
{
case DepthStencilErrors.Textrue: Debug.ThrowError("DepthStencil", "Failed to create Texture2D"); break;
case DepthStencilErrors.DepthStencilView: Debug.ThrowError("DepthStencil", "Failed to create DepthStencilView"); break;
}
}
catch (Exception e)
{
Dispose();
throw e;
}
}
示例2: init
private void init(IDisposableResource parent, int width, int height, DepthStencilFormats depthStencilFormats)
{
try
{
this.width = width;
this.height = height;
this.depthStencilFormats = depthStencilFormats;
video = parent.FindParentOrSelfWithException<Video>();
Size = new Size2(width, height);
SizeF = Size.ToVector2();
int depthBit = 16, stencilBit = 0;
switch (depthStencilFormats)
{
case DepthStencilFormats.Defualt:
depthBit = 24;
stencilBit = 0;
break;
case DepthStencilFormats.Depth24Stencil8:
depthBit = 24;
stencilBit = 8;
break;
case DepthStencilFormats.Depth16:
depthBit = 16;
stencilBit = 0;
break;
case DepthStencilFormats.Depth24:
depthBit = 24;
stencilBit = 0;
break;
case DepthStencilFormats.Depth32:
depthBit = 32;
stencilBit = 0;
break;
default:
Debug.ThrowError("Video", "Unsuported DepthStencilFormat type");
break;
}
com = new DepthStencilCom();
var error = com.Init(video.com, width, height, depthBit, stencilBit);
switch (error)
{
case DepthStencilErrors.DepthStencilSurface: Debug.ThrowError("DepthStencil", "Failed to create DepthStencil Surface"); break;
}
if (!video.Caps.ExDevice && !video.deviceReseting)
{
video.DeviceLost += deviceLost;
video.DeviceReset += deviceReset;
}
}
catch (Exception e)
{
Dispose();
throw e;
}
}