问题
How would you dim an image(or a section of the screen) so that you can show something else that's not dimmed as the focus? Sorry that it's a little vague and hard to understand, but I can't think of a better way to phrase it.
回答1:
I don't know how efficient or smart this is, but spriteBatch.Draw takes a color to shade textures. You could try setting up a list of textures and apply darker colors to the textures that are meant to be dimmed.
Something like:
for(int i = 0; i < texturesToDraw.Count; i++)
{
if(i == selected)
{
spriteBatch.Draw(texturesToDraw[i], position, Color.White)
}
else
{
spriteBatch.Draw(texturesToDraw[i], position, Color.SomeDarkColor)
}
}
A simple tutorial that might help you get started: http://www.xnadevelopment.com/tutorials/fadeinfadeout/FadeInFadeOut.shtml
来源:https://stackoverflow.com/questions/16600198/xna-how-to-dim-a-section-of-the-screen