public override void Draw(SpriteBatch pSpriteBatch)
        {
            base.Draw(pSpriteBatch);

            if (initialized)
            {
                pSpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap);
                pSpriteBatch.Draw(spaceIslandTexture, Vector2.Zero, Color.White);
                tinyMaleSprite.Draw(pSpriteBatch, 4f);

                smallFont.DrawString(pSpriteBatch, "Hello World!", new Vector2(20, 20), 8f);
                pSpriteBatch.End();
            }
        }
Beispiel #2
0
        public void DrawString(SpriteBatch pSpriteBatch, string pText, Vector2 pPosition, float pScale = 1f)
        {
            int x = (int)pPosition.X;

            foreach (char c in pText)
            {
                var bytes           = Encoding.Unicode.GetBytes(new char[] { c });
                int key             = BitConverter.ToInt16(bytes, 0);
                int translatedValue = mapping[key];

                sprite.SetCurrentFrame(translatedValue);
                sprite.Draw(pSpriteBatch, new Vector2(x, pPosition.Y), pScale);

                x += (int)(pScale * (sprite.FrameSize.Width + spacing.Width));
            }
        }