C# MDX drawing transparent rectangle over a sprite
I want to make a "Pausemenu" in a Tetrisgame, when I hit Esc, the Menu pops up and that the user clearly is aware of that the game isnt running, I want to draw a transparent black rectangle over the whole game sprite, I´m using C# Managed DirectX 9.0c on .Net Framework 3.5. (I could achieve the same effect with a texture, but since in the settings the Board Width/Height can be changed, this would be an ugly solution)
Is there an easy wa开发者_高级运维y to achieve this?
You can simple create a small PNG, make it black and 75% opaque.
In your Game just use the Sprite Class (with alpha enabled) and scale it (with transform) to the dimensions of your viewport.
You could also use the Sprite Class to modify the Color of the Sprite when drawing, so you can make it fade in or out or give it another color.
Hope that helps!
精彩评论