[PR]
×
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
プログラミング、3DCGとその他いろいろについて
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
public class MyGame : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D texture;
Effect effect;
public MyGame()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void LoadContent()
{
texture = Content.Load ("henohenomoheji");
effect = Content.Load ("2DEffect");
spriteBatch = new SpriteBatch(GraphicsDevice);
}
protected override void UnloadContent()
{
spriteBatch.Dispose();
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(
SpriteBlendMode.None,
SpriteSortMode.Immediate,
SaveStateMode.None
);
effect.Begin();
effect.CurrentTechnique.Passes[0].Begin();
spriteBatch.Draw(texture, new Vector2(), Color.White);
effect.CurrentTechnique.Passes[0].End();
effect.End();
spriteBatch.End();
}
static void Main()
{
using (MyGame game = new MyGame())
{
game.Run();
}
}
}
sampler TextureSampler : register(s0);
float4 PixelShaderFunction(float2 textureCoordinate : TEXCOORD) : COLOR0
{
float2 texOffset = {sin(textureCoordinate.x * 30) / 20 , 0};
return tex2D(
TextureSampler,
textureCoordinate + texOffset
);
}
technique Technique1
{
pass Pass1
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}