Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Microsoft.Xna.Framework.Input;
- namespace GameName1
- {
- /// <summary>
- /// This is the main type for your game
- /// </summary>
- public class Game1 : Game
- {
- GraphicsDeviceManager graphics;
- SpriteBatch spriteBatch;
- SpriteFont tempFont;
- public Game1()
- : base()
- {
- graphics = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
- }
- protected override void LoadContent()
- {
- spriteBatch = new SpriteBatch(GraphicsDevice);
- tempFont = Content.Load<SpriteFont>("SmallText");
- }
- protected override void UnloadContent()
- {
- }
- protected override void Update(GameTime gameTime)
- {
- if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
- Exit();
- base.Update(gameTime);
- }
- protected override void Draw(GameTime gameTime)
- {
- // Sample draw
- graphics.GraphicsDevice.Clear(new Color(204, 204, 204));
- spriteBatch.Begin();
- spriteBatch.DrawString(tempFont, "Ahoj, jak se mbm", new Vector2(20, 20), Color.Red);
- spriteBatch.DrawString(tempFont, "Ahoj, jak se mb", new Vector2(20, 20), Color.Blue);
- float size = tempFont.MeasureString("Ahoj, jak se mbm").X - tempFont.MeasureString("m").X;
- spriteBatch.DrawString(tempFont, "m", new Vector2(20 + size, 20), Color.Yellow);
- spriteBatch.End();
- base.Draw(gameTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment