using
System;
using
System.Collections.Generic;
using
Microsoft.Xna.Framework;
using
Microsoft.Xna.Framework.Audio;
using
Microsoft.Xna.Framework.Content;
using
Microsoft.Xna.Framework.GamerServices;
using
Microsoft.Xna.Framework.Graphics;
using
Microsoft.Xna.Framework.Input;
using
Microsoft.Xna.Framework.Net;
using
Microsoft.Xna.Framework.Storage;
public
class GameText
: Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
SpriteFont spriteFont;
public GameText()
{
graphics =
new
GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override
void LoadContent()
{
// Create a new SpriteBatch, which can be used to
draw textures.
spriteBatch = new
SpriteBatch(GraphicsDevice);
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
spriteFont
= Content.Load<SpriteFont>("myFont");
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
}
protected override
void Draw(GameTime
gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
spriteBatch.Begin();
spriteBatch.DrawString(spriteFont, //
spriteFont
"Hello World!!!!",
// String
new
Vector2(200, 200),
// ScreenPos
Color.Tomato);
// Colour
spriteBatch.End();
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
//**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**TEXTCODE**
base.Draw(gameTime);
}
}
//
Our program entry point
static
class Program
{
static void
Main(string[] args)
{
using (GameText
game = new
GameText())
{
game.Run();
}
}
} |