Created
July 13, 2011 07:31
-
-
Save gmjosack/1079883 to your computer and use it in GitHub Desktop.
Minimum 2D HLSL Pixel Shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace NewShader | |
{ | |
public class Game1 : Microsoft.Xna.Framework.Game | |
{ | |
GraphicsDeviceManager graphics; | |
SpriteBatch spriteBatch; | |
Texture2D texture; | |
Effect effect; | |
public Game1() | |
{ | |
graphics = new GraphicsDeviceManager(this); | |
Content.RootDirectory = "Content"; | |
} | |
protected override void LoadContent() | |
{ | |
spriteBatch = new SpriteBatch(GraphicsDevice); | |
texture = Content.Load<Texture2D>("surge"); | |
effect = Content.Load<Effect>("Effect1"); | |
} | |
protected override void Draw(GameTime gameTime) | |
{ | |
GraphicsDevice.Clear(Color.CornflowerBlue); | |
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); | |
effect.CurrentTechnique.Passes[0].Apply(); | |
spriteBatch.Draw(texture, new Vector2(0, 0), Color.White); | |
spriteBatch.End(); | |
base.Draw(gameTime); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment