前回のソースとプロジェクトをアップするのをすっかり忘れていたのでアップ。
後、レベルは1クマーでした。(^^;)
今日帰ったらりょーいちさんから質問をいただいた「他環境でのフォント」について調べたいと思います。
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
#endregion
namespace XNAGameProject
{
public class GameMain : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics = null;
public GraphicsDeviceManager Graphics
{
get { return this.graphics; }
}
ContentManager content = null;
public ContentManager Content
{
get { return this.content; }
}
SpriteBatch spriteBatch = null;
SpriteFont font = null;
public GameMain()
{
graphics = new GraphicsDeviceManager(this);
content = new ContentManager(Services, "Content");
}
protected override void Initialize()
{
base.Initialize();
}
protected override void LoadGraphicsContent(bool loadAllContent)
{
GraphicsDevice device = this.graphics.GraphicsDevice;
if (loadAllContent)
{
this.spriteBatch = new SpriteBatch(device);
this.font = this.content.Load<SpriteFont>("Font");
}
}
protected override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent == true)
{
content.Unload();
}
}
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)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
this.spriteBatch.Begin();
this.spriteBatch.DrawString(this.font, "Draw Sprite in a screen.",
Vector2.Zero, Color.White);
this.spriteBatch.End();
base.Draw(gameTime);
}
}
}