TheQuantumBros
TheQuantumBros

Reputation: 308

XNA - How to dim a section of the screen?

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.

Upvotes: 1

Views: 343

Answers (1)

Colton
Colton

Reputation: 1297

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

Upvotes: 1

Related Questions