Zuneのグラフィック
文字表示ですが、XNAの今までどおりで文字が表示できます。
namespace ZuneGame3 { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; private SpriteFont font; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0); } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); font = Content.Load<SpriteFont>("SpriteFont1"); } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); spriteBatch.DrawString(font, "test", new Vector2(50, 50), Color.White); spriteBatch.End(); base.Draw(gameTime); } } }
いままでのFont関係のサンプルと同様にContentにフォントの追加は必要です。
Zuneは2D系のsprite関係の関数は使えるのですが、3D関係で「GraphicsDevice.DrawUserPrimitives」などの関数がありません、
ほんとうに2Dに特化したゲームしか作れません、せめて3点を与えて2Dで表示する関数があればよかったのですが、それもないので、スプライト関数で工夫する必要があります、