コード例 #1
0
ファイル: MaterialEditor.cs プロジェクト: Tokter/TokED
 public override void DrawContent(LineBatch lineBatch, SpriteBatch spriteBatch)
 {
     if (_material != null)
     {
         if (_material.Mat[TextureUnit.Texture0] != null)
         {
             spriteBatch.AddSprite(_material.Mat, 0, 0, 0, 0, _material.Mat[TextureUnit.Texture0].Width, _material.Mat[TextureUnit.Texture0].Height);
             lineBatch.AddBox(0, 0, _material.Mat[TextureUnit.Texture0].Width, _material.Mat[TextureUnit.Texture0].Height, Color.Red);
         }
         else
         {
             spriteBatch.AddSprite(_material.Mat, new Vector2(0, 0), new Vector2(256, 256), 0.0f, 0.0f, 1.0f, 1.0f);
             lineBatch.AddBox(0, 0, 256, 256, Color.Red);
         }
     }
     else
     {
         lineBatch.Add(new Vector2(-100, -100), new Vector2(100, 100), Color.Red);
         lineBatch.Add(new Vector2(100, -100), new Vector2(-100, 100), Color.Red);
     }
 }
コード例 #2
0
ファイル: Handle.cs プロジェクト: Tokter/TokED
        protected override void OnDrawGui(LineBatch lineBatch)
        {
            Color c = Selected ? Color.Orange : Color.White;

            switch (_handleType)
            {
                case HandleType.Box:
                    lineBatch.AddBox(ScreenPos.X - _length / 2.0f, ScreenPos.Y - _length / 2.0f, _length, _length, c);
                    break;

                case Editors.HandleType.Cross:
                    lineBatch.Add(new Vector2(ScreenPos.X, ScreenPos.Y - _length), new Vector2(ScreenPos.X, ScreenPos.Y + _length), c);
                    lineBatch.Add(new Vector2(ScreenPos.X - _length, ScreenPos.Y), new Vector2(ScreenPos.X + _length, ScreenPos.Y), c);
                    break;
            }
        }