「VCS/XnaLissajous」の編集履歴(バックアップ)一覧はこちら

VCS/XnaLissajous」(2012/12/10 (月) 17:59:00) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

|開発環境|Microsoft Visual C# 2010 Express (SP1)| |実行環境|Microsoft Windows XP Home Edition (SP3)| |プロジェクトの種類|Windows Game (4.0)| |プロジェクト名|XnaLissajous| Game1.cs #highlight(c#){{ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaLissajous { class Game1 : Game { GraphicsDeviceManager graphics; BasicEffect effect; int deg = 0; public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; IsMouseVisible = true; } protected override void LoadContent() { effect = new BasicEffect(GraphicsDevice); effect.VertexColorEnabled = true; base.LoadContent(); } protected override void Update(GameTime gameTime) { KeyboardState kState = Keyboard.GetState(); if (kState.IsKeyDown(Keys.Escape)) Exit(); deg = (deg + 1) % 360; base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.BlendState = BlendState.AlphaBlend; VertexPositionColor[] vertices = new VertexPositionColor[240 + 1]; for (int n = 0; n <= 240; n++) { float rad = MathHelper.ToRadians((deg + n)); vertices[n] = new VertexPositionColor( new Vector3((float)Math.Cos(rad * 3) * 0.9f, (float)Math.Sin(rad * 2) * 0.9f, 0), Color.White * (n / 240.0f)); } foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives<VertexPositionColor>( PrimitiveType.LineStrip, vertices, 0, 240); } base.Draw(gameTime); } } } }}

表示オプション

横に並べて表示:
変化行の前後のみ表示: