像素颜色并不总是显示相同

时间:2013-05-09 21:23:35

标签: c# xna xna-4.0 pixels texture2d

我有一个落砂风格的游戏,目前只使用两种颜色,黑色和青色。我正在使用texture.SetData<Color>(colorArray);

设置纹理的颜色

主程序更新颜色,当像素离开某个点时,该位置的颜色设置为黑色,新点设置为青色。但是,正如您在图片中看到的那样,青色在整个过程中并不均匀(仔细观察右下角,它是非常深蓝色)。这是在Windows手机模拟器上发生的。起初我认为屏幕可能只是更快地更新,以便颜色投射并快速离开,但在停止更新方法(拍摄下图)后,颜色保持不变。

有关为何发生这种情况的任何想法?

没有阴影(除非它是自动完成的,我没有意识到)。只有:colorArray[position] = Black;colorArray[newPos] = Cyan;

http://i.imgur.com/SfJweTg.png

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.Black);

        spriteBatch.Begin();

        map.Draw(spriteBatch);
        spriteBatch.DrawString(spriteFont, fps, Vector2.Zero, Color.White);
        spriteBatch.End();

        base.Draw(gameTime);
    }

    //map.Draw()
    public void Draw(SpriteBatch sb)
    {
        sb.Draw(pixels, Vector2.Zero, Color.White);
    }

    public void Update()
    { 
          //this is only a portion of the update method
          colors[currentpos] = getColor(0);// returns a color from a list
          //some more updates not related to the texture
          //blah
          //blah blah
          colors[currentpos] = getColor(ID);// returns a color from a list
          //at the end of the update loop
          texture.SetData<Color>(colors);              
    }

0 个答案:

没有答案
相关问题