当 sourcerect 准确时,C# spritesheet 显示相邻的图块

问题描述

好的,我的问题是:this shows a small outline between tiles that isn't there on the spritesheet

我已经尝试在 spritesheet 上的瓷砖之间添加一个空间,它只是将相邻瓷砖的轮廓更改为边缘的略浅版本,我认为这是抗锯齿,但我的 spritebatch.Begin 是:

spriteBatch.Begin(SpriteSortMode.FrontToBack,null,SamplerState.PointClamp,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() 中

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)