本文整理汇总了C#中Camera2D.GetViewMatrix方法的典型用法代码示例。如果您正苦于以下问题:C# Camera2D.GetViewMatrix方法的具体用法?C# Camera2D.GetViewMatrix怎么用?C# Camera2D.GetViewMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera2D
的用法示例。
在下文中一共展示了Camera2D.GetViewMatrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(Camera2D camera)
{
_spriteBatch.Begin(sortMode: SpriteSortMode.Immediate, blendState: BlendState.AlphaBlend,
samplerState: SamplerState.PointClamp, transformMatrix: camera.GetViewMatrix());
_spriteBatch.Draw(_texture, Position, Color.White);
_spriteBatch.End();
}
示例2: Draw
public override void Draw(Camera2D camera)
{
var renderOrderFunction = GetRenderOrderFunction();
_spriteBatch.Begin(sortMode: SpriteSortMode.Immediate, blendState: BlendState.AlphaBlend,
samplerState: SamplerState.PointClamp, transformMatrix: camera.GetViewMatrix());
foreach (var tile in renderOrderFunction())
{
var region = _map.GetTileRegion(tile.Id);
if(region != null)
RenderLayer(_map, tile, region);
}
_spriteBatch.End();
}
示例3: Draw
public override void Draw(Camera2D camera)
{
var renderOrderFunction = GetRenderOrderFunction();
_spriteBatch.Begin(sortMode: SpriteSortMode.Immediate, blendState: BlendState.AlphaBlend,
samplerState: SamplerState.PointClamp, transformMatrix: camera.GetViewMatrix());
foreach (var tile in renderOrderFunction())
{
var region = _map.GetTileRegion(tile.Id);
if (region != null)
{
// not exactly sure why we need to compensate 1 pixel here. Could be a bug in MonoGame?
var tx = tile.X * (_map.TileWidth - 1);
var ty = tile.Y * (_map.TileHeight - 1);
_spriteBatch.Draw(region, new Rectangle(tx, ty, region.Width, region.Height), Color.White);
}
}
_spriteBatch.End();
}