Exemple #1
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            string text = textProcessor.Text;

            if (textProcessor.IsTextSelectionEnabled)
            {
                string selectedText = textProcessor.SelectedText;

                // on valittua tekstiä
                if (!selectedText.Equals(""))
                {
                    int startIndex = textProcessor.SelectionStartIndex;
                    int endIndex   = textProcessor.SelectionEndIndex;

                    Vector2 size   = Font.MeasureString(selectedText);
                    Vector2 offset = Vector2.Zero;
                    if (startIndex != 0)
                    {
                        offset = Font.MeasureString(text.Substring(0, startIndex));
                    }

                    Rectangle selectionPosition = new Rectangle((int)Position.Real.X + (int)offset.X, (int)Position.Real.Y, (int)size.X, (int)size.Y);
                    spriteBatch.Draw(Khv.Engine.KhvGame.Temp, selectionPosition, Color.Green);
                }
            }
            Vector2 position = new Vector2(Position.Real.X, Position.Real.Y);

            spriteBatch.DrawString(Font, text, position, Colors.Foreground, 0.0f, Vector2.Zero, 1f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f);
            spriteBatch.DrawString(Font, caret, caretPositionInPixels, caretColor);
        }
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Art.Background,
                             new Rectangle(0, 0, BudaGame.ViewPort.Width, BudaGame.ViewPort.Height), Color.White);
            spriteBatch.DrawString(Art.Font, "Crazy Plane Game", new Vector2(BudaGame.ScreenSize.X / 2 - 200, BudaGame.ScreenSize.Y / 2), Color.Black);

            spriteBatch.DrawString(Art.Font, "Space to play", new Vector2(BudaGame.ScreenSize.X / 2 - 100, BudaGame.ScreenSize.Y / 2 + 50), Color.Black);
            base.Draw(spriteBatch);
        }
Exemple #3
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            frameCounter++;

            string fps = string.Format("FPS: {0}", frameRate);

            sb.DrawString(gui.Game.DefaultFont, fps, new Vector2(pos.X + 1, pos.Y + 1), Color.Black);
            sb.DrawString(gui.Game.DefaultFont, fps, new Vector2(pos.X, pos.Y), Color.White);
        }
Exemple #4
0
 public void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch b, Microsoft.Xna.Framework.Graphics.SpriteFont font, Microsoft.Xna.Framework.Vector2 position, Microsoft.Xna.Framework.Color color)
 {
     if (this.drawThis)
     {
         b.DrawString(font, this.displayText, position, color);
     }
 }
Exemple #5
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            for (int y = 0; y < cells.Length; y++)
            {
                float   margin      = 25f;
                Vector2 destination = new Vector2(Position.Real.X, Position.Real.Y + y * 25);;
                for (int x = 0; x < cells[y].Length; x++)
                {
                    KeyboardButton button = cells[y][x];
                    destination.X = Position.Real.X + x * margin;
                    if (button.HasFocus)
                    {
                        Vector2 size = Font.MeasureString(button.Button);
                        spriteBatch.Draw(Khv.Engine.KhvGame.Temp,
                                         new Rectangle((int)destination.X - (int)((margin - size.X) / 2), (int)destination.Y,
                                                       (int)margin,
                                                       (int)size.Y),
                                         Color.Green);
                    }
                    spriteBatch.DrawString(Font, button.Button, destination, Color.Azure);
                }
            }
        }
Exemple #6
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     base.Draw(spriteBatch);
     if (_currentIndex < _text.Count)
     {
         spriteBatch.DrawString(Font, _text[_currentIndex], new Vector2(Position.X + 5, Position.Y + 5), FontColor);
     }
 }
Exemple #7
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch canvas, int x, int y, bool selected)
 {
     if (selected)
     {
         canvas.Draw(AssetLoader.diamond, new Rectangle(x - 50, y + 6, 40, 15), Color.White);
     }
     canvas.DrawString(AssetLoader.fnt_assetloadscreen, label, new Vector2(x, y), (selected)?Color.White:Color.Gray);
 }
Exemple #8
0
 public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     if (!Hidden)
     {
         sb.End();
         sb.Begin();
         sb.DrawString(_theme.Font, _text, GetTotalScreenPosition, LabelColor);
         sb.End();
     }
 }
Exemple #9
0
 public override void Render(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     base.Render(sb);
     for (int i = 0; i < rings.Count; i++)
     {
         rings[i].Render(sb);
     }
     sb.DrawString(TelephoneBase.font, "" + (int)(((float)loadingTimer / (float)maxLoadingTimer) * 100) + "%",
                   phone.position + new Vector2(-3 * 6, 75), Color.Gray);
 }
Exemple #10
0
        /// <summary>
        /// Draws the individual <see cref="Komodo.Core.ECS.Components.Drawable2DComponent"/>.
        /// </summary>
        /// <param name="component"><see cref="Komodo.Core.ECS.Components.Drawable2DComponent"/> to render.</param>
        /// <param name="spriteBatch"><see cref="Microsoft.Xna.Framework.Graphics.SpriteBatch"/> to render with.</param>
        private void DrawComponent(Drawable2DComponent component, SpriteBatch spriteBatch)
        {
            var position = component.WorldPosition;
            var rotation = component.Rotation;
            var scale    = component.Scale;

            if (ActiveCamera != null)
            {
                if (component.IsBillboard)
                {
                    position = Vector3.Transform(
                        position,
                        ActiveCamera.ViewMatrix * Matrix.CreateScale(1f, -1f, 1f)
                        );
                }
                else
                {
                    position = Vector3.Transform(
                        position,
                        Matrix.CreateScale(1f, -1f, 1f)
                        );
                }
            }

            switch (component)
            {
            case SpriteComponent spriteComponent:
                spriteBatch.Draw(
                    spriteComponent.Texture.MonoGameTexture,
                    position.XY.MonoGameVector,
                    null,
                    Color.White,
                    -rotation.Z,
                    spriteComponent.Center.MonoGameVector,
                    scale.XY.MonoGameVector,
                    SpriteEffects.None,
                    position.Z
                    );
                break;

            case TextComponent textComponent:
                spriteBatch.DrawString(
                    textComponent.Font,
                    textComponent.Text,
                    position.XY.MonoGameVector,
                    textComponent.Color,
                    -rotation.Z,
                    textComponent.IsCentered ? textComponent.Center.MonoGameVector : Vector2.Zero.MonoGameVector,
                    scale.XY.MonoGameVector,
                    SpriteEffects.None,
                    position.Z
                    );
                break;
            }
        }
        public void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            //Update(gameTime);

            spriteBatch.DrawString(
                _bitmapFont,
                text: $"FPS: {AverageFramesPerSecond:0}",
                position: Vector2.One,
                color: Color.Goldenrod
                );
        }
Exemple #12
0
 public override void Render(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
 {
     base.Render(sb);
     if (guiType == GuiType.Main)
     {
         if (searchBox.stringDate != null && searchBox.stringDate.Length > 0)
         {
             for (int i = 0; i < contactsSearched.Count; i++)
             {
                 contactsSearched[i].Render(sb);
             }
         }
         else
         {
             for (int i = 0; i < contacts.Count; i++)
             {
                 contacts[i].Render(sb);
             }
         }
         screenFonAdd.Render(sb);
         addContact.Render(sb);
         searchBox.Render(sb);
         search.Render(sb);
     }
     else if (guiType == GuiType.Add)
     {
         sb.DrawString(TelephoneBase.font, "Добавить контакт", position + new Vector2(-100, -170), new Color(TelephoneBase.fontColor));
         nameBox.Render(sb);
         phoneBox.Render(sb);
         acceptAdd.Render(sb);
     }
     else if (guiType == GuiType.Edit)
     {
         sb.DrawString(TelephoneBase.font, "Изменить контакт", position + new Vector2(-100, -170), new Color(TelephoneBase.fontColor));
         nameBox.Render(sb);
         phoneBox.Render(sb);
         acceptAdd.Render(sb);
     }
 }
Exemple #13
0
 public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     base.draw(spriteBatch);
     image.draw(spriteBatch);
     if (itemModel.rufusModel != null)
     {
         if (itemModel.rufusModel.title != "COMMING")
         {
             if (!itemModel.rufusModel.isActive)
             {
                 star.draw(spriteBatch);
                 spriteBatch.DrawString(ButtonFactory.spriteFont, itemModel.value.ToString(), position + labelPos, color, 0, new Vector2(), scalee, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f);
             }
         }
     }
     else if (!itemModel.isActive)
     {
         if (itemModel.rufusModel.title != "COMMING")
         {
             star.draw(spriteBatch);
             spriteBatch.DrawString(ButtonFactory.spriteFont, itemModel.value.ToString(), position + labelPos, color, 0, new Vector2(), scalee, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0f);
         }
     }
 }
Exemple #14
0
 public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(spriteFont, text, position, color);
 }
        public void DrawString(string text, GUIapp.Point point, MonoGameColor colorAdapter)
        {
            var pointAsVector = new Microsoft.Xna.Framework.Vector2(point.X, point.Y);

            sprite_batch.DrawString(font, text, pointAsVector, colorAdapter.toFrameworkColor());
        }