本文整理汇总了C#中GraphicsContext.GetViewport方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsContext.GetViewport方法的具体用法?C# GraphicsContext.GetViewport怎么用?C# GraphicsContext.GetViewport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsContext
的用法示例。
在下文中一共展示了GraphicsContext.GetViewport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DebugString
public DebugString(GraphicsContext graphics, Texture2D texture, int charaWidth, int charaHeight)
{
if(shaderProgram == null)
{
shaderProgram=CreateSimpleSpriteShader();
}
this.graphics = graphics;
this.texture = texture;
this.charaWidth = charaWidth;
this.charaHeight = charaHeight;
charaPositions = new float[maxNumOfCharactor * 4 * 3];
charaTexcoords = new float[maxNumOfCharactor * 4 * 2];
charaColors = new float[maxNumOfCharactor * 4 * 4];
charaIndices = new ushort[maxNumOfCharactor * indexSize];
vertices = new VertexBuffer(maxNumOfCharactor * 4, maxNumOfCharactor * indexSize,
VertexFormat.Float3, VertexFormat.Float2, VertexFormat.Float4);
PixelScreenPosition = new Vector3(0.0f, 0.0f, 0.0f);
ImageRect rectPixelScreen = graphics.GetViewport();
//@j ピクセルの座標系をスクリーンの座標系に変換する行列。
//@e Line to convert a pixel coordinate system into a screen coordinate system.
unitScreenMatrix = new Matrix4(
2.0f/rectPixelScreen.Width, 0.0f, 0.0f, 0.0f,
0.0f, -2.0f/rectPixelScreen.Height, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
-1.0f, 1.0f, 0.0f, 1.0f
);
}