article search result of 'Alpha' : 1

  1. 2011.04.27 [간단메모] Texture2D , Alpha Color (5443)

[간단메모] Texture2D , Alpha Color

private Texture2D tx;
        private Rectangle txRect;
        private Color txColor;
        protected override void LoadContent()
        {

            spriteBatch = new SpriteBatch(GraphicsDevice);
            using (System.IO.FileStream fs = new System.IO.FileStream
(
@"d:\logo2.jpg" ,System.IO.FileMode.Open)) { tx = Texture2D.FromStream(GraphicsDevice, fs); }; txRect = new Rectangle(0, 0, tx.Width, tx.Height); txColor = new Color(255, 255, 255, 0); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); txColor.A +=1; spriteBatch.Begin(); spriteBatch.Draw(tx, txRect, txColor); spriteBatch.End(); base.Draw(gameTime); }

txColor 를 보면 마지막 인자인 A(alpha) 값을 설정할수 있다.
이를 업데이트 시켜주면 알파블렌딩을 할수 있다.
Yamecoder 야매코더_
tags : , ,
XNA 2011.04.27 10:43
Powerd by Tistory, designed by criuce
rss