c# - 当 sourcerect 准确时,C# spritesheet 显示相邻的图块
问题描述
好的,所以我的问题是:这显示了精灵表上不存在的图块之间的小轮廓
我尝试在 spritesheet 上的图块之间添加一个空间,它只是将相邻图块的轮廓更改为边缘的稍微轻一点的版本,我认为它是抗锯齿的,但我的 spritebatch.Begin 是:
spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null, null, Main.cam.Completetransformation() * Main.DrawScaling);
SpriteBatch.Begin 在基础 Draw() 中被调用,Image.Draw() 是 spriteBatch.Draw() 被调用的地方
我的 Image 类运行如下:
Image.LayerDepth = layerDepth;
Image.Position = tile.position;
Image.SourceRect = tile.SourceRect;
Image.Color = tile.Color;
Image.Draw(spriteBatch);
和 Image.Draw(SpriteBatch spriteBatch):
public void Draw(SpriteBatch spriteBatch)
{
origin = Vector2.Zero;
spriteBatch.Draw(Texture, Position, SourceRect, Color * Alpha, 0.0f, origin, Scale, SpriteEffects.None, LayerDepth / 100);
}
我用谷歌搜索了不同的 spritebatch 开始模式等,但我不知道我错过了什么,SourceRect 始终为 32 * 32(等于图块大小),我没有发现位置问题,所以我完全没有想法
编辑:我也有
Graphics.PreferMultiSampling = false;
Graphics.ApplyChanges();
在我的 Initialize()
解决方案
推荐阅读
- javascript - 为什么我的 Websocket Server 需要手动刷新?
- c - 为什么这个程序打印 0 而不是指定数组中的特定值集?
- vba - 在循环发送之前显示每封电子邮件以进行手动编辑
- java - Android Google Maps API 未加载地图
- r - 时间序列图 ggplot
- c# - 带有数组模型的 Bootstrap Vue B-Checkbox 的 Blazor 实现
- css - 如何在 React 中运行微调器时使背景变灰
- bash - 为什么 AWS cli 被一个 bash 脚本看到,而另一个却没有?
- go - 减少多路复用中间件和自定义上下文实现中的样板
- python - 试图查看 N 及其 2N 是否存在于列表中